使用pHash检测重复或相似图片

h@h-B360M-D2VX-SI:~/models/DupImageDetection$ python3 gen_phash.py --img_dir ./dog/ --n_thread 3 --out_path ./result.txt

可直接生成哈希值
第二个指令:

python3 dup_img_detection.py --pHashs_path /home/h/models/DupImageDetection/result.txt --sim_thres 5 

当前文件夹的json文件就是结果
也可以使用python查看

>>> import json
>>> d = json.load(open("duplicated_images.json"))
>>> d
[['/home/h/手相/006uSzdIly1g3hd07m3nvj30u018wqb8.jpg', '/home/h/手相/006uSzdIly1g3hd0etvkbj30u018wqb8.jpg']]

参考github地址 https://github.com/xuehuachunsheng/DupImageDetection

猜你喜欢

转载自blog.csdn.net/weixin_34061042/article/details/90927233
今日推荐