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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12 Windows x86-64

perception-0.7.5-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.5-cp312-cp312-macosx_14_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.12 macOS 14.0+ ARM64

perception-0.7.5-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.5-cp311-cp311-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.11 Windows x86-64

perception-0.7.5-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.5-cp311-cp311-macosx_14_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.11 macOS 14.0+ ARM64

perception-0.7.5-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.5-cp310-cp310-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.10 Windows x86-64

perception-0.7.5-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.5-cp310-cp310-macosx_14_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.10 macOS 14.0+ ARM64

perception-0.7.5-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.5.tar.gz.

File metadata

  • Download URL: perception-0.7.5.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.5.tar.gz
Algorithm Hash digest
SHA256 5a1e50ff0927cc6b858854a96d8bb4d88f7ef983975d1d957f694e6a64266df9
MD5 1305d4de4f95e5b6eb72567f7369f2a7
BLAKE2b-256 6abbf0160df74412ee2b28d45c387f91b3d2eadaadb36caac769b9df7d2f8124

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.7.5-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.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 47f649f1ef41ac7f6dd23455303edebe3e11af1cf43e3938c70e837dec20560b
MD5 7816bd15561bc0a397858cfa34b2f8a7
BLAKE2b-256 631a6edda888fe7cb31b459f025e49f71d771dc453268be6ed9c279436628c14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.7.5-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 3fd366531b64ce262d945fab2c43f92cf23a12a0b0a51d0f84eab9077ade6406
MD5 cbe5ced12117bb91e8f93863b346f721
BLAKE2b-256 c774c74768ce06cbc10d63346677f1eacc71ccdc2a7ddd4f114b011c4792645b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.7.5-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 3237fff8fb187adcc1dd37af7083784bd4461ec0673644069fad81a06184bc3c
MD5 0ca177f667dab052b26985f6867da349
BLAKE2b-256 208adb48b8c6c128a5e8a171195bd59acde3aefb6eacf56335ab9ee6ea9c63e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.7.5-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 143f5edca90bd4d45cb4399addd49b4f91f16d6bed33f93dea83cae22019eca1
MD5 eeb9d9f0d4fad5cf03dfb42a5b31d3c4
BLAKE2b-256 a3312d85c68ded5e93b36bf103c5f19fbb84f04b751ed3ea960ddcacbc6e1133

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.7.5-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.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2c3854078985dcb1929282ce41afd644a72e900e1c0aae4959a86d96bb00727b
MD5 dec4e04f73fcc87de773e827c8624f70
BLAKE2b-256 acda610fbb8f2727b79b53cbeb913fbdb56bf053c063d3569b690f9369f3d1d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.7.5-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 d968d6681a5e1d70194f05d9efb1c1aa38756decd55a2e968943511a3abd64a3
MD5 fd2fe770fb12068ecd7dfde8a2480980
BLAKE2b-256 38405af2f4d09278cb0ce74bdfa62d545a11467d13c0a70f03cf9ac8e33ac31d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.7.5-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 02cd071498301ba198aec6a34f7516786e8a08f24cae76dbfa7c2626e7726a2f
MD5 b654ced55ece5085a7f637be388edefa
BLAKE2b-256 20188f021ef4bbee56ae8828fb80801c0b056d6d4135db8080cd7433a2dabae1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.7.5-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 132ddc2a2102b8ff01723edf0ac0feaaaf38f2e98e4400e6a4a5740ea27d01e2
MD5 022068f05bb4dfd29d18f7c128813b29
BLAKE2b-256 cdcba83b6a04ebd1d1ae8152cbcfa619f74cb8017703ab63c9b305ec78ba09fb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.7.5-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.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c773f2d2255f8eb05cf44d2835a82fe150e2ca059563aa4abe0286dc3133c634
MD5 ab3f7aeb566bfe34c42b977385e47100
BLAKE2b-256 e129dac3e7e52df96b8420ea2538dfd6f16aca9036426e01fe44882804808fde

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.7.5-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 2c8bca8bd24387988aa9f6972a4275251644ed5a860a481f8122d7bf89ae9546
MD5 4f2c72c2dd09573846f1c90becee6539
BLAKE2b-256 e3f9e6be08e76f02444e34ff0706562bc76357cd81e53b95c8f6a5b1bbe5d52e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.7.5-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 51cc0de000c73139aa6cdfc5d25733339b3a230be6cdc7c5d930be456da32f9b
MD5 514bf8397a420f76f4d4d510aad3153f
BLAKE2b-256 6f8b4bb2baf7c4565fe40f661958fafd7458a2d32c76c9a6ecc274bad0d0a2df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.7.5-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 17545d7de1bdcc7c7b49194458ddff8e9967d62fd26a4f387b77131c946a68fd
MD5 8fff78fb8550ea5b7c589fbd45ae6630
BLAKE2b-256 1f57dcacccf1d36e9da417119d03ff2676000b1cf9ac6688fe37057cae821c92

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