Skip to main content

Perception provides flexible, well-documented, and comprehensively tested tooling for perceptual hashing research, development, and production use.

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 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

- To do a (close to) comprehensive check before committing code, you can use `make precommit`.

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.

- [dedupe](https://github.com/dedupeio/dedupe)
- [imagededup](https://idealo.github.io/imagededup/)
- [ImageHash](https://github.com/JohannesBuchner/imagehash)
- [PhotoHash](https://github.com/bunchesofdonald/photohash)

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

Uploaded Source

Built Distributions

perception-0.7.4-cp312-cp312-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.12 Windows x86-64

perception-0.7.4-cp312-cp312-manylinux_2_35_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.35+ x86-64

perception-0.7.4-cp312-cp312-macosx_14_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.12 macOS 14.0+ ARM64

perception-0.7.4-cp312-cp312-macosx_13_0_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.12 macOS 13.0+ x86-64

perception-0.7.4-cp311-cp311-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.11 Windows x86-64

perception-0.7.4-cp311-cp311-manylinux_2_35_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.35+ x86-64

perception-0.7.4-cp311-cp311-macosx_14_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.11 macOS 14.0+ ARM64

perception-0.7.4-cp311-cp311-macosx_13_0_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.11 macOS 13.0+ x86-64

perception-0.7.4-cp310-cp310-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.10 Windows x86-64

perception-0.7.4-cp310-cp310-manylinux_2_35_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.35+ x86-64

perception-0.7.4-cp310-cp310-macosx_14_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.10 macOS 14.0+ ARM64

perception-0.7.4-cp310-cp310-macosx_13_0_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.10 macOS 13.0+ x86-64

File details

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

File metadata

  • Download URL: perception-0.7.4.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.5.0-1025-azure

File hashes

Hashes for perception-0.7.4.tar.gz
Algorithm Hash digest
SHA256 bd25ee8c89d43bc5f48b723ebdb99acdcc425c62378a2d8384e347a7c74c869f
MD5 5bb8cdbe8f1b8336f89d8bd3972f104f
BLAKE2b-256 ffb52e1d6f07baf93356c9aaa84f1c435ff3f84dd82c1c8cc1e693485387d3b5

See more details on using hashes here.

File details

Details for the file perception-0.7.4-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: perception-0.7.4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.5.0-1025-azure

File hashes

Hashes for perception-0.7.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b2a2451257c0c5570d6c38e3403dca07178b1db143783704698206f176a069c3
MD5 54bac6b9e0f6188096f81253b466ba04
BLAKE2b-256 d02b6c95fb7d14eebb4804cc131ed78f748fdd7c175f20f96c9b60e65b3f0ca3

See more details on using hashes here.

File details

Details for the file perception-0.7.4-cp312-cp312-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.7.4-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 668b7c3b37a9c0f9845bc2d1085be5059a9cd6a3a5b4a3a041438a91dcb1ea08
MD5 ad8a1d4935aec4b828948aa6cd5908d0
BLAKE2b-256 ea614ed3ade6495a456ec4ed078b3712b7fbf7c87f9d016a208f973ccd0d0173

See more details on using hashes here.

File details

Details for the file perception-0.7.4-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for perception-0.7.4-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 2e2d39a40d8fc4bf30db2fad42b7f4c708dd3aaec5dffb474796a64afc9b9cf9
MD5 a1e6643c0e9259addaf9e64b6d5cbfac
BLAKE2b-256 7a560ae249bdae9947959500a717567db07037b307e3b1baa6f09cb16b92ff63

See more details on using hashes here.

File details

Details for the file perception-0.7.4-cp312-cp312-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.7.4-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 1f8f4afa93bd6df7effd491a8cd81230bb7cddb3820272d9a90a9a19f339be10
MD5 d267b292edcecefabd7725d6de49db52
BLAKE2b-256 b6d889dd17a8d087822ddfe29e34b5cd02527211cbccaffd33722f2ae9e30305

See more details on using hashes here.

File details

Details for the file perception-0.7.4-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: perception-0.7.4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.5.0-1025-azure

File hashes

Hashes for perception-0.7.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4a2806f74f5354c4b063d029cfc0fc74a0f44e408d49bc07b5dc74d02a5223a4
MD5 7f5ba197178fca30f5520da00c425f11
BLAKE2b-256 b97538b0ebce518395b4c189c7ef0bebdedb7a71b156b37b2d9f9cddb994e1dd

See more details on using hashes here.

File details

Details for the file perception-0.7.4-cp311-cp311-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.7.4-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 f9c5d563f4b3707360077759039133cd0f2d40d78043f9f3e94a1791392e2f62
MD5 5590c6868a0047c216e4464c5c514d88
BLAKE2b-256 7812f79e1b8e8f1408eb1b51af917de4df583c3d14467b745a977410c788fa9c

See more details on using hashes here.

File details

Details for the file perception-0.7.4-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for perception-0.7.4-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 15cc82832ad6ed13288a62ba7d87890fb792f9844c85a58038c865bec066afd1
MD5 ba83cb0d62039806a46380b295549797
BLAKE2b-256 56ded3e0d3aa319310bee227a90f1cb6ca1869710e2ad8716fd0b5000075eee7

See more details on using hashes here.

File details

Details for the file perception-0.7.4-cp311-cp311-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.7.4-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 2e3c77809677da4becee830bd43c1f54c620c9d2da299d33db8d1e853ae99e9d
MD5 92499b4d5ec6e4b20804979c41906073
BLAKE2b-256 c030755a163b8ae4ad1c412882cc2d15d7819ba845b07f054feeabf11175d164

See more details on using hashes here.

File details

Details for the file perception-0.7.4-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: perception-0.7.4-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.5.0-1025-azure

File hashes

Hashes for perception-0.7.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a7c5b5561fa2807a9913547a5824fcddc7178d5910321186784916baa56bb925
MD5 02d0b3d9e7623cbc5a584d82bbbf2857
BLAKE2b-256 da4efc1d49a10e12e7a131301408dff4f8275875123f034ec3ccbe4a1c53aa0c

See more details on using hashes here.

File details

Details for the file perception-0.7.4-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.7.4-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 90a2721ca7576c02be035c05e39d1036b8449a960b4267b8f3b6a6f3b5157397
MD5 ca866b7ba21b7bb984787f95fde54776
BLAKE2b-256 aeff3394814a7c4e6bcb35ebc29faa699de44a0f634d337e6a4ee9471d4a4fd1

See more details on using hashes here.

File details

Details for the file perception-0.7.4-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for perception-0.7.4-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 4d319e4d3818c6bb819a83d8d64733573a29d74b1f9db67c81ccf2b7fc5fa918
MD5 1251d11603f6b28f666dee68ffd4b685
BLAKE2b-256 ee10a508f8124b6d5bda2f25553d58fb391196ea06ec7d9a5177420abb19a08c

See more details on using hashes here.

File details

Details for the file perception-0.7.4-cp310-cp310-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.7.4-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 1dcaf0457b54583605475f9d733627512b8913485df4da421c0e05d1186cb2db
MD5 ad98258da6e85179e2f1cfe231184ac9
BLAKE2b-256 03e99cd4171d943c4bfd7cb152579b6d5cad1989bd6c198e4fdc0f0ece79d60d

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