Skip to content

Commit

Permalink
Update fast_rcnn.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ricky0614 authored Jan 13, 2025
1 parent 3394fe6 commit f97e9fa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions detectron2/modeling/roi_heads/fast_rcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,9 @@ def losses(self, predictions, proposals):
# BCE Loss
gt_one_hot = F.one_hot(gt_classes, num_classes=pred_class_logits.size(1)).float()
loss_cls = F.binary_cross_entropy_with_logits(pred_class_logits, gt_one_hot, reduction="mean")
elif loss_type == 'dummy':
# dummy loss
loss_cls = torch.tensor(1.0, requires_grad=True, device=predictions[0].device)
elif self.use_sigmoid_ce:
loss_cls = self.sigmoid_cross_entropy_loss(scores, gt_classes)
else:
Expand Down

0 comments on commit f97e9fa

Please sign in to comment.