【IOU】intersection over union联合交叉

用于评估对象检测模型
在这里插入图片描述
iou的计算方式是:
在这里插入图片描述
代码实现:

import torch
def intersection_over_union(boxes_preds, boxes_labels, box_format="midpoint"):
    global box2_x1, box2_y2, box1_y2, box2_x2, box1_x2, box2_y1, box1_y1, box1_x1
    if box_format == "midpoint":
        box1_x1 = boxes_preds[..., 0:1] - boxes_preds[..., 2:3] / 2
        box1_y1 = boxes_preds[..., 1:2] - boxes_preds[..., 3:4] / 2
        box1_x2 = boxes_preds[..., 0:1] + boxes_preds[..., 2:3] / 2
        box1_y2 = boxes_preds[..., 1:2] + boxes_preds[..., 3:4] / 2
        box2_x1 = boxes_labels[..., 0:1] - boxes_labels[..., 2:3] / 2
        box2_y1 = boxes_labels[..., 1:2] - boxes_labels[..., 3:4] / 2
        box2_x2 = boxes_labels[..., 0:1] + boxes_labels[..., 2:3] / 2
        box2_y2 = boxes_labels[..., 1:2] + boxes_labels[..., 3:4] / 2
    if box_format == 'corners':
        box1_x1 = boxes_preds[..., 0:1]
        box1_y1 = boxes_preds[..., 1:2]
        box1_x2 = boxes_preds[..., 2:3]
        box1_y2 = boxes_preds[..., 3:4]
        box2_x1 = boxes_labels[..., 0:1]
        box2_y1 = boxes_labels[..., 1:2]
        box2_x2 = boxes_labels[..., 2:3]
        box2_y2 = boxes_labels[..., 3:4]

    x1 = torch.max(box1_x1, box2_x1)
    y1 = torch.max(box1_y1, box2_y1)
    x2 = torch.min(box1_x2, box2_x2)
    y2 = torch.min(box1_y2, box2_y2)

    intersection = (x2 - x1).clamp(0) * (y2 - y1).clamp(0)
    box1_area = abs((box1_x2 - box1_x1) * (box1_y2 - box1_y1))
    box2_area = abs((box2_x2 - box2_x1) * (box2_y2 - box2_y1))

    return intersection / (box1_area + box2_area)
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
### 回答1: 这里是推荐的20个目标检测 IOU 变形: 1. IOU (Intersection over Union) 2. Jaccard Index 3. Dice Similarity Coefficient 4. Tversky Index 5. Sensitivity 6. Specificity 7. Precision 8. Recall 9. F1 Score 10. Matthew's Correlation Coefficient 11. Informedness 12. Markedness 13. G-Mean 14. AUC-PR (Area Under the Precision-Recall Curve) 15. AUC-ROC (Area Under the Receiver Operating Characteristic Curve) 16. L1 Distance 17. L2 Distance 18. Cosine Similarity 19. Hamming Distance 20. Jaccard Distance ### 回答2: 目标检测的IoU变形指的是在计算两个边界框(bounding box)之间的重叠度量时,通过改变IoU的计算公式来达到不同的目的。以下是推荐的20个目标检测IoU变形: 1. IoU (Intersection over Union): 传统的IoU计算方式,定义为两个边界框相交区域面积除以它们的并集面积。 2. GIoU (Generalized Intersection over Union): 在计算IoU时,考虑相交区域相对于并集的冗余面积。 3. DIoU (Distance Intersection over Union): 在计算IoU时,引入两个边界框中心点的欧氏距离,考虑边界框之间的距离。 4. CIoU (Complete Intersection over Union): 在计算IoU时,综合考虑边界框的长宽比、中心点距离和相交区域的冗余面积。 5. IoF (Intersection over Foreground): 只考虑边界框与目标物体的相交区域,忽略背景的贡献。 6. GIoF (Generalized Intersection over Foreground): 在计算IoF时,考虑相交区域相对于目标物体的冗余面积。 7. DIoF (Distance Intersection over Foreground): 在计算IoF时,引入目标物体中心点的欧氏距离,考虑目标物体之间的距离。 8. CIoF (Complete Intersection over Foreground): 在计算IoF时,综合考虑目标物体的长宽比、中心点距离和相交区域的冗余面积。 9. IoB (Intersection over Background): 只考虑边界框与背景的相交区域。 10. GIoB (Generalized Intersection over Background): 在计算IoB时,考虑相交区域相对于背景的冗余面积。 11. DIoB (Distance Intersection over Background): 在计算IoB时,引入背景中心点的欧氏距离,考虑背景之间的距离。 12. CIoB (Complete Intersection over Background): 在计算IoB时,综合考虑背景的长宽比、中心点距离和相交区域的冗余面积。 13. GIoF (Generalized Intersection over Foreground): 同上,但考虑更多的物体信息,如像素点、轮廓等。 14. DIoT (Distance Intersection over Time): 在计算IoU时,将时间作为一维的信息引入,考虑目标物体在时间维度上的变化。 15. SIoU (Symmetric Intersection over Union): 将两个边界框的IoU计算结果互为分子和分母,可以消除计算结果的顺序依赖性。 16. IIoU (Integral Intersection over Union): 在计算IoU时,采用浮点运算的积分值来近似边界框的相交区域面积。 17. MIoU (Modified Intersection over Union): 在计算IoU时,限制边界框之间的重叠面积不能超过边界框自身的一部分。 18. RIoU (Regularized Intersection over Union): 在计算IoU时,对相交区域的像素点进行规则化,消除图像质量不一致的影响。 19. YIoU (Youdens's Intersection over Union): 引入Youdens' index,综合考虑真阳性和假阳性,用于二分类问题的目标检测。 20. CCIoU (Complete Cross Intersection over Union): 综合考虑边界框之间的相交区域、距离和长宽比,采用参数化的方式进行IoU计算。 ### 回答3: IOUIntersection over Union)是一种常用于目标检测中衡量预测框与真实框重叠程度的指标。它计算了两个框的交集面积与并集面积的比值,值介于0和1之间。为了进一步提升目标检测的准确性,人们对IOU进行了多种变形。下面是推荐的20个目标检测IOU变形: 1. GIOU(Generalized Intersection over Union) 2. CIOU(Complete Intersection over Union) 3. DIOU(Distance Intersection over Union) 4. OROU(Online Rectification Intersection over Union) 5. CCIU(Configurable Context Intersection over Union) 6. TIOU(Temporal Intersection over Union) 7. AIOU(Adjusted Intersection over Union) 8. SATIOU(Scale-Aware Temporal Intersection over Union) 9. TGIoU(Temporal Generalized Intersection over Union) 10. AGIOU(Anchor Generalized Intersection over Union) 11. VGIoU(Variable Generalized Intersection over Union) 12. BIoU(Backbone Intersection over Union) 13. FIoU(Future Intersection over Union) 14. PGIoU(Positional Geometric Intersection over Union) 15. GCIoU(Geodesic Intersection over Union) 16. LGIOU(Linear Growth Intersection over Union) 17. PPIoU(Positional Partition Intersection over Union) 18. SJIoU(Set Junction Intersection over Union) 19. CIOU-V2(Complete Intersection over Union Version 2) 20. PIOU(Prior Intersection over Union) 这些变形的提出都是为了解决目标检测中的具体问题或进一步提升检测的准确性。不同的变形方法适用于不同的场景和数据集,需要根据实际需求来选择最适合的IOU变形方法。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值