使用opencv进行人脸识别所需的训练图像数量python
Number of training images required for face recognition using opencv with python
我能够使用 python 和 opencv 检测和识别人脸。但对准确性不满意。第一次试用时我尝试使用 20 张图像。然后是 30,最后是 500。但是识别人脸的准确度并不是那么令人满意。
我对某些面孔显示出错误的识别。我也尝试使用置信度阈值。
if id_ == 1 and confidence < 60:
show_profile(1)
elif id_ == 2 and confidence < 60:
show_profile(2)
elif id_ == 3 and confidence < 60:
show_profile(3)
这是显示识别图像的代码。 get_profile 从数据库中获取信息。
def show_profile(profile_id): # shows id related information on image
cv2.putText(frame, 'Name: ' + get_profile(profile_id)[1], (x, y + h + 30),
font, 0.5, (0, 200, 0), 1)
cv2.putText(frame, 'Age: ' + str(get_profile(profile_id)[2]), (x, y + h + 50),
font, 0.5, (0, 200, 0), 1)
cv2.putText(frame, 'Gender: ' + str(get_profile(profile_id)[3]), (x, y + h + 70),
font, 0.5, (0, 200, 0), 1)
cv2.putText(frame, 'Designation: ' + str(get_profile(profile_id)[4]), (x, y + h + 90),
font, 0.5, (0, 200, 0), 1)
您可能已经达到了 opencv 的极限。尝试使用更好的模型。例如,可以在此处找到基准的准确性:https://www.sighthound.com/technology/face-recognition/benchmarks/pubfig200
我能够使用 python 和 opencv 检测和识别人脸。但对准确性不满意。第一次试用时我尝试使用 20 张图像。然后是 30,最后是 500。但是识别人脸的准确度并不是那么令人满意。 我对某些面孔显示出错误的识别。我也尝试使用置信度阈值。
if id_ == 1 and confidence < 60:
show_profile(1)
elif id_ == 2 and confidence < 60:
show_profile(2)
elif id_ == 3 and confidence < 60:
show_profile(3)
这是显示识别图像的代码。 get_profile 从数据库中获取信息。
def show_profile(profile_id): # shows id related information on image
cv2.putText(frame, 'Name: ' + get_profile(profile_id)[1], (x, y + h + 30),
font, 0.5, (0, 200, 0), 1)
cv2.putText(frame, 'Age: ' + str(get_profile(profile_id)[2]), (x, y + h + 50),
font, 0.5, (0, 200, 0), 1)
cv2.putText(frame, 'Gender: ' + str(get_profile(profile_id)[3]), (x, y + h + 70),
font, 0.5, (0, 200, 0), 1)
cv2.putText(frame, 'Designation: ' + str(get_profile(profile_id)[4]), (x, y + h + 90),
font, 0.5, (0, 200, 0), 1)
您可能已经达到了 opencv 的极限。尝试使用更好的模型。例如,可以在此处找到基准的准确性:https://www.sighthound.com/technology/face-recognition/benchmarks/pubfig200