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

Uploaded Source

Built Distributions

perception-0.3.1-cp38-cp38-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.8 Windows x86-64

perception-0.3.1-cp38-cp38-manylinux1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.8

perception-0.3.1-cp38-cp38-macosx_10_9_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

perception-0.3.1-cp37-cp37m-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.7m Windows x86-64

perception-0.3.1-cp37-cp37m-manylinux1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.7m

perception-0.3.1-cp37-cp37m-macosx_10_9_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

perception-0.3.1-cp36-cp36m-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.6m Windows x86-64

perception-0.3.1-cp36-cp36m-manylinux1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.6m

perception-0.3.1-cp36-cp36m-macosx_10_9_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

perception-0.3.1-cp35-cp35m-manylinux1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.3.1.tar.gz
  • Upload date:
  • Size: 1.1 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.1.tar.gz
Algorithm Hash digest
SHA256 6dcb881269e331463b6011c35abad43d7891f2257a08e83ce75de0b57ad5cd9a
MD5 b91040e20a3060915e00dbd6a9335132
BLAKE2b-256 2ee80779a58de3d4d8d3a65e152c3bb199854889504920048330c13b98a2e99c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.2 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.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 29e70803adcc1246a59e861823dbeb7bfbfe9067168dc820152fed303c637754
MD5 700c3d38a5c754b43eccc3e1fe52623b
BLAKE2b-256 4bd974a0b38b2fc7489cc7e871edb5a3a615994a86f24ce87c40b5cb9cd07d1d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.1-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.5 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.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1ae6b1e99bc509aaa0248146c7b457f92c6181529e9b14826d3749ad62c1393b
MD5 3deabaa88522023bfc6c78ec573892a0
BLAKE2b-256 22a8811532701eef300d4e7fc55e37f01208551569a711bb6d762eeb0083edec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.1-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.2 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.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 eda76531ab3e356ac4fb309260bcdb0a3969b38ecf6ce489e13bc63cf67ca4cf
MD5 d4e8b04fd2b3b4c413ea5534328f808b
BLAKE2b-256 6bc5175a6d099c06d17de21c586867a41423dabfc908b7cae9a30d3b811bf77b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.2 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.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 cc6ce398c13cf606cab8f711feadb23ced99ecf647aca6dbff81ba28c2087070
MD5 5d9ddd10723efdb419656b7d987d9683
BLAKE2b-256 4de418dedbcbc7fc040188b7cc610bda18c75263172304893fd8be69204b7ef0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.1-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.4 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.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a1cc552e1b18b5236094b8a23abd8e8bb5699c1f995f437b3eee2c9d64ea635e
MD5 7e487e3a82655c040bcc9ea0b6952c4b
BLAKE2b-256 8a6d204050fca1c86567f9b81135ad832f2ee7b494b730e1a8dd7d5a27d3fab6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.1-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.2 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.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 75bbaaae905c6e3337b7806a52e1ba278e382a4fdff9ebd46ae9dc8a8b029eca
MD5 1fe76c50d4ad09efd2c6dcb95bf015f4
BLAKE2b-256 abb8bdd724c16d49cdffb4614a35d3a4586fead41ea951beca4c022e7ce824ba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.1-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 1.2 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.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 b4c13f7aa7939a3bf3e0b4ad636355d1aa3f07e0bee38047b494ad75db3a1eb9
MD5 b36a604d8dcb8bd03feb7778099ccede
BLAKE2b-256 ff451939e5d7197a87d06d4e19c39a50d313c20e24d69e57df1014ddde48d3ca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.1-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.4 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.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a67dd3a4b2aaf5dc56feeb0a7e78cce11d2c04254d4144dd22fdc69cbeae5d13
MD5 68fa606fae44d2784c8812cb85e3268d
BLAKE2b-256 6a85d134790d4c541833ffd8ffb87669682be83aa703bcdcdc72de7d433b0ccd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.1-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.2 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.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e72a1bf757061b305021c39a6f6548546d974707811ec972e76a4c135ff82e51
MD5 69a2813a1f50fa042eea697948574a51
BLAKE2b-256 a46890a847c139c248bdaf24379c6cd8b330ec120d82c65533e4a6fcf7600600

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.1-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.4 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.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7ee57c7a731aa9f92c3c691735239f9d7ef402114d8287b6ba033e8c4ebd0fe8
MD5 9c55c6b5dd79e1c0082c35113a88e598
BLAKE2b-256 143c59835d433abfab3d30c15f4dc62865a51e15b20b20fcbe60e5ad0aeba3f4

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