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
推荐阅读
-
创投时报抛开品牌偏见,只看产品质量!华为对比苹果差距在哪?
-
忧家娱乐|一加8大米低价登峰造极,第六代AG玻璃工艺一加8T新机
-
-
-
-
便携与性能两手抓 六款11代酷睿全能轻薄本特色盘点
-
|无性无爱60年,百岁老人嫁初恋,真相曝光后,看哭众人
-
研究■袁隆平杂交水稻研究与安江农校史实陈列展示馆开工建设
-
王者荣耀|全英雄伴生皮肤白送,“李小龙”公布全场震惊,5款皮肤返场也不香了!
-
-
-
保湿|保湿好用到哭的面霜,都有谁给你盘点无限回购的面霜
-
-
新华网|国务院办公厅印发《深化医药卫生体制改革2020年下半年重点工作任务》
-
-
[冯善智观察]成中械军团核心战力,非洲首个买家!VT4坦克现身尼日利亚
-
囧在机途TAT华为OPPO持续加码5G布局,全球5G专利申请数量力压老牌公司
-
-
-
券商|国联闪电上市“精准”并购,券业新一轮并购潮启幕?