Skip to content

Commit

Permalink
Merge pull request #256 from GoldenStain/develop
Browse files Browse the repository at this point in the history
Fix misalignment between SOT and dynamic mode
  • Loading branch information
jerrywgz authored Feb 19, 2025
2 parents e37222a + e86a2b7 commit 08b36cf
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions ppdet/modeling/losses/yolov5_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,12 @@ def yolov5_loss(self, pi, t_cls, t_box, t_indices, t_anchor, balance):
# loss_cls = self.BCEcls(ps[:, 5:], t)

t = paddle.full_like(ps[:, 5:], self.cls_neg_label)
if not self.to_static:
t = paddle.put_along_axis(
t,
t_cls.unsqueeze(-1),
values=self.cls_pos_label,
axis=1)
else:
for i in range(n):
t[i, t_cls[i]] = self.cls_pos_label

t = paddle.put_along_axis(
t,
t_cls.unsqueeze(-1),
values=self.cls_pos_label,
axis=1)

loss_cls = self.BCEcls(ps[:, 5:], t)

Expand Down

0 comments on commit 08b36cf

Please sign in to comment.