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

Uploaded Source

Built Distributions

perception-0.5.2-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

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

Uploaded CPython 3.9 manylinux: glibc 2.5+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

perception-0.5.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.5+ x86-64

perception-0.5.2-cp37-cp37m-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m manylinux: glibc 2.5+ x86-64

perception-0.5.2-cp36-cp36m-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m manylinux: glibc 2.5+ x86-64

perception-0.5.2-cp35-cp35m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.5m manylinux: glibc 2.5+ x86-64

File details

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

File metadata

  • Download URL: perception-0.5.2.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.10

File hashes

Hashes for perception-0.5.2.tar.gz
Algorithm Hash digest
SHA256 95e17ac2b0d14f42e8e3068b1826cf307f4f4aec34168fef86f3290873e7b062
MD5 494f6a9caf1a57ed4f445604e3591c3e
BLAKE2b-256 726dcdabcaa53044b3ec67b524e5b5312348db2e3364c4e2fae8fadd24837328

See more details on using hashes here.

File details

Details for the file perception-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: perception-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.10

File hashes

Hashes for perception-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6af546fde3a180ce5d2fbbc717de156889f29427612b4de8b4a4477f0e9fd1e0
MD5 017bb096e50129ce87a60335f6528198
BLAKE2b-256 cde549c920280c262d7e34d3f3f2b7d65230ac73c6d20a1cd7e9d78ea00f08c3

See more details on using hashes here.

File details

Details for the file perception-0.5.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.5.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 47857d58e43b01c2924ed5e74561e2662c969172bb51639e3ffd07b883a78b9b
MD5 f16ebe5a8116576d054b0768545b65db
BLAKE2b-256 f7dc4bf2be3750dad85efcdbca31c4f58f5a958cc315c7332939d30aff13c571

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.2-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/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.10

File hashes

Hashes for perception-0.5.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 43ac7750c7568e2c076993fb907995c84011174a583ddf3f3d560f708f8d2b23
MD5 a0c0e1eec1c89cbd5609fd45f45d8f01
BLAKE2b-256 f61d4ad08c2b9a48804390f9e58bcc925c7dec01ba8c8e709fd36040bc51b0db

See more details on using hashes here.

File details

Details for the file perception-0.5.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.5.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c520e7ee160e945e6cdc8884c423be80bd42ec3ccdd5c6fdc6bc56c6738c68be
MD5 0a8351f36fce3707ace6729374ac3e58
BLAKE2b-256 4e35281c14789740976a9b04f5ce2fae34c351c259b8c8077e6d07142a8845ad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.2-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/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.10

File hashes

Hashes for perception-0.5.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 920138de27830a632f166d1f23e0ea14d65ff24d3f595416fa1a81fd570bbe24
MD5 12b80e4be77198004c56b02b1fac297e
BLAKE2b-256 2619a72b3a32c2444508f09c010e98281d6bd7c0374df0804fd45135f908851d

See more details on using hashes here.

File details

Details for the file perception-0.5.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.5.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 181f88d11a7991286142cca19c2d63281cdb52bfd2de33df1daa0a2a3d45ac50
MD5 5622ec7f92f1e2d2b38608131d6f4e19
BLAKE2b-256 9c39122502e00db01a9b3673b6832426dfb013a1e9d7d6dd9b9693f73b55d321

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.5.2-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/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.10

File hashes

Hashes for perception-0.5.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 f71b03617382143662a3aa7ee18cb1eb262e2f109172a70a021e34566b46fd4f
MD5 88ede58bfa37d22de16828ac71462e63
BLAKE2b-256 b722fb4d5a6cd96a15ca832f11cbac1cbbf1a99651f58ef7b413bc128eb91722

See more details on using hashes here.

File details

Details for the file perception-0.5.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.5.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 023e756714bcb781b41025b18a51b7bc082be4fbfac7cc11f13f58230bba4f47
MD5 24166517b9809d4ae497462ceb7ae2f4
BLAKE2b-256 4159af392b269722ae3d18d113b3a22f739e4797620d22613cbf6eafe79da554

See more details on using hashes here.

File details

Details for the file perception-0.5.2-cp35-cp35m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.5.2-cp35-cp35m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 177a8c04d817c43061290edbe2b71154a3763cac4fb54d4aaca131db08588243
MD5 18eb8a41ed0fd0ee2a04ae90c45f58f4
BLAKE2b-256 f992b8b84c72fc535d0ab6483699aa5ab3e1de74d063b6fc3da2d52350eb3782

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