| 46 | |
| 47 | @TRANSFORMS.register_module() |
| 48 | class Pack3DDetInputs(BaseTransform): |
| 49 | INPUTS_KEYS = ['points', 'img'] |
| 50 | # to be compatible with depths in bevdepth |
| 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: dict, |
| 67 | meta_keys: dict = ( |
| 68 | 'img_path', 'ori_shape', 'img_shape', 'lidar2img', 'depth2img', |
| 69 | 'cam2img', 'pad_shape', 'depth_map_path', 'scale_factor', 'flip', |
| 70 | 'pcd_horizontal_flip', 'pcd_vertical_flip', 'box_mode_3d', |
| 71 | 'box_type_3d', 'img_norm_cfg', 'num_pts_feats', 'pcd_trans', |
| 72 | 'sample_idx', 'pcd_scale_factor', 'pcd_rotation', |
| 73 | 'pcd_rotation_angle', 'lidar_path', 'transformation_3d_flow', |
| 74 | 'trans_mat', 'affine_aug', 'sweep_img_metas', 'ori_cam2img', |
| 75 | 'cam2global', 'crop_offset', 'img_crop_offset', 'resize_img_shape', |
| 76 | 'lidar2cam', 'ori_lidar2img', 'num_ref_frames', 'num_views', |
| 77 | 'ego2global', 'fov_ori2aug', 'ego2cam', 'axis_align_matrix', |
| 78 | 'text', 'tokens_positive', 'scan_id')): |
| 79 | self.keys = keys |
| 80 | self.meta_keys = meta_keys |
| 81 | |
| 82 | def _remove_prefix(self, key: str) -> str: |
| 83 | if key.startswith('gt_'): |
| 84 | key = key[3:] |
| 85 | return key |
| 86 | |
| 87 | def transform(self, results: Union[dict, |
| 88 | List[dict]]) -> Union[dict, List[dict]]: |
| 89 | """Method to pack the input data. when the value in this dict is a |
| 90 | list, it usually is in Augmentations Testing. |
| 91 | |
| 92 | Args: |
| 93 | results (dict | list[dict]): Result dict from the data pipeline. |
| 94 | |
| 95 | Returns: |
| 96 | dict | List[dict]: |
| 97 | |
| 98 | - 'inputs' (dict): The forward data of models. It usually contains |
| 99 | following keys: |
| 100 | |
| 101 | - points |
| 102 | - img |
| 103 | |
| 104 | - 'data_samples' (:obj:`Det3DDataSample`): The annotation info of |
| 105 | the sample. |
nothing calls this directly
no outgoing calls
no test coverage detected