Skip to main content

Python package clustimage is for unsupervised clustering of images.

Project description

clustimage

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

The aim of clustimage is 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 as silhouette, dbindex, and derivatives in combination with clustering methods, such as agglomerative, kmeans, dbscan and hdbscan. With clustimage we aim to determine the most robust clustering by efficiently searching across the parameter and evaluation the clusters. Besides clustering of images, the clustimage model can also be used to find the most similar images for a new unseen sample.

A schematic overview is as following:

clustimage overcomes the following challenges:

* 1. Robustly groups similar images.
* 2. Returns the unique images.
* 3. Finds higly similar images for a given input image.

clustimage is 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 ⭐️

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clustimage-1.5.16.tar.gz (38.3 kB view details)

Uploaded Source

Built Distribution

clustimage-1.5.16-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

Details for the file clustimage-1.5.16.tar.gz.

File metadata

  • Download URL: clustimage-1.5.16.tar.gz
  • Upload date:
  • Size: 38.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.27.1 setuptools/58.0.4 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.8.5

File hashes

Hashes for clustimage-1.5.16.tar.gz
Algorithm Hash digest
SHA256 020d2b53cfcb6590a074154282916f412158096ccc1e9abea1a296bdeca50e50
MD5 290c8d60cc54827a1bfd9dd98dff4528
BLAKE2b-256 1a1860081c60111280647372af18827444bddb46bf8ed07391761a7fb54e84fd

See more details on using hashes here.

File details

Details for the file clustimage-1.5.16-py3-none-any.whl.

File metadata

  • Download URL: clustimage-1.5.16-py3-none-any.whl
  • Upload date:
  • Size: 37.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.27.1 setuptools/58.0.4 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.8.5

File hashes

Hashes for clustimage-1.5.16-py3-none-any.whl
Algorithm Hash digest
SHA256 5d5861e245c93177bb0406f97e61ada590d77109e666334ed98cead41621c550
MD5 b76e321f34be9ab59b2451031401f8c2
BLAKE2b-256 bf3947d6df72a57d526981a6140e192f4a38dc310e702405ec1ca6baeb4493ea

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page