imagededup是一个Python软件包,它简化了在图像集合中查找精确且几乎重复的任务 。
下面这些图显示了排除重复照片:

文章插图
该软件包提供了利用散列算法的功能,这些算法特别擅长查找精确的重复项,而卷积神经网络也擅长查找近似的重复项 。还提供了评估框架来判断给定数据集的重复数据删除质量 。
以下详细介绍了软件包提供的功能:
- 使用以下算法之一在目录中查找重复项:
- 卷积神经网络(CNN)
- 感知哈希(PHash)
- 差异哈希(DHash)
- 小波哈希(WHash)
- 平均哈希(AHash)
- 使用上述算法之一为图像生成编码 。
- 给定基础事实映射的评估重复数据删除有效性的框架 。
- 绘制找到给定图像文件的重复项 。
【开源工具imagededup让查找重复图像变得更容易】imagededup与Python 3.6兼容,并根据Apache 2.0许可进行分发 。
有两种安装imagededup的方法:
1.从PyPI安装imagededup(推荐):
pip install imagededup
Note?注意:默认情况下,imagededup附带仅TensorFlow CPU支持 。如果您有GPU,则应该安装具有GPU支持的TensorFlow版本,尤其是在使用CNN查找重复项时 。它的速度更快 。有关如何安装的更多详细信息,请参见TensorFlow指南 。
2.从GitHub来源安装imagededup:
git clone https://github.com/idealo/imagededup.gitcd imagededuppython setup.py install快速开始
为了使用感知哈希在图像目录中查找重复项,可以使用以下工作流程:
导入感知哈希方法
from imagededup.methods import PHashphasher = PHash()
为图像目录中的所有图像生成编码
encodings = phasher.encode_images(image_dir='path/to/image/directory')
使用生成的编码查找重复项
duplicates = phasher.find_duplicates(encoding_map=encodings)
使用重复字典来绘制给定文件(例如:“ ukbench00120.jpg”)获得的重复
from imagededup.utils import plot_duplicatesplot_duplicates(image_dir='path/to/image/directory',duplicate_map=duplicates,filename='ukbench00120.jpg')
输出如下:

文章插图
工作流的完整代码为:
from imagededup.methods import PHashphasher = PHash()# Generate encodings for all images in an image directoryencodings = phasher.encode_images(image_dir='path/to/image/directory')# Find duplicates using the generated encodingsduplicates = phasher.find_duplicates(encoding_map=encodings)# plot duplicates obtained for a given file using the duplicates dictionaryfrom imagededup.utils import plot_duplicatesplot_duplicates(image_dir='path/to/image/directory',duplicate_map=duplicates,filename='ukbench00120.jpg')有关更多示例,请参考存储库的这一部分 。
有关软件包功能的更多详细用法,请参阅:
https://idealo.github.io/imagededup/
@misc{idealods2019imagededup, title={Imagededup}, author={Tanuj Jain and Christopher Lennan and Zubin John and Dat Tran}, year={2019}, howpublished={\url{https://github.com/idealo/imagededup}},}
Idealo的主要业务是商品比较,图像检索是查询相同商品的重要手段,因此其开源imagededup应该值得参考 。
开源地址:
https://github.com/idealo/imagededup
推荐阅读
-
-
-
-
-
快乐男声|昔日快男亚军卑微求职,晒出个人简历,为什么会沦落到这种地步?
-
-
第一电动网|ID.4 内饰官图曝光 或将于 9 月 23 日全球发布,大众
-
卫浴间|卫生间怎么确保通风透气?卫生间装修要注意什么
-
十二星座大宝典|你也搞不定这三大星座女!,用完三十六计
-
陈根,这通常是用3D打印机完成的,然后用一种新的环保添加剂对材料进行剪裁
-
2021年8月份出生的鼠宝宝起名-2021年8月份出生的宝宝五行缺什么
-
-
-
满江红|满嘴谎言!灰太狼的羊否认认识刘伟,19条婚前协议曝光太打脸
-
-
成龙房祖名为什么不同姓 成龙的儿子为什么叫房祖名呢-
-
-
-
120健康网|备孕应该如何补充叶酸?叶酸作用是什么?看完就懂了
-
高考生因系统崩溃错过志愿填报|谁来担责?高考生因系统崩溃错过志愿填报,今年超一本线79分