Skip to main content

Perception provides flexible, well-documented, and comprehensively tested tooling for perceptual hashing research, development, and production use.

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 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

- To do a (close to) comprehensive check before committing code, you can use `make precommit`.

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.

- [dedupe](https://github.com/dedupeio/dedupe)
- [imagededup](https://idealo.github.io/imagededup/)
- [ImageHash](https://github.com/JohannesBuchner/imagehash)
- [PhotoHash](https://github.com/bunchesofdonald/photohash)

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

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

perception-0.8.3-cp313-cp313-win_amd64.whl (7.0 MB view details)

Uploaded CPython 3.13Windows x86-64

perception-0.8.3-cp313-cp313-manylinux_2_39_x86_64.whl (10.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

perception-0.8.3-cp313-cp313-macosx_15_0_arm64.whl (7.0 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

perception-0.8.3-cp312-cp312-win_amd64.whl (7.0 MB view details)

Uploaded CPython 3.12Windows x86-64

perception-0.8.3-cp312-cp312-manylinux_2_39_x86_64.whl (10.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

perception-0.8.3-cp312-cp312-macosx_15_0_arm64.whl (7.0 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

perception-0.8.3-cp311-cp311-win_amd64.whl (7.0 MB view details)

Uploaded CPython 3.11Windows x86-64

perception-0.8.3-cp311-cp311-manylinux_2_39_x86_64.whl (10.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

perception-0.8.3-cp311-cp311-macosx_15_0_arm64.whl (7.0 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

perception-0.8.3-cp310-cp310-win_amd64.whl (7.0 MB view details)

Uploaded CPython 3.10Windows x86-64

perception-0.8.3-cp310-cp310-manylinux_2_39_x86_64.whl (10.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

perception-0.8.3-cp310-cp310-macosx_15_0_arm64.whl (7.0 MB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

File details

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

File metadata

  • Download URL: perception-0.8.3.tar.gz
  • Upload date:
  • Size: 6.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.3 Linux/6.14.0-1017-azure

File hashes

Hashes for perception-0.8.3.tar.gz
Algorithm Hash digest
SHA256 638b40e6b82eda4ff510c4792f2093163364e91c78a7b3c6dc2588ea73177057
MD5 0a67f588d332372227babdf7b96569a9
BLAKE2b-256 c02b48355ef3964cd82cd1c98bafa7022731e559da5488850fa068cfbe87e99b

See more details on using hashes here.

File details

Details for the file perception-0.8.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: perception-0.8.3-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 7.0 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.3 Linux/6.14.0-1017-azure

File hashes

Hashes for perception-0.8.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 50d605b67391632c536429710050612d38398b5b3b203540205a51d1af3ebba3
MD5 b9e3497f8309a62e6d02d3aac42ddd41
BLAKE2b-256 5e23d7813b23f1cc00edffefada4f146dbf9761eddd8764b214950386c835d93

See more details on using hashes here.

File details

Details for the file perception-0.8.3-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.8.3-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 027ea9113cef74ebe274287386da12142a10bb76d84bebb0edb25cecdaa58856
MD5 0f1ee3526538aeea3d6528cffff10ea2
BLAKE2b-256 918c9033860a49f71ce166bd821db89c45b3c5bfcee661d0f4b942b6c7c17b93

See more details on using hashes here.

File details

Details for the file perception-0.8.3-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for perception-0.8.3-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 94adaff517609cb8596d020370decda494f11f4bc137bfafc48615e45799265f
MD5 8e0f65c1b2b8b3120c5bec65a3a2833a
BLAKE2b-256 8a358e6969753c36eac6d44daa198f01777cab22d45dd6981fbac03409f04a65

See more details on using hashes here.

File details

Details for the file perception-0.8.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: perception-0.8.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 7.0 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.3 Linux/6.14.0-1017-azure

File hashes

Hashes for perception-0.8.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e748fa343616dd5ac086f1cffbd7762024502bf8e11f10410f24c785e97ba394
MD5 e8b349965d91e4cf42dc7cf86f9653d2
BLAKE2b-256 ee762859f5690e65f0224252c1f5af13f66478372026fd98112cdaa41a8625d3

See more details on using hashes here.

File details

Details for the file perception-0.8.3-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.8.3-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 8e96da6f7ea8e67eeb9a13dc6b9e88e688762c2f418988afb470312ad9a56947
MD5 7890566e62b8ac4ff3ed64681addae41
BLAKE2b-256 5900f366e721c357e41f66ae638117662487191d88a33772c612f546c34d6461

See more details on using hashes here.

File details

Details for the file perception-0.8.3-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for perception-0.8.3-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 6ca5c8c81e298e0df3b54ba3dc00cda03872f3ac23722f1ade147dc57c91c9d9
MD5 2e09f230afc7dce587eba0eba40b5d38
BLAKE2b-256 cf99be19400e05eb69a5570d97f40432117e1f82263f9ae51ca807934a0fb946

See more details on using hashes here.

File details

Details for the file perception-0.8.3-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: perception-0.8.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 7.0 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.3 Linux/6.14.0-1017-azure

File hashes

Hashes for perception-0.8.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4a58304774fc1a1bbe23c7ee58246d3e66e3ed961bd6020e28573633cec235ad
MD5 07ef85d2b42220f58b5c1c1bd4cb1707
BLAKE2b-256 d6299a6c1686bc072e4fe5aa6163711961b9220eda050561ab5896a6a863fc4e

See more details on using hashes here.

File details

Details for the file perception-0.8.3-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.8.3-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 28fa15ab1741127c244ffdd1248be12afff7ebdec8c34099123f727ddc2119de
MD5 ed3ddfc43f7c43e6a1d6ac3c461856e2
BLAKE2b-256 763ec5c1ebb96393d96236fbce2990e1a75abf5bff94f55df55e9df665bbbc62

See more details on using hashes here.

File details

Details for the file perception-0.8.3-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for perception-0.8.3-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 1ac92770cde19251a48f93a7e7654fa98240fe935349d115f1ef0eb428882cab
MD5 6f48ac59db8f48f24165dad454061422
BLAKE2b-256 b306a11ae21d1537a5c8ba4fe75a7e3682645c55ea2ecd60c70a04355e8f0d0f

See more details on using hashes here.

File details

Details for the file perception-0.8.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: perception-0.8.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 7.0 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.3 Linux/6.14.0-1017-azure

File hashes

Hashes for perception-0.8.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4836b4a9866dc8403ba25d4e8e6df579ddf30a3545c190f199d0c44eb0a5d70e
MD5 3bab4997de09e32fa8db283a5d8181ef
BLAKE2b-256 5ec0092698bb6e48580376285f63889992be460a7f259aafc69ad9f2a3310572

See more details on using hashes here.

File details

Details for the file perception-0.8.3-cp310-cp310-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.8.3-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 41dc8fdac94bfc8c62fc6ae313e8232ca08a12306524dd588541b4966a681106
MD5 9fa90b20967fc80202176379b45767d2
BLAKE2b-256 8149436c277b839f58af8addb5ea8676457119ed9489db50eaeaa8a5f99cd80d

See more details on using hashes here.

File details

Details for the file perception-0.8.3-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for perception-0.8.3-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 d83d2698ce9d38858d2f08a5f3528d1e56d382cbc5597cda6b3c3037858c76c6
MD5 ff197b6a0a82e0923180144f838b3e00
BLAKE2b-256 cf55070636c4d34f1a456027289796a049042252761354b6ca02a4e74cfbb6c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page