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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

perception-0.3.4-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.4-cp37-cp37m-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

perception-0.3.4-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.4-cp36-cp36m-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

perception-0.3.4-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.4-cp35-cp35m-manylinux1_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.3.4.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.4.tar.gz
Algorithm Hash digest
SHA256 a3b32422e7e9941aab2e2489d3096ebb7f5d035c6fd8d78f41e23f6073a80eed
MD5 1a242ac00b7ed1ffe9c09d6004b5db4b
BLAKE2b-256 06cc8583c4b9a5a28632a22cbc43d011dc537be08a847b3cc87412f4be28eecb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.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/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.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e33d169d023bbf262b83f20c930641cbe2babad90a576d622cac531819af84dd
MD5 6db5fe7960b51141988c33f0d92dc7a6
BLAKE2b-256 136fb85892158f07441d0a860c42dce1b362cd13ce2e665668a099702f5eb83b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.4-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.4-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8a642481b1e54cf564608df40bcad4066136fe8c54fe0fb9b9549c0dc416a72c
MD5 1f4589283305890e712f087535e0b2ab
BLAKE2b-256 c99526bc94899bd5209f01255a3dc17a13b789ddf9cfcde737e7472f238e8cf6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.4-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.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b2123aae4be30743a5d360c9e17e88fd36f446110e88d79144a9ca4dfb81385a
MD5 56fb055a939b600c25df8393542dcb1c
BLAKE2b-256 f6562c7b461119bbeb3e3b168014c378553f6eb17ec9a350225f5da3a3e3bbaa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.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/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.4-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 e8528c3241fca8bf5dfce4e7b1540bcc285faa97eda7c59d0319ce3a66d9abd9
MD5 d60809aad7a1641ed3d827fc01c331ee
BLAKE2b-256 3f28fd6454db4e9561a7a001db1f875dcc5fe8ddff05f069f076d6723b89a606

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.4-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.4-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1cc45614d34dde051100e2cf5be5dfee2b8fa7fe1f37b44a78a940a581979658
MD5 9bba06cae30ec81f2c60a7e81886725b
BLAKE2b-256 6b6e9cd5f6b0d857a0ba40dd89d51110ad697bf5a1914204b77aacff6d01a9d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.4-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.4-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e87dbbcdb4971c05d70f25cbdcc13bcd7d850ec5e2990fda7a262f366052aaf1
MD5 c125c5b95e9b016898f0ee050c3e503d
BLAKE2b-256 47b2a5491a4f6e88a9d838e2e8a9b5f35fdc4274478be3b03383c495f2870cdd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.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/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.4-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 f41f737417fd7f47bfba533edbad321ad4c49a3666c8e174b625862b3ce2c1ec
MD5 792a361b6836460d225169e2baeb03bd
BLAKE2b-256 9c72664e80a0c3b19aae2121975e9c77c44e457b12c416e95ea2dd1e2373fb0e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.4-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.4-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a17792c4a9a24d11063c59abb9d2fc77ef16079c5e45628ea2dd1799ccd1b130
MD5 25bd88f5d1fbbb89d981f542a7fa5e87
BLAKE2b-256 1bfd981964204e0e7a130f741a438d52950af965be36d251d6657d13a5978d24

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.4-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.4-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f0d9b2a539f03fadead64d59e8f8010f5882286f2419d993a7d0896d1a7380c5
MD5 b9d1c832b52e573206045bfd93905d3d
BLAKE2b-256 8d8a65c2cf98ab4a3b26d3c57df3ecb27f39d4282bfb46f5cc2847148b0a2864

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.4-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.4-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3b21a6a099ff8fefb16a63f25d500b7a799107e930fe46dfe4422b27825216e7
MD5 fc0dff30c3811e9ecf5b7979b9869d6c
BLAKE2b-256 6c9f43ef474500fcb1e854229da2bd6726e644a85cc2903518ee18278649033c

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