A package for image hashing
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 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
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
Hashes for perception-0.5.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6af546fde3a180ce5d2fbbc717de156889f29427612b4de8b4a4477f0e9fd1e0 |
|
MD5 | 017bb096e50129ce87a60335f6528198 |
|
BLAKE2b-256 | cde549c920280c262d7e34d3f3f2b7d65230ac73c6d20a1cd7e9d78ea00f08c3 |
Hashes for perception-0.5.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47857d58e43b01c2924ed5e74561e2662c969172bb51639e3ffd07b883a78b9b |
|
MD5 | f16ebe5a8116576d054b0768545b65db |
|
BLAKE2b-256 | f7dc4bf2be3750dad85efcdbca31c4f58f5a958cc315c7332939d30aff13c571 |
Hashes for perception-0.5.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43ac7750c7568e2c076993fb907995c84011174a583ddf3f3d560f708f8d2b23 |
|
MD5 | a0c0e1eec1c89cbd5609fd45f45d8f01 |
|
BLAKE2b-256 | f61d4ad08c2b9a48804390f9e58bcc925c7dec01ba8c8e709fd36040bc51b0db |
Hashes for perception-0.5.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c520e7ee160e945e6cdc8884c423be80bd42ec3ccdd5c6fdc6bc56c6738c68be |
|
MD5 | 0a8351f36fce3707ace6729374ac3e58 |
|
BLAKE2b-256 | 4e35281c14789740976a9b04f5ce2fae34c351c259b8c8077e6d07142a8845ad |
Hashes for perception-0.5.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 920138de27830a632f166d1f23e0ea14d65ff24d3f595416fa1a81fd570bbe24 |
|
MD5 | 12b80e4be77198004c56b02b1fac297e |
|
BLAKE2b-256 | 2619a72b3a32c2444508f09c010e98281d6bd7c0374df0804fd45135f908851d |
Hashes for perception-0.5.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 181f88d11a7991286142cca19c2d63281cdb52bfd2de33df1daa0a2a3d45ac50 |
|
MD5 | 5622ec7f92f1e2d2b38608131d6f4e19 |
|
BLAKE2b-256 | 9c39122502e00db01a9b3673b6832426dfb013a1e9d7d6dd9b9693f73b55d321 |
Hashes for perception-0.5.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f71b03617382143662a3aa7ee18cb1eb262e2f109172a70a021e34566b46fd4f |
|
MD5 | 88ede58bfa37d22de16828ac71462e63 |
|
BLAKE2b-256 | b722fb4d5a6cd96a15ca832f11cbac1cbbf1a99651f58ef7b413bc128eb91722 |
Hashes for perception-0.5.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 023e756714bcb781b41025b18a51b7bc082be4fbfac7cc11f13f58230bba4f47 |
|
MD5 | 24166517b9809d4ae497462ceb7ae2f4 |
|
BLAKE2b-256 | 4159af392b269722ae3d18d113b3a22f739e4797620d22613cbf6eafe79da554 |
Hashes for perception-0.5.2-cp35-cp35m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 177a8c04d817c43061290edbe2b71154a3763cac4fb54d4aaca131db08588243 |
|
MD5 | 18eb8a41ed0fd0ee2a04ae90c45f58f4 |
|
BLAKE2b-256 | f992b8b84c72fc535d0ab6483699aa5ab3e1de74d063b6fc3da2d52350eb3782 |