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]))