Face-recognition results in ValueError: operands could not be broadcast together with shapes (1,1499,1200,3) (128,)

Face-recognition results in ValueError: operands could not be broadcast together with shapes (1,1499,1200,3) (128,)

所以我有一些代码看起来像这样,用于我正在尝试做的人脸识别项目

import cv2
import face_recognition
import matplotlib.pyplot as plt
import numpy as np
path = 'youtube_stuff2/'
vid = cv2.VideoCapture(path+'obama.webm')
obama= face_recognition.load_image_file(path+'obama.jpg')
obama_encodings = face_recognition.face_encodings(obama)[0]
all_encoding = [obama]
images = face_recognition.load_image_file(path+'obama.jpg')
locations = face_recognition.face_locations(images)
encodings = face_recognition.face_encodings(images)
#print(encodings.shape)
print(face_recognition.compare_faces([obama],encodings[0]))



因为它们是相同的图像,所以我希望得到“真实”结果,但我却得到了这个


ValueError: operands could not be broadcast together with shapes (1,1499,1200,3) (128,)

我不明白为什么我的编码具有不同的形状,因为它是相同的图像。对此的任何帮助将不胜感激。 P.S 图片已链接 here

在这一行

print(face_recognition.compare_faces([obama],encodings[0]))

使用 obama_encodings 而不是 obama