Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaAndroid committed Nov 27, 2023
1 parent 1c2f397 commit 67fe383
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mmdet/models/dense_heads/grounding_dino_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def loss_by_feat_single(self, cls_scores: Tensor, bbox_preds: Tensor,

# ===== this change =====
x_labels = labels.reshape(-1, labels.size(-1))
pos_inds = (x_labels > 0).nonzero()
pos_inds = (x_labels.sum(1) > 0).nonzero()
scores = label_weights.new_zeros((x_labels.shape[0],))
pos_bbox_targets = bbox_targets[pos_inds]
pos_decode_bbox_targets = bbox_cxcywh_to_xyxy(pos_bbox_targets)
Expand Down Expand Up @@ -667,7 +667,7 @@ def _loss_dn_single(self, dn_cls_scores: Tensor, dn_bbox_preds: Tensor,

# ===== this change =====
x_labels = labels.reshape(-1, labels.size(-1))
pos_inds = (x_labels > 0).nonzero()
pos_inds = (x_labels.sum(1) > 0).nonzero()
scores = label_weights.new_zeros((x_labels.shape[0],))
pos_bbox_targets = bbox_targets[pos_inds]
pos_decode_bbox_targets = bbox_cxcywh_to_xyxy(pos_bbox_targets)
Expand Down

0 comments on commit 67fe383

Please sign in to comment.