TPIPS: text-conditioned perceptual image similarity (inference)
Project description
TPIPS
Text-Conditioned Perceptual Image Similarity for comparing two images along a
specified factor, such as lighting warmth, color palette, or camera angle.
Install
pip install tpips
TPIPS requires Python 3.10+ and downloads the selected model checkpoint from Hugging Face on its first use. A CUDA GPU is recommended. FlashAttention is optional: TPIPS selects a compatible backend automatically and falls back to PyTorch SDPA when FlashAttention is unavailable.
Quick start
import tpips
from PIL import Image
model = tpips.load_model("embedding", device="cuda")
a = Image.open("a.jpg").convert("RGB")
b = Image.open("b.jpg").convert("RGB")
similarity = model.similarity(a, b, factor="lighting") # higher is more similar
distance = model.distance(a, b, factor="lighting") # lower is more similar
# Raw, prompt-conditioned image vector; pass normalized=True for an L2-normalized vector.
vector = model.embed(a, factor="lighting")
Pass model_path= to load_model() to load a compatible local
checkpoint directory or Hugging Face repository instead of the released default.
Models and API
| Model type | similarity() |
distance() |
embed() |
|---|---|---|---|
embedding |
Cosine similarity | 1 - similarity |
Per-image, text-conditioned embedding |
early_fusion |
Cosine similarity | 1 - similarity |
Not supported |
activation_dist |
Not supported | Activation distance | Not supported |
License
TPIPS is provided under the Adobe Research License, for noncommercial research use only. Source files are Adobe confidential; ensure you have the required Adobe authorization before using, redistributing, or publishing the package or its checkpoints.
More information
See the repository README for evaluation, training, data download, and release-maintenance documentation.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tpips-0.1.1.tar.gz.
File metadata
- Download URL: tpips-0.1.1.tar.gz
- Upload date:
- Size: 1.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b61b0f32c986c0bfbca757323306c9c220114cc08f29118266c44d0a847be4d
|
|
| MD5 |
9a333502ee98df7c443c1d2b105aa0fc
|
|
| BLAKE2b-256 |
63192a233ccf562a37674c21edb0c437a02242384c9b761e78703926938b6027
|
File details
Details for the file tpips-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tpips-0.1.1-py3-none-any.whl
- Upload date:
- Size: 29.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9d533b15d2f1629afab53623592a1eac317680f31215f32baf44d8170f8026a
|
|
| MD5 |
cf8d412dab362b27f47f3055ea353aec
|
|
| BLAKE2b-256 |
694308ed27da3a3de2d9fd036271c7b7cb083b9b66e69a7d739c7f2b81adf843
|