i want to train a deep learning model for which i want camera and radar data for each sample in the scene. I am getting error in the code lines with " * ". The problem is that its not iterating through each and every sample in a scene.
nusc = NuScenes(version=‘v1.0-mini’, dataroot=’/data/sets/nuscenes’, verbose=True)
Iterate through scenes in the dataset
for scene in nusc.scene:
scene_data = nusc.get('scene', scene['token'])
# Get front camera and radar data for each sample in the scene
* for sample_token in scene_data['first_sample_token']:
* sample = nusc.get('sample', sample_token)
# Get front-radar data
radar_data = nusc.get('sample_data', sample['data']['RADAR_FRONT'])
# Load radar data
radar_points = RadarPointCloud.from_file(radar_data['filename'])
# Get radar-to-ego transformation
radar_pose_rec = nusc.get('ego_pose', radar_data['ego_pose_token'])
radar_cs_rec = nusc.get('calibrated_sensor', radar_data['calibrated_sensor_token'])
radar_to_ego = transform_matrix(radar_cs_rec['translation'], pq.Quaternion(radar_cs_rec['rotation']), inverse=False)
# Get front-camera data
camera_data = nusc.get('sample_data', sample['data']['CAM_FRONT'])
# Get ego-to-camera transformation
camera_pose_rec = nusc.get('ego_pose', camera_data['ego_pose_token'])
camera_cs_rec = nusc.get('calibrated_sensor', camera_data['calibrated_sensor_token'])
ego_to_camera = transform_matrix(camera_cs_rec['translation'], pq.Quaternion(camera_cs_rec['rotation']), inverse=True)