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

Uploaded Source

Built Distributions

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

Uploaded Python 3

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

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.4.6.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.6.tar.gz
Algorithm Hash digest
SHA256 f2241df95d417126b71402b5fec44ffcd9856973076109af4eedef05fa9a36d6
MD5 c99cd4f9045c64a505d5bf817fad833d
BLAKE2b-256 cd167e6a26e0bf0ce24eece547b0923aafea62289d68fbcffde5f8a241470aed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.6-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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5eaaabc5c1ed579f4d66926484faa85ccf3e09395d2535ee796d8eff3e42262c
MD5 65bda5d8d96e744a995acd78d7c57e7b
BLAKE2b-256 becbcccc40b957942dffb45736452791b419e08688fa7b3d0227257b71fcaaba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.6-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.6-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 bd60e890e6ad0a4b32f8dc042e4e80ffe3ebe50e9dbb701af456166d43c9d666
MD5 0d6dd277ce520404dcbb9f02d99ddaba
BLAKE2b-256 2fe1194ba47d52b1ef0da32959f546bf6b99aa5ea524da9eda10ddef2271db8f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.6-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.6-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e71e9a483f7446028243c6445890f9efe7aa682f0084025d2481a43b0d46a780
MD5 e8e852055cda0304a7d18c207923fe0a
BLAKE2b-256 82c594d7976dc5257ad62becdbe28b159ce183c5e0caf41b86da50a7136e8832

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.6-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.6-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9631d4abac7fcd941e952b81f47ed2c8b86b74f636a7ab39df03c100d6bb6559
MD5 3fdbeaca4e402ca96d0d6fb3515bbe84
BLAKE2b-256 758c6d057a53d9cd6ff860e850d8eaeaa198a70b5a389dbfee2a702dc6cb973b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.6-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.6-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 d1f8ea98b5e1083c126813fdf94f02ce90694d13bc60c2a96659bfcaab23f834
MD5 38c9ec8dd3ad560824db7fc76820e727
BLAKE2b-256 9af472482d0e697d31d83fa1baf3057ce3f509378671c41dd41e47ec3bc82cc2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.6-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.6-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 928ccfe97d86a33e0ab113a134ccfc559e2f6882f2c36ed36e27d8ad5a6e8393
MD5 bf892a0bfe016fa9be8d7118bdd62775
BLAKE2b-256 5cc1f118841e2599dae20849d0645a3460abc22535e1c9110d0c55045632aa5b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.6-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.6-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 22f39c5b3f37a05fbd2c62f677f223ffa1210d0a4bb8d6c3b88ba50f4e60262a
MD5 2ce1c239dc7af1e66e7fc6561cd4cfcb
BLAKE2b-256 6b0550c266ed6824050478f36ad022924575ee0d04fa86642ad58fb6bed69f56

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.6-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.6-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b0a37c7b34f3ea58481be24c722f689716b2ded5e90ab60df562e96347ccf9ad
MD5 eb72c7e9564ee5e49542ed0985ce2e40
BLAKE2b-256 fb1bb78a6648269f2d24410de6d07051984fd70e668658fb61d956f2ae79a5b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.6-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.6-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 59c3c0147058dde3d083fc10621e264025d54586446f07f3ff001cc08e3e81b7
MD5 0721c8fb66386d8d3a117c0080e0784e
BLAKE2b-256 de24e8291aef798efb698f9a7e492329fa8d5c433e41b830b9859d7ec0c2399a

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