目标检测mAP

概述

AP (Average precision) is a popular metric in measuring the accuracy of object detectors like Faster R-CNN, SSD, etc. Average precision computes the average precision value for recall value over 0 to 1. It sounds complicated but actually pretty simple as we illustrate it with an example. But before that, we will do a quick recap on precision, recall, and IoU first

Precision & Recall

Precision measures how accurate is your predictions. i.e. the percentage of your predictions are correct.

                                                             Precision = TP / (TP + FP)

Recall measures what percentage of all the positives you had found. For example, we can find 80% of the possible positive cases in our top K predictions.

                                                             Recall = TP / (TP + FN)

F1-score

                                                             F1 = 2PR / (P + R)

IoU(Intersection over union)

IoU measures the overlap between 2 boundaries. We use that to measure how much our predicted boundary overlaps with the ground truth (the real object boundary). In some datasets, we predefine an IoU threshold (say 0.5) in classifying whether the prediction is a true positive or a false positive.

AP(average precision)

Let’s create an over-simplified example in demonstrating the calculation of the average precision. In this example, the whole dataset contains 5 apples only. We collect all the predictions made for apples in all the images and rank it in descending order according to the predicted confidence level. The second column indicates whether the prediction is correct or not. In this example, the prediction is correct if IoU ≥ 0.5

Let’s take the row with rank #3 and demonstrate how precision and recall are calculated first.

Precision is the proportion of TP = 2/3 = 0.67.

Recall is the proportion of TP out of the possible positives = 2/5 = 0.4.

Recall values increase as we go down the prediction ranking. However, precision has a zigzag pattern — it goes down with false positives and goes up again with true positives.

Let’s plot the precision against the recall value to see this zig-zag pattern.

The general definition for the Average Precision (AP) is finding the area under the precision-recall curve above.

 Precision and recall are always between 0 and 1. Therefore, AP falls within 0 and 1 also. Before calculating AP for the object detection, we often smooth out the zigzag pattern first.

Graphically, at each recall level, we replace each precision value with the maximum precision value to the right of that recall level.

So the orange line is transformed into the green lines and the curve will decrease monotonically instead of the zigzag pattern. The calculated AP value will be less suspectable to small variations in the ranking. Mathematically, we replace the precision value for recall ȓ with the maximum precision for any recall ≥ ȓ.

Interpolated AP

PASCAL VOC is a popular dataset for object detection. For the PASCAL VOC challenge, a prediction is positive if IoU ≥ 0.5. Also, if multiple detections of the same object are detected, it counts the first one as a positive while the rest as negatives.

In Pascal VOC2008, an average for the 11-point interpolated AP is calculated.

First, we divide the recall value from 0 to 1.0 into 11 points — 0, 0.1, 0.2, …, 0.9 and 1.0. Next, we compute the average of maximum precision value for these 11 recall values.

 In our example, AP = (5 × 1.0 + 4 × 0.57 + 2 × 0.5) / 11

Here are the more precise mathematical definitions.

When APᵣ turns extremely small, we can assume the remaining terms to be zero. i.e. we don’t necessarily make predictions until the recall reaches 100%. If the possible maximum precision levels drop to a negligible level, we can stop.

For 20 different classes in PASCAL VOC, we compute an AP for every class and also provide an average for those 20 AP results.

According to the original researcher, the intention of using 11 interpolated point in calculating AP is

The intention in interpolating the precision/recall curve in this way is to reduce the impact of the “wiggles” in the precision/recall curve, caused by small variations in the ranking of examples.

However, this interpolated method is an approximation which suffers two issues. First, It is less precise. Second, it lost the capability in measuring the difference for methods with low AP. Therefore, a different AP calculation is adopted after 2008 for PASCAL VOC

AP (Area under curve AUC)

For later Pascal VOC competitions, VOC2010–2012 samples the curve at all unique recall values (r₁, r₂, …), whenever the maximum precision value drops. With this change, we are measuring the exact area under the precision-recall curve after the zigzags are removed.

No approximation or interpolation is needed. Instead of sampling 11 points, we sample p(rᵢ) whenever it drops and computes AP as the sum of the rectangular blocks.

This definition is called the Area Under Curve (AUC). As shown below, as the interpolated points do not cover where the precision drops, both methods will diverge.

 COCO mAP

Latest research papers tend to give results for the COCO dataset only. In COCO mAP, a 101-point interpolated AP definition is used in the calculation. For COCO, AP is the average over multiple IoU (the minimum IoU to consider a positive match). AP@[.5:.95] corresponds to the average AP for IoU from 0.5 to 0.95 with a step size of 0.05. For the COCO competition, AP is the average over 10 IoU levels on 80 categories (AP@[.50:.05:.95]: start from 0.5 to 0.95 with a step size of 0.05). The following are some other metrics collected for the COCO dataset.

mAP (mean average precision) is the average of AP. In some context, we compute the AP for each class and average them. But in some context, they mean the same thing. For example, under the COCO context, there is no difference between AP and mAP. Here is the direct quote from COCO:

AP is averaged over all categories. Traditionally, this is called “mean average precision” (mAP). We make no distinction between AP and mAP (and likewise AR and mAR) and assume the difference is clear from context.

In ImageNet, the AUC method is used. So even all of them follow the same principle in measurement AP, the exact calculation may vary according to the datasets. Fortunately, development kits are available in calculating this metric.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/7289.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

基于Java+SpringBoot+Vue前后端分离摄影分享网站平台系统

博主介绍:✌全网粉丝30W,csdn特邀作者、博客专家、CSDN新星计划导师、java领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌ 🍅文末获取源码联系🍅 👇🏻 精彩专…

【雕爷学编程】Arduino动手做(131)---跑马灯矩阵键盘模块

37款传感器与执行器的提法,在网络上广泛流传,其实Arduino能够兼容的传感器模块肯定是不止这37种的。鉴于本人手头积累了一些传感器和执行器模块,依照实践出真知(一定要动手做)的理念,以学习和交流为目的&am…

【uniapp开发小程序】实现粘贴一段文字后,自动识别到姓名/手机号/收货地址

一、需求 在uni-app中开发小程序&#xff0c;实现粘贴一段文字后自动识别到手机号&#xff0c;并将手机号前面的内容作为姓名&#xff0c;手机号后面的内容作为收货地址&#xff0c;并去除其中的特殊字符和前缀标识。 实现效果&#xff1a; 二、实现方式&#xff1a; <…

154个Bug!

持续测试了一个月的H5项目&#xff0c;终于迎来了上线日&#xff0c;在测试H5的过程中&#xff0c;遇到了一些坑&#xff0c;积累了些许经验&#xff0c;想着分享一下&#xff0c;希望对大家有所启发。 主要从以下一个方面展开&#xff1a; 一、项目背景 二、测试环境准备 三…

Ubuntu系统安装JDK教程

今天新买了一台阿里云服务器&#xff0c;因为centos 不提供了更新支持&#xff0c;所以Linux系统选择了Ubuntu 系统&#xff0c;今天就出一期 Ubuntu上安装的一系列教程&#xff0c;今天就先从JDK开始。 Ubuntu系统安装JDK教程 1、 jdk下载2、安装 lrzsz 命令 &#xff08;仅限…

【Cache】Squid代理服务器应用

文章目录 一、Squid 服务器的概念1. 代理服务器概述CDN 服务器 2. 代理的工作机制3. Squid 服务器的作用4. Squid 代理的类型 二、部署 Squid 服务器1. 安装 Squid 服务1.1 编译安装 Squid1.2 修改 Squid 的配置文件1.3 Squid 的运行控制1.4 创建 Squid 服务脚本1.5 supervisor…

均方误差,交叉熵损失函数举例计算

目录 Classification Error&#xff08;分类错误率&#xff09; Mean Squared Error (均方误差) 交叉熵损失函数 我们希望根据图片动物的轮廓、颜色等特征&#xff0c;来预测动物的类别&#xff0c;有三种可预测类别&#xff1a;猫、狗、猪。假设我们当前有两个模型&#xff0…

Appium: Windows系统桌面应用自动化测试(一)

Appium: Windows系统桌面应用自动化测试 一、方案调研二、环境搭建1、WinAppDriver环境搭建&#xff08;1&#xff09;开启开发者选项中的“开发人员模式”&#xff08;2&#xff09;windows sdk下载安装&#xff08;3&#xff09;WinAppDriver下载安装 2、appium环境搭建&…

开发者活动:云原生的开源 AI 大模型基础设施

随着 ChatGPT 的火热&#xff0c;大语言模型和相关应用不断涌现。你是否了解大语言模型的技术细节&#xff1f;你是否曾经开发过大语言模型应用&#xff1f;如果你对大语言模型背后的基础设施感兴趣&#xff0c;那么7月8号&#xff0c;北京海淀中关村创业大街&#xff0c;云原生…

Jmeter接口测试参数化详解

目录 前言&#xff1a; RandomString函数 CSVRead函数 CSV Data Set Config配置元件 前言&#xff1a; 在进行接口测试时&#xff0c;参数化是一项重要的技术&#xff0c;可以帮助测试人员有效地模拟不同的场景和数据&#xff0c;增加测试用例的覆盖范围。JMeter提供了多种…

十七、docker学习-docker-compose安装nginx反向代理

compose安装nginx反向代理 IDEA安装docker插件 idea安装docker插件。Dockerfile、docker-compose.yml文件大部分内容会有提示信息。方便开发人员编写配置文件。 https://plugins.jetbrains.com/plugin/7724-docker/versions基础镜像 docker pull 1.21.0-alpine docker pull…

1.1、Java初级认识Java、jdk、 idea

前言 1.1 软件开发之 Java 开发 Java现在已经占有主流市场 企业级应用领域&#xff08;JavaEE 后台&#xff09;&#xff1a;用来开发企业级的应用程序&#xff0c;大型网站如淘宝、京 东、12306&#xff0c;以及各大物流、银行、金融、社交、医疗、交通、各种 OA 系统等都…