bounding box overlap的计算分为三步
第一步是计算两个bounding box的交
计算的方式如函数一所示,计算x方向与y方向的重叠,然后相乘得到的就是交的值。
第二步是计算两个bounding box的并
第三部是两个bounding box的交除于并
函数一
template<typename Dtype>
Dtype lap(Dtype x1_min,Dtype x1_max,Dtype x2_min,Dtype x2_max){
if(x1_min < x2_min){
if(x1_max < x2_min){
return 0;
}else{
if(x1_max > x2_min){
if(x1_max < x2_max){
return x1_max - x2_min;
}else{
retur