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

Uploaded Source

Built Distributions

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

Uploaded Python 3

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

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

perception-0.5.1-cp35-cp35m-manylinux1_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.5.1.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.5.1.tar.gz
Algorithm Hash digest
SHA256 52030b1ec0e7c18df6b169d9fab658255386d1fe929fa5cbc6c71b28cca21c27
MD5 28918fc772f32270e0e5f6a48cec2820
BLAKE2b-256 35ee0fb27fee4b9dd77106be70d52125adc7189267588ed6426388d556332fa1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3d30c59c33079c486da4f87a0654d8041c3d8407c16f13db1bba78d64a7108b4
MD5 819190339227fa899b3777b28b7c7c31
BLAKE2b-256 6146a25e85929167c316bcf368b5188f1663a5e23314a47cffe9d21bd3926715

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.1-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.5.1-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4b19f15ee7bad1ea5698e8db2a0e5e468686d6bbdc860ec2242d651c57c84fe4
MD5 f9d3a6b510827da8c7f27b63d05f3d87
BLAKE2b-256 aebaf5dd66168c1ba62b2e6afa22a7ec578aabb34d05743ba94e744636416351

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.1-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.5.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 58f012fcee90e71da74822eb4b06a7e19fc1a695adf89ec622f4c823e94dbc24
MD5 a5a87ac3384291f04172d195252533a4
BLAKE2b-256 d277e9545749860a6233404b7814ee40dfc0b6f34a59017d8c85c0c8e7ff01f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.1-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.5.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 63e1e009efe7ef5b96208846ce7848f7444b8578353ee69b5c1a78c8dca73a57
MD5 7b863b3c6ae0a44441bf50f5fd2fe83f
BLAKE2b-256 5c16139fda0049cdbdebe3403a9bf2fb770c387727df3a33687576ace9c9b1b5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.1-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.5.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 5e6bafd0a06251920b268b16e537b07b6392aab1cfd6bf489a3be40fd47805c1
MD5 f7f2cd377de6fc4e69d3230a9fa06416
BLAKE2b-256 4b279da402bbceaebdcf4937789d10e432c20cdd02b664f27cf85dfe1336d011

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.1-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.5.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a030cf7cfeb77215e69f6112e03ab74efee4627284909481969726208c4934c2
MD5 d8af7e8e4ea76971babbee29ee132fa2
BLAKE2b-256 50d41e0f5214b21ef07e1c367a889071543aa75e51418f4b7ddd0cd41e6ebca0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.1-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.5.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 89075cffb883542b288ade44ddca76993a34f47c9e49ac133d67437da9554380
MD5 a828e6ce62d9d6fa22e6765c82a19b07
BLAKE2b-256 61c87b40990259ae1a724aa787c2522ad6fa966027931c7e78b91b956064707c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.1-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.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.5.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 90344ca7dcb975c06b97706d09f65bfd9a4cd42cdf3d62bbec50235072a973e4
MD5 bfb1f44f4a0ea097440f71cf5f68b7a4
BLAKE2b-256 a53af0d46c2680f773d84106ba30bb8c0ca87578d7895ab74ab68adb65a17895

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.1-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for perception-0.5.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c456d3c658ac1855f60dc36988a77305ae03dbb468a040747eea13b9dd348a97
MD5 fa09a37299b95750a7d596b665167740
BLAKE2b-256 319ea6176364fbcb032681b25f57fe04e6ab3b234dfefb5d6f94d48d38128613

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