我想比较两张照片。第一个有一个人的脸。第二张是多张脸的合影。我想看看第一张照片中的个人是否出现在第二张照片中
我尝试用python中的deepface和face_识别库来实现这一点,方法是从团体照片中逐个提取人脸,并将其与原始照片进行比较
face_locations = face_recognition.face_locations(img2_loaded)
for face in face_locations:
top, right, bottom, left = face
face_img = img2_loaded[top:bottom, left:right]
face_recognition.compare_faces(img1_loaded, face_img)
这导致操作数不能与形状(30882316,3)(90,89,3)一起广播的错误。当我从集体照片中取出脸,用PIL保存它们,然后尝试将它们传递到deepface时,我也会遇到同样的错误。有人能推荐实现此功能的其他方法吗?或者修复我当前的尝试?非常感谢你
deepface设计用于比较两个人脸,但您仍然可以比较一对多人脸识别
你有两张照片。其中一张只有一张人脸照片。我称之为img1.jpg。第二个有很多面孔。我称之为img2.jpg
您可以首先使用OpenCV在img2.jpg中检测人脸
然后,您需要将faces变量的每个项与img1.jpg进行比较
我们应该设计比较函数
所以,你可以将deepface改编成这样的案例
相关问题 更多 >
编程相关推荐