跳转到主要内容

感知为感知哈希研究、开发和生产使用提供灵活、文档齐全且全面测试的工具。

项目描述

perception ci

perception 提供灵活、文档齐全且经过全面测试的工具,用于感知哈希研究、开发和生产使用。有关详细信息,请参阅文档

背景

perception最初在Thorn开发,作为我们从互联网中消除儿童性虐待材料工作的一个部分。有关该问题的更多信息,请查看我们CEO的TED演讲

入门

安装

pip install perception

哈希函数

使用不同的哈希函数,通过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)

示例

以下为感知哈希的常见用例的端到端示例。

支持的哈希算法

perception目前附带以下算法:

  • pHash(DCT哈希)(perception.hashers.PHash)
  • Facebook的PDQ哈希 (perception.hashers.PDQ)
  • dHash(差分哈希)(perception.hashers.DHash)
  • aHash(平均哈希)(perception.hashers.AverageHash)
  • Marr-Hildreth (perception.hashers.MarrHildreth)
  • 色彩矩 (perception.hashers.ColorMoment)
  • 块均值 (perception.hashers.BlockMean)
  • wHash(小波哈希)(perception.hashers.WaveletHash)

贡献

要参与该项目,请先执行以下步骤。

# 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)

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源代码发行版

perception-0.7.7.tar.gz (2.3 MB 查看哈希值)

上传时间 源代码

构建发行版

perception-0.7.7-cp312-cp312-win_amd64.whl (3.0 MB 查看哈希值)

上传时间 CPython 3.12 Windows x86-64

perception-0.7.7-cp312-cp312-manylinux_2_35_x86_64.whl (6.0 MB 查看哈希值)

上传时间 CPython 3.12 manylinux: glibc 2.35+ x86-64

perception-0.7.7-cp312-cp312-macosx_14_0_arm64.whl (2.8 MB 查看哈希值)

上传于 CPython 3.12 macOS 14.0+ ARM64

perception-0.7.7-cp312-cp312-macosx_13_0_x86_64.whl (2.8 MB 查看哈希)

上传于 CPython 3.12 macOS 13.0+ x86-64

perception-0.7.7-cp311-cp311-win_amd64.whl (3.0 MB 查看哈希)

上传于 CPython 3.11 Windows x86-64

perception-0.7.7-cp311-cp311-manylinux_2_35_x86_64.whl (6.0 MB 查看哈希)

上传于 CPython 3.11 manylinux: glibc 2.35+ x86-64

perception-0.7.7-cp310-cp310-win_amd64.whl (3.0 MB 查看哈希)

上传于 CPython 3.10 Windows x86-64

perception-0.7.7-cp310-cp310-manylinux_2_35_x86_64.whl (5.9 MB 查看哈希)

上传于 CPython 3.10 manylinux: glibc 2.35+ x86-64

由以下提供支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页