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.1.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.1-py3-none-any.whl (10.9 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: difr-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 f7db453c680224c0bc73620bb34e1c3d42c79d52ad9a79fe7f78d529977c5531
MD5 eb16a25cdb6e62ce193cca4df5b1f645
BLAKE2b-256 60c511a1e188705e93e4d5a4cdb9f681125ec5c5af7dd160d073ff1b13a1bf17

See more details on using hashes here.

File details

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

File metadata

  • Download URL: difr-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bffa075a47f28bdb464b5857b31c73aa572e97fb1988bc10561ad51f67dec866
MD5 6f4bdc72f62f7e6724271a327bb466ba
BLAKE2b-256 15664a55c8eae533a3f59c1d14721b7efa8a0b90b26c2558ecfd41640c1ec018

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