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

Uploaded Source

Built Distributions

perception-0.4.1-cp39-cp39-manylinux1_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.7m macOS 10.9+ x86-64

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.6m macOS 10.9+ x86-64

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

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.4.1.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.4.1.tar.gz
Algorithm Hash digest
SHA256 f3d185bc65150f18de7c05f08228bfb633a705de5a223a9b1640691bda139584
MD5 3767e95605115817af1c2d11de706a66
BLAKE2b-256 bf52f7ecfe92765e06fd2e2984480aa2df16cd10a57df47fddfb4f4f0df413ce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.1-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.4.1-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7770228df997653b6281127ddd52200e8a20b7dc5aa6eeb4c23567bc284afc74
MD5 846d68688914eab4de36c47d4d2bc41d
BLAKE2b-256 5b8b29a8976406c750dcf4906843cd8f416ba0ced0220cd97e958b447d7c6e3a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.1-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.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.4.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 2dc4980bade7395311eb5bc14f93be5b8532bf878b7bc2d75bca6c7aff14e0df
MD5 234c1568c5b08c3e63b3f312fcaca0d9
BLAKE2b-256 b6476c9415e9bbfbedbfa406e3186a007059ae25e0ef69576a4cb58887706486

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.1-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.4.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f7d1dbfb824bf0594b0fd8ea8e5926299763ea13203b1d8422dfa3319c233319
MD5 91151d5e325912ae55715491ffc8d50e
BLAKE2b-256 dcf35a653fb316c8816abd9b6b7e4b54387f1337dbadd9bb7bf0b1fa90da9461

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.1-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/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.4.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 85f19100c2f75be661f85fe5d38996d84a4dc88ca7c4c0b007f4af36b7e119d9
MD5 f04525059897cefba336cf412c7f2734
BLAKE2b-256 9e1eb080f7942515a2240987369196b14b648fdc260b6234977749e0b2236188

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.1-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.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.4.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 fc0bc1bcb154912be9902c28b9786f2e3c7efb9a713a813283af188c21530cc4
MD5 bae933a41b59a8829780af548d79123c
BLAKE2b-256 2527ba3f65da27964099eaf54d35a602e71960a1a865a3bb39648752469abd37

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.1-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.4.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 510238388dec959151e4b75d8f01a62f9994849bdd9c7235334c120206ab6778
MD5 f12c9e91c62187b9519f681c70e063a3
BLAKE2b-256 4a49f8e5bdd498075250521c28eccf90a2c8e1287c849fbbdcf6e4096e126c6f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.1-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/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.4.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dc29763a98e60456c9fc5a00c931e76a7ae745699213628cf0fecb88b9a1a629
MD5 caf04df6c5e45b3464264dae70f0e0ee
BLAKE2b-256 272dc2585423fff678e3e8ffcb4773e698bce9b7760933352aa4d3175c7c1493

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.1-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.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.4.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 8e17bac2a986c936b523a60d6e37baa0c409a2a4c9f1a50d37105a570313c36a
MD5 5ad3527998b246e77917e8ee2b9e1012
BLAKE2b-256 3d3aa0ff028df530ac44ee9b21b34a53955ec84f98241f6e60523d010b10edf0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.1-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.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.4.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 bc8d79bca64410347a5a7adca0db7eadea52949949b86b917ccab6ad83a4f6d6
MD5 d9b47f9163edbb0bb8c95ac0997f70cb
BLAKE2b-256 1e754464c5230a1b3cde2dedd10b2446db8a5e034b8f62fd1a4ee05c2dc3dc1e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.1-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/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.4.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 191e97366b89f32b07814297c0fbf6e4cabae3d539dff26c6848c67f2ef30563
MD5 9cf42e2dddad268a545fac0c477c3f64
BLAKE2b-256 f5e7647a563b6315a2e44abca620bc69a564592520d462c8872efece2e978b0e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.1-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.4.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 77c4ea2f57f3ee1b67f33f94905d3e21af4b9bef256637ce535279d7f2fb5f0c
MD5 4cfd8938e5a173f949ce7ec3f1a46541
BLAKE2b-256 f2017afc4ebe8aecfc0fd98ca05d9ac2cd56d02a65b8fc02426421bd8d47bb8f

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