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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.3.15.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.15.tar.gz
Algorithm Hash digest
SHA256 2d8ee02e985910d2544ab2ef9aa05c9442bad726e6a80caa493defacd9dbf955
MD5 e6b0d26a36198883c98bbb5c00e01b8c
BLAKE2b-256 86fdc5f01da1ab591192d6bbb05fdde5b19b59560b3955a1bd9f23c0fe09fbdf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.15-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.15-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d681ac015b33281d8940a96c8d4227ac7e7ed185ccbfb8d7cc99d85045c5717d
MD5 1da86ab85489f835bdef33535eee02fe
BLAKE2b-256 d7680411c8e3de00f0b291080489483aa0e93cb8a933ef7710a3a7d9f309dfa0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.15-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.15-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ee53cb7c1d3c4e3d08eaef3228f10f028f03d2ab1f66d53bf78a9591dfac3779
MD5 61a8596e341f2995460133d08f2e16dc
BLAKE2b-256 d1f45431aa595f278f2203bd386b0bdd33f7f77b475a037d12f2324b278df88b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.15-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.15-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 da2597b1f614dfdbf5a533d9382ea02508fdb01588ce74a5585a166847c7b609
MD5 cccd73843bdc66465706873279971bab
BLAKE2b-256 6a852f63927379d708cb3d50609f8d0cdfe44e5d7bea926366719a2c39793e56

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.15-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.15-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2205dffe756b15f887b657aebc0bfdf7242281c14a4cfa1f8974e891ceb2df0a
MD5 d7d6d758cd7601ad128601817b3c457d
BLAKE2b-256 61862cee53d40e8a4bb4eabfc6f7c933bc6e466a166a059605158eda23899705

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.15-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.15-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 6dac8b7c41d0fc6e85ed41a969409a4702714971d77670d3622f898df49f63eb
MD5 dcd728ffa990565114dac71bbfb2f21d
BLAKE2b-256 c318ea046644d61f70d17e9d3a91661b1198511afb31bafa9991f5659a8a8c9a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.15-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.15-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c57acc7681d17005bc612561e0c6eddcbcc02eaa61aecb62adfc01782f966199
MD5 8027c868f6ee17e482baed5745a96b7a
BLAKE2b-256 0ded56f9af95752e1109ebd9355a21d0f1bf21cbaad0e37d5dbc1cdb79578ff5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.15-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.15-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d6da7f9c62e2e8d7d49783f35669f1e231baf2ea87d1911b3926ee006ed7ad42
MD5 3395d189e9a490468ebb6e7aecf12fae
BLAKE2b-256 e49262f0fa14f20f0d693f1222f245fa4788a23c64c10ee6d1d1eff7168fed7a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.15-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.15-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 522d2482b18274cbbd872892b9526e41104ce011cfcc277e719b768caed76b42
MD5 5306849c5e9ee84d2eb3ea4ac9749ad8
BLAKE2b-256 c4dac4913366a030155750ad2d64772ac2d05dc2cb1d4ecaaf93fa5edc79ce5c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.15-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.15-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 00d60583fd5480d943baa4605b5d536e9e9816b440ae67e95f6bf47948075042
MD5 f2a1585401854b88eee0b4738b1b5378
BLAKE2b-256 4d38af845355bcd96a5c111182734e56a2face9357049a41ad4a75b09431d50c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.15-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.15-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a8e20b7e3f8f57060458fbd34dd843a780fe4b1e19953a418dbca6652604a053
MD5 678e519290db31219704eaa51671bd29
BLAKE2b-256 1ef158550674e103af5a9c2a7bdb10cb5757e873f81b314717e83654a211bfd7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.15-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.15-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 635d276ece50d38cccb274f7e3a4089d12c4cd38a7229c4b4aeccd55fc1437a2
MD5 8c927be460552ddd52f45186b925e6aa
BLAKE2b-256 d814ee96dc01c085c710c916d32df7d1722bbfb575b15261f536b4860fe425ff

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