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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.3.5.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.5.tar.gz
Algorithm Hash digest
SHA256 686a33f0533b510c116dfdd63b2cd2b76c5fd0f485decdd4708274ee71966b53
MD5 7f02990d385af39670f55b68b8ef31fe
BLAKE2b-256 e28a67c07c8dacff28c2614222ed3146e1bda0379748e2c2d76f01dda0896055

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.5-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.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 bd0de5a2ba9ced9f78c25cba05b4c7c773e9acdd6135968da998b2602d146ab8
MD5 8f4793df2e3ba15fba2b90115fa8cc1d
BLAKE2b-256 4ba890eb229722834e742bebf2848cbd35ab7952dbda5f41a94b73a411734e55

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.5-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.5-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 02c40f3861a23fd2e236ef17760472932fcd7cc101c46cbe108eec8da49ac3a2
MD5 964b1468fa84f2331aa2f55f912ae84d
BLAKE2b-256 152400e56ee6f52b3cb15a6e6dd2ac04f91ef5a3b1cdbbdd9e8bd2dbdadc2c8c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.5-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.5-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d441adaf322e4ae0c6415fb1559a03ca907b12c744e9ad40ad9fa449c8264c50
MD5 f2e35187550d0dae0250943a4574f3f7
BLAKE2b-256 9dde0807e4fac8801f278051aee2d60827cb7750cc07b0664bbd1a54ba5b2adf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.5-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.5-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 239fca30b030e655f33223828ef2efebb6eaf803b053b9433c8c49a32b91a9b8
MD5 aec1f515a78e2668d4e346200275e786
BLAKE2b-256 2abce46f95b7928ee9b2d208ca37866fa3339b80fc7922f82b4a35a3b182dc4d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.5-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.5-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d946e3f0ae86197cb0725e77f320d1dd69aac0ce548c28522bd96378ddf83a8c
MD5 868460550b90bd55e45df5d7eaffd451
BLAKE2b-256 d77342ad7192d1e82f839537cb3b068294bfc5def62b1bc18b7d63b1a73396f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.5-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.5-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b99635f866f5d94f3819d78e07fa90ee4184e0e6d616c18f50fd3f8b387aa475
MD5 95941d2128e826127d8d6d8621b88b13
BLAKE2b-256 57396b06309799e3de7c9b91706fb43eda6c23861cf804a8e85f799e153ee810

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.5-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.5-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 2459b00e2eafb7cd40c3f1af98dfcbdcdcdc0e7de7e01dec0cbf0e3c69d48246
MD5 c1dd3536140bab83584b200e6f143707
BLAKE2b-256 37d2e176bd45dcd11475a259cc19fd16b960f4192ed87ccaa348f9dc8905f6b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.5-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.5-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3872bef30b0f76b9b10a2f7f83d1cab9436a16e5275323df609cf249d46362c2
MD5 d8f3ddbd389d36cd934dc28ab0915801
BLAKE2b-256 46de5ebbe7a02dc02bef97f1c43d8daf14a340999adaa1ed9210d0db267b7f6d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.5-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.5-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c9a73a4375dd88c3a08edd226efc35bcf227627b11d4f40808d5e0da0bd4a9b7
MD5 9fa5af4577d880c8c5729054d5f37a46
BLAKE2b-256 cbe1da212c51fbd9f2b55bdbede3a139769593c10537d186b3c95d4bc959c58d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.5-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.5-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 bf15c6be7eab752dcb1f0bac0cc2b5975aa16d8819bbd1516d9da4eb38677d7f
MD5 85db3b40a5bb91ee774e7b867f3e4204
BLAKE2b-256 6f09c5465ea235efbc362ae3ecacb4772e0781a669275765db989c2acad67bac

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