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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

perception-0.3.11-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.11-cp35-cp35m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.3.11.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.11.tar.gz
Algorithm Hash digest
SHA256 64f791017d6ab07ec021c971a9ff9dfd09016adc876aad794f92c9c7c1821a16
MD5 5d5bf939010758ca0942d2137e457362
BLAKE2b-256 1893505cb7a43725c648b1be31a2e6b4642c4cdd25a528bdc967f544e426adaa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.11-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.11-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3958c59b525b0887a85184e10589a2fadadd3ab63f14354b40f2b69324419732
MD5 3c64a4eee15e8ca87ee7d4321ec37f09
BLAKE2b-256 0f75facc64b13d302bfa6eb1f28f2713408438e2d91f94836dff33e2da203185

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.11-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.11-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e5f2db60baa2b558e1388150dc5a1a94e2df5fd545d90fc0247b26aa8d4a333e
MD5 72697befa0ddd4086a33580bb554be65
BLAKE2b-256 3400ae3ff5c6477e8dec710279dcd580c81f83098d7ac94ef2583312a62fab3e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.11-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.11-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0dd076bbebe7ff7622a26afcdd5339d6f163a565e83d22d5b4d5eb599d1fa788
MD5 d84b354075f03e602fc5388fb73add4f
BLAKE2b-256 13f0a04f57318fe5e97ba0ff23df532d987b98edd8b6a8fa7fc524635578204a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.11-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.11-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6be17f25758f5b9ee3c2dcfe02f77afdc4a52957f4c1915873aedb7df55423d1
MD5 beb7892393a61bb15158375bd254d39f
BLAKE2b-256 1df4b876f5cbd746035a79fb7b440225539b9a91523dd3a0b4d27ffb50364538

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.11-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.11-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 aa7ad948999707405b0c587443ecfc75a76d9d708feacb48d528d0615f11c633
MD5 062e9f637e080ee9448eb5225a66230c
BLAKE2b-256 b712bf873052e9ea89a283d33a9f319b29c7ab5fac0777cf7625f368a3df2300

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.11-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.11-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 581db8edf58b9abad8a9c559b6a4e93e34bb411af6682abe42802d3b634f1505
MD5 6f3a8e63be8befcfb1ca64b924190b13
BLAKE2b-256 6ff27d8911ddb1647bc29e1c20546e7e42b29e721956524e0af3750866b8b2d1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.11-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.11-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4307e52ef9aa6c74f42ec4e410bab2f376cf7e869dcb34de097180ab9084c733
MD5 e90b66166357a14e511c298ecb9cfeed
BLAKE2b-256 97f84ed8dc9dbaf5191c9993922ae120a8bdbd8bdde760d70b8b0d4a68be1741

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.11-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.11-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 6329e0dd91b3eedc26ad97b21e689c4daeb4c23b5baf1cd9dc00e2532f1d60a6
MD5 e9c83d088ad2ac6f81f72b037e3bf036
BLAKE2b-256 78c04f8299148541f94cf0a5e7c5e289a96949d7ebd0c4dd88a9fea8f5870221

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.11-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.11-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a7e05d94977f8ef6cfaab32921441c3a8faf2b32979a036df7564bec0910be42
MD5 167a4e2c7ed2c11297b3ec2d6f939079
BLAKE2b-256 d6c8a3da3fcd4909aa511c81036245867963068c6a46a193c2df5cff930cf9de

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.11-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.11-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9105351b89bc235012b57375dc137483d646cf6169728ff2377c6357a8533659
MD5 57f0126b2ba05319a22058844666b059
BLAKE2b-256 7076fff2ed532b325aef76d57a03532620b687a00d00726f7573c7a281323dae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.11-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.11-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dd829078b8c059a6adc1cd807636b01699d727c3c32b0bc4b38385eb83bb9f8e
MD5 bb6248951d13d3c1a4349e7e62950953
BLAKE2b-256 2241ec9d2662840daf91887bfb1441a906b9092ef5dbeba46d5e53439a28212a

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