zhang-tao-whu / e2ec

E2EC: An End-to-End Contour-based Method for High-Quality High-Speed Instance Segmentation
Other
214 stars 45 forks source link

loss problem #7

Closed xubangwu closed 2 years ago

xubangwu commented 2 years ago

Hello, if the number of instances in one batch is zero, the smooth L1 loss(Linit, Lcoarse, Liter) will be 'nan'. How can I address this problem?

zhang-tao-whu commented 2 years ago

Sorry for the late answer, I was very busy some time ago so I didn't come to answer the question. You can add a decision to change the way the loss is calculated when the number of instances is 0. For example:

if len(pred_polys) == 0:
    loss = torch.sum(pred_polys)
else:
    loss = smooth_l1(pred_polys, target_polys) 
zhang-tao-whu commented 2 years ago

I fixed this bugs.