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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.10 Windows x86-64

perception-0.6.7-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.7-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.7-cp39-cp39-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.9 Windows x86-64

perception-0.6.7-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.7-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.7-cp38-cp38-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.8 Windows x86-64

perception-0.6.7-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.7-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.7-cp37-cp37m-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.7m Windows x86-64

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

File metadata

  • Download URL: perception-0.6.7.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.7.tar.gz
Algorithm Hash digest
SHA256 afcbf6637ec5b61e457ae221cbacbdf2db097fe0ef657d8c913dcd13fc01b0c9
MD5 fd9bdf8ab3bc19c6a8569fb461ed2c76
BLAKE2b-256 b6209ce369cccbdb91cb185c7639fbc6cfddb528f03ca82014d587c8afe8f173

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.7-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 7ccc4b42ff6b3c09b530ea1770a9b37e2a51ea6646769e946c69c6712d5a6bdc
MD5 43e7646a891975ae9cfa9445b17b7f15
BLAKE2b-256 2319fb68fecc15bb8756a55c59819bd2c9dac16b9ac608b14c2355ae8e6eb6d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.7-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d04be888a02d67e1e0824b77b633ada252923db9ccec74ffa266204daaa2871e
MD5 b88bdee0e7b44f979d429c665dc4454c
BLAKE2b-256 75f798d7919b398ef62c2db26a44e5fa537e531d99ffc396fd0cd18b7b8834fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b2ecfbd46ed4254138403c0228c5004d93f5de37f5c13ab19aea616aa23bc43b
MD5 5aa7b8f5516686848ad59c466e5379d4
BLAKE2b-256 2bd3aca61345042e6a14f516f6eb5c9ff395a33dffc533e03f678f30ae20a3a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.7-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 caa2cad5f79a66495c3e04bc2e401ade482fa66cbf6d274489c5618d1397bbac
MD5 df3a54a6c3a756668b7375b9d0bb642d
BLAKE2b-256 854ec367bcd297a8c5a3a63aba10d2bd28803ad653c2117bde1bf37aa7d69c54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.7-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1461cd99e5fb8b70bf821876fc070aa7422e1fad1e3bea37c84461ee23a1a0d9
MD5 dad6db2678a053104967b9b5741b7d25
BLAKE2b-256 031e4b72d98f7dbc1ddd34843750ff5ea5c9c15469aec745f522980ede47e11c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.7-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 010b86c306a3a6bec305b818a27c76a43685538856f3af68a735292c315b2b31
MD5 bdc2f0185cb3b4964f10474ac7095c60
BLAKE2b-256 15401671c65918655ecc116496b10ed7722901ea8e2788cddf82ac052daceaaf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.7-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 2874fdeaef8a829dc0d0922f7f165b743432a79472767ec3b45639f2d06a7ec8
MD5 24a656efb85a7a223f72006eb0b31360
BLAKE2b-256 526dd57eea40943a4f8974547b1c47677e4198664717ad78ecdc0a38bd6b1b2d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.7-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4ee5959b8623300b57ba0a04de181eb91cce4e2363678048d438a0ce98638d12
MD5 e8526b32acd79b9c9a20e2b8f376d44a
BLAKE2b-256 22213b89c6eacd79af7c020d7d81e1030d49320dfaa282063f74f390413a5a06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.7-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 b771f3b0b159e4fb21ca8243d85a0a1c9ba53c36ec0e16f3fc3655fe059ce6e2
MD5 c98b8b8b2a52ec5f775e7baa7ad28dcc
BLAKE2b-256 35ae6d7f7ff6e8f70efd8b30810bfe475463b11d7e219f937ee03df58ffc6e55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.7-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 c7cea2c696d93ae5533c6f688e22ed5269b5049bff00988370547e088e9dd4cd
MD5 3cef4551030f3132eaec0ac33614a03e
BLAKE2b-256 6fa9f4d655bae23329475b69b25f970d884aa1972506282ae3571d6241370d64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.7-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4219e812e8e086139dced87d1be31e51d666dc9ac703e4b545bdefd3360020bb
MD5 47a068a560aed7f7db57a5b7677a334a
BLAKE2b-256 cb35a18571b8b3d7275da5ea0949d71d870f1ae510e4edc9d557d49d0f13cddd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.7-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 ef3d30e792923bd8716065333bbde304777234e3133e10790f9769a6704da499
MD5 0c1a89a3c690badcdf8fca1db7a96f7e
BLAKE2b-256 eae1b2960e05fee081da6a78406d41ea5d64fc2d0cdb24f9af5f506f146256c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.7-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d3241ce42a850a1a5002eeca835cc8a78d13fb4f748b316306d100752efd9324
MD5 f22bceeddf138e3bea190555b719033a
BLAKE2b-256 8a56ae72df691294b250060001e8664f0ca05f5f22478ee6cefff7ef469a4268

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.7-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2c0ca5bf2a00e988a2294ba9a263407f1ba431599e5d02c71ec97c5bbcfa302f
MD5 b64461359eb1aaa6143ce25d64c02a32
BLAKE2b-256 60b9fd6685d4a1151fee5c45301ac774f063b40a2e041f3968e895c969c176ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.7-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 be42070019aad38adfcfe1f5a4a7d27f881a71cf753a6ea8d955ffbf0f3d565a
MD5 0c565475ff27bce8f4b9d266a96f9583
BLAKE2b-256 99bc9a50524ace0242218ce920fb53627cd4af3ba530e27b8f11571e1fe92c5a

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