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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

perception-0.3.3-cp38-cp38-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

perception-0.3.3-cp37-cp37m-manylinux1_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.7m

perception-0.3.3-cp37-cp37m-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

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

Uploaded CPython 3.6m Windows x86-64

perception-0.3.3-cp36-cp36m-manylinux1_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.6m

perception-0.3.3-cp36-cp36m-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

perception-0.3.3-cp35-cp35m-manylinux1_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.3.3.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.3.3.tar.gz
Algorithm Hash digest
SHA256 69d37064c151104f082c2d296ba9f4ac9571dae99a3c51147f24f81034690af2
MD5 3e700273d60bf9dbafc57e204563d4ae
BLAKE2b-256 07c71a197376d86588974837ccf7651b23fd6821d8ca08a6e4a83aecd7e4acce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.3-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.3.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ad2256d7dc3a0c69e63f30c6580b0e83f5d8930aa7b049f82b35a05cbee388d9
MD5 dd43f22180b5dc7c049292397706a795
BLAKE2b-256 7eb0a9c72cf5401cb9865e9336de107c5ea9f2d76c5573c1d97bf50e5d5f8389

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.3-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.3.3-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 689f0d6686b00fa4078994a16f87b8c57619cde75161c108e14fd7f85c88a2df
MD5 59c8526b6089cd281a8ef0eea351882b
BLAKE2b-256 1803fff16410727d9d726936b6a12ad16347bb9e6cbb5e70a537e6bcdc9c0352

See more details on using hashes here.

File details

Details for the file perception-0.3.3-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: perception-0.3.3-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.8, macOS 10.9+ 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.3.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d7f3884e3d1742f4bff9d8b2ae03fa858874c72fc6bf57f9ea65cd34f5ac70a0
MD5 9d36af90a0c178c13cb42f7564b6d0c2
BLAKE2b-256 ac2fdf99e43992e40dc1043b901c00c3d4186e50a06ddf0351fc032e1c31da47

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.3-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.3.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 b82c1bec767e2857837aed4ef1dfc6d27ed75ba37dd78a57bdd12e49e7341cef
MD5 88a595986e10f61c029c663b1e95af09
BLAKE2b-256 e6bd51acdcc701da87ddd79f036d9781e83d023cf8caa5c66ed28bc6450122a7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.3-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.8 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.3.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5825ab7b665425590baa9e038193551d45b93d8c40f051014400888c58d58a62
MD5 2539319947b7a1d07020e65db18fffc1
BLAKE2b-256 7ef33a7b1c16be0558ad4de7c8489bc523826e1c0a66035062ea4456979c0c2a

See more details on using hashes here.

File details

Details for the file perception-0.3.3-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: perception-0.3.3-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.7m, macOS 10.9+ 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.3.3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 88f98f24fa391ff28996080722f07cfb5fe2daa2b1e11da305d5c028cc8caf06
MD5 127aae0a97bd841448c9abf0b46ef124
BLAKE2b-256 4c77c0d15deb5f4d1d9c65f739805a22d16f4853144b204802a181a4e4b3d56f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.3-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.3.3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 63ab0ee31e3042afe55d55f3b6e70a661c612aedc563058fa3579153b94f1acd
MD5 81bedf98c257d3c428de3c2e8871f31d
BLAKE2b-256 982507ca7d7f61f52ea674fa18a4be7810ade2359e39ea24ee034be70c5deca8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.3-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.8 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.3.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f71d71e3154c36ee4b4ade3037dcae6032dd2cadf3f6bd705f09766b11385af5
MD5 1dd09f65928463c30beeeca8c3bd19a2
BLAKE2b-256 1e392eacbadcbe071a973fd02b1aa927527d66b08f8615bf9c6102940b2df550

See more details on using hashes here.

File details

Details for the file perception-0.3.3-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: perception-0.3.3-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.6m, macOS 10.9+ 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.3.3-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9d9c71d4e3c94e1d31628b57a3d2465aafa51c23b2e2616c630e8a4fcf1da0f9
MD5 54e389628dad440bb46811b9d02b9f80
BLAKE2b-256 f78babcc69f9c285aa40d708cf49ea2ac7c5821273e82874b1b06e267fbea054

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.3-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.8 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.3.3-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3ca5f6545878118843e9ff31ccb5582804e72d3ec5fe0acc81a3ea7e64ec2cf5
MD5 aa5e7e97976ceab0e60fda52a7f66b4a
BLAKE2b-256 188e36b2810e86f6103d49d969f23c84137511a23bd2e00f5c27644b62820403

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