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.9.tar.gz (1.3 MB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

perception-0.3.9-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.9-cp37-cp37m-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.7m Windows x86-64

perception-0.3.9-cp37-cp37m-manylinux1_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.7m

perception-0.3.9-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.9-cp36-cp36m-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.6m Windows x86-64

perception-0.3.9-cp36-cp36m-manylinux1_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.6m

perception-0.3.9-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.9-cp35-cp35m-manylinux1_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.3.9.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.9.tar.gz
Algorithm Hash digest
SHA256 6494717e0f20912d279416c383df0cc0a42e97ce8c0c28ce81cd94d19b0cb1d5
MD5 eb535c7346b5cc0b236d815257254b4a
BLAKE2b-256 b84f9750fb38b1c504ec67d990bb32e490cd1c377e0dc71469f033e9e5116d95

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.9-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.9-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c247a7ac19ae26c7341cd2d31ce1999dec73986f0ba68fd19efb3a9a76655260
MD5 b97dc6ef8b1f6f2d04181dee638a1fe3
BLAKE2b-256 e85214e20668c5fd3607c50ccffd7e787020487666b22ec3b91c12591c63e099

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.9-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.9-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ab72d52fd927c99398e31ea3e05aea8f0cbf0460706e83fae38c9b9cae38b86e
MD5 3b30acb8e8eb19360e02a0dd6ac2d2fa
BLAKE2b-256 c186e3ebd20bd395b7d9986d1114ae5c98a1840e2be51435c1543cb11791a9a9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.9-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.9-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d9334c2c88393e513832026e5ce19515babd95dec2d8d515f41a36d0adbc8b11
MD5 b745f6592716d0e376c0bfa7c6feeaad
BLAKE2b-256 780424a4740ce4a211edb1c094274331413ebf7b6280efc3ae9b51fc3286cc7a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.9-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.9-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 d63b4ca013d0f1a148691a50299199db09ab13547f0b440093ed5296a2636609
MD5 f3b19b2133223d00b0819e1d9ebeb147
BLAKE2b-256 35cc34d390759acd9eb9bbccbc9050b197ab5f214959fa712955c51ad736e0d8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.9-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.8 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.9-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 91eba2a19d17cc7b99b97d76b27d3c3d5023c026ac8ec7f74bcf601d9c222d46
MD5 1d2c0be81611535b7129be817166da04
BLAKE2b-256 b6adf4dcf511daa356a8736f6bcccb75b80f7e9c29afdb2c6eda7ce847b8b641

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.9-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.9-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 deb474f86006e0e881ca73d82e95bf3d8224d1fe045300273a49330aa56d1807
MD5 1eeba8b4b43a42a6c403f33e982dbd3c
BLAKE2b-256 8c5a3195f91366945cbe8d8be373ea24dcb508fc0dd1ffc70b2928751caa4aa9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.9-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.9-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 ed7553d7460caa3a9fb0b1055e90dbc41f9151a861d62ccdaa4f39a041efbfeb
MD5 5d1c951bccdb802d166b57e3bbd958f6
BLAKE2b-256 715ed16b65077a65ff833e5a58acbbcdabc00a5c2ed7e299a943e30c335ce023

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.9-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.8 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.9-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ed4876c817a11af3c1eb903561c3e9b35ada554a5d8fe51f6137bb28fd5cc94a
MD5 d2de2bd9de1cefd2c993750ed6c45870
BLAKE2b-256 f2e9e701eb4fb8bba276140bab429df9392a7530efb87e6b8b6158a7d1a1bddf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.9-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.9-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dd24311f112e4645205ee49ac253decde3441dd1fa99746f6d71b67eedb6cdcb
MD5 8e9d7c7d6f888d6dce0501b145d9b88c
BLAKE2b-256 6652b43a405b7c3065b19f5313c5942d59081c5654e0e56f34d2476de7d176d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.9-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.8 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.9-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 735116e147e1a06cd5d60c30a9723c32bc99119bb0495e1899e68c922f81e0f3
MD5 d4c4d094e5e17b4d4abd3eac106ea0d3
BLAKE2b-256 c12d0c2d3e833249b4f8ced023c2ac814d6bee715377ecd02496bd277eba0114

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