"git@developer.sourcefind.cn:OpenDAS/dlib.git" did not exist on "89ee7cdb588a82ea2713b3dae616aa1ff200288a"
Commit fcb05070 authored by liyinhao's avatar liyinhao
Browse files

change flip and docstring

parent a4a7bb49
...@@ -7,32 +7,40 @@ from mmdet.datasets.builder import PIPELINES ...@@ -7,32 +7,40 @@ from mmdet.datasets.builder import PIPELINES
class IndoorFlipData(object): class IndoorFlipData(object):
"""Indoor Flip Data. """Indoor Flip Data.
Flip point_cloud and groundtruth boxes. Flip point cloud and ground truth boxes.
The point cloud will ve flipped along the yz plane
and the xz plane with a certain probability.
Args: Args:
flip_ratio (float): Probability of being flipped. flip_ratio_yz (float): Probability of being flipped along yz plane.
Default: 0.5.
flip_ratio_xz (float): Probability of being flipped along xz plane.
Default: 0.5. Default: 0.5.
""" """
def __init__(self, flip_ratio=0.5): def __init__(self, flip_ratio_yz=0.5, flip_ratio_xz=0.5):
self.flip_ratio = flip_ratio self.flip_ratio_yz = flip_ratio_yz
self.flip_ratio_xz = flip_ratio_xz
def __call__(self, results): def __call__(self, results):
points = results['points'] points = results['points']
gt_bboxes_3d = results['gt_bboxes_3d'] gt_bboxes_3d = results['gt_bboxes_3d']
name = 'scannet' if gt_bboxes_3d.shape[1] == 6 else 'sunrgbd' aligned = True if gt_bboxes_3d.shape[1] == 6 else False
if np.random.random() > self.flip_ratio: if np.random.random() > self.flip_ratio_yz:
# Flipping along the YZ plane # Flipping along the YZ plane
points[:, 0] = -1 * points[:, 0] points[:, 0] = -1 * points[:, 0]
gt_bboxes_3d[:, 0] = -1 * gt_bboxes_3d[:, 0] gt_bboxes_3d[:, 0] = -1 * gt_bboxes_3d[:, 0]
if name == 'sunrgbd': if not aligned:
gt_bboxes_3d[:, 6] = np.pi - gt_bboxes_3d[:, 6] gt_bboxes_3d[:, 6] = np.pi - gt_bboxes_3d[:, 6]
results['flip'] = True
results['gt_boxes'] = gt_bboxes_3d results['gt_boxes'] = gt_bboxes_3d
if name == 'scannet' and np.random.random() > 0.5: if aligned and np.random.random() > self.flip_ratio_xz:
# Flipping along the XZ plane # Flipping along the XZ plane
points[:, 1] = -1 * points[:, 1] points[:, 1] = -1 * points[:, 1]
gt_bboxes_3d[:, 1] = -1 * gt_bboxes_3d[:, 1] gt_bboxes_3d[:, 1] = -1 * gt_bboxes_3d[:, 1]
results['flip'] = True
results['gt_bboxes_3d'] = gt_bboxes_3d results['gt_bboxes_3d'] = gt_bboxes_3d
results['points'] = points results['points'] = points
...@@ -40,7 +48,8 @@ class IndoorFlipData(object): ...@@ -40,7 +48,8 @@ class IndoorFlipData(object):
def __repr__(self): def __repr__(self):
repr_str = self.__class__.__name__ repr_str = self.__class__.__name__
repr_str += '(flip_ratio={})'.format(self.flip_ratio) repr_str += '(flip_ratio_yz={})'.format(self.flip_ratio_yz)
repr_str += '(flip_ratio_xz={})'.format(self.flip_ratio_xz)
return repr_str return repr_str
...@@ -48,7 +57,8 @@ class IndoorFlipData(object): ...@@ -48,7 +57,8 @@ class IndoorFlipData(object):
class IndoorPointsColorJitter(object): class IndoorPointsColorJitter(object):
"""Indoor Points Color Jitter. """Indoor Points Color Jitter.
Augment the color of points. Randomly change the brightness and color of the point cloud, and
drop out the points' colors with a certain range and probability.
Args: Args:
color_mean (List[float]): Mean color of the point cloud. color_mean (List[float]): Mean color of the point cloud.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment