Skip to content
/ sfmp Public

Sfmp is a tool to quickly separate images using clustering based on features extracted through a convolutional neural network

Notifications You must be signed in to change notification settings

pstwh/sfmp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jul 14, 2024
9c70e1e · Jul 14, 2024

History

1 Commit
Jul 14, 2024
Jul 14, 2024
Jul 14, 2024
Jul 14, 2024
Jul 14, 2024
Jul 14, 2024
Jul 14, 2024

Repository files navigation

sfmp (separate for me please)

Sfmp is a tool to quickly separate images using clustering based on features extracted through a convolutional neural network. It's really lightweight, using only a mobilenetv2 for feature extraction and kmeans for clustering.

Installation

To install sfmp, follow there steps:

For cpu

pip install "sfmp[cpu]"

For cuda 11.X

pip install "sfmp[gpu]"

For cuda 12.X

pip install "sfmp[gpu]" --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/

Usage

Command Line Interface

You can use sfmp from the command line by providing a list of globs:

sfmp ../examples/*.jpg ../examples2/*.jpg

If you want to use CUDA:

sfmp ../examples/*.jpg ../examples2/*.jpg --provider CUDAExecutionProvider

Check all execution providers here.

To specify the number of clusters:

sfmp ../examples/*.jpg ../examples2/*.jpg --n_clusters 2

or output dir

To specify the number of clusters:

sfmp ../examples/*.jpg ../examples2/*.jpg --output_path result

Example

Before

.
├── cat.1.jpg
├── cat.2.jpg
├── dog.3061.jpg
└── dog.3062.jpg
sfmp ../examples/*.jpg --n_clusters 2

After

├── cluster_0000
│   ├── dog.3061.jpg
│   └── dog.3062.jpg
└── cluster_0001
    ├── cat.1.jpg
    └── cat.2.jpg

About

Sfmp is a tool to quickly separate images using clustering based on features extracted through a convolutional neural network

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages