简体   繁体   中英

Number of training images required for face recognition using opencv with python

I am able to detect as well as recognize the faces using python and opencv. But not satisfied with the accuracy. I tried using 20 images for the first trial. then 30 and finally 500. but the accuracy of recognizing the faces is not that much satisfactory. I shows wrong recognition for some faces. I tried using confidence threshold too.

        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)

Here is the code for displaying the recognized image. get_profile fetches the info from database.

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)

You have probably reached the limits of opencv. Try to use better models. Accuracies on benchmarks can be found for example here: https://www.sighthound.com/technology/face-recognition/benchmarks/pubfig200

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM