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

Uploaded Source

Built Distributions

perception-0.7.7-cp312-cp312-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.12 Windows x86-64

perception-0.7.7-cp312-cp312-manylinux_2_35_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.35+ x86-64

perception-0.7.7-cp312-cp312-macosx_14_0_arm64.whl (2.8 MB view details)

Uploaded CPython 3.12 macOS 14.0+ ARM64

perception-0.7.7-cp312-cp312-macosx_13_0_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.12 macOS 13.0+ x86-64

perception-0.7.7-cp311-cp311-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.11 Windows x86-64

perception-0.7.7-cp311-cp311-manylinux_2_35_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.35+ x86-64

perception-0.7.7-cp310-cp310-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.10 Windows x86-64

perception-0.7.7-cp310-cp310-manylinux_2_35_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.35+ x86-64

File details

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

File metadata

  • Download URL: perception-0.7.7.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for perception-0.7.7.tar.gz
Algorithm Hash digest
SHA256 6378707cb642f6f524411314c97b3550d1b9e834242f3121f93b911c1352f115
MD5 b9bef90f8d3b9814cdd731bdbc5ca522
BLAKE2b-256 9515d259c6087fe98998e07b4f5704dfb7b64c5efd8f87ab31c5a6b5b7508013

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.7.7-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for perception-0.7.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a268ef795598a34256a022534c3dd7f8bdd6db3b5586bfc990614141db80aeb9
MD5 5a233faa3818080ed7244cb3e42c172c
BLAKE2b-256 82e92500ae8917652f5ebfbc56f9946076c244efd43ce2e9db6e1fa087833b22

See more details on using hashes here.

File details

Details for the file perception-0.7.7-cp312-cp312-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.7.7-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 b14f387f6e492cdd6f17299594901014a8ed4f8f91ca1914aeaf4f18b80bb71a
MD5 1f2bf076ad285ac8846a4bc24659c292
BLAKE2b-256 62708650e9bac1110bc4e11c7c11a88696e08dec7fbb7565769711889b422327

See more details on using hashes here.

File details

Details for the file perception-0.7.7-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for perception-0.7.7-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 2cd61aa1bfb724b1f9738e5af7ea9c7f0e0a42d3a81ac96c1756fbf96b1755e5
MD5 2df3100bbf5b0305b33fd0a102ef2920
BLAKE2b-256 30af71d43f4c229b7166e02c49bce086546756fbac65289c41f5c0307f715333

See more details on using hashes here.

File details

Details for the file perception-0.7.7-cp312-cp312-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.7.7-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 e74fcf7aafd510403e477b667b568b2667e4530efa18df024f90d6af5bf507a2
MD5 2d7298dc34a188c389bdd7e80124aef7
BLAKE2b-256 cf590d7cda93463b3dfdc8c228617e417004837ddc5e233965107cf0ada3d5ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.7.7-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for perception-0.7.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 857d7ed6f9a2774856789fad2c0c21d39cd3208106d4e8efbf4735eb0b12dd40
MD5 5e50d1cafd5423947424c1372c0c3f49
BLAKE2b-256 510b818475c2ed50a77705fc8b34f13e0d6b880d524dd191f87b2af4073da37f

See more details on using hashes here.

File details

Details for the file perception-0.7.7-cp311-cp311-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.7.7-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 84a9d7a859afa4c5d61e6df10e6736085b803fcd43adf416e04ef8632a9b405d
MD5 99e84e2c356d7c0c8707d62c8e009a2a
BLAKE2b-256 6e8410e4e6d3be547235d12e9978e8c05c57f399b087a79f8f87de03c98d8a73

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.7.7-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for perception-0.7.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5d6a4c82cb3ce920280cfa6858ca03121dfa8f16a364f0cb18e5c2654332b5f9
MD5 855c13039b1cc79b788b7f11619c9f37
BLAKE2b-256 984b859a5fe902145ef6a6732f783aee99294f6f176e8ec3247bfe1be913cd93

See more details on using hashes here.

File details

Details for the file perception-0.7.7-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.7.7-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 34fe69b6724b5c1e2d9ee9c35249d0487b3d6a987040af08c071c63062a0a7d4
MD5 20da6251ed36f47c46d2959cc613be88
BLAKE2b-256 dffb7ce5d18644c8e9742228045a1fb804e5519088d375a8358845685b994b81

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