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

Uploaded Source

Built Distributions

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

Uploaded Python 3

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

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

perception-0.4.9rc3-cp35-cp35m-manylinux1_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.5m

File details

Details for the file perception-0.4.9rc3.tar.gz.

File metadata

  • Download URL: perception-0.4.9rc3.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9rc3.tar.gz
Algorithm Hash digest
SHA256 a2402957b3899960c195b5da71cf9b0faeb9f418f0505395018f9715a35b67a8
MD5 40cb4ab1683ebaba54801037006f207a
BLAKE2b-256 3e0a2ef5e6d2d47ffd6588e70d7132ce5481b42298ed6b97ec2521c719ffba4b

See more details on using hashes here.

File details

Details for the file perception-0.4.9rc3-py3-none-any.whl.

File metadata

  • Download URL: perception-0.4.9rc3-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9rc3-py3-none-any.whl
Algorithm Hash digest
SHA256 5b5e5b221b930510c4e516a24d7581a505a0376879dc59e5e92eaca75f47dbeb
MD5 481d34ec70b38361b173c5db0babce8d
BLAKE2b-256 70121abd0badd60aafbe8935cbdfded11aeca66a7ff45eb1b10a565b49cded68

See more details on using hashes here.

File details

Details for the file perception-0.4.9rc3-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.4.9rc3-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.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9rc3-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0096a16857a28fd50359d8bb2f963d3e8732b5756b3d947490ee443bdb8d0880
MD5 4376ef50e6c549f07f072e56b2c15ef8
BLAKE2b-256 e8fd861c1f6d563d72f68b25387cbe461e50f4680a4b8ad148e7ff7626ca8dae

See more details on using hashes here.

File details

Details for the file perception-0.4.9rc3-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: perception-0.4.9rc3-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.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9rc3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4302f7c5134c2bd130a6a2fe57d223caa0683bb71a6327fabba2225f0c88fa20
MD5 752913144dd30a988aff5703f1a71877
BLAKE2b-256 630870d5b7fe435936562b71cd04b53207c8a3e3e0ec3aa9f8361e38ba2102e8

See more details on using hashes here.

File details

Details for the file perception-0.4.9rc3-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.4.9rc3-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.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9rc3-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 451986b3a8556c94b3968fe2afa2bcf20214d1974f8836a143a87adf6392ef28
MD5 a443e0314c2f885f29fb505bf378d443
BLAKE2b-256 52b8563c6d33580409b492cad03e6db02c02f84541d8b0d2fe920583ce7b31cf

See more details on using hashes here.

File details

Details for the file perception-0.4.9rc3-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: perception-0.4.9rc3-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.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9rc3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 27199cd015d2a640504761f9ba172b1c69e91c1a2d6bea995e41d85eefc67a83
MD5 b76d8851bd3fd8ec3bee474f4f91f1fb
BLAKE2b-256 28bdaad5e789ade4609b677647b313c133ba4150669a49e8881e3cf49c6bc0a9

See more details on using hashes here.

File details

Details for the file perception-0.4.9rc3-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.4.9rc3-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.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9rc3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 441ae4ec417446a586aa662c680a1ab2b55432e53a17090b189d9438b8502058
MD5 39938fb76714e3d2d3bba1d3933aab89
BLAKE2b-256 64e7b28271d119b3961c0ae2c492479ea18755c5a27f3f8fb3ed521406e151de

See more details on using hashes here.

File details

Details for the file perception-0.4.9rc3-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: perception-0.4.9rc3-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.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9rc3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 33d491ce90af85013eebc3ff5827afdcb192808fe559614c59ce89b6b8871a36
MD5 534e69e93e6c06b3817c74cae4274819
BLAKE2b-256 ea62e8efae3349dd07020c8ba8e4b2a2439044ff773dd4605bcd9035756230d8

See more details on using hashes here.

File details

Details for the file perception-0.4.9rc3-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.4.9rc3-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.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9rc3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9b231db05379071ad558971715e81f435ac2cdf01bcc0212aecee446300bc706
MD5 070a55d2720a10896f23e73e205e53ce
BLAKE2b-256 dfd4d19b435030f08a60d817cb493ac8f1e84fe9dd3be289d3afdd9a2cbd940b

See more details on using hashes here.

File details

Details for the file perception-0.4.9rc3-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.4.9rc3-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.4.9rc3-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 92381c9401d40acc8445e2a5b5e34374904270366b0a00282a651d3c8f5ae21c
MD5 83a4d691b8ca15a9021ec04d36789314
BLAKE2b-256 d0ed0e4dd9e6b30420aec3193a5f36d3b1168d85721d2120565c81d7d5e24c62

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