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

Uploaded Source

Built Distributions

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

Uploaded Python 3

perception-0.6.4-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.4-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.4-cp310-cp310-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.10 Windows x86-64

perception-0.6.4-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.4-cp39-cp39-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.9 Windows x86-64

perception-0.6.4-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.4-cp38-cp38-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.8 Windows x86-64

perception-0.6.4-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.4-cp37-cp37m-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.7m Windows x86-64

perception-0.6.4-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.4-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.4.tar.gz.

File metadata

  • Download URL: perception-0.6.4.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.4.tar.gz
Algorithm Hash digest
SHA256 cce24a76e392b894601cbbf7457ef322559b80ce725399acc5566b239a8e491f
MD5 e7110294d0a82be3e566ac54530e4362
BLAKE2b-256 4a6cf9a4432f4feb690312abe1334b32cb9aebe013ecc0f0a556018967446eeb

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: perception-0.6.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8635b68107cc9b467f37f2171a670de561ad4c72f4cad3fd821a2728e2f060e1
MD5 a134e1ef278a050907e144bc9eca1007
BLAKE2b-256 4c119f910a1995bec48c75a9ea08a01b4125b310d13529bb77130537510aed62

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for perception-0.6.4-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 60ef373d1b8dc1ddd609443cf1669d7ed2c60a3cd2d2fc7f3d448bc68bca340a
MD5 085ebf354360abfb17ac226846eaceeb
BLAKE2b-256 0fc43856e83d3d1fbdd43433e4f2f1422298ea44d7ca571f08993a0a13b83a9d

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for perception-0.6.4-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 39827c286a7c0cd25037fccc52afadb26060def85e164966c0aca6b5e3d6664b
MD5 5b15364282fb062337dd39d165d49fc9
BLAKE2b-256 3b08d9fd3d739b0cec4dc2fe9095a8d225358ee117ecf39578cbafcac342deba

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for perception-0.6.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 bbd89ad2a4b24be8cee4835a72a92c616ea5499866497ef6c7401be7f33dcd0e
MD5 97c99ce94757144ac6ea364b33ac3157
BLAKE2b-256 1cc5654949ef46bf868a80142235da811758577fff79b4239365cf22d265d563

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for perception-0.6.4-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f7c254879d5bf7f2a3b92dd3cae482776626f28b75fff9caa4bce144a646f41a
MD5 d15fc7f1cdb3cd76e6c557c8cdffeaf6
BLAKE2b-256 c4f79c731e7ba78dd4edacb573d97bc76190ba9cf9c83ffaad6039583dc4d386

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for perception-0.6.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6eb83c60a534fa90be35cd15e7300dfe090c95858af7b2e50aa1918c469a52e1
MD5 8fc2135b46aacba79ac8f27853c58e70
BLAKE2b-256 3ab813f49abbd0bd99d911f6fc1a0630bb40fab7308ca9bd778c4c3b247c1504

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for perception-0.6.4-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 2d689fb9c07ee639648cb221690b65c334c26e4fa26bfb0972620266f7102ccb
MD5 71bbecec7b5b5efa8b837593f6352d23
BLAKE2b-256 506a2f98b09f98a33d70aff43d3cb70f30f59592428c723e1726e52c65d3ee5a

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for perception-0.6.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 721b694dc13538c8f09e92df59164b97236d81fb283079e6324a488334914532
MD5 750bb94c8ed494e2872f95f614d74e4c
BLAKE2b-256 08ca019e5aabe987b9e2565488d065d49b3575c90c4590170edc6e6ce4336cb2

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for perception-0.6.4-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 8aca4afcbec3cca2f94ace7ea618ad55c9bbd4bc79facc19f5f9fbd8612df750
MD5 11fdea096001b06f9a332ab1b57faf5c
BLAKE2b-256 ed758c93ac2ec3a64db34209a9fdcd395c8cc5198cab72d731dad43d60919eea

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for perception-0.6.4-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 a7860fef8a05d5aea349f8a4f16abb3468037c37f56ab3f41bf4f6089dd144df
MD5 7caf38ff78f13eff0aac355ca32eedbf
BLAKE2b-256 74a2b33a725734cac0c4561d8a1ee433dd1d4df7e4b1347cb8e52df22d123cb1

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for perception-0.6.4-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 2a7fe587eccae4bfd7ce7c966556a04f598885d51f98a80eb883bfa88e391999
MD5 b5a832c2e0811c1bd194e144d5a1f564
BLAKE2b-256 2ed88e0e6930c90486354eeaf3ae9ba1a45a724f79a62b1ce92add0564ad1d76

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for perception-0.6.4-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 00df97d512510216e233acd9e7cf5f5bd5df95e511edcfd5e7a9effe98f43de8
MD5 54820c1fc99bf339ed5b0e91227b87cd
BLAKE2b-256 c4f59a1750a42cd2513fbab9662a60253dcc56f026583651487903b64110f812

See more details on using hashes here.

Provenance

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