# Initialize NuScenes object.
# We do not store it in self to let garbage collection take care of it and save memory.
nusc = NuScenes(version=nusc_version, verbose=verbose, dataroot=nusc_dataroot)
nusc가 필요한 부분을 정리
1. load.gt()
gt_boxes = load_gt(nusc, self.eval_set, TrackingBox, verbose=verbose)
sample.json['token']
# Read out all sample_tokens in DB.
sample_tokens_all = [s['token'] for s in nusc.sample]
sample.json['scene_token']
scene.json['name']
for sample_token in sample_tokens_all:
scene_token = nusc.get('sample', sample_token)['scene_token']
scene_record = nusc.get('scene', scene_token)
if scene_record['name'] in splits[eval_split]:
sample_tokens.append(sample_token)
sample.json['sample_token']
sample_annotation.json
for ann_record in self.sample_annotation:
sample_record = self.get('sample', ann_record['sample_token'])
sample_record['anns'].append(ann_record['token'])
sample = nusc.get('sample', sample_token)
sample_annotation_tokens = sample['anns']
for sample_annotation_token in sample_annotation_tokens:
sample_annotation = nusc.get('sample_annotation', sample_annotation_token)
sample_annotation.json['instance_token']
# Use nuScenes token as tracking id.
tracking_id = sample_annotation['instance_token']
instance.json['category_token']
sample_annotation.json['instance_token']
category.json['name']
# Decorate (adds short-cut) sample_annotation table with for category name.
for record in self.sample_annotation:
inst = self.get('instance', record['instance_token'])
record['category_name'] = self.get('category', inst['category_token'])['name']
tracking_name = category_to_tracking_name(sample_annotation['category_name'])
sample_annotation.json['translation']['size']['rotation']
sample_annotation.json['prev']['next']
sample_annotation.json['num_lidar_pts']['num_radar_pts']
sample.json['timestamp']
sample_boxes.append(
box_cls(
sample_token=sample_token,
translation=sample_annotation['translation'],
size=sample_annotation['size'],
rotation=sample_annotation['rotation'],
velocity=nusc.box_velocity(sample_annotation['token'])[:2],
num_pts=sample_annotation['num_lidar_pts'] + sample_annotation['num_radar_pts'],
tracking_id=tracking_id,
tracking_name=tracking_name,
tracking_score=-1.0 # GT samples do not have a score.
)
)
2. add_center_dist()
# Add center distances.
pred_boxes = add_center_dist(nusc, pred_boxes)
gt_boxes = add_center_dist(nusc, gt_boxes)
sample.json
sample_data.json['ego_pose_token']
for sample_token in eval_boxes.sample_tokens:
sample_rec = nusc.get('sample', sample_token)
sd_record = nusc.get('sample_data', sample_rec['data']['LIDAR_TOP'])
pose_record = nusc.get('ego_pose', sd_record['ego_pose_token'])
ego_pose.json['translation']
ego_translation = (box.translation[0] - pose_record['translation'][0],
box.translation[1] - pose_record['translation'][1],
box.translation[2] - pose_record['translation'][2])
3. filter_eval_boxes()
pred_boxes = filter_eval_boxes(nusc, pred_boxes, self.cfg.class_range, verbose=verbose)
gt_boxes = filter_eval_boxes(nusc, gt_boxes, self.cfg.class_range, verbose=verbose)
sample_annotation.json
instance.json
category.json
# Perform bike-rack filtering.
sample_anns = nusc.get('sample', sample_token)['anns']
bikerack_recs = [nusc.get('sample_annotation', ann) for ann in sample_anns if
nusc.get('sample_annotation', ann)['category_name'] == 'static_object.bicycle_rack']
4. create_tracks()
# Convert boxes to tracks format.
self.tracks_gt = create_tracks(gt_boxes, nusc, self.eval_set, gt=True)
self.tracks_pred = create_tracks(pred_boxes, nusc, self.eval_set, gt=False)
sample.json['scene_token']
scene.json
scene_token = nusc.get('sample', sample_token)['scene_token']
scene = nusc.get('scene', scene_token)
최종
sample.json
sample_data.json
sample_annotation.json
scene.json
instance.json
category.json
ego_pose.json
'Dataset > K-Radar' 카테고리의 다른 글
K-Radar RTNH code run (1) | 2023.11.21 |
---|---|
make kradar json file(nuscenes ver.) (2) | 2023.10.17 |
kradar_token information (0) | 2023.10.16 |
nuscenes v1.0trainval (1) | 2023.10.11 |