DIoU-pytorch-detectron icon indicating copy to clipboard operation
DIoU-pytorch-detectron copied to clipboard

CIOU loss gives NaN values

Open notabee opened this issue 5 years ago • 9 comments

I am using CIOU for training where there can be multiple boxes at once, and I am getting NaN by your compute_ciou() loss function.

notabee avatar Dec 19 '19 20:12 notabee

Do u use this repo?or the others?what is the learning rate do u use?

Zzh-tju avatar Dec 20 '19 04:12 Zzh-tju

hello,i am also getting in trouble with the NaN loss ,How can i replace step size 1/(w^2+h^2) by 1 in my pytorch code as the paper said, “And thus in our implementation, the dominator w^ 2 +h^ 2 is simply removed for stable convergence, by which the step size 1/(w^2+h^2) is replaced by 1 and the gradient direc-tion is still consistent with Eqn. (12)”

WWW2323 avatar Apr 17 '20 12:04 WWW2323

utilize with torch no grad

Zzh-tju avatar Apr 18 '20 18:04 Zzh-tju

wrap what with torch no grad? forgive me for being a rookie , orz is there any code about this problem in your project? thanks very much

WWW2323 avatar Apr 20 '20 07:04 WWW2323

@WXP2314

......
u = d / c
v = torch.atan(w_gt / h_gt) - torch.atan(w_pred / h_pred)
with torch.no_grad():
    w_pred1 = w_pred * v
    h_pred1 = h_pred * v
ciou_loss =(1-iou+u+8/(math.pi**2) * (w_pred1*h_pred- h_pred1*w_pred)).sum()

Zzh-tju avatar Apr 20 '20 10:04 Zzh-tju

Hello, which file the ciou_loss code in?

jiangnanLZP avatar May 11 '20 01:05 jiangnanLZP

@jiangnanLZP compute_iou function in lib/utils/net.py

Zzh-tju avatar May 11 '20 01:05 Zzh-tju

@Zzh-tju thank you

jiangnanLZP avatar May 11 '20 01:05 jiangnanLZP

w_pred1 = w_pred * v h_pred1 = h_pred * v ciou_loss =(1-iou+u+8/(math.pi**2) * (w_pred1h_pred- h_pred1w_pred)).sum()

where is this code???

henbucuoshanghai avatar May 31 '20 10:05 henbucuoshanghai