imgsimilarity
imgsimilarity tool automates the process of comparing image pairs to check if they are similar or not and produces a score that quantifies the comparison by providing a score between 0 to 1, 0 being exactly identical.
How to use the tool
The tool is published in the pypi repository and the latest version can be installed with just a single line of command.
Prerequisites
- Python should be installed version 3 and above.
- Python package manager "pip" should be installed.
Installation
Open a terminal and paste:
pip install imgsimilarity
This will download the tool and set it up by installing all its dependencies
Execution
The module imgsimilarity takes a command line argument, i.e the path to the location of the csv file which needs to be provided when running it like in the example below
python -m imgsimilarity.diff C://pathtocsvfile
The tool will execute and a comparison_results.csv file will be generated in the directory the command was run.
How does the tool work?
The tool uses dhash algorithm to find a hashcode for each image and then find how many bits differ between the hashcodes to find the score for similarity. Identical images have difference as 0.
The dhash pypi module is being used here, its an out of the box python module to compute hashes and determine the difference for images. The hash for an image is stored in a dictionary to avoid repeated execution of dhash function and this reduces the cost of similarity detection. The execution time for each pair is calculated by taking the difference of process time at the start of the iteration and the process time at the end of the iteration.
Below is a flowchart that briefly illustrates how the tool functions.
How does the tool achieve hassle free installation and usage?
It is by using the Python Package Index repository!
Once the latest code is pushed and tagged, the gitlab ci is configured to run pytests to make sure the code works and the once the tests succeed it creates the build and a distributable with the help of setup.py file and twindle. and its uploaded to the PyPi Repository automatically.
The user can install the latest version using pip install or upgrade command. Thanks to the setup.py file all the dependencies are installed automatically
Reference:
PyPi repo: https://pypi.org/project/imgsimilarity/ dhash : https://pypi.org/project/dhash/
note
The source code is well documented and pydoc can be genrated.
Metadata
Release files for imgsimilarity 1
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 |
|---|---|---|---|---|
| imgsimilarity-1.tar.gz | 4.4 kB | Without provenance | Details for imgsimilarity-1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| imgsimilarity-1-py3-none-any.whl | Python 3 | none | any | Details for imgsimilarity-1-py3-none-any.whl |
Total release size: 8.8 kB
Release files / imgsimilarity-1.tar.gz
| Download URL | imgsimilarity-1.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9666770d2254b641a144bec0d5da145645e91bc1403dd0b87a37c1e3209f943a
|
|
BLAKE2b-256 checksum How to use checksums |
fe760d6de3fd0a288335efdca764526a0ca1893c39eff1cef90faf2d2820fa2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3
|
Release files / imgsimilarity-1-py3-none-any.whl
| Download URL | imgsimilarity-1-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6d0be4f4b090bd94be4283f8e1e06eb086dfade4598bc0bc927cc2fb6d31fb9e
|
|
BLAKE2b-256 checksum How to use checksums |
970139842464ca3cd7133f7e4bfc4e05e118003178ae315b4eb20d2e4ed31f42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3
|
Security for imgsimilarity 1
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.