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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

perception-0.3.7-cp38-cp38-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.8

perception-0.3.7-cp38-cp38-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

perception-0.3.7-cp37-cp37m-manylinux1_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.7m

perception-0.3.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.3.7-cp36-cp36m-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.6m Windows x86-64

perception-0.3.7-cp36-cp36m-manylinux1_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.6m

perception-0.3.7-cp36-cp36m-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

perception-0.3.7-cp35-cp35m-manylinux1_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.3.7.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.7.tar.gz
Algorithm Hash digest
SHA256 7ba74a3d0949185dfbebeba7965b106eb13536d34f3fa01701c7ad026466c24b
MD5 edcec09ba7a90d43440874ac39427439
BLAKE2b-256 6956b75ac09a3b3870ce13b3777c4796abb37ea751072e5cac7558aeeb8297c6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.7-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.7-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 308816b5d8ebd7546a9dcecb12ff72b7f4113a03ec9b2fb3bfa70dfec68fbd47
MD5 a70a33580dd90a546189a51cf35e6d98
BLAKE2b-256 272a5c04c8b838a220fe4acc405cc6bf0c793f2b19e5bd2d6a865c6ca11a8983

See more details on using hashes here.

File details

Details for the file perception-0.3.7-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.3.7-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.7-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c693899a75b45532ce24ca48cadc2b018a93da061364dee46d5df851e94a7d57
MD5 902cc2d1e6d60c5eddc03003aecaab42
BLAKE2b-256 7ae639e6c6a0723d49550d4e7ef49f911748aa3492d3fe5d91a8f98ef97710ad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.7-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.7-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 239ade48caf99c3c788f92ff1d8ed55574e99212d004e3c52b8cd4cd2aa6440c
MD5 d32471e746e9537c35adfb7863b51d4c
BLAKE2b-256 78c754236fc70616249b14cfd32539fec37fbbe4b2c60d17a0bd8481f91fb283

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.7-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.7-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 2903af2569a1744b8ba576060b50c24fb8597d777080dcf600523e75ad690827
MD5 86093fdce1d5adcd7faf95846a6067f5
BLAKE2b-256 9dfb8fcbe3beb6c2d88c5a3d743918ca1c4bee30600bf9bd1dd27b95770bce6f

See more details on using hashes here.

File details

Details for the file perception-0.3.7-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.3.7-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.7-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 51181bc5476beb28a3b185b43f33dcc2660d00d7c8c8d35d17fa46e1c0cd0faa
MD5 8701cac244b981ed7dc9731d8e216d91
BLAKE2b-256 98ce6dabbbd53bdc0649896472d082bf4c9b1ce911ea19bd37fc63201ebc8120

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.7-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.7-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b0c3c25553d584fd6b88a3735d88f93ac389a343311046ab4707abcb8c8cc27c
MD5 862c8e51cfe1d8edaee3335cad0cf433
BLAKE2b-256 33d383779f459c4b01329e9756ddcf2bcc2c30efe7f86b24615ef70c2029c839

See more details on using hashes here.

File details

Details for the file perception-0.3.7-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: perception-0.3.7-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.7-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 e4704cec72a526459cfa4ec425027c67e083bbfab1ec45b870fe45286e72afab
MD5 06339af32def8cdb7577a6e61faf278f
BLAKE2b-256 ca0e18b695aa47fee975b8f2f651632a4371b49a8ccb0d929a0411e23e26e5ea

See more details on using hashes here.

File details

Details for the file perception-0.3.7-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.3.7-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.7-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7fccfe6c7107e305787ee4819ea8f5ed9aea1c1f1729ebfbb394ccd584165b46
MD5 35466e815207a6d5140f62240d347363
BLAKE2b-256 ed358832626b5e74378aa6b45789e1018ea15dac0a4cbf5ee94325900fcdffd8

See more details on using hashes here.

File details

Details for the file perception-0.3.7-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: perception-0.3.7-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.7-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b6b9e15739d0a2fc46ddafb7795b068e9bab925902fcf43879bea1d663b74e83
MD5 79db6f6a937f588c6c53a8556b0c27c0
BLAKE2b-256 353c737ef075347a08fe0a0a18fbb6d8e4a6033b62d41ea0c271b73ac07e3b4e

See more details on using hashes here.

File details

Details for the file perception-0.3.7-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.3.7-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.7-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f2eda8daa4924f83ce746b05ddc680b9405f02fd834602bbfb66e8848f1894dc
MD5 135ead0dd65f348b83719b919fc5d012
BLAKE2b-256 f08b81cf00eae39d22c2edd1308255fb9bd2e44628dfc5a6893eed81534c6618

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