Skip to main content

This tool offers a solution for identifying and managing similar images across multiple directories.

Project description

Duplicate Image Finder and Remover

DIFR(Duplicate Image Finder and Remover) offers a solution for identifying and managing similar images across multiple directories. Utilizing Convolutional Neural Networks for feature extraction, it provides users with the capability to efficiently compare images, detect similarities, and manage image datasets with ease. Key features include:

  • Flexible Directory Comparisons: Specify target and comparison directories to find similar images, ensuring precise dataset management.
  • Feature Caching: Reduce computation time on subsequent runs by caching image features in a specified directory.

Installing

pip install difr

Usage

Use Case 1: Removing Duplicates within a Single Directory

Detect and remove duplicate images within a single directory (--target_dir_path) to declutter your image collection and save space (--save_dir_path).

Example:

difr --target_dir_path ./path/to/imagedir --save_dir_path ./path/to/savedir -th 0.95 --compare_self

Use Case 2: Comparing Images Across Directories

Identify and remove images in one directory that are duplicates of images in another directory (--compare_dir_path). This is useful for merging collections without retaining duplicates.

Example:

difr --target_dir_path ./path/to/imagedir --save_dir ./path/to/savedir -th 0.95 --compare_dir_path comp_dir_1 comp_dir_2

Advanced Options

  • --cache_dir_path: Specify a directory to cache image features.
  • --batch_size: Specifies the number of images to process in a single batch when extracting features. A larger batch size can speed up the processing by taking advantage of parallel computing capabilities, but it will also require more memory.
  • --workers: Set the number of workers for parallel image loading.
  • --similarity_threshold: Set the cosine similarity score threshold for considering two images as similar. The value must be between 0 (no similarity) and 1 (identical images), where a higher value means a stricter criterion for similarity.

Example Usage and Output

Command:

difr --target_dir_path ./data/train --save_dir_path ./data/train_unique --compare_dir_path data/val data/test --cache_dir_path .difr_cache --similarity_threshold 0.7 --batch_size 32 --workers 16

Output:
output1

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

difr-1.0.0.tar.gz (10.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

difr-1.0.0-py3-none-any.whl (10.9 MB view details)

Uploaded Python 3

File details

Details for the file difr-1.0.0.tar.gz.

File metadata

  • Download URL: difr-1.0.0.tar.gz
  • Upload date:
  • Size: 10.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.13 Linux/6.5.0-1015-azure

File hashes

Hashes for difr-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e7dedbb950118181eb618dc98bdb9504908f7e71ae39db9b326a305250e9ba61
MD5 98a169b08d3e6f30af12013d180181b7
BLAKE2b-256 3cbf878e2218e70cf828480ce2ffbdc779ebbdbdbd066ffcd27012426ae22ab9

See more details on using hashes here.

File details

Details for the file difr-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: difr-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.13 Linux/6.5.0-1015-azure

File hashes

Hashes for difr-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a56113114214c914ca0f7ba1169fe85d3f87a941b9fe72fac3ef505371481a2e
MD5 e82c4ee0aabe3dabd6914668361239a5
BLAKE2b-256 0ebaa8bc99d7a219ebad927cccc92bac1f0f3bbdc669ea3d8ffb9dba00600cae

See more details on using hashes here.

Supported by

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