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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.3.2.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.2.tar.gz
Algorithm Hash digest
SHA256 2192a3f37ae3cd8ced5ab3428b18fd22efe08ee6b7838258bcf07fa38c541965
MD5 668fef8d626468dcc53e2792600eb6f8
BLAKE2b-256 c42f19ddb8cd827f4cad7e543eea14348679e8bb70c0c5cdc2b75b8962cf8019

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.2-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.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 3ca265df05956b3653515676bfcf3041005fb7b960ecc87110730ff4df396acb
MD5 578a68115db115324cf29c2ae5f08606
BLAKE2b-256 422646b318ce9848dddb6ed777db856f2a52a26e9223c96bbb6ba91f028d7f9e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.2-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.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e5086907a3739d7f9eec338fe18bcefaa4dd947eed4f02d2224e9fbf5234fa34
MD5 e80a535e67199c3b6dbc8f6c9d34a91b
BLAKE2b-256 4c776c63ada9c3ee572644ac62488ecc3106d33a61ebdae185aac78679408de1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.2-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.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2b1e9ed2738c8cb7eb45e95fff2c32e7d5b0529c99357d57c503a98eedb7b412
MD5 fa4b570a87527f7df123f47ce1052b9f
BLAKE2b-256 5ee0b5a06ad6aaa5306307b45beb9f047976be043bd22e6eb95f50f8b7a1096c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.2-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.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 7ad97cb92a531a670736450dbbf2f359fd25d571f266f960b258d70603266649
MD5 987795862ef63c1e572a9380d432f35d
BLAKE2b-256 d7c433a97fb84fa8c5ff3a5209961d274bfc9fc228ad55123a6712637787aaac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.2-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.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 79a3d5bc230f5ce649cbbfaa2921be2f0210bd8259cd004f34b28e56c14d4919
MD5 f34285bfd4f3920e6d600d0fbb4c9238
BLAKE2b-256 dac549f388e7dc28ecf49256d8b79283bafdd703794ca40a881ee0b608bb4e84

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.2-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.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b88581cc9cee0c159b3360d8b41b31083ade8f4b5d4f0eb61d3b83a0c2058f7a
MD5 3e3f7173027acbdbf7dce8034dd70b35
BLAKE2b-256 784aafff6dc943dc4a90efb2a9c1924e98f36e31b979e3bdb59fd47e2a7da1b8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.2-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.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 4e8466aa153523b1d06ce27684177a833d9a0f05ece7a93f3aea9b2104a5f5f6
MD5 aa160823b3dd23cdc71210fe6b9d4f53
BLAKE2b-256 303cff772b8d7c2f67f842067a14644cafa2395085692a6692974dfafba6bd94

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.2-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.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a2b640f42e60bc927e87c13162c261ad1d49952a6010a5fe414ca898652f1e47
MD5 250d7136384270173aa3b1dccc289769
BLAKE2b-256 242caab4ea71ec63f6b5d3c2e8e7fb309f14a1ddfffa2e640b5d9789512bdb80

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.2-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.2-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9306802a3b28c112fb8523f89e81757c29d269699456675bf7a4c172dc9adf29
MD5 62d1edeb5f67e449413cfa5a14f3697e
BLAKE2b-256 c7169fb656e88edcd19e617628dccdacfc4fb37f669bf04935c50657c67e5b83

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.2-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.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b7239d29ba5ff74dd11a11459fb119e0481646b9b5e251f05007771a2c80fca2
MD5 3ef83bb7fc3876600f41cef2e487f0a4
BLAKE2b-256 273349a508c89f3e913d055597c2ac8f9afe6eb131efe291ca3906d882bf8e47

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