Giter VIP home page Giter VIP logo

image-clustering's Introduction

Image-Clustering using KMeans (A Python3 implementation)

This is a simple unsupervised image clustering algorithm which uses KMeans for clustering and Keras applications with weights pre-trained on ImageNet for vectorization of the images.

A folder named "output" will be created and the different clusters formed using the different algorithms will be present.

Change the following variables(present in the main() function) as per your convinience:

  1. number_of_clusters - The number of clusters to be created by the clustering algorithm. (default is 10)
  2. data_path - This is the path of the folder that contans the different images that you want to pass to the algorithm.
  3. max_examples - The max number of examples to be used for the clustering (if None, all the images in the data_path folder will be used)
  4. use_imagenets - choose which keras application to use. (Choose from: "Xception", "VGG16", "VGG19", "ResNet50", "InceptionV3", "InceptionResNetV2", "DenseNet", "MobileNetV2" and "False". If False, the image will be passed as is to the clustering algorithm)
  5. use_pca - choose whether to use PCA for dimentionality reduction. (choose betwwen between "True" and "False". If use_imagenets=False, then use_pca will automatically be set to False as well)

Python Modules used:
-Keras
-Theano (as backend for keras)
-os
-sys
-random
-cv2 (openCV)
-numpy
-sklearn (scikit-learn for KMeans and PCA)
-shutil

To Run: "python image_clustering.py"

Pipeline:
step 1: Set the different parameters for the model. (The Variables mentioned above)
step 2: Initialize an object of the class "image_clustering" with the parameters set in the previous step.
step 3: Call the class's load_data() function.
step 4: Call the class's get_new_imagevector() function.
step 5: Call the clustering() function.

image-clustering's People

Contributors

rohanbaisantry avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.