A small library for multi-dimensional image similarity. Looking for feedback.
▲ 11 r/computervision+1 crossposts

A small library for multi-dimensional image similarity. Looking for feedback.

For a downstream task, I had to extract unique frames only from videos. The tricky part was that "duplicate" covered two different things in the same video.
- back-to-back frames where nothing visibly moved, and
- frames showing the same scene a few seconds apart.

Perceptual hashing measures pixel-level similarity and embedding models measure content similarity, so neither alone matched what I meant by unique. I had to run both and look at the scores together.

Doing that with separate libraries meant separate preprocessing, separate score scales, and glue code to combine them. The glue was the reusable part, so I turned it into a library. You can pick the kinds of similarity that matter for your case (pixels, scene, object, face, style) and get a score for each in one call:

```python
from imageprism import ImagePrism

prism = ImagePrism(dimensions=["hash", "semantic"])
prism.compare("a.jpg", "b.jpg").scores # {"hash": 0.12, "semantic": 0.82}
```

It is CPU only, no PyTorch, no API keys. It's at 0.1.0 and still rough in places. For a single kind of similarity, the specialized libraries are the better choice: imagehash for hashing, CLIP directly for semantic search, insightface for faces. imageprism combines several of them behind one interface, so the value is the integration, not the models.

I don't know whether this is a common problem or just something I ran into once. If you've dealt with image similarity before, I'd appreciate hearing where this falls short. That feedback will tell me whether it's worth developing further. Please drop a star if you think this is useful.

GitHub: https://github.com/nebulaanish/imageprism

PyPI: https://pypi.org/project/imageprism/

pypi.org
u/NebulaAnish — 16 hours ago