CLORPS: A module for CLIP, LPIPS, and ORB based image similarity.
Project description
CLORPS
CLORPS is a Python package for calculating image similarity based on three complementary techniques: CLIP embeddings, LPIPS (Learned Perceptual Image Patch Similarity), and ORB (Oriented FAST and Rotated BRIEF). It provides a combined similarity score for one image compared to another image or a set of target images. Ideal for image retrieval, similarity-based ranking, and image comparison tasks.
Features
- CLIP Embeddings: Uses OpenAI’s CLIP model for embedding-based similarity.
- LPIPS Similarity: Calculates perceptual similarity using LPIPS.
- ORB Keypoint Matching: Traditional ORB-based similarity for structural comparison.
- Combined Score: Normalizes and combines the three scores for a final similarity metric.
Installation
pip install clorps
Usage
from clorps import CLORPS
# Initialize CLORPS instance
clorps_instance = CLORPS()
# Paths to input and target images
input_image_path = "/path/to/input/image.jpg"
target_image_paths = ["/path/to/target/image1.jpg", "/path/to/target/image2.jpg"]
# Calculate combined similarity scores
combined_scores = clorps_instance.calculate_combined_similarity(input_image_path, target_image_paths)
print("Combined similarity scores:", combined_scores)
Input: Path to the input image and either a single target image path or a list of target image paths. Output: A list of similarity scores, one for each target image.
Requirements:
- Python 3.6+
- torch
- open_clip_torch
- lpips
- numpy
- scikit-learn
- Pillow
- opencv-python
LICENSE This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file clorps-0.1.0.tar.gz
.
File metadata
- Download URL: clorps-0.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10592bf0f992aab9e6129a393d6e7ab64b828ca7c4f5c691d9108baff0dc21b0 |
|
MD5 | 3775056e7305a3566da81b61748beaa0 |
|
BLAKE2b-256 | 325d0d62ecc3e8c251da6efa883563864669bb2f14d845a9b06e6f528405f38e |
File details
Details for the file clorps-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: clorps-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c7b74465161f5e673bc54620aab3b09a61e49d3665172e1cd27f14563f05632 |
|
MD5 | a33560c664cdc9db672717788bac9b00 |
|
BLAKE2b-256 | d255d8ea2b9931b5d8d92e35cd30b2769efb92ddadc9e7337ebf1c52296da1c9 |