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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.3.12.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.12.tar.gz
Algorithm Hash digest
SHA256 16092bf84528102c9b3942c98533920f71aeccc9d22eb40bf0d5b45c92a7f4f6
MD5 eb2d27ca46ab8454456c4c890ad333d4
BLAKE2b-256 663f778aad93ebc2268ac42cb0fb9f3ec4a3084f0271bc4876d33e804c771a82

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.12-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.12-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 41c94e96ecf5a0caefde4bf17ffaf0e4d1b269ac4fccfed7afc1f71a4662684e
MD5 41b68446cb7721f153c83f3477569086
BLAKE2b-256 be820319bb2997314b6ee4cf8c234bd84075538239f87d7da69ff2c4a5fb0930

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.12-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/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.12-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 1390bba8432d03b1e7c0e96bf5fd7be1b98a193730d8fc9921b44185e94f8743
MD5 b4d5206741b61f5d1ba025ad9cb109b5
BLAKE2b-256 03cc36d8dde042cd22f78387df1777678166bf754171329963e2505a8a49b90a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.12-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.12-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 25249f990695603b13edb44053dfb89024ab1a05d3aff3f5a142f6c8678e9b2c
MD5 3798b61f5271ece5d83f8d948098427d
BLAKE2b-256 995b642385f7806af03b58b3ff9c6033435404b54a7a4a0ab79fbedf51757d0d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.12-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/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.12-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 83bd7aa7c02be70c004118ef0027512943edcb8d7ec278eca882449ccae55d99
MD5 481d7791ba02b0337ed01769e80239d8
BLAKE2b-256 2ccad0a645be6cb8c67708b71c6e1478a6fd90cd9b0cd930a6cb3329a365439e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.12-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/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.12-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 4e2496b7d5caf87f5444474909848f7378bbf8c0e8e93b36e59aa0327a999133
MD5 c423f968047a8acd20236e27a75eaf47
BLAKE2b-256 3d239a8cae3871d2e188855174be5470ffb83c7318522dd6d22532ff8e2e1a04

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.12-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.12-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 becd62adcd056151cee579e91497798fc1a4aea9abf8f2163d422ed1e4102276
MD5 6ea3d9e2b1f5f66b8ba10849b365d853
BLAKE2b-256 c2fffcff35dea0984bcc6e1dd1c2ea9c69f91ecd7a97b212c63ad2dd683cc132

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.12-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/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.12-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2412a4d5bffa7c4222b8ac740aca49acafe25d9159a367a6cbb7e683045d4aeb
MD5 3462063e14764a6725ea925cd1dc0bf8
BLAKE2b-256 a2d4eb2530cec5be5f8372f7eb5344e3b3db353270805cb7c45fb0ed915ad15a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.12-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/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.12-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 c28e8caa9ad888aa4e6d1d54033c519fdc323b9c25b29abca0a3d2cfedecda81
MD5 816dacc02a50d304e0f21009609eca2a
BLAKE2b-256 8582534d7325ba18a40ac45dcccba4e19baf17060252ee2ceb4910c206827924

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.12-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.12-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a24e2c0323cd453bc179c9d328efc2241275583b2e65727a0b236aed7f3716db
MD5 1f6964fe376a768c634fcb315c469aae
BLAKE2b-256 72b2963448a7e2729349980ab52bf3f053581c941d509603efb9feaeb8a72cf9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.12-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/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.12-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5bd3f170b9cd227ef3b8d346ee67e93bee79f2a2d3f212485ce1d78c6378463a
MD5 86dc22121034ecaf1b5df173d847bc83
BLAKE2b-256 dd634267f4ec7150b38c5e4a8195a67fb803b107604bfc8763372c3fd655727d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.12-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.4

File hashes

Hashes for perception-0.3.12-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d4abb852219dfc4e10ba67700f6da4b5739b12e3270edeeed16e672572856a9b
MD5 3f6575718ff307d1f6a077a5094d50d4
BLAKE2b-256 ecd70edae0616dfab0b20662d2b71265c1f621629dba6281c3bbcb58bb48ddd1

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