PolarMix transform function. Args: input_dict (dict): Result dict from loading pipeline. Returns: dict: output dict after transformation.
(self, input_dict: dict)
| 178 | return input_dict |
| 179 | |
| 180 | def transform(self, input_dict: dict) -> dict: |
| 181 | """PolarMix transform function. |
| 182 | |
| 183 | Args: |
| 184 | input_dict (dict): Result dict from loading pipeline. |
| 185 | |
| 186 | Returns: |
| 187 | dict: output dict after transformation. |
| 188 | """ |
| 189 | if np.random.rand() > self.prob: |
| 190 | return input_dict |
| 191 | |
| 192 | assert 'dataset' in input_dict, \ |
| 193 | '`dataset` is needed to pass through PolarMix, while not found.' |
| 194 | dataset = input_dict['dataset'] |
| 195 | |
| 196 | # get index of other point cloud |
| 197 | index = np.random.randint(0, len(dataset)) |
| 198 | |
| 199 | mix_results = dataset.get_data_info(index) |
| 200 | |
| 201 | if self.pre_transform is not None: |
| 202 | # pre_transform may also require dataset |
| 203 | mix_results.update({'dataset': dataset}) |
| 204 | # before polarmix need to go through |
| 205 | # the necessary pre_transform |
| 206 | mix_results = self.pre_transform(mix_results) |
| 207 | mix_results.pop('dataset') |
| 208 | |
| 209 | input_dict = self.polar_mix_transform(input_dict, mix_results) |
| 210 | |
| 211 | return input_dict |
| 212 | |
| 213 | def __repr__(self) -> str: |
| 214 | """str: Return a string that describes the module.""" |
nothing calls this directly
no test coverage detected