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

Uploaded Source

Built Distributions

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

Uploaded Python 3

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

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.4.4.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.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.4.tar.gz
Algorithm Hash digest
SHA256 36a3a2ed6dea031729102e9c7e7dd6af87e4d4e55e98462ac8e69291be3da9ab
MD5 0c1938b9f02ffbf471daa194d85135e6
BLAKE2b-256 27c85215d4bcfcdbb157f134d667de70822ed589b1b654f7b789e9d7dd5b6f90

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.4-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.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 763a52ea4441e1699b0b140700616536e27d64e46f1d6384ef248872b2643b4f
MD5 240a11d8524f5328fbffb909613c024c
BLAKE2b-256 8e4accf58bf3f84f20aa0d8f6227a7f6a6269c235582ade3b801cf4580cbc3ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.4-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.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.4-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 21dd7b999458dea6e684c6a13eb75340d6412824d1c6be4832ca3363049870bc
MD5 f41d9f7a6a29e0d0e5d941634e27dc5a
BLAKE2b-256 31e8d870426773f37f252be91dc9ddf859ed9bf88a6e0c142d8afac2cec52c5c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.4-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.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ecaa9fe60442f8122bc1781f1a8d2fe8e7324bb92cbc3149816253a5c1052db6
MD5 9cb9fdc289f9324ff662a7c7c195c2a8
BLAKE2b-256 d10b89e7594782c68c8a06ee7cc72b3073efbae18b7a53325036e9f3306fc73b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.4-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.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.4-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 bdee6612f1bd7b2620ae4c49681b4dd73d87a168cec23689f074560e37235da8
MD5 213208784f1b6176e5d1a4c1482ea6f5
BLAKE2b-256 a2626166a3c25d33167ad41928e8f3afa2391fff66f8f091359580d47a261db7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.4-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.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.4-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 b994723ebc9d333bcf59f47323afdf6443a7942dc93b4e2f8947691ea3b2134a
MD5 73f20b7f9760103f3acc987ebe25524d
BLAKE2b-256 53a6504a094858cbfb76c930b2d5b4749e813212e71df79c58da61daff6480ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.4-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.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.4-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4ae1699cf5bb1f77ac2bb7991cdf21620286dcf137e81fbdbcc7b28a9e7cb458
MD5 051ab5926149421964ab4d121e47316b
BLAKE2b-256 cd346172efe3244f67d71b7b412cce4d979961aed1ba33487ce5041ddd434bb9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.4-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.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.4-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 6a2597d605fafbbe8886a26a8655bf64475e276c3c446b9358659351efac569a
MD5 18de523a373221f149a55cfe26563a2a
BLAKE2b-256 49b4ce7f0ff172f497e34e56ebe4c49176dcc1eed1075429c1a52615c7ba3316

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.4-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.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.4-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 69b7351be76a937d81ae94f2287913126ea542fed18138ee207b4d9db3750e26
MD5 4dfbfde842d6a014fe0a79f9f7ac706f
BLAKE2b-256 6f32d87d0ee75f7141efc25621745e4f963033156ea13b9a679bca7a921642c9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.4-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.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.4-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6ee83c5c3411e129f16e89d524602533916c317a5698e9517d211be04debd3c3
MD5 f50af6c6feff3885ab57027c168aafa2
BLAKE2b-256 45f7914c3b0f088c2b9cad89e565600359443f13b5655a3a20aa24d5834ed80a

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