我正在使用dlib库(使用python2)在静态图像中进行面部检测,如果检测到的面部的概率/质量较低,我想丢弃这些面部。因此,我想要一个能够给出检测到的面部概率的函数。或者另一个可用于丢弃面孔质量的指标将会有所帮助。
答案 0 :(得分:2)
从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]))