Exemple #1
0
        sample_rec = nusc.get('sample', scene_rec['first_sample_token'])
        f_rad_rec = nusc.get('sample_data', sample_rec['data']['RADAR_FRONT'])
        f_cam_rec = nusc.get('sample_data', sample_rec['data']['CAM_FRONT'])

        has_more_data = True
        while has_more_data:

            bboxes = []
            filtered_anns = []
            ax1 = fig.add_subplot(1, 2, 1)
            ax2 = fig.add_subplot(1, 2, 2)
            camera_token = f_cam_rec['token']
            radar_token = f_rad_rec['token']

            ## FRONT CAM + RADAR
            impath, boxes, camera_intrinsic = nusc.get_select_sample_data(
                camera_token, min_ann_vis_level=1)
            points, coloring, image = nusc.explorer.map_pointcloud_to_image(
                radar_token, camera_token)
            points[2, :] = coloring

            ## -----------------------------------------------------------------
            ## Do the processing here

            # Plot the 3D boxes and create 2D COCO bboxes
            for box in boxes:
                coco_cat, coco_supercat = nuscene_cat_to_coco(box.name)
                if coco_cat is None:
                    continue
                c = np.array(nusc.explorer.get_color(box.name)) / 255.0
                box.render(ax1,
                           view=camera_intrinsic,
Exemple #2
0
        bl_rad_rec = nusc.get('sample_data',
                              sample_rec['data']['RADAR_BACK_LEFT'])

        has_more_data = True
        while has_more_data:
            rnd = random.uniform(0, 1)
            anns_f = []
            anns_b = []
            f_camera_token = f_cam_rec['token']
            b_camera_token = b_cam_rec['token']
            f_radar_token = f_rad_rec['token']
            br_radar_token = br_rad_rec['token']
            bl_radar_token = bl_rad_rec['token']

            ## FRONT CAM + RADAR
            impath_f, boxes_f, camera_intrinsic_f = nusc.get_select_sample_data(
                f_camera_token, min_ann_vis_level=1)
            points_f, coloring_f, image_f = nusc.explorer.map_pointcloud_to_image(
                f_radar_token, f_camera_token)
            points_f[2, :] = coloring_f

            ## Back CAM + RADARs
            impath_b, boxes_b, camera_intrinsic_b = nusc.get_select_sample_data(
                b_camera_token, min_ann_vis_level=1)
            points_br, coloring_br, image_b = nusc.explorer.map_pointcloud_to_image(
                br_radar_token, b_camera_token)
            points_br[2, :] = coloring_br
            points_bl, coloring_bl, _ = nusc.explorer.map_pointcloud_to_image(
                bl_radar_token, b_camera_token)
            points_bl[2, :] = coloring_bl

            ## Concatenate the two back Radar detections