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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.3.6.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.6.tar.gz
Algorithm Hash digest
SHA256 3277a0689c148e92d431f5b6e212000feb02cd091b0d3aede405dd185541f21d
MD5 060c82c2aedcc58c3a37d966d02e6962
BLAKE2b-256 47ea66443c38e017e18a96aa9eeaab3c3fe585f373c8e289ea55f549b9a499b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.6-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.6-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 3a709f795eed144c8c57f256f57e7dea1377d24faa2f0418ebdae929b5b9c5b0
MD5 5abb30df7bea929ecc8e616a0eeba9e4
BLAKE2b-256 5c8ca595d3f5de55652d6be87ac25f710d67e3481d237885c22ae0761bcc594b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.6-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.6-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c119e13eee9bc19e1a2b30408369f8c3758484ad41ab38abde95005e308c8ed0
MD5 1703f291829bcfed27184bb420150dd1
BLAKE2b-256 7cc6bb0a0f0cea8d1901e623f73909bb3f654847693bf59cf5539238eb5f061e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.6-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.6-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8b057a441419d3757c247679fd23b7100869abd3c3ed062063383141bc719c8b
MD5 02c94fb265bda689af105faeffb8b6c5
BLAKE2b-256 808520088f5df171b1f5374ed72dc240481e380c45d05956dd9d49d37d1b7f2e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.6-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.6-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 c67a1fe8ec60c3e50eb8329caa6b32cd484398a1175ea288ceeff15aa1382d69
MD5 d1317ad6ab90c2defdd34b517c2a815d
BLAKE2b-256 e4af0b2f0c922181a0950bbb26db4d0bd8d1db315b6a7b5a3ee9d70e905c76af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.6-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.6-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6a0e7c2b7a61ef8c653c38b5d90e2937b5df9e74d031ab2fb5c67b4be6cdf205
MD5 1458916fdbe2784f4086d67d9b0218a4
BLAKE2b-256 e5bcb35e66572f697776bb2ad55859ca71ee305e285558f02b3474ac21bb766f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.6-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.6-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c6bfbf8fa7abc4058940310ac80081ba7a69547ad935ff52b2b1eb4d7c9085ae
MD5 94885f8db67dbf6a55d0f543e1f4941f
BLAKE2b-256 2795b00c2a238414fe3890f783fc5a49897f560dcafa977d00789a11cbccc1b4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.6-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.6-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 419a7968707b18674091acdf6af19687a8d732173b0f79d9a9a3998ec7474900
MD5 5df5055c7fc0ed7161f2a59f231d18df
BLAKE2b-256 97951c29ad8121f9e9cace0f520b862bddc70c106504de1e7c5caa2929900aa3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.6-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.6-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7dc13efedd90b042abc4552a6da428abd461b8baadb7dd254591e00105960d86
MD5 d921ef62a31d0f24664b3e5f136ca61d
BLAKE2b-256 924baab4ec43f178847824cdc475df85dc9fbf216374f42cfe426131a2ecb0a1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.6-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.6-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 33e0b939efac9af5e86b7041e1677b8678211fbc03ab17b06282eab966bf4672
MD5 f79626d8522fe354e8a18ede5506c381
BLAKE2b-256 c26873643fe4cbdcc6202eef67551249ae881f56fbfde690a74ebdeba0269a07

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.6-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.6-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 2f56e87eca23ff529280b36ab96acb4bc02beebcb8f83301d4fdec65bc196d1f
MD5 77978e58b72636763c61ba69861a29bc
BLAKE2b-256 3abc04edb4f6d5b0245810250a44a8dd7734c281d2b1e4089d850c9eb304c1fc

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