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

Uploaded Source

Built Distributions

perception-0.4.5-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

perception-0.4.5-cp39-cp39-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

perception-0.4.5-cp38-cp38-manylinux1_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.8

perception-0.4.5-cp37-cp37m-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

perception-0.4.5-cp36-cp36m-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

perception-0.4.5-cp35-cp35m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.4.5.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.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.5.tar.gz
Algorithm Hash digest
SHA256 3ab8dc03e559b380001adfa6c14191591c84d249f0cf620bd6bb435ac7f98678
MD5 ab3e5285558300d4e1ceefeaf00a2aab
BLAKE2b-256 9da255c98884e99a8c56aaa226b9ac88d05fe10e3edf42a273cb1fa5638f0d32

See more details on using hashes here.

File details

Details for the file perception-0.4.5-py3-none-any.whl.

File metadata

  • Download URL: perception-0.4.5-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2848b866f2a8e421c5eda56867651a7f7de4988fbd3c6fa94edcd8330639591b
MD5 8a427c87942de6b0eee0b5b0c8a81c5f
BLAKE2b-256 b9ade2c2d52bd4ea9f2ad3ff10d93dac41c6fa78ddcb85e3c09063faacd8e113

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.5-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.5-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 934d26f918b6bef5c5374dce30ae3f5fb9f1fe2ceb470e4cf40abe5180a3fea9
MD5 999fc9353e9cb6197c5b7c4df418a7c7
BLAKE2b-256 5a8817847de0a2be5aaf62f3ed993083fc933306cec17304d2528643ff35fbd1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.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/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 def5829cc52d3ac83940297a95c12e443db386c52d52a8983f43fde0860bebcd
MD5 c4993c1e0f5f8428613bea2e4b5afaa7
BLAKE2b-256 4a827b5985df10ea84dd660b62dc00f9cd58e9021b919329115f82e42e85a98d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.5-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.5-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 263ca15530aed8a5c0d203e90184bfae3978cf3d8437e5277397a50145a2df5a
MD5 2ab3dd5a97c175d146b4e681821b2bd1
BLAKE2b-256 72ab89cd5d2ff8a5e7728f951c595219a372b87b3c3c8ae61b28fb1b6ac30ef8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.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/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.5-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 3d9caa3c6a42265feba95f1a112592166eff617c53d7fe3ee3bbc5e3861bbb62
MD5 e4fc07fa4eaf418eaff932ccbcb82bb3
BLAKE2b-256 6f1f095d663693a073d3a295a6625342a1527648879fa6d9901683f91586cba3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.5-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.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.5-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 93ee074b1c15e0647cc72381ab43227d86317edb1d15aa7eef25306bec4c62fd
MD5 359b601742895f38b2ef5512f016b8c0
BLAKE2b-256 1703ee563231a99ccfc78743a56da04a54304e96fb5892b2b6886f9480b5c0f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.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/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.5-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 c43f253a53b3750f6670787d04aeede1d4112ff831171aebf31f7cf5e3ca8c84
MD5 cc91b8a0f33be12da85d34a907bc7dbb
BLAKE2b-256 2e4a6ee5141e580e280cad9b464d8d0446746aef53f65161e0cf0db34c481dd3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.5-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.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.5-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 17d929aefca8e49716eb6efad481080d45f09aca1fa124df2f9b7eec26b6446b
MD5 bbcf9087c2480c9b3b6ee542ff1bcbf1
BLAKE2b-256 17c23d140c2f973a90ab928fe19a9307bc0b1ecb04eb7905284eae24a2394a2c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.5-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.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.5-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 273f0efed6096048ff13505cb3875cf3ecf1e08e636395aee91f3fea13681aac
MD5 51facbf4bc0759ba2767bf665da8bbb8
BLAKE2b-256 5f7bcbeaf4b7f13e0faedd3c0d8d0cee4f5a637c60be028f5b1491f711b10e0d

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