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.4.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.4-cp313-cp313-win_amd64.whl (7.0 MB view details)

Uploaded CPython 3.13Windows x86-64

perception-0.8.4-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.4-cp313-cp313-macosx_15_0_arm64.whl (7.0 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

perception-0.8.4-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.4-cp312-cp312-macosx_15_0_arm64.whl (7.0 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

perception-0.8.4-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.4-cp311-cp311-macosx_15_0_arm64.whl (7.0 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

perception-0.8.4-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.4-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.4.tar.gz.

File metadata

  • Download URL: perception-0.8.4.tar.gz
  • Upload date:
  • Size: 6.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.3 CPython/3.12.3 Linux/6.17.0-1008-azure

File hashes

Hashes for perception-0.8.4.tar.gz
Algorithm Hash digest
SHA256 81fb85820906e600177e4a952e19867d2bd319bacb617aadb415212927edcc85
MD5 682b7c8bca6edbf03c67f70c6c0767b3
BLAKE2b-256 600c44213cde0e716428f9d5129c57019ce523b28b258b70d143be58891e5f74

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.8.4-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.3 CPython/3.12.3 Linux/6.17.0-1008-azure

File hashes

Hashes for perception-0.8.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 dee4d7df901312548c587700d941088545183798ecb6b3f6dc9559d45e5a7d07
MD5 d68578b11db32e49d303de468ad17b7b
BLAKE2b-256 cddd44d5b6c37f0b226510f0314bab2be2570eb0ffff539bbbe7f1d68f1e61e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.8.4-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 5ad7a4138fd714e5b082b1f7e43a0017b4217195ecf3879b4e4cd26eff5ee02e
MD5 711d5bc47a087113fc261615e62627a6
BLAKE2b-256 2e3f80986eb8417c3a5f19d9113c55c5dcb87f725a41c8606103048e23410586

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.8.4-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 2d306699d5f382eff0f5db74b94b3df51dc28c46604e6df433c38d2a6fdde2f2
MD5 03191a0cf383ba540b5b612936fe0e08
BLAKE2b-256 18a85094132daab9b0a1355520a52d367bb86041a5c4ebd2f17a7aed860378c1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.8.4-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.3 CPython/3.12.3 Linux/6.17.0-1008-azure

File hashes

Hashes for perception-0.8.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 07c5bc9eba22f2ee2bf72868b098418cdf4926048d36f7a05a73d2dddd8c21c0
MD5 d08ec4b0410997b1ee507dff85b53e1f
BLAKE2b-256 fc45a276f887ffa1b196b63d4d4155d599b5af92807be6a3fff5012b44c458dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.8.4-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 7f873dc698f333e74f27550566d41986772172d39e1ab4bf08c8ac59e3a5366e
MD5 d95ef3b64ab1ead9d2f2974f096f607a
BLAKE2b-256 63e11580d509645bfd86e48b52853a2b4174d8f1693a50d4acd4582ddddfc609

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.8.4-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 f4cf232fe25bba84c1304c8a9917e34349523a51526a1019ba120f0d3d4e8045
MD5 282f8907fc895a1fd063ac64100cf97f
BLAKE2b-256 5947fbd4b1a7fc02b968f9b712ea7f3ec03029e3cf785cb8c3764926ca46752e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.8.4-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.3 CPython/3.12.3 Linux/6.17.0-1008-azure

File hashes

Hashes for perception-0.8.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a0ed9ab7cee63996600b463ef5db2226be235609cef4a72df74f9a42921d31c1
MD5 881375bca6edae06618b51807b81aa85
BLAKE2b-256 b24c235e09cb35d43eea5780e3e7c7782f66d8e7c7824c38767b2737050319a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.8.4-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 3a35e1cfe65dd84171152bc4f8d53b6bad23a2b6c54fadcc4914eb55c025ded3
MD5 892b0a0ca3d184f4943bc1c0952776b8
BLAKE2b-256 78dd893ad173b04df4d4fa7396f62490e262d243a786d05331a486ce916e83b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.8.4-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 113f1868b0e866125db009a21001e44f4b7dc1d9b76b1443e88e6673a09d19e5
MD5 2f10951c5685481bc966e7b4aed7f3cc
BLAKE2b-256 95b5a3a7a90f76ff9456dc2761c3c3d6945e020646667c89eef9bb133ccdf524

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.8.4-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.3 CPython/3.12.3 Linux/6.17.0-1008-azure

File hashes

Hashes for perception-0.8.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 18951f8ab4d3c4cc04a95d62d717efca4544753b2159f07bcd8fbea5a0e9c87b
MD5 81dfc37c8c19941a60fbdbd03ac09be9
BLAKE2b-256 49d642977ac2bb93f5800ef13394d6b6dd9bc774dac6f2da93d7ccc6ea68a7dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.8.4-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 ec5acbaeaf0078dcf4dc33eb0312ab88c99524f9bbded4cd372ad69ce9545190
MD5 54568ed31326a27c49d2aad1c5f5fa1c
BLAKE2b-256 8cbbac87c13f6362ddf7792e7ea04bd608844af3e0f0796e2b5fc43e6d85afd3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.8.4-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 c42681f1512a31265126c1adccba49ee0de238d91fdab5c7cb8b3f9715ecd8f1
MD5 e2a39c1a2593e6a8fdd0905db5fc824b
BLAKE2b-256 4aef10e4c619f46cbe9e6bd5de1272d19d3b79f801f9f541906f0ac43c983d5c

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