Image Similarity Criteria
A Python package that provides various perceptual similarity metrics for comparing images using state-of-the-art models including Face Recognition Systems (FRS), CLIP, and LPIPS.
Features
- Face Recognition System (FRS) based identity loss with multiple model options:
- IR-152
- IR-SE-50
- MobileFaceNet
- FaceNet
- CurricularFace
- CLIP-based similarity metrics
- LPIPS (Learned Perceptual Image Patch Similarity)
- Ensemble ID loss for combining multiple FRS models
Installation
pip install criteria
Usage
Face Recognition System (FRS)
from criteria import id_loss
from PIL import Image
# Initialize ID loss with a specific model
id_loss_fn = id_loss.IDLoss(model_name='ir_se50')
# Load images
img1 = Image.open('image1.jpg')
img2 = Image.open('image2.jpg')
# Calculate identity loss
loss = id_loss_fn(img1, img2)
CLIP Similarity
from criteria import clip_loss
# Initialize CLIP loss
clip_loss_fn = clip_loss.CLIPLoss()
# Calculate CLIP similarity
similarity = clip_loss_fn(img1, img2)
LPIPS
from criteria import lpips_loss
# Initialize LPIPS
lpips_fn = lpips_loss.LPIPSLoss()
# Calculate perceptual similarity
distance = lpips_fn(img1, img2)
Model Weights
Pre-trained model weights will be automatically downloaded when initializing the respective loss functions.
License
MIT License
Citation
If you use this package in your research, please cite:
@misc{criteria2023,
author = {Le, Minh-Ha},
title = {Criteria: Image Similarity Metrics},
year = {2023},
publisher = {GitHub},
url = {https://github.com/minha12/criteria}
}
Metadata
Release files for criteria 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| criteria-0.1.7.tar.gz | 16.9 kB | Without provenance | Details for criteria-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| criteria-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for criteria-0.1.7-py3-none-any.whl |
Total release size: 37.7 kB
Release files / criteria-0.1.7.tar.gz
| Download URL | criteria-0.1.7.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea154f17dbf7e9650794ad3f7bda92558e7c2f1c6cf842b1dec9995559c9a845
|
|
BLAKE2b-256 checksum How to use checksums |
9a85fae16f30f28d3322f29c6331bd618495c0e429c629ab8de4620aeda1a820
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.18
|
Release files / criteria-0.1.7-py3-none-any.whl
| Download URL | criteria-0.1.7-py3-none-any.whl |
|---|---|
| Size | 20.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
34d4f0f93aafee672ca86c96fba912804cbea2ecddd7532ad9e5098994cbb4c0
|
|
BLAKE2b-256 checksum How to use checksums |
0eb1f298dde4dcf6dace5d3bcefe7552ef6c7149b4ea94cb33bea4ffecf0b552
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.18
|
Security for criteria 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.