Unverified Commit fab8ea75 authored by ChaimZhu's avatar ChaimZhu Committed by GitHub
Browse files

[Enhance] support semantic seg in Flip3D augmentation (#1181)

* support semantic seg in flip

* change box_dtype_3d to bbox3d_fields
parent 19f7461c
......@@ -112,6 +112,10 @@ class RandomFlip3D(RandomFlip):
updated in the result dict.
"""
assert direction in ['horizontal', 'vertical']
# for semantic segmentation task, only points will be flipped.
if 'bbox3d_fields' not in input_dict:
input_dict['points'].flip(direction)
return
if len(input_dict['bbox3d_fields']) == 0: # test mode
input_dict['bbox3d_fields'].append('empty_box3d')
input_dict['empty_box3d'] = input_dict['box_type_3d'](
......@@ -148,7 +152,7 @@ class RandomFlip3D(RandomFlip):
'pcd_horizontal_flip' and 'pcd_vertical_flip' keys are added \
into result dict.
"""
# filp 2D image and its annotations
# flip 2D image and its annotations
super(RandomFlip3D, self).__call__(input_dict)
if self.sync_2d:
......@@ -916,11 +920,11 @@ class PointSample(object):
"""
points = results['points']
# Points in Camera coord can provide the depth information.
# TODO: Need to suport distance-based sampling for other coord system.
# TODO: Need to support distance-based sampling for other coord system.
if self.sample_range is not None:
from mmdet3d.core.points import CameraPoints
assert isinstance(points, CameraPoints), \
'Sampling based on distance is only appliable for CAMERA coord'
'Sampling based on distance is only applicable for CAM coord'
points, choices = self._points_random_sampling(
points,
self.num_points,
......@@ -1288,7 +1292,7 @@ class VoxelBasedPointSampler(object):
Args:
cur_sweep_cfg (dict): Config for sampling current points.
prev_sweep_cfg (dict): Config for sampling previous points.
time_dim (int): Index that indicate the time dimention
time_dim (int): Index that indicate the time dimension
for input points.
"""
......@@ -1312,7 +1316,7 @@ class VoxelBasedPointSampler(object):
points (np.ndarray): Points subset to be sampled.
sampler (VoxelGenerator): Voxel based sampler for
each points subset.
point_dim (int): The dimention of each points
point_dim (int): The dimension of each points
Returns:
np.ndarray: Sampled points.
......@@ -1393,7 +1397,7 @@ class VoxelBasedPointSampler(object):
points_numpy = points_numpy.squeeze(1)
results['points'] = points.new_point(points_numpy[..., :original_dim])
# Restore the correspoinding seg and mask fields
# Restore the corresponding seg and mask fields
for key, dim_index in map_fields2dim:
results[key] = points_numpy[..., dim_index]
......
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