What is often referred to IoU target detection and mAP exactly?

After reading this will understand.

IoU

intersect over union, Chinese: pay and ratio. It refers to the proportion of the intersection and the real target prediction frame and the frame of the union.

mAP

mean average precision. It means the arithmetic mean of the average precision of each category. I.e. to determine the average precision for each category (AP), the AP then arithmetically average of these categories. There are many specific calculation method, introduced here only PASCAL VOC competition (before voc2010) mAP calculation method used, the method also assess methods yolov3 model adopted, yolov3 project so interpreted mAP, temporarily do not understand you can first jump too, will be able to look back and finally understand.

For example, we now in a given test sample Cat centralized computing the AP this category, as follows:
First, the AP to be able to generalize the shape of the curve of the PR, which is defined as calculated using the following formula:

So, let's take a look at what PR curve is: blue handwriting cover part need not be concerned.

Curve C in FIG PR is a curve, P is a precision longitudinal precision, R is recall the horizontal axis represents referred to recall or recall. Area under the curve for PR capacity curve model corresponding to the evaluation, that is comparing two detection target model which is better, PR may be used to compare the area under the curve, the larger the area the better the model. However, it may be because this area is not easy to calculate, so the definition of the formula (1) to calculate something called the AP, anyway, this thing can also reflect the combined effects of precision and recall ability of the model.

From equation (2) can be known, Pinterpo (r) indicates a maximum value greater than the specified recall all of the recall rate r rhat of the corresponding p. R is greater than a certain rhat there are many, we need to find these rhat the corresponding p is the largest one, and then return to this p. Equation (1) will be specified in the r from 0 to 1.0 in steps of 0.1 to 11 take values, then these r 11 p 11 corresponding to the cumulative average value arithmetically obtained on the AP. So we must first get a set of rhat and p, which requires us to understand the recall and precision are calculated.

我们先来看看P(precision)和R(recall)的计算公式:
precision = TP / (TP+FP)
recall = TP / (TP+FN)

TP是检测对了的正样本,FP是检测错了的正样本,FN是漏检的正样本。

对于目标检测模型一般最后都会输出一个置信度(如果样本图片中有不止一个目标,本例中只选择猫类别的置信度即可),所以可以设置一个置信度阈值,比如0.6,那么高于0.6的就认为该样本被检测为了正样本(即检测为猫),这样我们会得到0.6阈值下的一组正样本。

然后在这组正样本的基础上,设定一个IoU的阈值,其值为0.5(意思是检测为猫的目标的预测边界框和真实边界框的交并比要大于0.5),大于该阈值的认为是TP,其它的认为是FP。然后用测试样本中真实的正样本数量减去TP,就得到了FN。

这样,在置信度阈值为0.6的情况下,我们就得到了一对P(precision)和R(recall),接着我们取不同的置信度阈值,得到更多的P-R对,然后根据公式(2)找到所有大于指定召回率r的召回率rhat所对应的的p的最大值(采用这种方法是为了保证P-R曲线是单调递减的,避免摇摆),作为当前指定召回率r条件下的最大查准率p,然后根据公式(1)计算出AP。这个AP就是猫这个类别的AP,接着我们可以计算其它类别的AP,然后对这些AP求算术平均值,就得到了mAP。

了解了mAP之后,我们就容易理解为什么目标检测模型的度量指标不能像图像分类模型那样直接计算一遍precision和recall,因为目标检测任务中会包含多个类别的目标,并且除了给目标分类,还要预测目标的边界框,所以要加入IoU的概念,并考虑多个类别,而mAP就是在考虑了IoU和多类别之后计算出的度量指标。

参考文献:

http://homepages.inf.ed.ac.uk/ckiw/postscript/ijcv_voc09.pdf
https://github.com/AlexeyAB/darknet

推荐阅读:

还再@微信官方要国旗?这才是正确的打开方式~

Guess you like

Origin www.cnblogs.com/anai/p/11588912.html