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

Uploaded Source

Built Distributions

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

Uploaded Python 3

perception-0.4.8-cp39-cp39-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

perception-0.4.8-cp38-cp38-manylinux1_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

perception-0.4.8-cp37-cp37m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.7m

perception-0.4.8-cp36-cp36m-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.6m Windows x86-64

perception-0.4.8-cp36-cp36m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.6m

perception-0.4.8-cp35-cp35m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.4.8.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.9

File hashes

Hashes for perception-0.4.8.tar.gz
Algorithm Hash digest
SHA256 465166d71e7d5714d14e195fb44c6337b24603ef281df1bc1e763ce53aa1e457
MD5 bd4f8dd9ead8d3f80e981b85ce16be7f
BLAKE2b-256 a8062c3de330ced85d312801f7147df8055cce48b74b2ca54017b33026a72d65

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.8-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.9

File hashes

Hashes for perception-0.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 0d06c669857026a93c7c0e63a3eed2dab34048ba832ac8353d81aebc91be9953
MD5 a53693f1d9c657049bfaafa4b465e807
BLAKE2b-256 e657b42b6e1da15d19c750a232ae7d30fa82935b7fb0acb6010874293ca72c8d

See more details on using hashes here.

File details

Details for the file perception-0.4.8-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.4.8-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.9

File hashes

Hashes for perception-0.4.8-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 696a7a806a2e24b45058f6a83c58779b26e3b1aa96ae3f0e442cede6c0775c06
MD5 5949dc54a5ef1b7e12fc453ac12bc29e
BLAKE2b-256 f774f08c65e9b6f946b87c27af5114bd8fa32fe10275dda198209d50d04a33c1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.8-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/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.9

File hashes

Hashes for perception-0.4.8-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 8e05b0a02a008c05897ea9667a31c8f529de7446aeb0220a83331c965e2fa2a4
MD5 329b10cfa49778bf1ea62b76fa7606e4
BLAKE2b-256 86ffdea60c3247930553dcd6a88a912438d128abef76bbd344364153e6c8a558

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.8-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.9

File hashes

Hashes for perception-0.4.8-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 533f79b0137b6d9a1fda42d7d8d694c74e6a9381a4477aa0a3eb77d0a1565c95
MD5 8beb5de59cf681b46a75ce97d55fc628
BLAKE2b-256 4ee172c5e529ce4b7ec95edc27810517306dbb77a0b973f54df7e8b23e7c4fc9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.8-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/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.9

File hashes

Hashes for perception-0.4.8-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 741aa7e36cd9b14f5e32f907cb73e7e8b0163fda37eb965d85263efcb51d592e
MD5 6c3b47f52d154e7495b20e962b7973fc
BLAKE2b-256 c8bd106925c1e654e2a6775f7a99a156c2f99f94bd6efdd517972c7582481b60

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.8-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.9

File hashes

Hashes for perception-0.4.8-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 72d4cd50c304721becdfc695aea555a4db64053d9e97b04e425029cc1b0a2958
MD5 f4ae14649ee1f9b0745443b766ddbbac
BLAKE2b-256 64f6b45f3c9e99d1ca6452a32b685abce5bb9f4ee15cf510d3233d2cc0e7cb54

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.8-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/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.9

File hashes

Hashes for perception-0.4.8-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 e54d7053aaa582b318deaba7d192bb564ebcb429ecedc248dbf279c68426ec5b
MD5 e8eb9912efb4d7738f4bdc770cbab14b
BLAKE2b-256 73b0fc7e26754dd4e335c71c7cf7e9e62e67a516d1ea812df8fcc15b2686085c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.8-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.9

File hashes

Hashes for perception-0.4.8-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 260b5aada193192f2775918828de52703f844190430ad2eb8a36c1e711f37771
MD5 25b8b3637ed95e3a788f86eba425aa73
BLAKE2b-256 d5d96779e10990ccaf9ecb054f82fac553126081ac034d3f1fdee93a6a2fd43b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.8-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.9

File hashes

Hashes for perception-0.4.8-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 480bef7ef41b23fd56ad27fa4d107bca014ba6600006e033a4cd7a6262749306
MD5 78c9959f1b0f52ba6b649b29fbef1798
BLAKE2b-256 64c3d8e79d0f63e71be0a1913943aeb0b00fc757603b6131d09881fb0fc91bfc

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