Skip to content

Commit

Permalink
fix scaling with roi boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
David Josef Emmerichs authored and demmerichs committed Jul 31, 2023
1 parent 5c226dc commit 8a76f59
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pcdet/datasets/augmentor/augmentor_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def global_rotation(gt_boxes, points, rot_range, return_rot=False, noise_rotatio
def global_scaling(gt_boxes, points, scale_range, return_scale=False):
"""
Args:
gt_boxes: (N, 7), [x, y, z, dx, dy, dz, heading]
gt_boxes: (N, 7), [x, y, z, dx, dy, dz, heading, [vx], [vy]]
points: (M, 3 + C),
scale_range: [min, max]
Returns:
Expand All @@ -66,7 +66,7 @@ def global_scaling(gt_boxes, points, scale_range, return_scale=False):
points[:, :3] *= noise_scale
gt_boxes[:, :6] *= noise_scale
if gt_boxes.shape[1] > 7:
gt_boxes[:, 7:] *= noise_scale
gt_boxes[:, 7:9] *= noise_scale

if return_scale:
return gt_boxes, points, noise_scale
Expand All @@ -75,7 +75,7 @@ def global_scaling(gt_boxes, points, scale_range, return_scale=False):
def global_scaling_with_roi_boxes(gt_boxes, roi_boxes, points, scale_range, return_scale=False):
"""
Args:
gt_boxes: (N, 7), [x, y, z, dx, dy, dz, heading]
gt_boxes: (N, 7), [x, y, z, dx, dy, dz, heading, [vx], [vy]]
points: (M, 3 + C),
scale_range: [min, max]
Returns:
Expand All @@ -85,7 +85,11 @@ def global_scaling_with_roi_boxes(gt_boxes, roi_boxes, points, scale_range, retu
noise_scale = np.random.uniform(scale_range[0], scale_range[1])
points[:, :3] *= noise_scale
gt_boxes[:, :6] *= noise_scale
if gt_boxes.shape[1] > 7:
gt_boxes[:, 7:9] *= noise_scale

roi_boxes[:,:, [0,1,2,3,4,5,7,8]] *= noise_scale

if return_scale:
return gt_boxes,roi_boxes, points, noise_scale
return gt_boxes, roi_boxes, points
Expand Down

0 comments on commit 8a76f59

Please sign in to comment.