Package: clustimage
clustimageThe aim ofclustimageis to detect natural groups or clusters of images. It works using a multi-step proces of carefully pre-processing the images, extracting the features, and evaluating the optimal number of clusters across the feature space.
The optimal number of clusters can be determined using well known methods suchs assilhouette, dbindex, and derivativesin combination with clustering methods, such asagglomerative, kmeans, dbscan and hdbscan.
Withclustimagewe aim to determine the most robust clustering by efficiently searching across the parameter and evaluation the clusters.
Besides clustering of images, theclustimagemodel can also be used to find the most similar images for a new unseen sample.A schematic overview is as following:clustimageovercomes the following challenges:* 1. Robustly groups similar images.
* 2. Returns the unique images.
* 3. Finds higly similar images for a given input image.clustimageis fun because:* It does not require a learning proces.
* It can group any set of images.
* It can return only the unique() images.
* it can find highly similar images given an input image.
* It provided many plots to improve understanding of the feature-space and sample-sample relationships
* It is build on core statistics, such as PCA, HOG and many more, and therefore it does not has a dependency block.
* It works out of the box.⭐️ Star this repo if you like it ⭐️BlogsRead theblogto get a structured overview how to cluster images.Documentation pagesOn thedocumentation pagesyou can find detailed information about the working of theclustimagewith many examples.InstallationIt is advisable to create a new environment (e.g. with Conda).condacreate-nenv_clustimagepython=3.8
condaactivateenv_clustimageInstall bnlearn from PyPIpipinstallclustimage# new installpipinstall-Uclustimage# update to latest versionDirectly install from github sourcepipinstallgit+https://github.com/erdogant/clustimageImport clustimage packagefromclustimageimportclustimageExamplesThe results obtained from the clustimgage library is a dictionary containing the following keys:* img       : image vector of the preprocessed images
* feat      : Features extracted for the images
* xycoord   : X and Y coordinates from the embedding
* pathnames : Absolute path location to the image file
* filenames : File names of the image file
* labels    : Cluster labelsExamples Mnist dataset:Example: Clustering mnist datasetIn this example we will be using a flattened grayscale image array loaded from sklearn. The unique detected clusters are the following:Click on the underneath scatterplot to zoom-in and see ALL the images in the scatterplotExample: Plot the explained varianceExample: Plot the unique imagesExample: Plot the dendrogramExamples Flower dataset:Example: cluster the flower datasetExample: Make scatterplot with clusterlabelsExample: Plot the unique images per clusterExample: Plot the images in a particular clusterExample: Make prediction for unseen input imageExample: Clustering of faces on imagesExample: Break up the stepsExample: Extract images belonging to clustersSupportThis project needs some love! ❤️ You can help in various ways.

* Become a Sponsor!
* Star this repo at the github page.
* Other contributions can be in the form of feature requests, idea discussions, reporting bugs, opening pull requests.
* Read more why becoming an sponsor is important on the Sponsor Github Page.

Cheers Mate.