使用开源工具imagededup让查找重复图像变得更容易

 

imagededup是一个python软件包,它简化了在图像集合中查找精确且几乎重复的任务。

 

下面这些图显示了排除重复照片:

 

使用开源工具imagededup让查找重复图像变得更容易_第1张图片

该软件包提供了利用散列算法的功能,这些算法特别擅长查找精确的重复项,而卷积神经网络也擅长查找近似的重复项。还提供了评估框架来判断给定数据集的重复数据删除质量。

 

 

以下详细介绍了软件包提供的功能:

 

  1. 使用以下算法之一在目录中查找重复项:

    • 卷积神经网络(CNN)

    • 感知哈希(PHash)

    • 差异哈希(DHash)

    • 小波哈希(WHash)

    • 平均哈希(AHash)

  2. 使用上述算法之一为图像生成编码。

  3. 给定基础事实映射的评估重复数据删除有效性的框架。

  4. 绘制找到给定图像文件的重复项。

 

 

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

 

输出如下:

使用开源工具imagededup让查找重复图像变得更容易_第2张图片

工作流的完整代码为:

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应该值得参考。

 

相关论文源码下载地址:关注“图像算法”微信公众号 回复imagededup 获取

你可能感兴趣的:(图像算法)