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

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded CPython 3.12Windows x86-64

perception-0.8.2-cp312-cp312-manylinux_2_39_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

perception-0.8.2-cp312-cp312-macosx_15_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.12macOS 13.0+ x86-64

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

Uploaded CPython 3.11Windows x86-64

perception-0.8.2-cp311-cp311-manylinux_2_39_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

perception-0.8.2-cp311-cp311-macosx_15_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

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

Uploaded CPython 3.11macOS 13.0+ x86-64

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

Uploaded CPython 3.10Windows x86-64

perception-0.8.2-cp310-cp310-manylinux_2_39_x86_64.whl (6.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

perception-0.8.2-cp310-cp310-macosx_15_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

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

Uploaded CPython 3.10macOS 13.0+ x86-64

File details

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

File metadata

  • Download URL: perception-0.8.2.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.12 Linux/6.11.0-1018-azure

File hashes

Hashes for perception-0.8.2.tar.gz
Algorithm Hash digest
SHA256 3c64808a51d6a5b67de5736e562577d5922e767af87eed979c1c4cbfccde8d37
MD5 32045dc9286b6964995e5c9b5643f4dd
BLAKE2b-256 d8e9bbf95c190afb6f4530dd2dd0f528e7e380c6502d99f108a9abd78f990d9a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.8.2-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/2.2.1 CPython/3.12.12 Linux/6.11.0-1018-azure

File hashes

Hashes for perception-0.8.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 eb93d3b331ed957e864b155c980f30e8fc54b04f9c59cb7a3dd22e12ea10d439
MD5 91cdd8643a3040d8ba795a203dca78b9
BLAKE2b-256 ff209bf10207dbaae849f6d5421f6766d65286f7f795bf79a3cfc2e815cd8d13

See more details on using hashes here.

File details

Details for the file perception-0.8.2-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.8.2-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 2867fc94fca9ab68e2d6c0cbbbea41fbd505f235f7a3639929bcccb2f9233999
MD5 40320e4d9b1ec976fd1f11bb9cc93283
BLAKE2b-256 4be276b4d5b2841cc8a7b1a54d0b8efdf134d81a6adc39eae8336d12bcfb43b2

See more details on using hashes here.

File details

Details for the file perception-0.8.2-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for perception-0.8.2-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 13a2a7c0348649d62198ccc2ae766520918549278d5548016ed4038b61796bb5
MD5 89a7f9de5c6c31049426387686a0c477
BLAKE2b-256 73042f1151f0375ef0ab2973d7b4274ea76a8e20a49b782627ffb6d1cb0411a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.8.2-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 e31f2cf2d343f312e25a949422c08872eb9cc58693c9d9d713cf47ec3cf1bad3
MD5 e4ed0390a550f125ab3c55dfffc1159c
BLAKE2b-256 7480e556c950fa84a9b642898c4e98d1fb40e4e5b699754345d99c20b4cc049d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.8.2-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/2.2.1 CPython/3.12.12 Linux/6.11.0-1018-azure

File hashes

Hashes for perception-0.8.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 32244e80dcd0461e2ff7ca9ad73ab29c8ab0d36756f63f3745fbe46fd5acbe53
MD5 bea1eab714ecb1f51605730e251f5015
BLAKE2b-256 2d1b70720d4e93540e602dc3d73e96a194224e0602bc1987d9801bf0f877d78a

See more details on using hashes here.

File details

Details for the file perception-0.8.2-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.8.2-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 9c2168a59898b2352d35e9872fe0d03baa025c2af4be101bbaf99ed264acb62c
MD5 4b471a07301f7a385b4cd506ca4a57a9
BLAKE2b-256 3675f5cc1995242a0cbf787435c207209edd97bad23d5a4e637e9e959e7853fc

See more details on using hashes here.

File details

Details for the file perception-0.8.2-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for perception-0.8.2-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 e89f70d9896acce4e24938c1cea78190b9aca5e940bc2f725f172697b0f7b5c1
MD5 0213efffc2d529c38dfe23e26bf93f46
BLAKE2b-256 05e8e85731b43fbd96a10bf846e58dca31981c3fbe520f9f6ea5f6024c27f5d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.8.2-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 865350623837e604289434f8cc915e6710f7bcdb5fd4d7effeeeafe84726e35e
MD5 6926ff5b143dfe8332c9494560453595
BLAKE2b-256 c690969ed25791904c4e5287b023c05517f087c80c593e19a52a11061e2f3521

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.8.2-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/2.2.1 CPython/3.12.12 Linux/6.11.0-1018-azure

File hashes

Hashes for perception-0.8.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ae759bacab63594f8a49441cb5b315e6aa98db800c68c3dc18d64ee112deae4e
MD5 093f3e3837cb607de7b436f20db9282c
BLAKE2b-256 a55848d31841f6c251844e2291e17253561583a9799864f13d1476edd6900bc9

See more details on using hashes here.

File details

Details for the file perception-0.8.2-cp310-cp310-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.8.2-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 14bb11f2f1531b52bcd2dc654ccfd899195f8a43666c9eb7bd6bb409cc2bf92d
MD5 e01ea670ac828e6fc5b146673fe25459
BLAKE2b-256 1f2fedf7ed27216a9ca6fd39245eb8b3274f8273bb49dd558968e8544b30ce2a

See more details on using hashes here.

File details

Details for the file perception-0.8.2-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for perception-0.8.2-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 1729fb9a5a2d3ea1676eb40a10ceb05ebdca1a37881160c8f0a8640861fe3fae
MD5 3884ce533124d9e9a9c9305f4738e55a
BLAKE2b-256 3338c806fed430eed6ff5ec4e5c129262e42c67c9649dd71591fdb25c49e0d18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.8.2-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 fb5b05256c361df92577acd0cbe1ca682834864b1bf719ee08b3d209fef5ede6
MD5 0e6c9510d92c89f1a133dc80f96a5efe
BLAKE2b-256 8d3f4eca7b52a03f823acff46932ea9f47e153c3ffb4d5d4d1f1d613b3368119

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page