imagededup 是一个 Python 包,用来简化在一堆图片中提取类似的图片。
imagededup 采用如下算法进行图像查重:
示例代码:
from imagededup.methods import PHash phasher = PHash() # Generate encodings for all images in an image directory encodings = phasher.encode_images(image_dir='path/to/image/directory') # Find duplicates using the generated encodings duplicates = phasher.find_duplicates(encoding_map=encodings) # plot duplicates obtained for a given file using the duplicates dictionary from imagededup.utils import plot_duplicates plot_duplicates(image_dir='path/to/image/directory', duplicate_map=duplicates, filename='ukbench00120.jpg')