Commit c2c0f3d8 authored by liyinhao's avatar liyinhao
Browse files

delete extra files and some unnecessary code, add assertions

parent c087723d
...@@ -242,7 +242,7 @@ def rotation_points_single_angle(points, angle, axis=0): ...@@ -242,7 +242,7 @@ def rotation_points_single_angle(points, angle, axis=0):
else: else:
raise ValueError('axis should in range') raise ValueError('axis should in range')
return points @ rot_mat_T.T, rot_mat_T return points @ rot_mat_T, rot_mat_T
def project_to_image(points_3d, proj_mat): def project_to_image(points_3d, proj_mat):
......
...@@ -182,6 +182,7 @@ class IndoorGlobalRotScale(object): ...@@ -182,6 +182,7 @@ class IndoorGlobalRotScale(object):
name = 'scannet' if gt_bboxes_3d.shape[1] == 6 else 'sunrgbd' name = 'scannet' if gt_bboxes_3d.shape[1] == 6 else 'sunrgbd'
if self.rot_range is not None: if self.rot_range is not None:
assert len(self.rot_range) == 2
rot_angle = np.random.uniform(self.rot_range[0], self.rot_range[1]) rot_angle = np.random.uniform(self.rot_range[0], self.rot_range[1])
rot_mat = self._rotz(rot_angle) rot_mat = self._rotz(rot_angle)
points[:, :3] = np.dot(points[:, :3], rot_mat.T) points[:, :3] = np.dot(points[:, :3], rot_mat.T)
...@@ -193,15 +194,16 @@ class IndoorGlobalRotScale(object): ...@@ -193,15 +194,16 @@ class IndoorGlobalRotScale(object):
gt_bboxes_3d[:, 6] -= rot_angle gt_bboxes_3d[:, 6] -= rot_angle
if self.scale_range is not None: if self.scale_range is not None:
assert len(self.scale_range) == 2
# Augment point cloud scale # Augment point cloud scale
scale_ratio = np.random.uniform(self.scale_range[0], scale_ratio = np.random.uniform(self.scale_range[0],
self.scale_range[1]) self.scale_range[1])
scale_ratio = np.tile(scale_ratio, 3)[None, ...]
points[:, :3] *= scale_ratio points[:, :3] *= scale_ratio
gt_bboxes_3d[:, :3] *= scale_ratio gt_bboxes_3d[:, :3] *= scale_ratio
gt_bboxes_3d[:, 3:6] *= scale_ratio gt_bboxes_3d[:, 3:6] *= scale_ratio
if self.use_height: if self.use_height:
points[:, -1] *= scale_ratio[0, 0] points[:, -1] *= scale_ratio
results['points'] = points results['points'] = points
results['gt_bboxes_3d'] = gt_bboxes_3d results['gt_bboxes_3d'] = gt_bboxes_3d
......
0.97959 0.012593 0.20061 0.012593 0.99223 -0.12377 -0.20061 0.12377 0.97182
529.5 0 0 0 529.5 0 365 265 1
bed 328 152 346 320 1.047307 4.168696 -0.246859 0.943792 1.151035 0.984807 -0.124529 -0.992216
night_stand 5.725418e+02 2.756355e+02 9.837793e+01 5.317726e+01 2.583086 4.811675 -0.786667 0.441588 0.292586 0.486667 -0.079116 -0.996865
ottoman 3.323579e+02 3.181773e+02 3.164047e+02 2.091639e+02 0.822727 2.518182 -0.861364 0.795610 0.351884 0.338636 -0.103340 -0.994646
dresser_mirror 1.577592e+02 1.063545e+01 1.568729e+02 3.624916e+02 -0.831818 3.845455 -0.179545 0.974308 0.301683 1.020455 0.994423 -0.105469
dresser 1 1 221 529 -1.086364 1.904545 -0.147727 0.781567 0.356405 1.052273 0.994781 -0.102029
lamp 6.141973e+02 2.003010e+02 5.494983e+01 9.394649e+01 2.566667 4.800000 0.118333 0.321404 0.216742 0.441667 -0.148340 -0.988936
bed 328 152 346 320 1.047307 4.168696 -0.246859 0.943792 1.151035 0.984807 -0.124529 -0.992216
night_stand 5.685384e+02 2.766194e+02 9.535192e+01 9.226649e+01 2.431818 4.840909 -0.750000 0.287264 0.273673 0.450000 -0.083045 -0.996546
ottoman 324 319 325 211 0.822727 2.518182 -0.861364 0.795610 0.351884 0.338636 -0.103340 -0.994646
dresser_mirror 154 17 151 368 -0.831818 3.845455 -0.179545 0.974308 0.301683 1.020455 0.994423 -0.105469
dresser 1 1 221 529 -1.086364 1.904545 -0.147727 0.781567 0.356405 1.052273 0.994781 -0.102029
...@@ -49,6 +49,7 @@ def test_indoor_flip_data(): ...@@ -49,6 +49,7 @@ def test_indoor_flip_data():
scannet_results = scannet_indoor_flip_data(scannet_results) scannet_results = scannet_indoor_flip_data(scannet_results)
scannet_points = scannet_results.get('points', None) scannet_points = scannet_results.get('points', None)
scannet_gt_bboxes_3d = scannet_results.get('gt_bboxes_3d', None) scannet_gt_bboxes_3d = scannet_results.get('gt_bboxes_3d', None)
expected_scannet_points = np.array( expected_scannet_points = np.array(
[[-1.6110241, 0.16903955, 0.5811581, 0.5989725], [[-1.6110241, 0.16903955, 0.5811581, 0.5989725],
[-1.3978075, -0.42035791, 0.38729519, 0.40510958]]) [-1.3978075, -0.42035791, 0.38729519, 0.40510958]])
...@@ -82,6 +83,7 @@ def test_global_rot_scale(): ...@@ -82,6 +83,7 @@ def test_global_rot_scale():
sunrgbd_results = sunrgbd_augment(sunrgbd_results) sunrgbd_results = sunrgbd_augment(sunrgbd_results)
sunrgbd_points = sunrgbd_results.get('points', None) sunrgbd_points = sunrgbd_results.get('points', None)
sunrgbd_gt_bboxes_3d = sunrgbd_results.get('gt_bboxes_3d', None) sunrgbd_gt_bboxes_3d = sunrgbd_results.get('gt_bboxes_3d', None)
expected_sunrgbd_points = np.array( expected_sunrgbd_points = np.array(
[[0.89427376, 3.94489646, 0.21003141, 1.72415094], [[0.89427376, 3.94489646, 0.21003141, 1.72415094],
[-0.47835783, 1.09972989, -0.79757058, 0.71654893]]) [-0.47835783, 1.09972989, -0.79757058, 0.71654893]])
...@@ -113,6 +115,7 @@ def test_global_rot_scale(): ...@@ -113,6 +115,7 @@ def test_global_rot_scale():
scannet_results = scannet_augment(scannet_results) scannet_results = scannet_augment(scannet_results)
scannet_points = scannet_results.get('points', None) scannet_points = scannet_results.get('points', None)
scannet_gt_bboxes_3d = scannet_results.get('gt_bboxes_3d', None) scannet_gt_bboxes_3d = scannet_results.get('gt_bboxes_3d', None)
expected_scannet_points = np.array( expected_scannet_points = np.array(
[[1.61240576, -0.15530836, 0.5811581, 0.5989725], [[1.61240576, -0.15530836, 0.5811581, 0.5989725],
[1.39417555, 0.43225122, 0.38729519, 0.40510958]]) [1.39417555, 0.43225122, 0.38729519, 0.40510958]])
......
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