Intersection over Union(IoU) algorithms
IoU算法可用与评估两个多维度数据的相似度,举一个实际应用,做CV,目标检测,我们需要评估模型的识别准确率,不同于二元类问题,普通的评估算法不合适,于是用到了这个算法,这个算法简单易懂,评估效果也不错。
这里主要讨论如何计算并评估两个矩形相交程度。有空再训练一个目标检测器,来试试水。。
第一种对于数据形状是这样的 $ (x_{top-left}, y_{top-left}, w, h) $,意思是:给出了起始坐标,矩形沿着 $ w, h $ 扩展开。
算法实现:
double IoU(int*a, int*b)
{
int overlap_w = min(a[0] + a[2], b[0] + b[2]) - max(a[0], b[0]);
int overlap_h = min(a[1] + a[3], b[1] + b[3]) - max(a[1], b[1]);
int overlap_s = overlap_w*overlap_h;
return overlap_s / double(a[2]*a[3] + b[2]*b[3] - overlap_s);
}
第二种数据形状是这样的 $ (x_{top-left}, y_{top-left}, x_{right-down}, y_{right-down}) $,意思是:给出了起始坐标和终点坐标,如图:
算法实现:
double IoU_2(int*a, int*b)
{
int overlap_w = min(a[2], b[2]) - max(a[0], b[0]);
int overlap_h = min(a[3], b[3]) - max(a[1], b[1]);
int overlap_s = overlap_w*overlap_h;
return overlap_s / double((a[2] - a[0])*(a[3] - a[1]) + (b[2] - b[0])*(b[3] - b[1]) - overlap_s);
}
用这几组数据测试一下:
1: [39, 63, 203, 112], [54, 66, 198, 114]
2: [49, 75, 203, 125], [42, 78, 186, 126]
3: [31, 69, 201, 125], [18, 63, 235, 135]
4: [50, 72, 197, 121], [54, 72, 198, 120]
5: [35, 51, 196, 110], [36, 60, 180, 108]
output:
0.825758
0.795771
=====================
0.809624
0.787838
=====================
0.791962
0.609319
=====================
0.947743
0.946628
=====================
0.79667
0.727656
=====================
参考:
1.https://www.pyimagesearch.com/2016/11/07/intersection-over-union-iou-for-object-detection/
2.https://en.wikipedia.org/wiki/Jaccard_index
Intersection over Union(IoU) algorithms的更多相关文章
- 论文阅读笔记四十七:Generalized Intersection over Union: A Metric and A Loss for Bounding Box Regression(CVPR2019)
论文原址:https://arxiv.org/pdf/1902.09630.pdf github:https://github.com/generalized-iou 摘要 在目标检测的评测体系中,I ...
- 目标识别(object detection)中的 IoU(Intersection over Union)
首先直观上来看 IoU 的计算公式: 由上述图示可知,IoU 的计算综合考虑了交集和并集,如何使得 IoU 最大,需要满足,更大的重叠区域,更小的不重叠的区域. 两个矩形窗格分别表示: 左上点.右下点 ...
- 『计算机视觉』Generalized Intersection over Union: A Metric and A Loss for Bounding BoxRegression
论文地址:Generalized Intersection over Union 一.相关工作 目标检测精度标准 度量检测优劣基本基于 IOU,mAP 是典型的基于 IOU 的标准,但是 mAP 仅有 ...
- Generalized Intersection over Union: A Metric and A Loss for Bounding Box Regression
Generalized Intersection over Union: A Metric and A Loss for Bounding Box Regression 2019-05-20 19:3 ...
- Dice Similarity Coefficent vs. IoU Dice系数和IoU
Dice Similarity Coefficent vs. IoU Several readers emailed regarding the segmentation performance of ...
- 评价目标检测(object detection)模型的参数:IOU,AP,mAP
首先我们为什么要使用这些呢? 举个简单的例子,假设我们图像里面只有1个目标,但是定位出来10个框,1个正确的,9个错误的,那么你要按(识别出来的正确的目标/总的正确目标)来算,正确率100%,但是其实 ...
- Analyzing The Papers Behind Facebook's Computer Vision Approach
Analyzing The Papers Behind Facebook's Computer Vision Approach Introduction You know that company c ...
- 大规模视觉识别挑战赛ILSVRC2015各团队结果和方法 Large Scale Visual Recognition Challenge 2015
Large Scale Visual Recognition Challenge 2015 (ILSVRC2015) Legend: Yellow background = winner in thi ...
- YOLO: You Only Look Once论文阅读摘要
论文链接: https://arxiv.org/pdf/1506.02640.pdf 代码下载: https://github.com/gliese581gg/YOLO_tensorflow Abst ...
随机推荐
- MySQL 8.0.18 在 Windows Server 2019 上的安装(ZIP)公开
AskScuti MySQL : Windows Server 2019 安装 MySQL 8.0 温馨提示:为了展现我最“魅力”的一面,请用谷歌浏览器撩我. 一切就绪,点我开撩
- laravel如何向视图传递值
1.定义路由 Route::get('demo','DemoController@demo'); 2.定义控制器(内with();方法就是定义传递的值 key=>value)=>" ...
- 2.4测试赛AC代码临时保存
//H #include<cstdio> #include<cstdlib> #include<cstring> #include<stack> usi ...
- 题解【洛谷P3958】[NOIP2017]奶酪
题面 题解 我们考虑使用一个并查集维护空洞之间的关系. 如果两个空洞能相互到达,那么它们的祖先也是相同的. 枚举从哪一个空洞开始,能否到达奶酪的上表面. 如果能到达就输出Yes,否则输出No. 注意开 ...
- [USACO19OPEN]I Would Walk 500 Miles 贪心
题目 洛谷P5425(点击可跳转) 题目描述 Farmer John想要将他的编号为 \(1 \ldots N\)的 N N 头奶牛( \(N \leq 7500\) )分为非空的 \(K\) 组( ...
- Mapper-元素和属性
Mapper.xml文件内部的元素和属性 parameterType(输入类型) § 传递简单类型 § 使用#{}占位符,或者${}进行sql拼接, #{}括号中的值可以任意, ${}括号 ...
- codeforces 1288E. Messenger Simulator(树状数组)
链接:https://codeforces.com/contest/1288/problem/E 题意:序列p的长度为n,初始序列为1 2 3 4 ...n,然后有m次操作,每次指定序列中一个数移动到 ...
- 使用鼠标左键事件实现VR中的Eye Gaze Input
1.光标以及光标动画的显示 using System.Collections; using System.Collections.Generic; using UnityEngine; using U ...
- JS高级---逆推继承看原型
逆推继承看原型 function F1(age) { this.age = age; } function F2(age) { this.age = age; } F2.prototype = new ...
- ts中的类
TypeScript 除了实现了所有 ES6 中的类的功能以外,还添加了一些新的用法(部分ES7). 一.ES6中类的主要用法: 1.使用 class 定义类,使用 constructor 定义构造函 ...