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

Uploaded Source

Built Distributions

perception-0.3.0-cp38-cp38-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.8 Windows x86-64

perception-0.3.0-cp38-cp38-manylinux1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.8

perception-0.3.0-cp38-cp38-macosx_10_9_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

perception-0.3.0-cp37-cp37m-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.7m Windows x86-64

perception-0.3.0-cp37-cp37m-manylinux1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.7m

perception-0.3.0-cp37-cp37m-macosx_10_9_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

perception-0.3.0-cp36-cp36m-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.6m Windows x86-64

perception-0.3.0-cp36-cp36m-manylinux1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.6m

perception-0.3.0-cp36-cp36m-macosx_10_9_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

perception-0.3.0-cp35-cp35m-manylinux1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.3.0.tar.gz
  • Upload date:
  • Size: 1.1 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.0.tar.gz
Algorithm Hash digest
SHA256 b351376df4ae45c52f87421187d90be81f339ba6e25089fb29e3a5b05315a1b8
MD5 b7fc7755babfc8e323758ba9cd94953a
BLAKE2b-256 56ececb45643d9bc9dc69f8642d832621684a7a78d7877a6f82d181ce0b64725

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.2 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.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d08efa6315582c623b3bace052627b336592eebb09e8c0d382cfe6ac698c3d50
MD5 3f8e2eb531fe768a6da1531cf8aee2e3
BLAKE2b-256 249fd42f884a1052a554044cb263ea636c724139e361f5f88187568b531a7a94

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.0-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.5 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.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6fcbad28695583065d1a4db2e7bfef6847bc842b518003b55a9dafe92660b61e
MD5 5930e95b3e9860ffcf147f5981ede7e3
BLAKE2b-256 63a606ef7486c33766363fa64b63a3e83a8d8320b998fed3e6256ee55099f3d6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.0-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.2 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.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 578d4f0c46ef1d45cfc56a612272336e0da3be3bf8508be43c1574909e01295f
MD5 0f8e26d2fd452dd1fed3b5bc8e497f79
BLAKE2b-256 61e574ad359bcf45336af829c60e9f8a6f5c73808fd5671a66936f0ab1236833

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.2 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.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 fe22a02a67b9ba495e6a7d44785c2c96899c35e6f8afcce6af3af74e335ed3bc
MD5 603873574c0ff276b284f217447fe873
BLAKE2b-256 b7527e5ba8cd3fd4da8f76b2b7e6d28f64875f12602931e6493a038a0e716ca0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.4 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.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 66b2eae84f1e35c8c729ac105da2cba96bf3d918482b276263e2089701f2c30c
MD5 2ccb0e4378c791422f2741b1f5ac5509
BLAKE2b-256 00de3cc8ddf90f6bc6793a13e88c7101832e71f412af76bb7aacd2a26268ea28

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.2 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.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 62c4e27c7dd74adfc51cb27397eb5748b2441786f54583dc985e7a22ecbe5713
MD5 491b33b0cca6de3353a2490fad466e23
BLAKE2b-256 bfb3eef88d25f231ab8c21ecf62f0af1d9973f650ad5ed1af6d65067f35a83ca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 1.2 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.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 a7e55fcbf00f938044be9641f99d47381b06e6b3935d7a2ffc8d024c6be51377
MD5 8cf4dde48443285812028558a4872557
BLAKE2b-256 cc0979f59c9162c2ba76d92ec83eb948744c0d7784fbc150de1adbe831c1dda2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.4 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.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 94eb95887495641b7f67a45eca4a4e3d1ee286bbfcf7e690553ff8f43055acce
MD5 f69513bd565824610f184959a163edb7
BLAKE2b-256 6818295cdd62a11e3b91facbd669e9c887ca0a71097a82355421a83ef1f7608e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.0-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.2 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.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2dbf97c43a317038605f138a9e355a7c26644d94033ebb9c6747962a48c28846
MD5 fef32410b4e9aea928002890e3b342c8
BLAKE2b-256 848efeea22bb082698612c6c33f3146474f1bea8a0ddde9b16a96bd619c6f7fa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.3.0-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.4 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.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 deda41f88a6a93ebc4f977445721ed7fc2c20e9abb752d32764b2e7f869cb37f
MD5 49c434e8d1b1451a9b9d931b43b3fc02
BLAKE2b-256 cae8409755741ab727b35e6065f0087e3ad1516d622e7485e7e76a7ed94b920e

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