图像去重/图像相似度评估

pip install imagededup

from imagededup.methods import PHash
from imagededup.utils import plot_duplicates
phasher = PHash()

# Generate encodings for all images in an image directory
encodings = phasher.encode_images(image_dir='/media/liuyanxin/7bb102f1-967f-40cb-8069-704229851f24/heaven/data/test')

# Find duplicates using the generated encodings
duplicates = phasher.find_duplicates(encoding_map=encodings)

# plot duplicates obtained for a given file using the duplicates dictionary

plot_duplicates(image_dir='/media/liuyanxin/7bb102f1-967f-40cb-8069-704229851f24/heaven/data/test',
                duplicate_map=duplicates,
                filename='12.jpg')

你可能感兴趣的:(python)