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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.3.10.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.10.tar.gz
Algorithm Hash digest
SHA256 3955a2fdb0d9d4d3ddaf3ecb0f7c076cba96f63a9461b3111e4dfa8612239e47
MD5 209736ae547dda87310cd6458940bc83
BLAKE2b-256 794f252ad9ab2a3fa06189cacdd9496fa6d1cab9acbcc8c8c638d2d4f170df89

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.10-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.10-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 cf2ddfd5cc516bfeaa1697bf6dffcabbca43d348670f1b00feb71bd6f894976d
MD5 ac106137a7d47031f18551ee8e352478
BLAKE2b-256 6afa0f8e013a5dcf19bcb318233548fb74f98d9a2cfacdf8cbb9fa1296aeaed0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.10-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.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.10-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 aec594bd06b2b60833f7c68f051b200e2f11917c1b05c79361d867c44733a5f6
MD5 2f6b27a2e070fb297be260ec3a809ca4
BLAKE2b-256 b3478e563a5c8330912e08354e5dda21dc992f89b894603739ad3cfbe831bd68

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.10-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.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.10-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7146c9fef72a5a9e627b3e3c1d23d4b82c23f39ac74200fbbbffda826d63bdef
MD5 f84037114fd0347313663bdcb886ed13
BLAKE2b-256 4d89db1a5a4e1c894714f1088e16232976cabb5b92adb79557e7d3ac2c0db339

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.10-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.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.10-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1d92c1a75d04cd3b06a3c4fbdd0ee94e6a257535ceed997de8413237ed6b41d2
MD5 7abe4ef03420a02c1f55df2f03f95248
BLAKE2b-256 c7cd1c5472102e7acf4f0744b12c4202b339fa8edffd3728a2228e3226532190

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.10-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.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.10-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 accd482747625c13c91f0dfc41f77a8a7c4d1cf7fb607e9f82b4a20f10efabe1
MD5 bd45366773efdd5385a70f48b3d89a6e
BLAKE2b-256 14df7f7db76b87c62bb3087d40b5d55e4b2a31733eaff419638a00a909011a8f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.10-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.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.10-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d0c2cbd16b984699c1a35ec3696ad696b181fb34378e3b93e5b188b4802cc8d0
MD5 c1964ce8763c778d24389f7363e0e6b9
BLAKE2b-256 3c397392fb63625d2ea29bc6492d07d98dd87be91f65e744425fbf2a08957695

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.10-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.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.10-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 699f6c6001a3750749c4bb4571b52f003673118be09a6635e088b41fdbb3241f
MD5 3a61e4931cb607938fceebdd4257638b
BLAKE2b-256 05f29da4c1f4b75f48f233f419022bc45ec18571cfb81196a58fa04ceadecdaa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.10-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.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.10-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 1e418024e0c70d92c7161f25de4c5c3457e729f5d6760d333203aecb837f181c
MD5 76fd9e1cb571724321bead68300765f9
BLAKE2b-256 e5f14ffa06e61c84f78b1ccc923cfede8386cebe28396c0d0aabb49bc96f4bd1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.10-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.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.10-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c4bec6ded9f15830098035cf578254e12375241cfbe4fc3a91f5332ba54cc257
MD5 732ce3cdbb868341901fda753790dd01
BLAKE2b-256 9ff249fd7c3078e6c49c0b33b30f0cf630d17caa05aaad946404329b518374be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.10-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.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.10-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 53ace2f2ea9605987ce90942d29bb4c4a29360d3990f10fb9155c311dd619e49
MD5 314fd39921d5cded162515f012527010
BLAKE2b-256 461b13c93649f9bf06c7da907ce67ac3f8c691e1f34c43c2c694a9bbbd9520d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.10-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.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.10-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b478ce7952fdecac2dcc8a917efe52c45fb97bf7107c8f445496573e61556d19
MD5 d7317dd17383a77b3c0ddf9c6d42e58f
BLAKE2b-256 6cab89e1caec061803fe63d9620cd97821669c3e622cf1409698a95eb4bae089

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