Unverified Commit 07419768 authored by ltphy's avatar ltphy Committed by GitHub
Browse files

fix sampling points (#218)

parent 96a60920
...@@ -89,9 +89,14 @@ class DataProcessor(object): ...@@ -89,9 +89,14 @@ class DataProcessor(object):
far_idxs_choice = np.where(pts_near_flag == 0)[0] far_idxs_choice = np.where(pts_near_flag == 0)[0]
near_idxs = np.where(pts_near_flag == 1)[0] near_idxs = np.where(pts_near_flag == 1)[0]
near_idxs_choice = np.random.choice(near_idxs, num_points - len(far_idxs_choice), replace=False) near_idxs_choice = np.random.choice(near_idxs, num_points - len(far_idxs_choice), replace=False)
choice = []
choice = np.concatenate((near_idxs_choice, far_idxs_choice), axis=0) \ if num_points > len(far_idxs_choice):
if len(far_idxs_choice) > 0 else near_idxs_choice near_idxs_choice = np.random.choice(near_idxs, num_points - len(far_idxs_choice), replace=False)
choice = np.concatenate((near_idxs_choice, far_idxs_choice), axis=0) \
if len(far_idxs_choice) > 0 else near_idxs_choice
else:
choice = np.arange(0, len(points), dtype=np.int32)
choice = np.random.choice(choice, num_points, replace=False)
np.random.shuffle(choice) np.random.shuffle(choice)
else: else:
choice = np.arange(0, len(points), dtype=np.int32) choice = np.arange(0, len(points), dtype=np.int32)
......
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