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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.3.8.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.8.tar.gz
Algorithm Hash digest
SHA256 3df4bb7617c6976fd9d58d4b6093695c164c5aa3b36b1966344401011edf4324
MD5 98b264376a445ee00eded9022a09a18a
BLAKE2b-256 37071673cfde5cbeda793b0457fd4a05b01415a62362491623c3f6612f8116c2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.8-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.8-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 15a9a0d5e2ec2016f8a51d5e5c5ac85fd83a910e1ae9c40bdba347c002078846
MD5 aaf9e30f9b36e1c3001a3fe757580199
BLAKE2b-256 c8274b6bafa45fe7a12af9084a7a4b02b81c22dd22942a3f44cede03cace8aa7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.8-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.8-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 eead04dccf17430301a2d4366d50cc32651a025f34d0b2bd8f1f61f55a5d6c48
MD5 be408880014d6f8e2458fd6d2496f02c
BLAKE2b-256 ffe57d456d5a134ab6e38de96879b32605e51082886cfa31edf2dff100c129aa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.8-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.8-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6b1fe3ccb7fbd899b91599fa9fe3d95ece55c2926f41a814fe15670427ef1794
MD5 4688e1fb79bee9958907ba23e599f0f6
BLAKE2b-256 09a5f84ad6b2bf66c0d1e845b49cd15fd6b909a2b1da6c0202faeedf65167fd9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.8-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.8-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 e1bf7a5409a8e3be275b49ba1fa44d2cea35dd4d25bcaa1c8a3a75e921630d7a
MD5 7c581d14adb6ce4b1d96d90cfac1c28b
BLAKE2b-256 2e6e6f44fb2f77cf32346cf80dfc1d25bf498c01ebdab92e34b56080e7403c87

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.8-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.8-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 eaf60f1ae93565b32f29d05143cc0ac424f79bdea49fbd469d6cc2731bfde98d
MD5 a408f9987fc529f145c7aec2ce7f98e1
BLAKE2b-256 16258e4403073697459551418383adcd78db2ea30093f45bb071fd73e22cafd3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.8-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.8-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4e67ca61eab7f88d6c1168866ec5c2eec00ccdd5e05cfd4b49834899d2beab2d
MD5 fe6bd4f7d8841511eb48676e250120fb
BLAKE2b-256 7b2d09d31fd048c254d3b5e4f987195d9f3ad42424c1e0716bfcf8b3244d5750

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.8-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.8-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 ca6490c25588903960fad468b12b43c4e6202021b84559d0a7cb64b4e3afe7cd
MD5 2ae6cd295386ca8f32a54d4e8612fdd7
BLAKE2b-256 7614d9fe89e2ad8f03d581aedf30c8f2dce783942225cf64b4a9df6fb3b88dc8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.8-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.8-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3654c659c81ec0af53cca767b31485009ccf0eedf8a7a7039c9a3058826f2d36
MD5 a1bbd7d18c534e0207e7cc9cf336d050
BLAKE2b-256 75c745b90353df112b7c79026914249e92ba88c2ca82bafeac9fc6a4373413b2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.8-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.8-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 456b42dedbec8bca26bfbdb39d0de23b05290f4c3fc728905252f5fb664a77c7
MD5 f682ea51344ed81d3db301273f997dce
BLAKE2b-256 c8dbb0b80d7fb3cd54c060a881a7e7269906f252b7e04bf37da085302d5e32ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.8-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.8-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4f09c2174426a687ed1c276202083780a8590b704a129833f6abc78162654960
MD5 a3e73602671c0d524db41d702e9fbd98
BLAKE2b-256 d53002c12ecd088e3463bcb3cbb9a9f0857ddf420d1c8a929b07711d2236d6cc

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