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

Uploaded Source

Built Distributions

perception-0.3.14-cp39-cp39-manylinux1_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

perception-0.3.14-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.14-cp35-cp35m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.3.14.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.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.3.14.tar.gz
Algorithm Hash digest
SHA256 88ba4433e1ade665a3364e1389d143853ee150b7032df022b0641e7d08114004
MD5 66126ad10834cc743ce66df6c964e9cf
BLAKE2b-256 d41b8136fd9371ea9c8712e18b49f56c1ef4208a33ec41fd05eca4a785db8869

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.14-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.3.14-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 da18113061a51f07f366b859f581f1476827e4175bbe89b4f118f732003c4370
MD5 04fe024e907613e899606111841d3215
BLAKE2b-256 a9fc54dd585a5442593351c27b763b73285e7b0ac1ea3beda790587f126cecfe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.14-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.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.3.14-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 57d8910468fd9e281d7ef303f6f2c3d08159fc87bf99ac8a0cd3c58378aed777
MD5 9825905d2299cd8518fdf823fe21f72b
BLAKE2b-256 621633cb01eb1548b3e18331d37765c38b0825027fa5b51d97032dfac46da4e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.14-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.3.14-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9a19fa20bfddb6e1bc9e74a65b40a2e2478c3f1bcb31f16dce2f20af617c3998
MD5 bb5ee342ec7fdacd33d4ae014478b7e3
BLAKE2b-256 58213b20b3c67f5fed458af54cadc51030540f6cae0572f53dfe8898e8a768d4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.14-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/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.3.14-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4393596be8bf0dd1929ef1d1df41b47a3b1d51b0d889ced50f316d98364c56b7
MD5 35a3e5d0abd1a963a215f4b60e981b89
BLAKE2b-256 1f8ffc26856903c340951a10fd16fbaf10070a1acc6f9679ff59758297f6b59b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.14-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.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.3.14-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 6e30076b5a2b13c607249d809bd62f18703a0ed1423b6661d14ed6ad15477f92
MD5 f4679973bcd326db91442f394a7acb17
BLAKE2b-256 8cbe3447eb28c8a9b448b349bbe324b1745b73de880d4e3bb027f11694326004

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.14-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.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.3.14-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 68cecf74df42fb80c15994ad0cefb0999d1551bfc83ab11cf86350829d14f223
MD5 a218df2628a7240d4dc6fedf7c40b1f6
BLAKE2b-256 76765b1a1805ded5f884c3700326bcdc4fd09b46bcaa9ea563e5434489ee5b10

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.14-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/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.3.14-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e8270b6d078bec18c658f5d843d213f2caf1442de521cf7497adf3f2323f69de
MD5 4cbee0f6c1a139d780b8eb8762e4f3ab
BLAKE2b-256 d99814573c3a8214d437812e9515b8db89d5d3a458353b9d47e22fab87293578

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.14-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.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.3.14-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 f8e0cbedb9d3d0e3d3739b5101ea227a0eae447fd6a1f9f45529cb15213c8a8c
MD5 bbb87795ae5c3fbd7a9b65723f30f057
BLAKE2b-256 e5d790499fdefd70756e96703d0e00a560509130047a0096a8a786be3e97d6d5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.14-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.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.3.14-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 df93c284466199cfa20bf0d5c4d2a4cfdf14f88dd98c03a9e824a73531275cac
MD5 41c29fcc7a5c79242df743fc199f9ed1
BLAKE2b-256 195a0436ae67a5fecf9ef1696c9899eeba0afb571f150a0350abee7523d59388

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.14-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/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.3.14-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ecefed20e7a3fd43d2e0eebe236ea24a4b7b4a5a4695eedf22c5781bc82db2aa
MD5 bb7c40534188ff49487e3c96e2a9e782
BLAKE2b-256 cf0b8b26729b9415609a96ef9b6cd221585aa620dad90fc3870d23cc6590a3eb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.14-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.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2

File hashes

Hashes for perception-0.3.14-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 be4f03109446ebf6a545d30f6f50cda92b932153681ac1f1f1046b97208586bf
MD5 7466611a4c85e1f526076c9e87714f82
BLAKE2b-256 51b4354b1ce15effab46c5cde11c70526cd38bf40ae770285c3e3bf3e796fad9

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