@@ -263,11 +263,11 @@ def forward(self, xin, labels=None):
263263 target [..., 2 :4 ] *= tgt_scale
264264
265265 loss_xy += F .binary_cross_entropy (input = output [..., :2 ], target = target [..., :2 ],
266- weight = tgt_scale * tgt_scale , size_average = False )
267- loss_wh += F .mse_loss (input = output [..., 2 :4 ], target = target [..., 2 :4 ], size_average = False ) / 2
268- loss_obj += F .binary_cross_entropy (input = output [..., 4 ], target = target [..., 4 ], size_average = False )
269- loss_cls += F .binary_cross_entropy (input = output [..., 5 :], target = target [..., 5 :], size_average = False )
270- loss_l2 += F .mse_loss (input = output , target = target , size_average = False )
266+ weight = tgt_scale * tgt_scale , reduction = 'sum' )
267+ loss_wh += F .mse_loss (input = output [..., 2 :4 ], target = target [..., 2 :4 ], reduction = 'sum' ) / 2
268+ loss_obj += F .binary_cross_entropy (input = output [..., 4 ], target = target [..., 4 ], reduction = 'sum' )
269+ loss_cls += F .binary_cross_entropy (input = output [..., 5 :], target = target [..., 5 :], reduction = 'sum' )
270+ loss_l2 += F .mse_loss (input = output , target = target , reduction = 'sum' )
271271
272272 loss = loss_xy + loss_wh + loss_obj + loss_cls
273273
@@ -511,7 +511,6 @@ def evaluate(model, data_loader, cfg, device, logger=None, **kwargs):
511511 "scores" : scores ,
512512 "labels" : labels ,
513513 }
514-
515514 evaluator_time = time .time ()
516515 coco_evaluator .update (res )
517516 evaluator_time = time .time () - evaluator_time
0 commit comments