# mAP (mean Average Precision)
[![GitHub stars](https://img.shields.io/github/stars/Cartucho/mAP.svg?style=social&label=Stars)](https://github.com/Cartucho/mAP)
This code will evaluate the performance of your neural net for object recognition.
<p align="center">
<img src="https://user-images.githubusercontent.com/15831541/37559643-6738bcc8-2a21-11e8-8a07-ed836f19c5d9.gif" width="450" height="300" />
</p>
In practice, a **higher mAP** value indicates a **better performance** of your neural net, given your ground-truth and set of classes.
## Citation
This project was developed for the following paper, please consider citing it:
```bibtex
@INPROCEEDINGS{8594067,
author={J. {Cartucho} and R. {Ventura} and M. {Veloso}},
booktitle={2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS)},
title={Robust Object Recognition Through Symbiotic Deep Learning In Mobile Robots},
year={2018},
pages={2336-2341},
}
```
## Table of contents
- [Explanation](#explanation)
- [Prerequisites](#prerequisites)
- [Quick start](#quick-start)
- [Running the code](#running-the-code)
- [Authors](#authors)
## Explanation
The performance of your neural net will be judged using the mAP criterium defined in the [PASCAL VOC 2012 competition](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/). We simply adapted the [official Matlab code](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/#devkit) into Python (in our tests they both give the same results).
First (**1.**), we calculate the Average Precision (AP), for each of the classes present in the ground-truth. Finally (**2.**), we calculate the mAP (mean Average Precision) value.
#### 1. Calculate AP
For each class:
First, your neural net **detection-results** are sorted by decreasing confidence and are assigned to **ground-truth objects**. We have "a match" when they share the **same label and an IoU >= 0.5** (Intersection over Union greater than 50%). This "match" is considered a true positive if that ground-truth object has not been already used (to avoid multiple detections of the same object).
<img src="https://user-images.githubusercontent.com/15831541/37725175-45b9e1a6-2d2a-11e8-8c15-2fb4d716ca9a.png" width="35%" height="35%" />
Using this criterium, we calculate the precision/recall curve. E.g:
<img src="https://user-images.githubusercontent.com/15831541/43008995-64dd53ce-8c34-11e8-8a2c-4567b1311910.png" width="45%" height="45%" />
Then we compute a version of the measured precision/recall curve with **precision monotonically decreasing** (shown in light red), by setting the precision for recall `r` to the maximum precision obtained for any recall `r' > r`.
Finally, we compute the AP as the **area under this curve** (shown in light blue) by numerical integration.
No approximation is involved since the curve is piecewise constant.
#### 2. Calculate mAP
We calculate the mean of all the AP's, resulting in an mAP value from 0 to 100%. E.g:
<img src="https://user-images.githubusercontent.com/15831541/38933241-5f9556ae-4310-11e8-9d47-cb205f9b103b.png"/>
<img src="https://user-images.githubusercontent.com/15831541/38933180-366b6fca-4310-11e8-99b9-17ad4b159b86.png" />
## Prerequisites
You need to install:
- [Python](https://www.python.org/downloads/)
Optional:
- **plot** the results by [installing Matplotlib](https://matplotlib.org/users/installing.html) - Linux, macOS and Windows:
1. `python -mpip install -U pip`
2. `python -mpip install -U matplotlib`
- show **animation** by installing [OpenCV](https://www.opencv.org/):
1. `python -mpip install -U pip`
2. `python -mpip install -U opencv-python`
## Quick-start
To start using the mAP you need to clone the repo:
```
git clone https://github.com/Cartucho/mAP
```
## Running the code
Step by step:
1. [Create the ground-truth files](#create-the-ground-truth-files)
2. Copy the ground-truth files into the folder **input/ground-truth/**
3. [Create the detection-results files](#create-the-detection-results-files)
4. Copy the detection-results files into the folder **input/detection-results/**
5. Run the code:
```
python main.py
```
Optional (if you want to see the **animation**):
6. Insert the images into the folder **input/images-optional/**
#### PASCAL VOC, Darkflow and YOLO users
In the [scripts/extra](https://github.com/Cartucho/mAP/tree/master/scripts/extra) folder you can find additional scripts to convert **PASCAL VOC**, **darkflow** and **YOLO** files into the required format.
#### Create the ground-truth files
- Create a separate ground-truth text file for each image.
- Use **matching names** for the files (e.g. image: "image_1.jpg", ground-truth: "image_1.txt").
- In these files, each line should be in the following format:
```
<class_name> <left> <top> <right> <bottom> [<difficult>]
```
- The `difficult` parameter is optional, use it if you want the calculation to ignore a specific detection.
- E.g. "image_1.txt":
```
tvmonitor 2 10 173 238
book 439 157 556 241
book 437 246 518 351 difficult
pottedplant 272 190 316 259
```
#### Create the detection-results files
- Create a separate detection-results text file for each image.
- Use **matching names** for the files (e.g. image: "image_1.jpg", detection-results: "image_1.txt").
- In these files, each line should be in the following format:
```
<class_name> <confidence> <left> <top> <right> <bottom>
```
- E.g. "image_1.txt":
```
tvmonitor 0.471781 0 13 174 244
cup 0.414941 274 226 301 265
book 0.460851 429 219 528 247
chair 0.292345 0 199 88 436
book 0.269833 433 260 506 336
```
## Authors:
* **João Cartucho**
Feel free to contribute
[![GitHub contributors](https://img.shields.io/github/contributors/Cartucho/mAP.svg)](https://github.com/Cartucho/mAP/graphs/contributors)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
1、该资源内项目代码经过严格调试,下载即用确保可以运行! 2、该资源适合计算机相关专业(如计科、人工智能、大数据、数学、电子信息等)正在做课程设计、期末大作业和毕设项目的学生、或者相关技术学习者作为学习资料参考使用。 3、该资源包括全部源码,需要具备一定基础才能看懂并调试代码。 基于keras-yolov3进行烟火数据集训练及识别(python开发源码+项目说明).zip 基于keras-yolov3进行烟火数据集训练及识别(python开发源码+项目说明).zip 基于keras-yolov3进行烟火数据集训练及识别(python开发源码+项目说明).zip 基于keras-yolov3进行烟火数据集训练及识别(python开发源码+项目说明).zip 基于keras-yolov3进行烟火数据集训练及识别(python开发源码+项目说明).zip 基于keras-yolov3进行烟火数据集训练及识别(python开发源码+项目说明).zip 基于keras-yolov3进行烟火数据集训练及识别(python开发源码+项目说明).zip
资源推荐
资源详情
资源评论
收起资源包目录
基于keras-yolov3进行烟火数据集训练及识别(python开发源码+项目说明).zip (2000个子文件)
README.md 6KB
烟火识别流程.md 4KB
README.md 4KB
README.md 3KB
convert.py 10KB
mAP_preprocess.py 1KB
voc_annotation.py 1KB
yolo_video.py 504B
yolo_pic.py 373B
yolo_annotation.txt 447KB
yolo_train_annotation.txt 404KB
2007_test.txt 72KB
train.txt 28KB
2007_val.txt 18KB
trainval.txt 7KB
test.txt 6KB
SIL Open Font License.txt 4KB
val.txt 1KB
yolo_anchors.txt 76B
smokefire_anchors.txt 72B
smokefire_classes.txt 10B
20022301974.xml 7KB
20022301978.xml 5KB
20022301183.xml 5KB
20022301977.xml 4KB
20022301995.xml 4KB
20022302154.xml 4KB
20022302178.xml 4KB
20022301993.xml 4KB
20022301981.xml 4KB
20022300469.xml 4KB
20022301695.xml 4KB
20022301991.xml 4KB
20022302151.xml 3KB
20022302398.xml 3KB
20022302155.xml 3KB
20022301030.xml 3KB
20022302226.xml 3KB
20022301992.xml 3KB
20022302179.xml 3KB
20022301904.xml 3KB
20022301929.xml 3KB
20022300405.xml 3KB
20022301930.xml 3KB
20022301639.xml 3KB
20022300402.xml 3KB
20022301694.xml 3KB
20022301970.xml 3KB
20022301032.xml 3KB
20022301980.xml 3KB
20022300586.xml 3KB
20022300829.xml 3KB
20022302386.xml 3KB
20022300472.xml 3KB
20022301890.xml 3KB
20022301670.xml 3KB
20022301698.xml 3KB
20022301189.xml 3KB
20022300340.xml 3KB
20022300833.xml 3KB
20022302142.xml 3KB
20022300363.xml 3KB
20022302217.xml 3KB
20022300727.xml 3KB
20022300498.xml 3KB
20022301280.xml 3KB
20022301925.xml 3KB
20022300390.xml 3KB
20022301603.xml 3KB
20022302387.xml 2KB
20022301713.xml 2KB
20022302647.xml 2KB
20022301711.xml 2KB
20022301188.xml 2KB
20022302682.xml 2KB
20022300428.xml 2KB
20022302529.xml 2KB
20022301692.xml 2KB
20022302171.xml 2KB
20022300839.xml 2KB
20022301876.xml 2KB
20022301276.xml 2KB
20022302395.xml 2KB
20022302144.xml 2KB
20022301029.xml 2KB
20022301026.xml 2KB
20022301922.xml 2KB
20022301031.xml 2KB
20022300542.xml 2KB
20022302953.xml 2KB
20022301604.xml 2KB
20022301962.xml 2KB
20022301147.xml 2KB
20022302158.xml 2KB
20022302202.xml 2KB
20022302944.xml 2KB
20022301903.xml 2KB
20022300541.xml 2KB
20022301931.xml 2KB
20022302224.xml 2KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
辣椒种子
- 粉丝: 4139
- 资源: 5745
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 10、安徽省大学生学科和技能竞赛A、B类项目列表(2019年版).xlsx
- 9、教育主管部门公布学科竞赛(2015版)-方喻飞
- C语言-leetcode题解之83-remove-duplicates-from-sorted-list.c
- C语言-leetcode题解之79-word-search.c
- C语言-leetcode题解之78-subsets.c
- C语言-leetcode题解之75-sort-colors.c
- C语言-leetcode题解之74-search-a-2d-matrix.c
- C语言-leetcode题解之73-set-matrix-zeroes.c
- 树莓派物联网智能家居基础教程
- YOLOv5深度学习目标检测基础教程
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功