Skip to content

Commit 40e54e3

Browse files
authored
Update loss.py
1 parent ce38464 commit 40e54e3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

efficientdet/loss.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def forward(self, classifications, regressions, anchors, annotations, **kwargs):
5151
bbox_annotation = annotations[j]
5252
bbox_annotation = bbox_annotation[bbox_annotation[:, 4] != -1]
5353

54+
classification = torch.clamp(classification, 1e-4, 1.0 - 1e-4)
55+
5456
if bbox_annotation.shape[0] == 0:
5557
if torch.cuda.is_available()
5658

@@ -84,9 +86,7 @@ def forward(self, classifications, regressions, anchors, annotations, **kwargs):
8486
classification_losses.append(cls_loss.sum(), min=1.0)
8587

8688
continue
87-
88-
classification = torch.clamp(classification, 1e-4, 1.0 - 1e-4)
89-
89+
9090
IoU = calc_iou(anchor[:, :], bbox_annotation[:, :4])
9191

9292
IoU_max, IoU_argmax = torch.max(IoU, dim=1)

0 commit comments

Comments
 (0)