diou ciou torch
生活随笔
收集整理的這篇文章主要介紹了
diou ciou torch
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
diou比ciou要小,比iou的值也小,訓(xùn)練時候用比較好。
測試時還是iou比較好,訓(xùn)練時giou比較好
import math
import torchdef bbox_iou(box1, box2, x1y1x2y2=True, GIoU=False, DIoU=False, CIoU=False):# Returns the IoU of box1 to box2. box1 is 4, box2 is nx4box2 = box2.t()# Get the coordinates of bounding boxesif x1y1x2y2: # x1, y1, x2, y2 = box1b1_x1, b1_y1, b1_x2, b1_y2 = box1[:, 0], box1[:, 1], box1[:, 2], box1[:, 3]b2_x1, b2_y1, b2_x2, b2_y2 = box2[:, 0], box2[:, 1], box2[:, 2], box2[:, 3]else: # x, y, w, h = box1b1_x1, b1_x2 = box1[:, 0] - box1[:, 2] / 2, box1[:, 0] + box1[:, 2] / 2b1_y1, b1_y2 = box1[:, 1] - box1[:, 3] / 2, box1[:, 1] + box1[:, 3] / 2b2_x1, b2_x2 = box2[:, 0] - box2[:, 2] / 2, box2[:, 0] + box2[:, 2] / 2b2_y1, b2_y2 = box2[:, 1] - box2[:, 3] / 2, box2[:, 1] + box2[:, 3] / 2# I
總結(jié)
以上是生活随笔為你收集整理的diou ciou torch的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php中国天气api接口,免费天气预报A
- 下一篇: 水题(water)(非详细解答)