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

Method transform

datasets/transforms/transforms_3d.py:343–374  ·  view source on GitHub ↗

LaserMix 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

341 return input_dict
342
343 def transform(self, input_dict: dict) -> dict:
344 """LaserMix transform function.
345
346 Args:
347 input_dict (dict): Result dict from loading pipeline.
348
349 Returns:
350 dict: output dict after transformation.
351 """
352 if np.random.rand() > self.prob:
353 return input_dict
354
355 assert 'dataset' in input_dict, \
356 '`dataset` is needed to pass through LaserMix, while not found.'
357 dataset = input_dict['dataset']
358
359 # get index of other point cloud
360 index = np.random.randint(0, len(dataset))
361
362 mix_results = dataset.get_data_info(index)
363
364 if self.pre_transform is not None:
365 # pre_transform may also require dataset
366 mix_results.update({'dataset': dataset})
367 # before lasermix need to go through
368 # the necessary pre_transform
369 mix_results = self.pre_transform(mix_results)
370 mix_results.pop('dataset')
371
372 input_dict = self.laser_mix_transform(input_dict, mix_results)
373
374 return input_dict
375
376 def __repr__(self) -> str:
377 """str: Return a string that describes the module."""

Callers

nothing calls this directly

Calls 1

laser_mix_transformMethod · 0.95

Tested by

no test coverage detected