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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.4.0.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.0.tar.gz
Algorithm Hash digest
SHA256 c67c0d8efea401335736049f293e975a5d1a44d70a4a245458a8f284a3c79385
MD5 0bdd3ea690f2bcd84db97c743469d444
BLAKE2b-256 88d514828d6c171b99a3f218f2892526454075eb550df75dc4a52f577b3ac9d8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.0-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.0-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b0e95b9dcf29b0c12b8030ab0246711d4b7267e2770efe0aed3d1296d921da62
MD5 317e353ab2c458e24b712f5a13a81bfd
BLAKE2b-256 e4a7de5eeb47a311528c6491aaad1964a37a9e104f68fd71e0967ccd45297916

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.0-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.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ae6432688704dd400bba84e89cf104ebf9f514c6bad8b4acac874ffa487be695
MD5 541796a4a60a1be7786c29bd423c6e96
BLAKE2b-256 4c0ee1f39db781238582331c0f0accab7df83bf5ef40066e13f052944fcf10d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.0-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.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 658f0e428aac0f2d460dbde072f78caa4aaa3b5e9a683e529b3f4b339cc43287
MD5 22351dc17d97b366e865e30163d60637
BLAKE2b-256 6489e36a1ffd26d75de73ec8d35f0d253e48124114d90bb354afb6b82311024c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.0-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.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 67464ad7b470caf0258169691adbc73e713d618685e51e15c0411d4e274b0d5d
MD5 f3e51ba81155af255d4de577fa67631a
BLAKE2b-256 9bef6f1abdb7de6f6a20732b0fcec2c3f622c9864a3eaa413d4c89921fb5cdbf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.0-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.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 a032a01ac60170106712a4ba63c207e83c329b8e0c0d3df9a624b96bcf8b0947
MD5 233ed6e72c45e679bf2008f80ef469c7
BLAKE2b-256 20300990927e3e87d0570dad07f5656b2894d456cef3dd23189f582a3572f511

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.0-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.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e3bcc55873f317a609118e2013cd939e0d7f3ec372027c14c88d49a1b0591985
MD5 1d0d1d2e11c81ace4e145d5ab845353a
BLAKE2b-256 4f8eca8ce1e295b7c1b545b6329f0ea7825ea79315cc24d649fc494022006cb6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.0-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.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6d6b552351e5992c31ad658f541b78ea3b303b9bb8bdb72dac0ddbf68ddcd1e5
MD5 ba929d431845b7dc6fe26c6824483a18
BLAKE2b-256 d1cf0310dcfe68eeed642a47b778b360cfe17362c8628e8e31e21255defb7538

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.0-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.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 5175f593918649ed29609afef07476370014f944d45a5622f762f75d7bbf1dcf
MD5 06c56db8b1099c544c61c7a6111cef6d
BLAKE2b-256 5b49e75d9e3726813fe33c93c3e9e95c093376a461359edfccbcbb843028de4d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.8 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.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 113792fd9c70953cedf661a73005f70a092aebfe4f5ed94fc228be6fc916518d
MD5 bce0fa1f30898555d95e846e543862f3
BLAKE2b-256 7d81856ca6fce1744909b9ce10e2d4b88dc9828fe8967264a63d7b3c5d6fe7c6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.0-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.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7f2adb30fd31b1a2b72965eb25c024bbe9817624ddf148e650d136626d1f7362
MD5 6b7240962258bf2d825dbf99619f1148
BLAKE2b-256 6dc5ca120758b2aa0039016acedea3fe88d5da3aefeea32911a2167aee2b0789

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.0-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.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 89f439ee36a47eb1e5f161434568f4483193c5ed2f938eddd9c2ae57a897a424
MD5 09fa089d2667676676939d54aeed0c15
BLAKE2b-256 0ac20b1af0ce30c71010869aaf9f47b3c10d2c69c2a6be97d31716bfb879f454

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