如何让face_recognition得到正确的人脸号码?

How to make face_recognition get right face number?

请下载图片并将其另存为test.png

大家可以看到里面有两个人,每个人都是整张脸
让python代码统计图像中的人脸数量。

from PIL import Image
import face_recognition
image = face_recognition.load_image_file('test.png')
face_locations = face_recognition.face_locations(image)
print("I found {} face(s) in this photograph.".format(len(face_locations)))

输出:

I found 1 face(s) in this photograph.

如何face_recognition得到正确的人脸号码?

你可以试试

face_locations = face_recognition.face_locations(image, number_of_times_to_upsample=2, model="cnn")

它比默认的“hog”模型和唯一的上采样 运行.

工作时间更长但更准确