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

Uploaded Source

Built Distributions

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

Uploaded Python 3

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

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.4.2.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.4.2.tar.gz
Algorithm Hash digest
SHA256 8d3bdcf71a047dc3e899f5f8b73955ed8d0c4100a5be7b2e7c3727ed4939ff58
MD5 995cf90231e02729ec8188b6b2a1a9a5
BLAKE2b-256 17bbf2ba6b50b6944599daf3feae40aa25042446d6c0c6a82219efe6b49633ad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • 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.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 36ca1118890a2b58d5e9bf3228f74e4984a1752d91631ba086cc451b89a1789e
MD5 61a1e98a980870a2e8d1e941aba1dcfc
BLAKE2b-256 9a822b1c83e88d1840e4600e35f9ac8f7f75bda6819b040384916accdefed095

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.2-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.9
  • 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.4.2-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 079d090041e7782a7cc8580dd20ce3c422c01778bebc2068a8905cf96e64a111
MD5 d99275d98f49b7a3673ae8e6c903c29f
BLAKE2b-256 219d4467c2d33a30015bd1c6ac6d0b8810c36609d087a3c79c1d115f14e76d1f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.2-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.4.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 9b66561ed99666fb8e23db12144868695b6bd22bf1970bd9c1cc656b6d1cfd39
MD5 8f55f63a75f6a89b9da5da1dddc84921
BLAKE2b-256 4092b2289851c7b2fe45efdbb23a6fd38ae7e2bf7dc733787351c3a38f494afe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.2-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.4.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 375b61263dff8efd2f4cba801b615e907ca63b9bbf34ec69ebd00f5111e666c7
MD5 714d4d551062b650f82235ad40d7c3e5
BLAKE2b-256 816647347ebb2219de540230303c78f26eb7f5aa297becab1f062dbdbbed267d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.2-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.4.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 4970c5f2f9a47f0bbba38b51851bea3cb311ea7358796b7e6299a246b394d945
MD5 d6dd982c44eb5393099320ea9c3c9b00
BLAKE2b-256 f3a422fbb3890dfb39c201dba48c54669a2e549a8543e8db150bf518b774007d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.2-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 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.4.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5669921f37609fb54045dcab39021df7f462f0de14c8eaff23426ab95d450884
MD5 213b1f0450cdb010bd997646c4d858ee
BLAKE2b-256 6135519b003021c203a78f89120918bd96d68c0cd36d39919caa285d2b6746c1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.2-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.4.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 0fb6652a4a8969c8f5f7b9b4b03c5e926c08791bceb40a59f636542b6036a793
MD5 212e56363d5cd7b31956c1cf4b350212
BLAKE2b-256 8146db1d6fb6c11f33cea171d37964a24e150b14c43b3473a371e9dde688eaf1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.2-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 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.4.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c391098964c707decd9bbc5e071eabe4c37d45514a77ae95c0f25a4f371410e8
MD5 a7964b8cc4f1efb690c19979c100fc76
BLAKE2b-256 be42c3b5ee4cda865e0371d9cb6ecab77410f49d5fffbfab783b3448d6e64cb3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.2-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 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.4.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f7f1b8f71d04af81c89b7154d59bb8c09cfcefe35244ebaa77fb52fcd3cb23cf
MD5 77866fd9b4ff6d7dc57895f7a37ad879
BLAKE2b-256 c106b2c835675be1c06f6baa9400ef42346c1cf8f5899998e4ea43b0cc77eee6

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