MCPcopy Create free account
hub / github.com/InternRobotics/P3Former / _Pack3DDetInputs

Class _Pack3DDetInputs

datasets/transforms/formating.py:49–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47
48@TRANSFORMS.register_module()
49class _Pack3DDetInputs(BaseTransform):
50 INPUTS_KEYS = ['points', 'img']
51 INSTANCEDATA_3D_KEYS = [
52 'gt_bboxes_3d', 'gt_labels_3d', 'attr_labels', 'depths', 'centers_2d'
53 ]
54 INSTANCEDATA_2D_KEYS = [
55 'gt_bboxes',
56 'gt_bboxes_labels',
57 ]
58
59 SEG_KEYS = [
60 'gt_seg_map', 'pts_instance_mask', 'pts_semantic_mask',
61 'gt_semantic_seg'
62 ]
63
64 def __init__(
65 self,
66 keys: tuple,
67 meta_keys: tuple = ('img_path', 'ori_shape', 'img_shape', 'lidar2img',
68 'depth2img', 'cam2img', 'pad_shape',
69 'scale_factor', 'flip', 'pcd_horizontal_flip',
70 'pcd_vertical_flip', 'box_mode_3d', 'box_type_3d',
71 'img_norm_cfg', 'num_pts_feats', 'pcd_trans',
72 'sample_idx', 'pcd_scale_factor', 'pcd_rotation',
73 'pcd_rotation_angle', 'lidar_path',
74 'transformation_3d_flow', 'trans_mat',
75 'affine_aug', 'sweep_img_metas', 'ori_cam2img',
76 'cam2global', 'crop_offset', 'img_crop_offset',
77 'resize_img_shape', 'lidar2cam', 'ori_lidar2img',
78 'num_ref_frames', 'num_views', 'ego2global')
79 ) -> None:
80 self.keys = keys
81 self.meta_keys = meta_keys
82
83 def _remove_prefix(self, key: str) -> str:
84 if key.startswith('gt_'):
85 key = key[3:]
86 return key
87
88 def transform(self, results: Union[dict,
89 List[dict]]) -> Union[dict, List[dict]]:
90 """Method to pack the input data. when the value in this dict is a
91 list, it usually is in Augmentations Testing.
92
93 Args:
94 results (dict | list[dict]): Result dict from the data pipeline.
95
96 Returns:
97 dict | List[dict]:
98
99 - 'inputs' (dict): The forward data of models. It usually contains
100 following keys:
101
102 - points
103 - img
104
105 - 'data_samples' (:obj:`Det3DDataSample`): The annotation info of
106 the sample.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected