3

I am using the dlib library(with python2) for face detection in static images, if the probability/quality of the detected face is less, I would like to discard those faces. Thus I would like a function which would give the probability of the detected face. Or another metric which can be used to discard faces on its quality will be helpful.

Kousik Krishnan
  • 118
  • 1
  • 6

1 Answers1

3

Extraction from the official example:

# Finally, if you really want to you can ask the detector to tell you the score
# for each detection.  The score is bigger for more confident detections.
# The third argument to run is an optional adjustment to the detection threshold,
# where a negative value will return more detections and a positive value fewer.
# Also, the idx tells you which of the face sub-detectors matched.  This can be
# used to broadly identify faces in different orientations.
if (len(sys.argv[1:]) > 0):
    img = io.imread(sys.argv[1])
    dets, scores, idx = detector.run(img, 1, -1)
    for i, d in enumerate(dets):
        print("Detection {}, score: {}, face_type:{}".format(
            d, scores[i], idx[i]))
sascha
  • 32,238
  • 6
  • 68
  • 110