Skip to main content

A package for image hashing

Project description

perception ci

perception provides flexible, well-documented, and comprehensively tested tooling for perceptual hashing research, development, and production use. See the documentation for details.

Background

perception was initially developed at Thorn as part of our work to eliminate child sexual abuse material from the internet. For more information on the issue, check out our CEO's TED talk.

Getting Started

Installation

pip install opencv-python perception

Hashing

Hashing with different functions is simple with perception.

from perception import hashers

file1, file2 = 'test1.jpg', 'test2.jpg'
hasher = hashers.PHash()
hash1, hash2 = hasher.compute(file1), hasher.compute(file2)
distance = hasher.compute_distance(hash1, hash2)

Examples

See below for end-to-end examples for common use cases for perceptual hashes.

Supported Hashing Algorithms

perception currently ships with:

  • pHash (DCT hash) (perception.hashers.PHash)
  • Facebook's PDQ Hash (perception.hashers.PDQ)
  • dHash (difference hash) (perception.hashers.DHash)
  • aHash (average hash) (perception.hashers.AverageHash)
  • Marr-Hildreth (perception.hashers.MarrHildreth)
  • Color Moment (perception.hashers.ColorMoment)
  • Block Mean (perception.hashers.BlockMean)
  • wHash (wavelet hash) (perception.hashers.WaveletHash)

Contributing

To work on the project, start by doing the following.

# Install local dependencies for
# code completion, etc.
make init

# Build the Docker container to run
# tests and such.
make build
  • You can get a JupyterLab server running to experiment with using make lab-server.
  • To do a (close to) comprehensive check before committing code, you can use make precommit.
  • To view the documentation, use make documentation-server.

To implement new features, please first file an issue proposing your change for discussion.

To report problems, please file an issue with sample code, expected results, actual results, and a complete traceback.

Alternatives

There are other packages worth checking out to see if they meet your needs for perceptual hashing. Here are some examples.

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

perception-0.3.13.tar.gz (1.3 MB view details)

Uploaded Source

Built Distributions

perception-0.3.13-cp39-cp39-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.9

perception-0.3.13-cp38-cp38-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.8 Windows x86-64

perception-0.3.13-cp38-cp38-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.8

perception-0.3.13-cp38-cp38-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

perception-0.3.13-cp37-cp37m-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.7m Windows x86-64

perception-0.3.13-cp37-cp37m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.7m

perception-0.3.13-cp37-cp37m-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

perception-0.3.13-cp36-cp36m-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.6m Windows x86-64

perception-0.3.13-cp36-cp36m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.6m

perception-0.3.13-cp36-cp36m-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

perception-0.3.13-cp35-cp35m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.5m

File details

Details for the file perception-0.3.13.tar.gz.

File metadata

  • Download URL: perception-0.3.13.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.13.tar.gz
Algorithm Hash digest
SHA256 7455b742ed5fd9880fd1304843eeda3287c93b372385d8afc442c8dd601f69b7
MD5 34101dd4c78ea9e19b5dc023db6964a2
BLAKE2b-256 d53595374ea439f4a8ef44268f0d321250812d2527f5bc7bb89383ee34a6084f

See more details on using hashes here.

File details

Details for the file perception-0.3.13-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.3.13-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.13-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7966140281f7077db0f9395995e5635347785ff276af738b16b74b2382e4e0eb
MD5 72e666fe0b5c3a9a3c726de9819d17b2
BLAKE2b-256 113940d712f9f3a7e4711e8124a88875d88977a8f76c4d29c0eb5a3a0df748cc

See more details on using hashes here.

File details

Details for the file perception-0.3.13-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: perception-0.3.13-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.13-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 835c2ea69a98b7ddb74f4e69ac75dabb084ad0bc93b64a90228e7b334a3e63c8
MD5 55d0cc6bb0907b617450c1b42b652a9c
BLAKE2b-256 c7b83569945280af1719da5b761ef6e8884ae31ba7e138ef53b99a723988c2e6

See more details on using hashes here.

File details

Details for the file perception-0.3.13-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.3.13-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.13-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6047bcbdae07d8b3acba6b3f6b9f36cdf62f609476e89d04c58a64eb95570cd2
MD5 e46a9b360684cb04edc7a1d2a4969cb1
BLAKE2b-256 9fa85420563c71265a8619d361ff7f68a082100e7137ee98b5ffb76c43005732

See more details on using hashes here.

File details

Details for the file perception-0.3.13-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: perception-0.3.13-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.13-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3efbc10b93e134c800a408286ef2ef28f76273a2550b0d284368680202f998ca
MD5 36b53fc80adf580a4729f1befa68d263
BLAKE2b-256 3fca465a6c991da22103503a13e5200565546d43906fcc9c13725d3e1c7126f0

See more details on using hashes here.

File details

Details for the file perception-0.3.13-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: perception-0.3.13-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.13-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 7d9fc44a971b7d81008d6ea972e92ae78f481f02424020466954699746fda558
MD5 ae276b1de3dfae47859b48974673f0ab
BLAKE2b-256 4d4e003db10c2f05adebcb13a9a9a2fbbaa74d1112ddefe1ffee0440c8710a71

See more details on using hashes here.

File details

Details for the file perception-0.3.13-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.3.13-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.13-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c38b16c69b4737278793f93420f9e716b4b3f5e97c0f942e5b427104c43dc3a6
MD5 d691cb2ecb7889da25b8acb66728494d
BLAKE2b-256 0bf1066402127e0b465dd24d8cbd063f5956bc94cc30c761363de723a5912180

See more details on using hashes here.

File details

Details for the file perception-0.3.13-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: perception-0.3.13-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.13-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ad33737413cdc4d6ffaba88638d8584d5ab1cb1d1e25202c53f28aaeddb22d2f
MD5 fdba0a63e8454a5fdd354897ecaa3b90
BLAKE2b-256 e6eb7ce81fd0e1e71f739554e295e3f743c8f73055682b7aa61d4a90fa390284

See more details on using hashes here.

File details

Details for the file perception-0.3.13-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: perception-0.3.13-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.13-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 205f8286240291d72824d68fcf177319ecdc0982fc049a6a6a2a9bd07118410f
MD5 e81c88a6f7605500227f48d9cf654a09
BLAKE2b-256 380ed466b52d3e5452852d3037afee528d07f3c2bb63ee3a1982ee0712bdee88

See more details on using hashes here.

File details

Details for the file perception-0.3.13-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.3.13-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.13-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 634bcd95fdfb3b3e61d7b486ec84d37d29c5e2a76bbdc491bcaa8e394b6e5cd2
MD5 85a8501d761161cecab93aa43161d6af
BLAKE2b-256 7eb0c711790da9ba2838d7df46d8915df7960e16ea33308c653e09b2182c3bc3

See more details on using hashes here.

File details

Details for the file perception-0.3.13-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: perception-0.3.13-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.13-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e66da7632e0e27d0f7f6b1d0c33532c5977ea5c810d49c95f31791e653ccc812
MD5 1dd779e13b0a44db095616c0c613a606
BLAKE2b-256 f0f1ffbc126e7ab3d5d24752965be04ea1cffa7720b7b61028b99b74be936747

See more details on using hashes here.

File details

Details for the file perception-0.3.13-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.3.13-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.13-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 648ec0b10472d3078ce2d3bdc0392e75151ec9fb2fff8870df61bd0c2afc1b3f
MD5 e9e3172a07605f9b81aecb3bc45cf81e
BLAKE2b-256 5d8c156278ffb56bc17f64e2ac973353be4912b39e5ab218b8b4d6d03d102477

See more details on using hashes here.

Supported by

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