".github/git@developer.sourcefind.cn:OpenDAS/nerfacc.git" did not exist on "6ce69df7c33255ebdf1ae34d0b3b53d12afb5070"
Commit d9c7fb38 authored by liyinhao's avatar liyinhao
Browse files

add empty lines

parent 6ce6b0fc
...@@ -60,6 +60,7 @@ class IndoorFlipData(object): ...@@ -60,6 +60,7 @@ class IndoorFlipData(object):
def __call__(self, results): def __call__(self, results):
points = results.get('points', None) points = results.get('points', None)
gt_boxes = results.get('gt_boxes', None) gt_boxes = results.get('gt_boxes', None)
if np.random.random() > 0.5: if np.random.random() > 0.5:
# Flipping along the YZ plane # Flipping along the YZ plane
points[:, 0] = -1 * points[:, 0] points[:, 0] = -1 * points[:, 0]
...@@ -67,6 +68,7 @@ class IndoorFlipData(object): ...@@ -67,6 +68,7 @@ class IndoorFlipData(object):
if self.name == 'sunrgbd': if self.name == 'sunrgbd':
gt_boxes[:, 6] = np.pi - gt_boxes[:, 6] gt_boxes[:, 6] = np.pi - gt_boxes[:, 6]
results['gt_boxes'] = gt_boxes results['gt_boxes'] = gt_boxes
if self.name == 'scannet' and np.random.random() > 0.5: if self.name == 'scannet' and np.random.random() > 0.5:
# Flipping along the XZ plane # Flipping along the XZ plane
points[:, 1] = -1 * points[:, 1] points[:, 1] = -1 * points[:, 1]
...@@ -103,11 +105,13 @@ class IndoorRotateData(object): ...@@ -103,11 +105,13 @@ class IndoorRotateData(object):
3) - np.pi / 6 # -30 ~ +30 degree 3) - np.pi / 6 # -30 ~ +30 degree
rot_mat = _rotz(rot_angle) rot_mat = _rotz(rot_angle)
points[:, 0:3] = np.dot(points[:, 0:3], np.transpose(rot_mat)) points[:, 0:3] = np.dot(points[:, 0:3], np.transpose(rot_mat))
if self.name == 'scannet': if self.name == 'scannet':
gt_boxes = _rotate_aligned_boxes(gt_boxes, rot_mat) gt_boxes = _rotate_aligned_boxes(gt_boxes, rot_mat)
else: else:
gt_boxes[:, 0:3] = np.dot(gt_boxes[:, 0:3], np.transpose(rot_mat)) gt_boxes[:, 0:3] = np.dot(gt_boxes[:, 0:3], np.transpose(rot_mat))
gt_boxes[:, 6] -= rot_angle gt_boxes[:, 6] -= rot_angle
results['points'] = points results['points'] = points
results['gt_boxes'] = gt_boxes results['gt_boxes'] = gt_boxes
return results return results
......
...@@ -28,6 +28,7 @@ class IndoorLoadData(object): ...@@ -28,6 +28,7 @@ class IndoorLoadData(object):
def __call__(self, results): def __call__(self, results):
data_path = results.get('data_path', None) data_path = results.get('data_path', None)
info = results.get('info', None) info = results.get('info', None)
if info['annos']['gt_num'] != 0: if info['annos']['gt_num'] != 0:
gt_boxes = info['annos']['gt_boxes_upright_depth'] gt_boxes = info['annos']['gt_boxes_upright_depth']
gt_classes = info['annos']['class'].reshape(-1, 1) gt_classes = info['annos']['class'].reshape(-1, 1)
...@@ -36,6 +37,7 @@ class IndoorLoadData(object): ...@@ -36,6 +37,7 @@ class IndoorLoadData(object):
gt_boxes = np.zeros((1, 6), dtype=np.float32) gt_boxes = np.zeros((1, 6), dtype=np.float32)
gt_classes = np.zeros((1, 1)) gt_classes = np.zeros((1, 1))
gt_boxes_mask = np.zeros((1, 1)) gt_boxes_mask = np.zeros((1, 1))
if self.name == 'scannet': if self.name == 'scannet':
scan_name = info['points']['lidar_idx'] scan_name = info['points']['lidar_idx']
points = self._get_lidar(scan_name, data_path) points = self._get_lidar(scan_name, data_path)
...@@ -45,6 +47,7 @@ class IndoorLoadData(object): ...@@ -45,6 +47,7 @@ class IndoorLoadData(object):
points = np.load( points = np.load(
osp.join(data_path, 'lidar', osp.join(data_path, 'lidar',
'%06d.npz' % info['points']['lidar_idx']))['pc'] '%06d.npz' % info['points']['lidar_idx']))['pc']
if not self.use_color: if not self.use_color:
points = points[:, 0:3] # do not use color for now points = points[:, 0:3] # do not use color for now
pcl_color = points[:, 3:6] pcl_color = points[:, 3:6]
...@@ -52,11 +55,13 @@ class IndoorLoadData(object): ...@@ -52,11 +55,13 @@ class IndoorLoadData(object):
points = points[:, 0:6] points = points[:, 0:6]
pcl_color = points[:, 3:6] pcl_color = points[:, 3:6]
points[:, 3:] = (points[:, 3:] - np.array(self.mean_color)) / 256.0 points[:, 3:] = (points[:, 3:] - np.array(self.mean_color)) / 256.0
if self.use_height: if self.use_height:
floor_height = np.percentile(points[:, 2], 0.99) floor_height = np.percentile(points[:, 2], 0.99)
height = points[:, 2] - floor_height height = points[:, 2] - floor_height
points = np.concatenate([points, np.expand_dims(height, 1)], 1) points = np.concatenate([points, np.expand_dims(height, 1)], 1)
results['points'] = points results['points'] = points
if self.name == 'scannet': if self.name == 'scannet':
results['pcl_color'] = pcl_color results['pcl_color'] = pcl_color
results['instance_labels'] = instance_labels results['instance_labels'] = instance_labels
......
...@@ -24,6 +24,7 @@ def test_indoor_flip_data(): ...@@ -24,6 +24,7 @@ def test_indoor_flip_data():
sunrgbd_gt_boxes = sunrgbd_results.get('gt_boxes', None) sunrgbd_gt_boxes = sunrgbd_results.get('gt_boxes', None)
assert sunrgbd_points.shape == (2, 4) assert sunrgbd_points.shape == (2, 4)
assert sunrgbd_gt_boxes.shape == (2, 7) assert sunrgbd_gt_boxes.shape == (2, 7)
scannet_flip_data = IndoorFlipData('scannet') scannet_flip_data = IndoorFlipData('scannet')
scannet_results = dict() scannet_results = dict()
scannet_results['points'] = np.array( scannet_results['points'] = np.array(
...@@ -43,7 +44,7 @@ def test_indoor_flip_data(): ...@@ -43,7 +44,7 @@ def test_indoor_flip_data():
def test_indoor_rotate_data(): def test_indoor_rotate_data():
sunrgbd_indoor_rotate_data = IndoorRotateData('sunrgbd') sunrgbd_indoor_rotate_data = IndoorRotateData('sunrgbd')
scannet_indoor_rotate_data = IndoorRotateData('scannet')
sunrgbd_results = dict() sunrgbd_results = dict()
sunrgbd_results['points'] = np.array( sunrgbd_results['points'] = np.array(
[[1.02828765e+00, 3.65790772e+00, 1.97294697e-01, 1.61959505e+00], [[1.02828765e+00, 3.65790772e+00, 1.97294697e-01, 1.61959505e+00],
...@@ -61,6 +62,8 @@ def test_indoor_rotate_data(): ...@@ -61,6 +62,8 @@ def test_indoor_rotate_data():
sunrgbd_gt_boxes = sunrgbd_results.get('gt_boxes', None) sunrgbd_gt_boxes = sunrgbd_results.get('gt_boxes', None)
assert sunrgbd_points.shape == (2, 4) assert sunrgbd_points.shape == (2, 4)
assert sunrgbd_gt_boxes.shape == (2, 7) assert sunrgbd_gt_boxes.shape == (2, 7)
scannet_indoor_rotate_data = IndoorRotateData('scannet')
scannet_results = dict() scannet_results = dict()
scannet_results['points'] = np.array( scannet_results['points'] = np.array(
[[1.6110241e+00, -1.6903955e-01, 5.8115810e-01, 5.9897250e-01], [[1.6110241e+00, -1.6903955e-01, 5.8115810e-01, 5.9897250e-01],
......
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