Skip to content

Commit

Permalink
[FIX] Arrange scale between bbox preds and bbox targets in ATSS (#1880)
Browse files Browse the repository at this point in the history
Arrange scale between bbox preds and bbox targets
  • Loading branch information
jaegukhyun authored and goodsong81 committed Mar 14, 2023
1 parent 6c5600b commit 0e10a0e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions otx/mpa/modules/models/heads/custom_atss_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,16 @@ def loss_single(
pos_centerness = centerness[pos_inds]

centerness_targets = self.centerness_target(pos_anchors, pos_bbox_targets)
pos_decode_bbox_pred = self.bbox_coder.decode(pos_anchors, pos_bbox_pred)
pos_decode_bbox_targets = self.bbox_coder.decode(pos_anchors, pos_bbox_targets)
if self.reg_decoded_bbox:
pos_bbox_pred = self.bbox_coder.decode(pos_anchors, pos_bbox_pred)

if self.use_qfl:
quality[pos_inds] = bbox_overlaps(
pos_decode_bbox_pred.detach(), pos_decode_bbox_targets, is_aligned=True
).clamp(min=1e-6)
quality[pos_inds] = bbox_overlaps(pos_bbox_pred.detach(), pos_bbox_targets, is_aligned=True).clamp(
min=1e-6
)

# regression loss
loss_bbox = self.loss_bbox(
pos_decode_bbox_pred, pos_decode_bbox_targets, weight=centerness_targets, avg_factor=1.0
)
loss_bbox = self.loss_bbox(pos_bbox_pred, pos_bbox_targets, weight=centerness_targets, avg_factor=1.0)

# centerness loss
loss_centerness = self.loss_centerness(pos_centerness, centerness_targets, avg_factor=num_total_samples)
Expand Down

0 comments on commit 0e10a0e

Please sign in to comment.