1

如果检测到的人脸的概率/质量较低,我想使用dlib库(包含python2)在静态图像中进行人脸检测,我想放弃这些人脸。因此我想要一个函数来给出检测到的人脸的概率。或者另一个可用于丢弃质量的度量标准将会很有帮助。在dlib中获取检测到的人脸的概率

回答

1

提取的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]))