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

Uploaded Source

Built Distributions

perception-0.6.8-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.8-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.8-cp310-cp310-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.10 Windows x86-64

perception-0.6.8-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.8-cp310-cp310-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

perception-0.6.8-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.8-cp39-cp39-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

perception-0.6.8-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.8-cp38-cp38-macosx_10_9_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

perception-0.6.8-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.8-cp37-cp37m-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

perception-0.6.8-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.8.tar.gz.

File metadata

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

File hashes

Hashes for perception-0.6.8.tar.gz
Algorithm Hash digest
SHA256 0fa263ca6b228a4c031d3242f48c63c156d88a3f727e1be24a9ef51f0c858e37
MD5 e1c5577120863f5477769c35080dd882
BLAKE2b-256 1629c47796e09da48195875c2d0e1f8662a72aa114c074a555e3b9b4ff2485c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.8-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 eda432767abbb97e3959e9cbe1be8b734a7dba34a764c20b29dcc71f7a287063
MD5 e9dc315a4ad0a0bc16473fc545d53b5a
BLAKE2b-256 be3a925f94634f196268429cfcb9ac8aa1a505f65ce680e0d2c6b01cbe33a08c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.8-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 b5c0b2701306587b1eba2cb2fade5c63b5ec90551649f152f5e5a5d8c28cb98b
MD5 f0a24048085b5ce142fc575f2d9eeeed
BLAKE2b-256 f2b1db7b134c9506c7ef534693a80b21149e831b9b0c096121e4054833145caf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.8-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e0bfd07278fcc9c6ca34acc410bf5db3c0979dabaa7ad33bcf3a8e12f5ef6875
MD5 58981f92378bf871661c2c6a5f5caeb8
BLAKE2b-256 de81a6bebb21cba59c07546693c6cf55689c15e4ade680512bce675a02acb310

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.8-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d6c19784ee734d038a9bbaca5b5e97f7c7f05ba1b81883ff94ccb71d6cafda34
MD5 c9370adcec34ec9fc070dad5d8aad0e4
BLAKE2b-256 8e483a4ddeccc01ecb697f9f1a73dcc7fc6db94842bc33688ea9a8f612cc64bf

See more details on using hashes here.

File details

Details for the file perception-0.6.8-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.8-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 81efaf193232aededd18ab98bfa768e1b40474245839db5e9edd2f93e37fef58
MD5 f43254f3d2eb78011ca9e91904546c06
BLAKE2b-256 d91048acb75404d2d6aaee7c45ba0b6c73084bf15de589ff902bf6016945c26e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.8-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c07bc00d88bf32625d7fe8890a20d6d9feb8ce295c40402a7c818954130e9543
MD5 93faae7168059f483e4bfdfaab87d218
BLAKE2b-256 6b5a18568d1986b9d68dfb9384c5ff14ff2c23f79f777d1578d844c73dee628e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.8-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 058f7ffb16b9724e9aff906a0b1860395b1b35f7b071db99adfde00a754225a6
MD5 ae76899660292451ecd3375cadf7bd9a
BLAKE2b-256 d70bc7568a19cf0fc2329ef8e03e7afb05415f94f199f14aab44ab715954b999

See more details on using hashes here.

File details

Details for the file perception-0.6.8-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.8-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 40a0f4800718eb2614d41b6139df36bc8ccd162258ea2d03a2ea180cb7f58e43
MD5 4b41c54e305e320e224c1a07ed954fdb
BLAKE2b-256 329c0293c0df76372138465b2a3f322ad942ccd94a14f8ae327c980da0e33ae7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.8-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 420ebefa46cff61adf5737eaff06bab02dcd1973ce56eac01f023b83d85e23dc
MD5 21e347572f3b5c8b1ff4e163a1fdeddb
BLAKE2b-256 65ce44e5de384ae422a3f664f50090866ccb907936dd99bc885ea1b524b87b97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.8-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d1065e2413a148fbec705554dd4ff33d229f618b5cf739f27c878eb7575aa95f
MD5 da2853f7dd4bff8755bd1112cf28dfc6
BLAKE2b-256 0bed58fa3b5d67ae0aedf4b7dd3a4455add72c4a9acf72f18ea48158d88695af

See more details on using hashes here.

File details

Details for the file perception-0.6.8-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.8-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8f637c5399653741c51336c86a49ce355ca258c4cc42ecf150c0c6058c08051b
MD5 45aa427b6184cd9e6cd4a5f7d5df83a3
BLAKE2b-256 ad4ac028cb4dd447011842f58ca7bb03485525c2c1565fb515ed39f8d71f750a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.8-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 0ac75c37ea8bd3268cc279e797da4378a48148231d3e1206c75f1c37b289f40b
MD5 0efeef67d3688cdadfdaf0434d2c281a
BLAKE2b-256 58f7df039571728cec31dabdcf9b75a12a2e99e0ba27d55ca1130c90e3a81b99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.8-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 2305cdfc2fda46ab3ba845e23f0ebb7e2bc85655a086b81994f822ae025f6a67
MD5 fe47954e57d0260e9cdd9f9c6b350071
BLAKE2b-256 707314e8ad8ac1107c5b55553d6329a153342b8cb869718f6de1aafb8b346111

See more details on using hashes here.

File details

Details for the file perception-0.6.8-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.8-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b4c5643ecb8868eeafd28d3bf4e5b26e380af1f2cad348165706dce35c4e929a
MD5 9e5d19253e6688b3f64d049319c422b0
BLAKE2b-256 3b8c69a7664a3cebeeada71ea17e92f80c1be2ff149914bcd502c9d8b016b072

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.8-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f718452c245f78619c2d371e6dd48aaa2e2efad3d923beb21be869fa48041e34
MD5 e1e0a3c87e700b22e542038d5eac6d01
BLAKE2b-256 feaffce6c42ea55dbf486af53061e50e13367776fe215604e653e93a8450c559

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