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

Method transform

datasets/transforms/transforms_3d.py:180–211  ·  view source on GitHub ↗

PolarMix transform function. Args: input_dict (dict): Result dict from loading pipeline. Returns: dict: output dict after transformation.

(self, input_dict: dict)

Source from the content-addressed store, hash-verified

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."""

Callers

nothing calls this directly

Calls 1

polar_mix_transformMethod · 0.95

Tested by

no test coverage detected