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
推荐阅读
-
捷途|只卖7万左右的中型SUV,空间宽敞实用,还是1.5T
-
-
-
-
-
1998年洪水抱着树干的小姑娘 98年洪水7岁女孩抱树9小时
-
-
泰光快讯|电动车加装尾箱违规吗?就放个头盔,电动车车主发出紧急提问
-
-
刘公岛|“小学生研究癌症获奖”,官方回应:系研究员之子
-
穿搭|杨紫长得好看衣品更好,穿牛仔连衣裙秀身材,比例让人羡慕
-
石榴花|12种幸运花,你是几月出生,最旺你的花就是那它
-
投资者网| 数名核心高管接连出走“无伤大体”?,华润微上市8个月又欲定增50亿
-
【别动它我不许】颜值直线飙升,衣品也是美翻了!,有一种整容叫阿拉蕾长大
-
健康骆医师|健康不会远离你,吃青椒有1大禁忌,早知早健康,爱吃青椒的人
-
7月末|佛山建行:深耕普惠金融,切实扶“微”助“小”
-
红枣■老中医:红枣要少吃,最好不要吃!到底为什么?早知早受益
-
北大首钢医院之窗@他们24小时备战,保障国家队队员健康任务:28天
-
-
青年|《Haydee》,一款让你烧脑“伤肾”的硬核解密游戏