Skip to main content

pHashML Image Perceptual Hash

Project description

Python package to compute image perceptual hashes. The perceptual hash is based on the mobilenetv2 tensorflow image classification model. It is condensed down to 32-bytes per image. Distance between two hashes gives some measure of image similarity, where distance(a,b) == 0 means idential images and similar images give lower distance.

Usage

Run unit tests

python -m unittest tests.test_phashml

Build the package

cd pyPhashML
python -m build .

Install binary

pip install pyphashml-0.0.1-py3-none-any.whl

Calculate perceptual hash for two images and calculate distance:

from pyphashml.phashml import phashmlctx

x = phashmlctx.imghash("/path/to/imgfile.jpg")
y = phashmlctx.imghash("/path/to/imgfile2.jpg")
d = phashmlctx.hamming_distance(x, y)

x,y are bitstring objects. d is an integer value >= 0.

Submit perceptual hashes for a directory of images to ImageScoutPro server

python -m pyphashml.imgscoutclient --dir /path/to/img/files --key mykey --host 127.0.0.1 --port 6379 --db 0

Compare two images by their perceptual hashes

python3 -m pyphashml.imgcmp /path/to/img/file.jpg /path/to/img/file2.jpg

Reqires

bitstring numpy tensorflow >=1.14,<2 redis (for the imgscoutclient command to submit to imgscout server)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyphashml-0.1.0.tar.gz (32.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyphashml-0.1.0-py3-none-any.whl (32.0 MB view details)

Uploaded Python 3

File details

Details for the file pyphashml-0.1.0.tar.gz.

File metadata

  • Download URL: pyphashml-0.1.0.tar.gz
  • Upload date:
  • Size: 32.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.1 CPython/3.7.3

File hashes

Hashes for pyphashml-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fb1904fe1bb6640cf19789826ee1d3d8f888ef426dd9aa1c1ce785ae66b12222
MD5 83ce0c56fda15367d94c99f5d5832b0d
BLAKE2b-256 045fd09dea994540dfae737d4bef9c31f2c7eb3ba123e8342f1a884a1dd4bcc3

See more details on using hashes here.

File details

Details for the file pyphashml-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyphashml-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 32.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.1 CPython/3.7.3

File hashes

Hashes for pyphashml-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b2ba0f0f4dc5c379e8da8b6e1bf0e63a2fb0b201d01d87ebed36091d9f1f4ecc
MD5 f4995e83895e54af6c8d7fed42f2ea2a
BLAKE2b-256 1901633d1977a4f0a8f1eed68e45009a4bffd7911b48f47f08229145f9feca42

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page