Welcome to pyvisim!
pyvisim is a computer vision library for computing image similarities using traditional and deep learning methods.
📚 Documentation: https://mechacritter.github.io/Python-Visual-Similarity/
Table of Contents
Status
[!WARNING] This project is still in early development, so the API might change anytime (with deprecation, but the change will come soon afterwards). Feel free to use it in development environments, but I would recommend against using it in production.
The first stable release will have the version tag
v1.0.0and will come approximately by the end ofAugust 2026.
Overview
The goal of pyvisim is to become the largest collection of image similarity metrics, varying from
traditional methods like PSNR, SSIM, Fisher Vectors, and VLAD to deep learning methods like CLIP and Siamese Networks. Then, one can use these for image retrieval and clustering.
Currently, one would need to install numerous libraries just to get all the metrics mentioned (for example, scikit-image + opencv-python for Fisher Vectors and SSIM, open-clip for CLIP Embedder). pyvisim
attempts to close this gap by implementing as many metrics as possible using only numpy, scipy (for conventional metrics), and
torch (for deep learning metrics), plus making them more user-friendly with a simple Object-Oriented code design.
Accelerated Computation
Cython kernels and C++ libraries are used for some metrics to accelerate computation significantly compared
to all reference libraries on the CPU. See, for example, benchmark results of the SSIM implementation.
Examples
Structural Similarity (see documentation here):
from pyvisim.structural import SSIM
ssim = SSIM()
similarity_score = ssim.similarity_score(image1, image2)
print(f"Similarity Score: {similarity_score}")
One-Shot similarity computation using the CLIPEmbedder(see documentation here):
from pyvisim.neural_networks import ClipEmbedder
# Declare the Clip Embedder
embedder = ClipEmbedder()
# Compute the similarity score. By default, cosine similarity is used.
similarity_score = embedder.similarity_score(image1, image2)
print(f"Similarity Score: {similarity_score}")
Image retrieval (see documentation here):
from pyvisim.neural_networks import ClipEmbedder
from pyvisim.image_store import InMemoryImageEmbeddingStore
embedder = ClipEmbedder()
image_store = InMemoryImageEmbeddingStore(
image_paths=train_image_paths,
embedder=embedder,
search_index="hnsw",
index_params={"graph_degree": 16, "build_candidates": 200},
)
candidates = image_store.retrieve_top_k_similar(image, k=5)[0] # one Candidate per match
for candidate in candidates:
print(candidate.path, candidate.score)
The alpha query expansion and the k-reciprocal re-rankingcan additionally be used to refine
the retrieval results, improving mean Average Precision (see the
documentation):
from pyvisim.image_store import KReciprocalReranker
pool = image_store.retrieve_top_k_similar(image, k=100, query_expansion=True)[0]
best = KReciprocalReranker(image_store).rerank(pool, top_k=5)
For more examples, please refer to the pyvisim Examples
Repository.
Installation
To install the slim version (without deep learning features):
pip install pyvisim
Additional features include (note: these pull in heavy dependencies like torch):
# For deep learning features and the OxfordFlowerDataset
pip install "pyvisim[nn]"
All experiments in this project was made on the Oxford Flower Dataset [7], for which I have created a custom dataset class. For more details on the dataset, please refer to the documentation.
Contributing
See the contributing guidelines.
Get in Touch
If you have any questions or just want to say hi, feel free to:
- Open an issue on GitHub.
- Write me an email at vunhathuy234@gmail.com.
- Connect on LinkedIn to follow my work and share your thoughts.
License
This project is licensed under the terms of the MIT license.
Release files for pyvisim 0.9.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyvisim-0.9.3.tar.gz | 705.7 kB | Details |
Built distributions (wheels)
Total release size: 41.4 MB
Release files / pyvisim-0.9.3.tar.gz
| Download URL | pyvisim-0.9.3.tar.gz |
|---|---|
| Size | 705.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6686535b294d2cac5c6c4d1846f02f971e64dd7047f8a65474c3cf16b0449e4f
|
|
BLAKE2b-256 checksum How to use checksums |
e33122ead75dc2a209af6a7ebb51acca108ed50411692a1b5a6155d234fda8ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pyvisim-0.9.3-cp314-cp314-win_amd64.whl
| Download URL | pyvisim-0.9.3-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2e5359f5a28e05e6685f256ce6515cc1ccfe15d44c4689e3d743fe658932d116
|
|
BLAKE2b-256 checksum How to use checksums |
91b02b697f4eab0ddc7d092271b8cd8ed223a6883e465c196ea8e89c8f0954c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pyvisim-0.9.3-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyvisim-0.9.3-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.5 MB |
| Tags | CPython 3.14 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
c8bdf2d871551688802408f804a51fbf46090af45104a0cebb7d05221f1ab5f1
|
|
BLAKE2b-256 checksum How to use checksums |
f04d5655a8cbd72f8e533d14fb45f8984374f6521cee42047f30cae19a462626
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pyvisim-0.9.3-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | pyvisim-0.9.3-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
81fa9412ca0869d0c9f2af35442d354da486d74326a17c0b1eef7903a417b6f4
|
|
BLAKE2b-256 checksum How to use checksums |
1f6d567b57ef468aecc15e4368f8e059c90fa1f0088b3d3e5c5235ec11714800
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pyvisim-0.9.3-cp313-cp313-win_amd64.whl
| Download URL | pyvisim-0.9.3-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b5bbde3505b289ab0e6a1ae1a3065163d478456aa5fcb5cd24bd5cec0d060c88
|
|
BLAKE2b-256 checksum How to use checksums |
7605a12cd7e054c2f91d8c506bc60722ed70f2ec2ced3a3cd662adb874fd89be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pyvisim-0.9.3-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyvisim-0.9.3-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.5 MB |
| Tags | CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
a035796c4288201ee1735a82f68077726eb6b97a911ada14d523b6f4730ca7d8
|
|
BLAKE2b-256 checksum How to use checksums |
d126cf7a4478ee91449221aa6d7937385f751ce69e171dc9d7627d32f9457d33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pyvisim-0.9.3-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | pyvisim-0.9.3-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
84c5e1b9c5c86ecee0e1355f13c55aba4e50bf277eff64647f3aeb2dab2cf54c
|
|
BLAKE2b-256 checksum How to use checksums |
8f6d5196e25e877114f69185f1c5907794460a0060e788ecd37c1ce931af58e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pyvisim-0.9.3-cp312-cp312-win_amd64.whl
| Download URL | pyvisim-0.9.3-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a17ab7dcaba2f9825446f78551d7901352a4da671ffdde8df52e66a8727470c7
|
|
BLAKE2b-256 checksum How to use checksums |
a7c8ad0438eb54df449341e71fd20ca3dbc6fd67e866010a3c9af97c3abc702e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pyvisim-0.9.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyvisim-0.9.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.5 MB |
| Tags | CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
1e1b94c66dcd00ed99c18a95e35c677d019be05a253508853a632423540cc0b7
|
|
BLAKE2b-256 checksum How to use checksums |
f7c8745bf00c6b15a21f2b74accf41a217eae1208392708a91a2bfe491b68c24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pyvisim-0.9.3-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | pyvisim-0.9.3-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b699068e3fafb51e0bda503512409d25d4c2567d02b9a23d37cce849f2423814
|
|
BLAKE2b-256 checksum How to use checksums |
a71b20a6878884ad16fc600ede12cffc17388e5e57f744decff37ceb9bfbaada
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pyvisim-0.9.3-cp311-cp311-win_amd64.whl
| Download URL | pyvisim-0.9.3-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
34b5e62743038caddfa63a66d439b622cc3eccd120d5b53d68fceaef1448690e
|
|
BLAKE2b-256 checksum How to use checksums |
57dc230a956ecb5d81e3e3a0efae0adcb8541b2dd6692d68686cad081c215368
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pyvisim-0.9.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyvisim-0.9.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.4 MB |
| Tags | CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
0a64a1813617d7f549cde67172bf9c6f1f1f7fc4674d5003b5dca105234dbab5
|
|
BLAKE2b-256 checksum How to use checksums |
3df1a8ae5692357788a7e5bef4577702a30388c694633c9d4e3af4dc9a94d1ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pyvisim-0.9.3-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | pyvisim-0.9.3-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ba1b18ecb644c8638a6c6891924b22cffa37c98fdb12fa40fa82a89de0b50bfc
|
|
BLAKE2b-256 checksum How to use checksums |
2037eb9c165bbe9c7e27d007d7f287707e4f20b821ca4749a97015e099f7eaa3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pyvisim-0.9.3-cp310-cp310-win_amd64.whl
| Download URL | pyvisim-0.9.3-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
3375b7efd1301d437679dd9ddd194c2b99a9583cfc05ee0d260f296f0ce928cc
|
|
BLAKE2b-256 checksum How to use checksums |
ea9f91ecd004106b8d8341ce3e3f253092063831502f022af940869b32c01241
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pyvisim-0.9.3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyvisim-0.9.3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
77ae10528b3ca07759e656210ef8bb18f58d8cea5d06ac625d69d1751d88db6b
|
|
BLAKE2b-256 checksum How to use checksums |
55a7c048f250cd149a0a4c758be36e827299a40bc6e1fdbfefa5251bed86ba7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / pyvisim-0.9.3-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | pyvisim-0.9.3-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c7edb677dc40198c09b5b7019a583e73230e103ad68b26080c2394a97e07f88e
|
|
BLAKE2b-256 checksum How to use checksums |
9a0a7f03b9a1fef8a79401dd5b579b423ed5e6057abf054cfa0c551fa5a433aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency log