Perception provides flexible, well-documented, and comprehensively tested tooling for perceptual hashing research, development, and production use.
Project description
perception
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file perception-0.7.6.tar.gz
.
File metadata
- Download URL: perception-0.7.6.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee6ad1e8463249447ad76bd4e5601ae023e3dcbda2377963af75f87a0fc59aaf |
|
MD5 | 4db27150b8831ea8e72777582180494e |
|
BLAKE2b-256 | bc2f7bca38a8579c69f85ff9ef4922ec9ee58580bd56acf12bc202a54df4f4bb |
File details
Details for the file perception-0.7.6-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: perception-0.7.6-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95c5d2c17f9dec3a0aaf187f18667046da686e41b150ccfd5c1cfb5e50d16b82 |
|
MD5 | 3dd7ef2a6e73666686f2894ea4708a22 |
|
BLAKE2b-256 | ebeb4e21d81fd3986d5baf70236ede88ff06ed932ab647fda90b30b6ecb75452 |
File details
Details for the file perception-0.7.6-cp312-cp312-manylinux_2_35_x86_64.whl
.
File metadata
- Download URL: perception-0.7.6-cp312-cp312-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 6.0 MB
- Tags: CPython 3.12, manylinux: glibc 2.35+ 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79642c03596e5d8c3f5d28da17d43c4ccb798d1e3f5a3d71994e4c214c1955fe |
|
MD5 | fef3d3af3ee408a884731cd8363cfb4b |
|
BLAKE2b-256 | 04d6afa0ebab45b831b7146f0254a2bc5aa9266015e43180a8ef504d6a3b5ee7 |
File details
Details for the file perception-0.7.6-cp312-cp312-macosx_14_0_arm64.whl
.
File metadata
- Download URL: perception-0.7.6-cp312-cp312-macosx_14_0_arm64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.12, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a770a84f3e41267040d8edc23832a7e1af9d65090a04c3a0fd55b6066a773af |
|
MD5 | fae01818fc0fa5630745b1583b094df9 |
|
BLAKE2b-256 | d872a8b6acfccba3b13fa3c1a355e091a0c77c1404e02568e4baa7dcb1fd59e5 |
File details
Details for the file perception-0.7.6-cp312-cp312-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: perception-0.7.6-cp312-cp312-macosx_13_0_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.12, macOS 13.0+ 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9519e62889103dcb2bb968c23cd5bc0db9312f8f56787780144ab72404622c5 |
|
MD5 | 10878f28f166dd0489508c77679e55c0 |
|
BLAKE2b-256 | a4a0fb7a6e98607985a39c77bae7979fe59df51fd2f3ef8a04204eec91faae59 |
File details
Details for the file perception-0.7.6-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: perception-0.7.6-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 005c135d31b9d315bdf95bfdfeeb6c12a8b5390c5c439afd6883b64629162568 |
|
MD5 | a3e594b1f353c731d4623738c598d3dd |
|
BLAKE2b-256 | 0ad434bf99350c8708588a860186b90f33d5e05e72d9c2c40424623267575c5f |
File details
Details for the file perception-0.7.6-cp311-cp311-manylinux_2_35_x86_64.whl
.
File metadata
- Download URL: perception-0.7.6-cp311-cp311-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 6.0 MB
- Tags: CPython 3.11, manylinux: glibc 2.35+ 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0deb1efed5517f83f3b949bc5d5a02d3ddab72c92376d22fe0fb99e0fb11562d |
|
MD5 | 21c6883934bc4debb0b0922a916a2012 |
|
BLAKE2b-256 | 20469704b63afec0c56185cebb61affe08fba530d0fa9a0acab3b1cead3e64ce |
File details
Details for the file perception-0.7.6-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: perception-0.7.6-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffaa9fbe2328896e34dcfbf8bd8c138e23d38173604de5587c19ac4ea44e4e6e |
|
MD5 | 10f3668f9bf3e9d5914534505f9506b4 |
|
BLAKE2b-256 | 0196c69c144cafdee0535bc25468b0e9b46ee76ea09f1f75b22aaa0c430c62b6 |
File details
Details for the file perception-0.7.6-cp310-cp310-manylinux_2_35_x86_64.whl
.
File metadata
- Download URL: perception-0.7.6-cp310-cp310-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 5.9 MB
- Tags: CPython 3.10, manylinux: glibc 2.35+ 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a3eabe15ce6c8f8b1a6e321a4bfd74547cf4eac57e40c254be9508f66e9631d |
|
MD5 | 2ac51fe3357c10424643e2e1b9b06914 |
|
BLAKE2b-256 | ec04baf129a368d174870c44d3697013b0318c292485efd3214f261492cc4f14 |