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

Uploaded Source

Built Distributions

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

Uploaded Python 3

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

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.5.0.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.0.tar.gz
Algorithm Hash digest
SHA256 0e6300b12839eacefcc96f702267929a997c958f69d0a72db8a5538219371e3b
MD5 3067efdd39b768ab1ae4f30c61cce2ca
BLAKE2b-256 6b6c9700b0fb6bdad102a294d73d8d7021ae6e94a9877119824af133e8ba72bb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06a17e3ab4b93cb96f731534bf426706133142f3bf4343004cdba396b25b37ad
MD5 7825a1ee3d435e6ea9030fc8c91335d8
BLAKE2b-256 05dbd1087711d01d90b65c466d03a7f8565dbb89021c440730a750458deee606

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.0-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.0-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c010990fa20009d1677e7858bbf6ed438eb88be1c8dc4874bed32c98a1a8aafe
MD5 ff0359f58a45430bb105907bfbca9096
BLAKE2b-256 e706f7f36442adcfcd48cc325e3f6bef4f1a37f9b7c9b1d43ac039e668b70176

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.0-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.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 0247091e03a68284a9535557f72dfea292be3784f60b7614e7e05dced3d987d5
MD5 00e347ee3036cd611b1ec24fab9aac40
BLAKE2b-256 bd3d8c4c29332949deaba7afae93de1d24c858a3525c7ca42c8fcbcfa35d21a7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.0-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.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 178cf28f0b5c623b3b164dffa83c73e4502bbe3eeb24b84eb60461fdd5fb740b
MD5 290fe5c57ebcc88b820b78daf8c1c548
BLAKE2b-256 ec903eb36cec708cb020132f98aa8e76c69de1124f804b641a40fb12e8d0eaf3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.0-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.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 dcc60a3421c1e202d8c8555eddd624630bff30fc41792a4a5bac5dd510c165ae
MD5 0e7a6c1055e94b0725e12d3d127f411d
BLAKE2b-256 776ccc488ddf1c9d195da806d6b42808fc2ec35ee8fd4c74eb90b99402ba987c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.0-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.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 944e83f2f8cec8f6fbb27dd0e44a47a3049de110ed221802c0ac300892db1396
MD5 c909aec8e154f99391d9dfec4c4959dc
BLAKE2b-256 bfe95326ff420b2de42390e20fb9edb1cbd6120f94920012e6543b666bb7d52d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.0-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.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 482c7c41859a46087f5bf56d19ae1a92c6558f14a355182dd24676292c9acb49
MD5 8e0a6863ccdfb841f3e3a71c397f0f1f
BLAKE2b-256 96892d65d82a841eb649446419402dbb10344f322392c495797ef131c6018dd4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.0-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.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ed9fe6d7fd71d36097210cdc4b3fc41537f2277cb5640507434eb0407c1f97ca
MD5 70d1567f3fc98c6d735edff8eea6781b
BLAKE2b-256 ae6f6841819b91682257e745db9399171244e995c897fea8440434a2543500e4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.0-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.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f71c767c4d4bc48b42d0399c86a499bf59667bbf6f3beea59c4ec2372380e42a
MD5 4008819d891392a521ad306e5c20188d
BLAKE2b-256 4384ff912803b70e4be8be9ef938410e453dccebbd4ed7ef51f22149e72e5714

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