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
  • Running make init will update this repository's dependencies and preserve the results in Pipfile.lock. We strongly recommend including changes to the lock alongside any other changes that may have been made.
  • 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.6.3.tar.gz (1.3 MB view details)

Uploaded Source

Built Distributions

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

Uploaded Python 3

perception-0.6.3-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.5 MB view details)

Uploaded PyPy manylinux: glibc 2.12+ x86-64

perception-0.6.3-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.5 MB view details)

Uploaded PyPy manylinux: glibc 2.12+ x86-64

perception-0.6.3-cp310-cp310-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.10 Windows x86-64

perception-0.6.3-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.12+ x86-64

perception-0.6.3-cp39-cp39-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.9 Windows x86-64

perception-0.6.3-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

perception-0.6.3-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

perception-0.6.3-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.1 MB view details)

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

perception-0.6.3-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.1 MB view details)

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

File details

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

File metadata

  • Download URL: perception-0.6.3.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.13

File hashes

Hashes for perception-0.6.3.tar.gz
Algorithm Hash digest
SHA256 3fa0f3c27cdb6e1073a7339a4b19109e76d891e4f2cd3b8bbd60046820a84ea3
MD5 a90443f1bcc53f6a5a29c5d045b7a95e
BLAKE2b-256 4a71554b549861c341f26af1270a53f71f1d0a0ad0fb301003f3790c201d4a14

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.6.3-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.13

File hashes

Hashes for perception-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 441bcd4d2a8b21cca0f4b987e9e3b41b9e0878d9c58be6268a50cceea011d4b6
MD5 f9a880bda111a9708d001a2e160cf8e6
BLAKE2b-256 212f4c390474985fdd6e46584b29ce4a03461bfb20ad30a71ad8c5d9378ff059

See more details on using hashes here.

File details

Details for the file perception-0.6.3-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.3-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 0ae96fd5023ce03525125d5f438e715ead79557c65997c869e72fca25d623237
MD5 f6fdc2cbf0f7053a1eabb2eb91b78da4
BLAKE2b-256 f7f65e4dd9adc9069a33621446795aa67bddf728b889fcb66d0d200e00d4a84c

See more details on using hashes here.

File details

Details for the file perception-0.6.3-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.3-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 26353d78374137a2fbd3f1a068691a8ac8fb7787a1ab89ea41d72046b9b298f9
MD5 e9a3608c714bc651cab09f6b6e2f1dc8
BLAKE2b-256 a0cfd0d7b84f2f7ad910a10340b9d81685002a51376b0aec572e9208de923a3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 bf3bc5068a9700c4055678d2fea9008bfe73107a0dcbe951836c4feb5d466ca5
MD5 769077b529a3d946afc9ec0bf731a4b8
BLAKE2b-256 05de54c07608037d629e18d565b839fa857b6e568794ba77c61381d76ca31315

See more details on using hashes here.

File details

Details for the file perception-0.6.3-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.3-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 ae376019c0b9fa89a86ceaabcbb57f4983fca5ca79e6ee37c79da4741868cb4d
MD5 048f72acb5cb5a1289b921f6b2a0df02
BLAKE2b-256 5dd7e1b58b9a5118d2ba4603258120d447e90ea275103fad38b49849a4fe8bff

See more details on using hashes here.

File details

Details for the file perception-0.6.3-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for perception-0.6.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 be06eb16ff1ed22de6cb810eccbad0979885ca5801858008f546cb37ee5967ef
MD5 35622e4d5ce89f5e7ecf357a560fa39f
BLAKE2b-256 09be41b001a0d74c33f16e40f0247714b614d0c60c851b26232e4ac8833f9dd2

See more details on using hashes here.

File details

Details for the file perception-0.6.3-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.3-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 40eb020882cc24f995b88a176fc144fdb63ce4ce24d7cd9e065337cbcc7bd262
MD5 4f7be1be8be16df29f91a30de4aaf790
BLAKE2b-256 64b60553215359c4ed6b87c97cc53581684fe9c27a0ef9c24db5761f764e1ca3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 414ba1bd6ba91e947bfb4b06dbea606f67e33d3cb850f71a346786cfca610635
MD5 d2789f801b515534800fafacbf7b52a7
BLAKE2b-256 71046dd6d40ce2526354fafa6873125cdd5d092113585beef1fe97da716d00de

See more details on using hashes here.

File details

Details for the file perception-0.6.3-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.3-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 2ed0f45370ac21f39b0ce1fd49d3f1bee7adf20675b119995eb7c051f13a41c7
MD5 9480f71f95259402870015107d52d193
BLAKE2b-256 b635dbbed77c04e0074b672433a644ea23866d626cd8597561e596553b3eb149

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for perception-0.6.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 8d84ec55e4c2c339fb5800e6f133b82e09e7729cc876cee4f94c39e873698da6
MD5 f3a1a523d61003910c4a9f37c9af7cc0
BLAKE2b-256 78e521602bb0190327fb9820b35a600a69becc881c2b65a7dc2867d5b1df875e

See more details on using hashes here.

File details

Details for the file perception-0.6.3-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.3-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 17d99a53103ca38439d5b9fb56cb880cdfbcbd6ae006fbed97ebeb7987b58148
MD5 39569c82f14d1056baa5a1939d9dd536
BLAKE2b-256 f7d14e1e3a57b28bb3fee56b2e9d034e1bf54f78a8dfa84f233bc0cc3edbf8ef

See more details on using hashes here.

File details

Details for the file perception-0.6.3-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for perception-0.6.3-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 c53aa8f9b9f9811d25bb1e797c1831577b8f98ac68385b3fa831ecd375cd4514
MD5 b4e4131a1204ad508ae2aa6b1b90ac7f
BLAKE2b-256 f634a05e95c9f1be9984ca8d73ce63479daf08243e67576246040988db898984

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