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

Uploaded Source

Built Distributions

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

Uploaded Python 3

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

Uploaded CPython 3.9

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

perception-0.4.3-cp35-cp35m-manylinux1_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.5m

File details

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

File metadata

  • Download URL: perception-0.4.3.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.3.tar.gz
Algorithm Hash digest
SHA256 5ee8ffd28cf4089ec88044436a6cdf71db8f89d41c54f111588079c70d8cc082
MD5 2defbb420062a55a28431bbe6674a2d8
BLAKE2b-256 172b421475f1e9bc5117db22fc66bc65260dc9d1b9506a206df53223167b996f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d66bef9db5714ba24fbc29ff4cf73ae3cf0e76a93949bde5ba9739e1a247e272
MD5 3d7fec48d7f0378443a606d54a199ff6
BLAKE2b-256 9db016a9ad7655240974cf8b75fa67820137d31a7d8fc81b74302a7770f8a5ab

See more details on using hashes here.

File details

Details for the file perception-0.4.3-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.4.3-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.3-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 2fdff263899a36add0fed74b2a49240da967e170ab27fdaee9806b2608439030
MD5 6d62a139f2e4658b0663b7f7b4ed1448
BLAKE2b-256 0d7120d5e1e00c9bb0a0fe4bfa9cb6a27ae528bd39885ea538797538fd542f69

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.3-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.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 265c5ebaff4227b0f1180e82a65a10591c11be256bdb22aef5ff8016b96d36db
MD5 438c558ded59724ff8ae285d1a6d74e6
BLAKE2b-256 7ac7cb63ad9f05378a5b88433c7e20148ed6f8daca030181d2d3ef1a979b30bd

See more details on using hashes here.

File details

Details for the file perception-0.4.3-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.4.3-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.3-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 2a9bc3bb4800dbdf12d90daf87c713805d96979ff3e26101496d3b9f31237119
MD5 9979b8fc98f43ddb272d666087a46566
BLAKE2b-256 47cfaac9751fbd7357570afe32e56b8ba98bfa9a584a0d26424c3fa4b28c1654

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.3-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.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 c98af01c56c92441e1988a345a400a179fb0f879cc1afea17bbae16be311d800
MD5 09780e949365cbfbbafc05db975e2fa0
BLAKE2b-256 99e1f98a3f453890ad0ad1d4cfaf2aa19b379221e9f4a791f4cb65c8c6c56e4b

See more details on using hashes here.

File details

Details for the file perception-0.4.3-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.4.3-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 61b38a750669290803d59e9a157d139ecac52791bdbfd104f714176d16fe90d2
MD5 a280def9e320cf533ee21bf4b1ab846a
BLAKE2b-256 764c6d58e372024a9378bed5d7d65520cfda8724a3ad45837bb6b1eb428c3279

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perception-0.4.3-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.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 d698268af0efdb51f405918ad935065ce7ba5127c75ed76ade8073740c398fb4
MD5 25b9bc572b2c6bac55557cb8229ac7a0
BLAKE2b-256 b513422d2fac74e7b1fda1663a90c52ab58615a76f217dbc7191dda048038883

See more details on using hashes here.

File details

Details for the file perception-0.4.3-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.4.3-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c355e47c6bc4d4268a28f193357086157d18f49218e90db57ac21b8b04a376de
MD5 92d3c201ddaa107e92c609d44cee21bd
BLAKE2b-256 7f45942643b5304c8dba742793e9006319ce126b3122dc13e8b201add32e9ee7

See more details on using hashes here.

File details

Details for the file perception-0.4.3-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: perception-0.4.3-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for perception-0.4.3-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0825b51e0f1ca83d89cbd1c432964d65c28be961d23aa0ae31993c6aab45b81d
MD5 b2cf21d87810d3226616b02749e44789
BLAKE2b-256 0b086e55178dbe8234c0ffcaf91d91e0e73b4c8cef18c028bb3399449426f0f7

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