Skip to main content

clustimage

Python Pypi Docs LOC Downloads Downloads License Forks Issues Project Status DOI Medium Colab Donate

clustimage is a Python library to detect natural groups or clusters of images. Multiple steps are pipelined where images are processed, features extracted, and the clusters evaluated across the feature space. The optimal number of clusters is determined using methods such as *silhouette, dbindex, and derivatives* in combination with clustering methods, such as *agglomerative, kmeans, dbscan and hdbscan*. clustimage allows you to determine the most robust clustering by efficiently searching across the parameters and by evaluating the clusters. Besides clustering of images, the ``clustimage`` library can also find the most similar images for a new, unseen sample. ⭐️Star it if you like it⭐️


clustimage overcomes the following challenges:

* 1. Robustly groups similar images.
* 2. Returns the unique images.
* 3. Finds highly similar images for a given input image.
* 4. Cluster on datetime or latlon coordinates when using photos.

clustimage is fun because:

* It does not require a learning process.
* 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 can map photos on an interactive map with thumbnails and cluster labels so that you can easily structure your photos.
* It provided many plots to improve the  understanding of the feature-space and sample-sample relationships
* It is built on core statistics, such as PCA, HOG, EXIF data, and many more, and therefore it does not have a dependency block.
* It works out of the box.

⭐️ Star this repo if you like it ⭐️

Blogs

  • Read the blog to get a structured overview how to cluster images.

Documentation pages

On the documentation pages you can find detailed information about the working of the clustimage with many examples.

Installation

It is advisable to create a new environment (e.g. with Conda).
conda create -n env_clustimage python=3.8
conda activate env_clustimage
Install bnlearn from PyPI
pip install clustimage            # new install
pip install -U clustimage         # update to latest version
Directly install from GitHub source
pip install git+https://github.com/erdogant/clustimage
Import clustimage package
from clustimage import clustimage

Examples

The 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 labels

Examples Mnist dataset:

Example: Clustering mnist dataset

In 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 scatterplot

Example: Plot the explained variance

Example: Plot the unique images

Example: Plot the dendrogram


Examples Flower dataset:

Example: cluster the flower dataset

Example: Make scatterplot with clusterlabels

Example: Plot the unique images per cluster

Example: Plot the images in a particular cluster

Example: Make prediction for unseen input image


Example: Clustering of faces on images


Example: Break up the steps


Example: Extract images belonging to clusters


Support

This 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.

Release files for clustimage 1.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clustimage 1.7.1
File Size Uploaded
clustimage-1.7.1.tar.gz 59.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clustimage 1.7.1
File Interpreter ABI Platform
clustimage-1.7.1-py3-none-any.whl Python 3 none any Details

Total release size: 117.7 kB

Release files / clustimage-1.7.1.tar.gz

Download URL clustimage-1.7.1.tar.gz
Size 59.4 kB
Tags Source
SHA-256 checksum
How to use checksums
47c53ba920ad23ba9e388ad785dc217df898f41a0e104e3bf4e9f43792861321
BLAKE2b-256 checksum
How to use checksums
2a1e4e05fb1d3655b8d6c653761d4bd2e317cd73d63c8b269beace9bb232611d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / clustimage-1.7.1-py3-none-any.whl

Download URL clustimage-1.7.1-py3-none-any.whl
Size 58.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb05be77508913ceebaa8c838f26d3a0f637f170335881c6da8906e869e0ea33
BLAKE2b-256 checksum
How to use checksums
31c4a4a696b919d8e0565f5d77388770a795ffcb5f5713adf73bb465509e32ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release history Release notifications | RSS feed

This release

1.7.1 This release

2 release files

1.7.0

2 release files

1.6.25

2 release files

1.6.24

2 release files

1.6.23

2 release files

1.6.22

2 release files

1.6.20

2 release files

1.6.17

2 release files

1.6.16

2 release files

1.6.15

2 release files

1.6.14

2 release files

1.6.13

2 release files

1.6.9

2 release files

1.6.8

2 release files

1.6.7

2 release files

1.6.6

2 release files

1.6.5

2 release files

1.6.4

2 release files

1.6.3

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.18

2 release files

1.5.16

2 release files

1.5.15

2 release files

1.5.14

2 release files

1.5.13

2 release files

1.5.9

2 release files

1.5.8

2 release files

1.5.7

2 release files

1.5.6

2 release files

1.5.5

2 release files

1.5.4

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.10

2 release files

1.4.9

2 release files

1.4.8

2 release files

1.4.7

2 release files

1.4.6

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.15

2 release files

1.3.14

2 release files

1.3.12

2 release files

1.3.11

2 release files

1.3.10

2 release files

1.3.9

2 release files

1.3.8

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page