MCPcopy Create free account
hub / github.com/InternRobotics/EmbodiedScan / BBox3DL1Cost

Class BBox3DL1Cost

embodiedscan/models/losses/match_cost.py:50–75  ·  view source on GitHub ↗

L1 cost for 3D boxes.

Source from the content-addressed store, hash-verified

48
49@TASK_UTILS.register_module()
50class BBox3DL1Cost(BaseMatchCost):
51 """L1 cost for 3D boxes."""
52
53 def __call__(self,
54 pred_instances: InstanceData,
55 gt_instances: InstanceData,
56 img_meta: Optional[dict] = None,
57 **kwargs) -> Tensor:
58 """Compute match cost.
59
60 Args:
61 bbox_pred (Tensor): Predicted boxes with normalized coordinates
62 (cx,cy,l,w,cz,h,sin(φ),cos(φ),v_x,v_y)
63 which are all in range [0, 1] and shape [num_query, 10].
64 gt_bboxes (Tensor): Ground truth boxes with `normalized`
65 coordinates (cx,cy,l,w,cz,h,sin(φ),cos(φ),v_x,v_y).
66 Shape [num_gt, 10].
67 Returns:
68 Tensor: Match Cost matrix of shape (num_preds, num_gts).
69 """
70 pred_bboxes = pred_instances.bboxes_3d.tensor # (num_preds, 9)
71 gt_bboxes = gt_instances.bboxes_3d.tensor # (num_gts, 9)
72
73 bbox_cost = torch.cdist(pred_bboxes, gt_bboxes,
74 p=1) # (num_preds, num_gt)
75 return bbox_cost * self.weight
76
77
78@TASK_UTILS.register_module()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected