Skip to main content

A package for image hashing

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 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
  • Running make init will update this repository's dependencies and preserve the results in Pipfile.lock. We strongly recommend including changes to the lock alongside any other changes that may have been made.
  • 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


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

Uploaded Source

Built Distributions

perception-0.6.5-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

perception-0.6.5-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.5 MB view details)

Uploaded PyPy manylinux: glibc 2.12+ x86-64

perception-0.6.5-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.5 MB view details)

Uploaded PyPy manylinux: glibc 2.12+ x86-64

perception-0.6.5-cp310-cp310-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.10 Windows x86-64

perception-0.6.5-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.12+ x86-64

perception-0.6.5-cp39-cp39-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.9 Windows x86-64

perception-0.6.5-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

perception-0.6.5-cp38-cp38-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.8 Windows x86-64

perception-0.6.5-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

perception-0.6.5-cp37-cp37m-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.7m Windows x86-64

perception-0.6.5-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

perception-0.6.5-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

File details

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

File metadata

  • Download URL: perception-0.6.5.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.13

File hashes

Hashes for perception-0.6.5.tar.gz
Algorithm Hash digest
SHA256 fcb7ccc1fb951230ba01cf36ce4f1796ec0c1474daa986d2725ead2568ee5e5e
MD5 95ed321ff72e3b04b386d56d44501208
BLAKE2b-256 e2a9d6477912698301daebebb24c8c99fa7a08a29d11d7ee2be87538e8754aea

See more details on using hashes here.

File details

Details for the file perception-0.6.5-py3-none-any.whl.

File metadata

  • Download URL: perception-0.6.5-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.13

File hashes

Hashes for perception-0.6.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1d72a7b568f96a867b59a0dab8f03e1a0a0732e2b92774335fef18973f469df2
MD5 4e21876bf3b23f050e11befd4108d59e
BLAKE2b-256 adc690e34589e22f5ef7080d1478c38da88539d3517e075f47af3add29504d68

See more details on using hashes here.

File details

Details for the file perception-0.6.5-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.5-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6ef3b9bf6e8176f782402f5cb1bd7a7bb5b588f08d35f4f797552da7ab3a95c5
MD5 b38e601b57ebd38a962182d9d3bf4ec4
BLAKE2b-256 c91352b6a9e7aa1bf33ed767be15e2a1be736b5bd2b387431a058eea23127e53

See more details on using hashes here.

File details

Details for the file perception-0.6.5-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.5-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 0d67f73a7f5d882010b4ae1f659bdfb273ac5ec8a8acf624182df62b091ba34e
MD5 a25ecc020233c83c9c78be6c7a2dc8ea
BLAKE2b-256 aa9909b58a4554f2b298fbe55709eca3e6364d013ca77c22339b0feb9d512345

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c68b6fa42cdc87bb49e98d86ff390bdd1919e31cdcfb50b5e556be1cb1fd4da3
MD5 2d566e4f37d735f2af20c5830174bef8
BLAKE2b-256 9d34ca924c52e5bdb27f51b293ba1ef961949b3951629dd3efbcc104b68cf7c0

See more details on using hashes here.

File details

Details for the file perception-0.6.5-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.5-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 730b4250bdb377d072a6bae728be663d6689a1672a3f28a5976f6163389dbc3b
MD5 866fd0b5fc4e51027f234f38c6b391df
BLAKE2b-256 8ad006800dd6f49202ef474901ec3caa69a6489b5c140e14020818410bf062db

See more details on using hashes here.

File details

Details for the file perception-0.6.5-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for perception-0.6.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 46c2cb7aa4b42bd0a56cfafaaa7524a498246d09b058a8b1414f69fde6c588b2
MD5 795e07c9cba3c5eb82e7d198b961d88c
BLAKE2b-256 5d7cd02182ec3a1177a3a24d96d273bd34bc8b57678d8cfc95a8afad8cf6f711

See more details on using hashes here.

File details

Details for the file perception-0.6.5-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.5-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 b382c30c079c89b5bcbf5b7e6f821b29cea48de2332cfbd8386880db513c9668
MD5 c0b9f04a47c69f4b04b9c6acb55b4b7a
BLAKE2b-256 710881ff963f89abb26bdd8e45cdbc7a458a5b9156c0e7fa02ec1464595f6e50

See more details on using hashes here.

File details

Details for the file perception-0.6.5-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for perception-0.6.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 60d3e900dd77fdff2ba9f962c8f03a1ac47913ff1e9cb04108b98e0a06e09248
MD5 43929877c021ca6cf633871f73c22e30
BLAKE2b-256 6eecb67a7f50df0f4d5e8c4bc6bf952a8ed3b618c6563e506e6242fbb26cce66

See more details on using hashes here.

File details

Details for the file perception-0.6.5-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.5-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6c0a856689dc4a993a7e7919dc19525fa789633bc8f8a84d2f783b727d134894
MD5 4c11b4b44e1a99026df537a4b7fc8956
BLAKE2b-256 5693d2110d781211aa1ed680b753350c7c8d4e149557dc9eebe61109c04c6f57

See more details on using hashes here.

File details

Details for the file perception-0.6.5-cp37-cp37m-win_amd64.whl.

File metadata

File hashes

Hashes for perception-0.6.5-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 decc61e562ee083ff6082e98c2de7130a172af9f5b2972dee507de5841c44ecc
MD5 1f97512148f0db560a9883d3ab5821ec
BLAKE2b-256 4decfde9b6dec19eb918d0c73e3c5411bf3c626f3493580ecbca1ca5692564a2

See more details on using hashes here.

File details

Details for the file perception-0.6.5-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.5-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f379bbe2a0dd47f74a13063deb9a67588d7e51d5c0e1e64ff74f8a3186754065
MD5 0cb29b5e974a832b76fd39017483545b
BLAKE2b-256 054d39de6fde9ba27f8f8ddda11d7ab0bda5708c86691ef88f80293eb348739f

See more details on using hashes here.

File details

Details for the file perception-0.6.5-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.5-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 a549740995e38a258e140e7fd3a61931d410dbc8e3548401bc08620b248e4264
MD5 cbef078a93dbf4a07069692868671c6c
BLAKE2b-256 8e27da105648e6c3121aabbcca990071c5dfa1c8b243b5297128ab01f7acd545

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