pytorch框架中目标检测模型中如何将iou替换成Ciou的代码

可以使用Pytorch中提供的bbox_iou函数,将其中的IoU替换成CIoU,并将关于CIoU的公式加入到函数中。具体代码如下: def bbox_ciou(box1, box2, eps=1e-5): # box1 [xmin, ymin, xmax, ymax] # box2 [xmin, ymin, xmax, ymax] # Calculate the IoU between two bounding boxes. # Calculate the area of each box. area1 = (box1[2] - box1[0] + e

猜你喜欢

转载自blog.csdn.net/weixin_42599908/article/details/129610092
今日推荐