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

Uploaded Source

Built Distributions

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

Uploaded Python 3

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

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.4.7.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.7.tar.gz
Algorithm Hash digest
SHA256 18b36c509c9f65cda50e9790584c67e2e8421c5a4ba618d4e5b84e37eb3bbcbe
MD5 29fe471d28df366927d8f796ae4ff672
BLAKE2b-256 99a505f9f85b1bfc7550191c2a6a01894d07985c3a38b72a334fbbb6fc0397a0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 418b1279b5041c54dc20c6943f765b66219bde12b71a867ea5b491eec4992eba
MD5 833e4700811242e4c6a2c0bbbb4fe0a4
BLAKE2b-256 22c6a6b3a7e0daa9af790a465ce445fc6f00abe85ae6c0f48326d723003f9ec4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.7-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.7-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b74e89e97873a8c557a41bbdefc6a9b3048bcea15f94a86d8dedcd29ae9d6518
MD5 1d951c8f1e62d0afa07c8013afc67e42
BLAKE2b-256 f6b1891c6f60761c438f8ec9d4d72d7f1355563675fefe76c904abcd5bead02f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.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/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.7-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ebfd4c85234703212621bd699f3cb46319bdbba0c467b7d9251c35925f7f7ed1
MD5 5bfab26650830ec8681a3ba7c6da25de
BLAKE2b-256 4147dc01ea825f20288dd2752631d976a779e2e48b1d7d515a616647c59af5e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.7-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.7-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 2e913cf3398c7e644a06a74e47653ddb5a03032da1f79a07f0c61e745eaebb13
MD5 cdf5c280dc1487d6fa3389e91bec6289
BLAKE2b-256 75a4da09c9f617d8ce6bd47c2b002e5c0ca58327e1c78a8b3c91866dc94a339b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.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/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.7-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 7657b09af266fec3bfae68693f17ac0c3167ae0e14468bc8dc521860d7feb2f7
MD5 f649e0ff426646c4cc05c55a570b67a8
BLAKE2b-256 63c36d816447cdda1a689fbf0062af41d61d777ff83e77c7a4292d1a5671ee01

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.7-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.7-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 68bc0c1761d415325ee3aa05340ca1265109659e1f69ff9989feb8a4c5879027
MD5 73eeeeb3797c8bf0fee62f97645bc6ba
BLAKE2b-256 2b3872d29ba9494e79e5833b4c9f066b70be6431fe3a983cc726079120bd77af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.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/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.7-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 82d4284719eb056f8bb175a08ca16186cc043cdb372f4c2c51240a4e17bc7aba
MD5 7ab85a2686451622ee4e3f2d50eb37c5
BLAKE2b-256 3f1ac4fd1b64b586a8020d7fc21056e2c4dbca1bc659225fed9d434500f7efee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.7-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.7-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d4b394dd1ec99fa67e9bdd8ec5b614ef0f9b086a30bae13406b96c02b741376a
MD5 09f89f6c662e101b6082ffed721474e0
BLAKE2b-256 7035683838252000ae7687e6f0eb7b1c0ad237fca08050c1d56cd5dcb77fead8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.7-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.7-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 fbfa476f211d49633a295dff81991852e58ecf4977505d34a8364a388585aa9d
MD5 e1a9305a7577621bd3bc4821506450bd
BLAKE2b-256 035cd4fef2ee40870b837bd811e7c1c6e62d4ef15aad5c1691327f454b1898c4

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