MCPcopy Create free account
hub / github.com/InternRobotics/EmbodiedScan / RandomFlip3D

Class RandomFlip3D

embodiedscan/datasets/transforms/augmentation.py:11–249  ·  view source on GitHub ↗

Flip the points & bbox. If the input dict contains the key "flip", then the flag will be used, otherwise it will be randomly decided by a ratio specified in the init method. Required Keys: - points (np.float32) - gt_bboxes_3d (np.float32) Modified Keys: - points

Source from the content-addressed store, hash-verified

9
10@TRANSFORMS.register_module()
11class RandomFlip3D(RandomFlip):
12 """Flip the points & bbox.
13
14 If the input dict contains the key "flip", then the flag will be used,
15 otherwise it will be randomly decided by a ratio specified in the init
16 method.
17
18 Required Keys:
19
20 - points (np.float32)
21 - gt_bboxes_3d (np.float32)
22
23 Modified Keys:
24
25 - points (np.float32)
26 - gt_bboxes_3d (np.float32)
27
28 Added Keys:
29
30 - points (np.float32)
31 - pcd_trans (np.float32)
32 - pcd_rotation (np.float32)
33 - pcd_rotation_angle (np.float32)
34 - pcd_scale_factor (np.float32)
35
36 Args:
37 sync_2d (bool): Whether to apply flip according to the 2D
38 images. If True, it will apply the same flip as that to 2D images.
39 If False, it will decide whether to flip randomly and independently
40 to that of 2D images. Defaults to True.
41 flip_2d (bool): Whether to apply flip for the img data.
42 If True, it will adopt the flip augmentation for the img.
43 False occurs on bev augmentation for bev-based image 3d det.
44 Defaults to True.
45 flip_3d (bool): Whether to apply flip for the 3d point cloud data.
46 If True, it will adopt the flip augmentation for the point cloud.
47 Defaults to True.
48 flip_ratio_bev_horizontal (float): The flipping probability
49 in horizontal direction. Defaults to 0.0.
50 flip_ratio_bev_vertical (float): The flipping probability
51 in vertical direction. Defaults to 0.0.
52 flip_box3d (bool): Whether to flip bounding box. In most of the case,
53 the box should be fliped. In cam-based bev detection, this is set
54 to False, since the flip of 2D images does not influence the 3D
55 box. Defaults to True.
56 """
57
58 def __init__(self,
59 sync_2d: bool = True,
60 flip_2d: bool = True,
61 flip_3d: bool = True,
62 flip_ratio_bev_horizontal: float = 0.0,
63 flip_ratio_bev_vertical: float = 0.0,
64 flip_box3d: bool = True,
65 update_lidar2cam: bool = False,
66 **kwargs) -> None:
67 # `flip_ratio_bev_horizontal` is equal to
68 # for flip prob of 2d image when

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected