Unverified Commit 7438a47c authored by Wenhao Wu's avatar Wenhao Wu Committed by GitHub
Browse files

[Fix] Remove PointSample constraint (#1314)

* remove the constraint of PointSample with distance

* rename variable
parent 1f906cff
......@@ -907,9 +907,9 @@ class PointSample(object):
point_range = range(len(points))
if sample_range is not None and not replace:
# Only sampling the near points when len(points) >= num_samples
depth = np.linalg.norm(points.tensor, axis=1)
far_inds = np.where(depth >= sample_range)[0]
near_inds = np.where(depth < sample_range)[0]
dist = np.linalg.norm(points.tensor, axis=1)
far_inds = np.where(dist >= sample_range)[0]
near_inds = np.where(dist < sample_range)[0]
# in case there are too many far points
if len(far_inds) > num_samples:
far_inds = np.random.choice(
......@@ -936,12 +936,6 @@ class PointSample(object):
and 'pts_semantic_mask' keys are updated in the result dict.
"""
points = results['points']
# Points in Camera coord can provide the depth information.
# 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 applicable for CAM coord'
points, choices = self._points_random_sampling(
points,
self.num_points,
......
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