瀏覽代碼

Fix bug #541 #542 (#545)

* fix #541 #542

* Update train.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
5.0
AlexWang1900 GitHub 4 年之前
父節點
當前提交
a209a32019
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 2 個檔案被更改,包括 3 行新增3 行删除
  1. +1
    -1
      train.py
  2. +2
    -2
      utils/utils.py

+ 1
- 1
train.py 查看文件

@@ -377,7 +377,7 @@ def train(hyp, tb_writer, opt, device):

# Save last, best and delete
torch.save(ckpt, last)
if (best_fitness == fi) and not final_epoch:
if best_fitness == fi:
torch.save(ckpt, best)
del ckpt
# end epoch ----------------------------------------------------------------------------------------------------

+ 2
- 2
utils/utils.py 查看文件

@@ -346,8 +346,8 @@ def bbox_iou(box1, box2, x1y1x2y2=True, GIoU=False, DIoU=False, CIoU=False):
elif CIoU: # https://github.com/Zzh-tju/DIoU-SSD-pytorch/blob/master/utils/box/box_utils.py#L47
v = (4 / math.pi ** 2) * torch.pow(torch.atan(w2 / h2) - torch.atan(w1 / h1), 2)
with torch.no_grad():
alpha = v / (1 - iou + v)
return iou - (rho2 / c2 + v * alpha) # CIoU
alpha = v / (1 - iou + v + 1e-16)
return iou - (rho2 / c2 + v * alpha ) # CIoU

return iou


Loading…
取消
儲存