分类器对opencv人脸检测器的信心 [英] Classifiers confidence in opencv face detector
问题描述
我在 python 中使用了 opencv 的 har 级联人脸检测器 (cv.HaarDetectObjects).
I'm using opencv's har cascade face detector (cv.HaarDetectObjects) in python.
例如:
faces = cv.HaarDetectObjects(grayscale, cascade, storage, 1.2, 2,
cv.CV_HAAR_DO_CANNY_PRUNING, (50,50))
for f in faces:
print(f)
这将以这种形式打印检测列表:
This will print a list of detections in this form:
((174, 54, 114, 114), 53)
((22, 51, 121, 121), 36)
((321, 56, 114, 114), 21)
((173, 263, 125, 125), 51)
((323, 272, 114, 114), 20)
((26, 271, 121, 121), 36)
每行代表一次检测.前 4 个数字是左上角点的 x、y 位置,以及边界框的高度、宽度.最后一个数字是(引用自 openCV 文档)邻居的数量.
Where each line represent a detection. The first 4 numbers are the x,y location of the top-left point, and the height, width of the bounding box. The last number is (quoting from the openCV documentation) the number of neighbors.
我想我有两个问题:
1) 最后一个数字是什么意思?我在谷歌搜索时找不到任何参考.
1) What does the last number mean? I couldn't find any reference to that when googling.
2)(更重要)有没有办法为每个检测获得置信度分数?人脸分类器在多大程度上确定检测对应于真实人脸?
2) (more important)Is there a way to get a confidence score for each detection? How much is the face classifier certain that the detection corresponds to a real face?
谢谢
推荐答案
1) 检测代码对一个对象产生多个检测 - 例如.以不同的比例,稍微偏移等.然后对检测进行分组,这样一个组中的邻居数就是返回的数.另见 Viola Jones 论文,第 5.6 段 (http://research.microsoft.com/en-us/um/people/viola/Pubs/Detect/violaJones_IJCV.pdf) 和 OpenCV 源代码.
1) The detection code produces more than one detection for an object - e.g. in different scales, slightly shifted, etc. The detections are then grouped and the number of neighbours in such a group is the number returned. See also Viola Jones paper, paragraph 5.6 (http://research.microsoft.com/en-us/um/people/viola/Pubs/Detect/violaJones_IJCV.pdf) and OpenCV source.
2) 您可以使用邻居的数量来衡量置信度.
2) You can possibly use the number of neighbours as some measure of confidence.
这篇关于分类器对opencv人脸检测器的信心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!