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

Uploaded Source

Built Distributions

perception-0.4.9-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

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

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

perception-0.4.9-cp38-cp38-manylinux1_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

perception-0.4.9-cp35-cp35m-manylinux1_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.4.9.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9.tar.gz
Algorithm Hash digest
SHA256 4ec82ce78cb1d5bffda019ffa65d4a40aaad731df44b6caf0204fd594fb82f28
MD5 cea4305c60cf6db028c9cd0faf420665
BLAKE2b-256 77966ff9eb6cfc82833724056ec67e8782b76af1b9a83bc0ea5442246d711d94

See more details on using hashes here.

File details

Details for the file perception-0.4.9-py3-none-any.whl.

File metadata

  • Download URL: perception-0.4.9-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9-py3-none-any.whl
Algorithm Hash digest
SHA256 574d00c9f635789ffa077ef06de23aec4981482f7c01bf30da145b0f3c958dc9
MD5 fda065b94ae1fedce7d5bbb62a4b5f51
BLAKE2b-256 f2f3039cbe501712c10225aadf141e7c75af7b5d8008c5e05c4633c7712c07d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.9-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4ac17ff49be0dc5dfc7aeaeea4b4536f4abb43d20f3679ea2a46ebda1041ae27
MD5 9ca0d90b30de030ccf097486009a218e
BLAKE2b-256 8ce683da284784b9a959bfcb1a6a15f98b9530af4edc7cf2323906430b37a8bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.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/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 0def5230dd23a5bc22da601b3a2b8ea6226a069d23d43fd065a208574dba9c77
MD5 d4f78c7f2f001f8a936622bd754b9a9f
BLAKE2b-256 9685c3317cd8d271386a26032ed65fe1ed3907f64b86e0475a0a129cb87ccbda

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.9-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8bfb9cbbd6503128a21e8e46b20e415fa94d47e7ec55db60e2453a5150a41292
MD5 4efad63c8eef7ac3f0b7810e7f897a67
BLAKE2b-256 1cc6f93cf430de1934618a73b6a22070b6c97724ecafa4a1dfa3e51224d3a300

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.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/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 3bbc308f56a53cc61e3906769bd9ff47b28b9a3feada351ea18fe8e4c4f2b0c9
MD5 7dac893dcc5d25a3601d0b6b0d118ec4
BLAKE2b-256 1111083d4e079906e16dbff2e35b20b793b3cc656edf2f1ffacde56d0b167a34

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.9-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a5e53668939b58d0166a04343b0560c14dbb1927c72190b7837cec8823515a66
MD5 9efb0151554bc5679b1c43104458ddce
BLAKE2b-256 7d4986aefc75a7b12dd3583d490d62a2f86f2d6422b89a1991336bf4fe3a23f4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.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/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 da093b6be0ac9a58306507172494089bbdc8254a6d5947ca04c97bacaa3c9970
MD5 a58ab82cc073811389f69ae4d720bed4
BLAKE2b-256 8aa7141b3973eab33949ba5b7fc7b382bd862b8a4932b9ca5107669c01f87a6e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.9-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8ff22e71c75e6db18dba7bee37f01defa520fa313be731e684f326a9bbb528ed
MD5 a4acd3c68c3f353d43c5bb6b16bb11f0
BLAKE2b-256 67b66add37f06ce562beda1372ba7569c113cc879077ad853289828bf0767643

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.9-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b6c21b6fcfb86acbbb94c93156b86532c2041c71a7fe8811fc7ec02ed71baedd
MD5 0f23fd0651e823a3fcdcdc3c01650624
BLAKE2b-256 7bf502cc4a3a82afb335b160edea24b5c72c6bde36f8e784b737d0844b9bfd60

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