Skip to content

Commit

Permalink
Fix incorrect loss_depth
Browse files Browse the repository at this point in the history
  • Loading branch information
Tai-Wang committed Oct 28, 2021
1 parent 3f77afc commit b8a46bc
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions mmdet3d/models/dense_heads/pgd_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,11 +663,6 @@ def loss(self,
pos_bbox_targets_3d[:, :2],
weight=bbox_weights[:, :2],
avg_factor=equal_weights.sum())
loss_depth = self.loss_bbox(
pos_bbox_preds[:, 2],
pos_bbox_targets_3d[:, 2],
weight=bbox_weights[:, 2],
avg_factor=equal_weights.sum())
loss_size = self.loss_bbox(
pos_bbox_preds[:, 3:6],
pos_bbox_targets_3d[:, 3:6],
Expand Down Expand Up @@ -698,6 +693,12 @@ def loss(self,
equal_weights,
avg_factor=equal_weights.sum())

# init depth loss with the one computed from direct regression
loss_dict['loss_depth'] = self.loss_bbox(
pos_bbox_preds[:, 2],
pos_bbox_targets_3d[:, 2],
weight=bbox_weights[:, 2],
avg_factor=equal_weights.sum())
# depth classification loss
if self.use_depth_classifier:
pos_prob_depth_preds = self.bbox_coder.decode_prob_depth(
Expand Down Expand Up @@ -764,9 +765,9 @@ def loss(self,
else:
# need absolute due to possible negative delta x/y
loss_offset = pos_bbox_preds[:, :2].sum()
loss_depth = pos_bbox_preds[:, 2].sum()
loss_size = pos_bbox_preds[:, 3:6].sum()
loss_rotsin = pos_bbox_preds[:, 6].sum()
loss_dict['loss_depth'] = pos_bbox_preds[:, 2].sum()
if self.pred_velo:
loss_dict['loss_velo'] = pos_bbox_preds[:, 7:9].sum()
if self.pred_keypoints:
Expand Down Expand Up @@ -795,7 +796,6 @@ def loss(self,
dict(
loss_cls=loss_cls,
loss_offset=loss_offset,
loss_depth=loss_depth,
loss_size=loss_size,
loss_rotsin=loss_rotsin,
loss_centerness=loss_centerness))
Expand Down

0 comments on commit b8a46bc

Please sign in to comment.