Radar points counting


I used the codes below to get the radar points from a specific instance.

current_sample_ann = nusc.get('sample_annotation', obj_sample_ann_token)
print("num_radar_pts from sample annotation: " + str(current_sample_ann['num_radar_pts']))
current_sample = nusc.get('sample', current_sample_ann['sample_token'])

mask = []
radars = [key for key in current_sample['data'].keys() if 'RADAR' in key]
for radar in radars:
    # Return boxes and radar pts in sensor coord sys 
    data_path, boxes, _ = nusc.get_sample_data(current_sample['data'][radar], 
    pc = RadarPointCloud.from_file(data_path)
    # Then use points_in_box to check if the radar pts fall into the box
    arr = points_in_box(boxes[0], pc.points[0:3, :], wlh_factor=1.0)
print("num_radar_pts from pcd files: " + str(mask.count(True)))

So I used the function get_sample_data to get the box of a specific instance. Next, read all the radar points, and then used points_in_box function to check if the point in that box. Finally, I calculated the number of the points in that box.

At the same time, I compared the number of radar points I got with the num_radar_pts in the sample_annotation. What I found is these two numbers are different. In my case, I got something as following:

Scene name: scene-0061
Description: Parked truck, construction, intersection, turn left, following a van
Number of samples: 39
num_radar_pts from sample annotation: 13
num_radar_pts from pcd files: 7

My questions are:

  1. Is the same way how the num_radar_pts is calculated?
  2. If 1. is true, should I put wlh_factor=1.0 into the function points_in_box when calculating the number of radar points?
  3. If 1. is true, should I use function RadarPointCloud.from_file to load the radar points from pcd file? It seems that this function has filtered some radar points.
  4. If 1. is false, what’s the exact way to calculate num_radar_pts in sample_annotation?


I think the main difference are the radar filter settings. By default we filter most of the points. Try:

            pc = RadarPointCloud.from_file(pc_path,

wlh_factor=1.0 is correct.