henry000 commited on
Commit
94fae81
Β·
1 Parent(s): 598b827

πŸ› [Fix] loss function calculation, detach predicts

Browse files
Files changed (1) hide show
  1. yolo/tools/loss_functions.py +1 -1
yolo/tools/loss_functions.py CHANGED
@@ -88,7 +88,7 @@ class YOLOLoss:
88
  def __call__(self, predicts: List[Tensor], targets: Tensor) -> Tuple[Tensor, Tensor, Tensor]:
89
  predicts_cls, predicts_anc, predicts_box = predicts
90
  # For each predicted targets, assign a best suitable ground truth box.
91
- align_targets, valid_masks = self.matcher(targets, (predicts_cls, predicts_box))
92
 
93
  targets_cls, targets_bbox = self.separate_anchor(align_targets)
94
  predicts_box = predicts_box / self.vec2box.scaler[None, :, None]
 
88
  def __call__(self, predicts: List[Tensor], targets: Tensor) -> Tuple[Tensor, Tensor, Tensor]:
89
  predicts_cls, predicts_anc, predicts_box = predicts
90
  # For each predicted targets, assign a best suitable ground truth box.
91
+ align_targets, valid_masks = self.matcher(targets, (predicts_cls.detach(), predicts_box.detach()))
92
 
93
  targets_cls, targets_bbox = self.separate_anchor(align_targets)
94
  predicts_box = predicts_box / self.vec2box.scaler[None, :, None]