数据集下载: nuScenes.
GitHub: nuscenes-devkit.
对应jupyter notebook教程翻译
安装
指令:
pip install nuscenes-devkit
数据集使用
对应GitHub中的 nuscenes-devkit/python-sdk/tutorials/nuimages_tutorial.ipynb
下载数据集的mini版本
%matplotlib inline
from nuscenes.nuscenes import NuScenes
nusc = NuScenes(version='v1.0-mini', dataroot='H:/Downloads/v1.0-mini', verbose=True)
这里需要将dataroot改成自己的数据集下载目录。
输出结果:
Loading NuScenes tables for version v1.0-mini...
23 category,
8 attribute,
4 visibility,
911 instance,
12 sensor,
120 calibrated_sensor,
31206 ego_pose,
8 log,
10 scene,
404 sample,
31206 sample_data,
18538 sample_annotation,
4 map,
Done loading in 3.4 seconds.
Reverse indexing ...
Done reverse indexing in 0.6 seconds.
即数据集相关信息。
scene:场景-20秒的汽车行程片段
sample:样本-特定时间戳的场景的标注快照
sample_data:样本数据-从特定传感器采集的数据
sample_annotation:样本标注-我们感兴趣的目标的标注实例
instance:实例-枚举我们观察到的所有目标实例
category:类别-目标类别的分类法(例如车辆、人)
attribute:属性-在类别保持不变的情况下可以更改的实例的属性
visibility:可见性-从6个不同摄像头采集的所有图像中可见的像素部分
sensor:传感器-特定传感器类型
calibrated sensor:校准传感器-在特定车辆上校准的特定传感器
ego_pose:自主姿态-自主车辆载具在特定时间戳的姿态
log:日志—从中提取数据的日志信息
map:映射—从自顶向下的视图中存储为二进制语义掩码的映射数据
场景
包含1000个场景的标注样本,每个场景约20s。
nusc.list_scenes()
输出:
scene-0061, Parked truck, construction, intersectio... [18-07-24 03:28:47] 19s, singapore-onenorth, #anns:4622
scene-0103, Many peds right, wait for turning car, ... [18-08-01 19:26:43] 19s, boston-seaport, #anns:2046
scene-0655, Parking lot, parked cars, jaywalker, be... [18-08-27 15:51:32] 20s, boston-seaport, #anns:2332
scene-0553, Wait at intersection, bicycle, large tr... [18-08-28 20:48:16] 20s, boston-seaport, #anns:1950
scene-0757, Arrive at busy intersection, bus, wait ... [18-08-30 19:25:08] 20s, boston-seaport, #anns:592
scene-0796, Scooter, peds on sidewalk, bus, cars, t... [18-10-02 02:52:24] 20s, singapore-queensto, #anns:708
scene-0916, Parking lot, bicycle rack, parked bicyc... [18-10-08 07:37:13] 20s, singapore-queensto, #anns:2387
scene-1077, Night, big street, bus stop, high speed... [18-11-21 11:39:27] 20s, singapore-hollandv, #anns:890
scene-1094, Night, after rain, many peds, PMD, ped ... [18-11-21 11:47:27] 19s, singapore-hollandv, #anns:1762
scene-1100, Night, peds in sidewalk, peds cross cro... [18-11-21 11:49:47] 19s, singapore-hollandv, #anns:935
查看元数据:
my_scene = nusc.scene[0]
my_scene
输出:
{'token': 'cc8c0bf57f984915a77078b10eb33198',
'log_token': '7e25a2c8ea1f41c5b0da1e69ecfa71a2',
'nbr_samples': 39,
'first_sample_token': 'ca9a282c9e77460f8360f564131a8af5',
'last_sample_token': 'ed5fc18c31904f96a8f0dbb99ff069c0',
'name': 'scene-0061',
'description': 'Parked truck, construction, intersection, turn left, following a van'}
样本
标注频率:2Hz
定义样本(Sample)为给定时间戳的标注关键帧。
查看第一个带注释的示例:
first_sample_token = my_scene['first_sample_token']
元数据:
my_sample = nusc.get('sample', first_sample_token)
my_sample
输出:
{'token': 'ca9a282c9e77460f8360f564131a8af5',
'timestamp': 1532402927647951,
'prev': '',
'next': '39586f9d59004284a7114a68825e8eec',
'scene_token': 'cc8c0bf57f984915a77078b10eb33198',
'data': {'RADAR_FRONT': '37091c75b9704e0daa829ba56dfa0906',
'RADAR_FRONT_LEFT': '11946c1461d14016a322916157da3c7d',
'RADAR_FRONT_RIGHT': '491209956ee3435a9ec173dad3aaf58b',
'RADAR_BACK_LEFT': '312aa38d0e3e4f01b3124c523e6f9776',
'RADAR_BACK_RIGHT': '07b30d5eb6104e79be58eadf94382bc1',
'LIDAR_TOP': '9d9bf11fb0e144c8b446d54a8a00184f',
'CAM_FRONT': 'e3d495d4ac534d54b321f50006683844',
'CAM_FRONT_RIGHT': 'aac7867ebf4f446395d29fbd60b63b3b',
'CAM_BACK_RIGHT': '79dbb4460a6b40f49f9c150cb118247e',
'CAM_BACK': '03bea5763f0f4722933508d5999c5fd8',
'CAM_BACK_LEFT': '43893a033f9c46d4a51b5e08a67a1eb7',
'CAM_FRONT_LEFT': 'fe5422747a7d4268a4b07fc396707b23'},
'anns': ['ef63a697930c4b20a6b9791f423351da',
'6b89da9bf1f84fd6a5fbe1c3b236f809',
'924ee6ac1fed440a9d9e3720aac635a0',
'91e3608f55174a319246f361690906ba',
'cd051723ed9c40f692b9266359f547af',
'36d52dfedd764b27863375543c965376',
'70af124fceeb433ea73a79537e4bea9e',
'63b89fe17f3e41ecbe28337e0e35db8e',
'e4a3582721c34f528e3367f0bda9485d',
'fcb2332977ed4203aa4b7e04a538e309',
'a0cac1c12246451684116067ae2611f6',
'02248ff567e3497c957c369dc9a1bd5c',
'9db977e264964c2887db1e37113cddaa',
'ca9c5dd6cf374aa980fdd81022f016fd',
'179b8b54ee74425893387ebc09ee133d',
'5b990ac640bf498ca7fd55eaf85d3e12',
'16140fbf143d4e26a4a7613cbd3aa0e8',
'54939f11a73d4398b14aeef500bf0c23',
'83d881a6b3d94ef3a3bc3b585cc514f8',
'74986f1604f047b6925d409915265bf7',
'e86330c5538c4858b8d3ffe874556cc5',
'a7bd5bb89e27455bbb3dba89a576b6a1',
'fbd9d8c939b24f0eb6496243a41e8c41',
'198023a1fb5343a5b6fad033ab8b7057',
'ffeafb90ecd5429cba23d0be9a5b54ee',
'cc636a58e27e446cbdd030c14f3718fd',
'076a7e3ec6244d3b84e7df5ebcbac637',
'0603fbaef1234c6c86424b163d2e3141',
'd76bd5dcc62f4c57b9cece1c7bcfabc5',
'5acb6c71bcd64aa188804411b28c4c8f',
'49b74a5f193c4759b203123b58ca176d',
'77519174b48f4853a895f58bb8f98661',
'c5e9455e98bb42c0af7d1990db1df0c9',
'fcc5b4b5c4724179ab24962a39ca6d65',
'791d1ca7e228433fa50b01778c32449a',
'316d20eb238c43ef9ee195642dd6e3fe',
'cda0a9085607438c9b1ea87f4360dd64',
'e865152aaa194f22b97ad0078c012b21',
'7962506dbc24423aa540a5e4c7083dad',
'29cca6a580924b72a90b9dd6e7710d3e',
'a6f7d4bb60374f868144c5ba4431bf4c',
'f1ae3f713ba946069fa084a6b8626fbf',
'd7af8ede316546f68d4ab4f3dbf03f88',
'91cb8f15ed4444e99470d43515e50c1d',
'bc638d33e89848f58c0b3ccf3900c8bb',
'26fb370c13f844de9d1830f6176ebab6',
'7e66fdf908d84237943c833e6c1b317a',
'67c5dbb3ddcc4aff8ec5140930723c37',
'eaf2532c820740ae905bb7ed78fb1037',
'3e2d17fa9aa5484d9cabc1dfca532193',
'de6bd5ffbed24aa59c8891f8d9c32c44',
'9d51d699f635478fbbcd82a70396dd62',
'b7cbc6d0e80e4dfda7164871ece6cb71',
'563a3f547bd64a2f9969278c5ef447fd',
'df8917888b81424f8c0670939e61d885',
'bb3ef5ced8854640910132b11b597348',
'a522ce1d7f6545d7955779f25d01783b',
'1fafb2468af5481ca9967407af219c32',
'05de82bdb8484623906bb9d97ae87542',
'bfedb0d85e164b7697d1e72dd971fb72',
'ca0f85b4f0d44beb9b7ff87b1ab37ff5',
'bca4bbfdef3d4de980842f28be80b3ca',
'a834fb0389a8453c810c3330e3503e16',
'6c804cb7d78943b195045082c5c2d7fa',
'adf1594def9e4722b952fea33b307937',
'49f76277d07541c5a584aa14c9d28754',
'15a3b4d60b514db5a3468e2aef72a90c',
'18cc2837f2b9457c80af0761a0b83ccc',
'2bfcc693ae9946daba1d9f2724478fd4']}
list_sample() 能够列出所有相关sample_data的关键帧和相关的sample_annotation:
nusc.list_sample(my_sample['token'])
输出:
Sample: ca9a282c9e77460f8360f564131a8af5
sample_data_token: 37091c75b9704e0daa829ba56dfa0906, mod: radar, channel: RADAR_FRONT
sample_data_token: 11946c1461d14016a322916157da3c7d, mod: radar, channel: RADAR_FRONT_LEFT
sample_data_token: 491209956ee3435a9ec173dad3aaf58b, mod: radar, channel: RADAR_FRONT_RIGHT
sample_data_token: 312aa38d0e3e4f01b3124c523e6f9776, mod: radar, channel: RADAR_BACK_LEFT
sample_data_token: 07b30d5eb6104e79be58eadf94382bc1, mod: radar, channel: RADAR_BACK_RIGHT
sample_data_token: 9d9bf11fb0e144c8b446d54a8a00184f, mod: lidar, channel: LIDAR_TOP
sample_data_token: e3d495d4ac534d54b321f50006683844, mod: camera, channel: CAM_FRONT
sample_data_token: aac7867ebf4f446395d29fbd60b63b3b, mod: camera, channel: CAM_FRONT_RIGHT
sample_data_token: 79dbb4460a6b40f49f9c150cb118247e, mod: camera, channel: CAM_BACK_RIGHT
sample_data_token: 03bea5763f0f4722933508d5999c5fd8, mod: camera, channel: CAM_BACK
sample_data_token: 43893a033f9c46d4a51b5e08a67a1eb7, mod: camera, channel: CAM_BACK_LEFT
sample_data_token: fe5422747a7d4268a4b07fc396707b23, mod: camera, channel: CAM_FRONT_LEFT
sample_annotation_token: ef63a697930c4b20a6b9791f423351da, category: human.pedestrian.adult
sample_annotation_token: 6b89da9bf1f84fd6a5fbe1c3b236f809, category: human.pedestrian.adult
sample_annotation_token: 924ee6ac1fed440a9d9e3720aac635a0, category: vehicle.car
sample_annotation_token: 91e3608f55174a319246f361690906ba, category: human.pedestrian.adult
sample_annotation_token: cd051723ed9c40f692b9266359f547af, category: movable_object.trafficcone
sample_annotation_token: 36d52dfedd764b27863375543c965376, category: vehicle.bicycle
sample_annotation_token: 70af124fceeb433ea73a79537e4bea9e, category: human.pedestrian.adult
sample_annotation_token: 63b89fe17f3e41ecbe28337e0e35db8e, category: vehicle.car
sample_annotation_token: e4a3582721c34f528e3367f0bda9485d, category: human.pedestrian.adult
sample_annotation_token: fcb2332977ed4203aa4b7e04a538e309, category: movable_object.barrier
sample_annotation_token: a0cac1c12246451684116067ae2611f6, category: movable_object.barrier
sample_annotation_token: 02248ff567e3497c957c369dc9a1bd5c, category: human.pedestrian.adult
sample_annotation_token: 9db977e264964c2887db1e37113cddaa, category: human.pedestrian.adult
sample_annotation_token: ca9c5dd6cf374aa980fdd81022f016fd, category: human.pedestrian.adult
sample_annotation_token: 179b8b54ee74425893387ebc09ee133d, category: human.pedestrian.adult
sample_annotation_token: 5b990ac640bf498ca7fd55eaf85d3e12, category: movable_object.barrier
sample_annotation_token: 16140fbf143d4e26a4a7613cbd3aa0e8, category: vehicle.car
sample_annotation_token: 54939f11a73d4398b14aeef500bf0c23, category: human.pedestrian.adult
sample_annotation_token: 83d881a6b3d94ef3a3bc3b585cc514f8, category: vehicle.truck
sample_annotation_token: 74986f1604f047b6925d409915265bf7, category: vehicle.car
sample_annotation_token: e86330c5538c4858b8d3ffe874556cc5, category: human.pedestrian.adult
sample_annotation_token: a7bd5bb89e27455bbb3dba89a576b6a1, category: movable_object.barrier
sample_annotation_token: fbd9d8c939b24f0eb6496243a41e8c41, category: movable_object.barrier
sample_annotation_token: 198023a1fb5343a5b6fad033ab8b7057, category: movable_object.barrier
sample_annotation_token: ffeafb90ecd5429cba23d0be9a5b54ee, category: movable_object.trafficcone
sample_annotation_token: cc636a58e27e446cbdd030c14f3718fd, category: movable_object.barrier
sample_annotation_token: 076a7e3ec6244d3b84e7df5ebcbac637, category: vehicle.bus.rigid
sample_annotation_token: 0603fbaef1234c6c86424b163d2e3141, category: human.pedestrian.adult
sample_annotation_token: d76bd5dcc62f4c57b9cece1c7bcfabc5, category: human.pedestrian.adult
sample_annotation_token: 5acb6c71bcd64aa188804411b28c4c8f, category: movable_object.barrier
sample_annotation_token: 49b74a5f193c4759b203123b58ca176d, category: human.pedestrian.adult
sample_annotation_token: 77519174b48f4853a895f58bb8f98661, category: human.pedestrian.adult
sample_annotation_token: c5e9455e98bb42c0af7d1990db1df0c9, category: movable_object.barrier
sample_annotation_token: fcc5b4b5c4724179ab24962a39ca6d65, category: human.pedestrian.adult
sample_annotation_token: 791d1ca7e228433fa50b01778c32449a, category: human.pedestrian.adult
sample_annotation_token: 316d20eb238c43ef9ee195642dd6e3fe, category: movable_object.barrier
sample_annotation_token: cda0a9085607438c9b1ea87f4360dd64, category: vehicle.car
sample_annotation_token: e865152aaa194f22b97ad0078c012b21, category: movable_object.barrier
sample_annotation_token: 7962506dbc24423aa540a5e4c7083dad, category: movable_object.barrier
sample_annotation_token: 29cca6a580924b72a90b9dd6e7710d3e, category: human.pedestrian.adult
sample_annotation_token: a6f7d4bb60374f868144c5ba4431bf4c, category: vehicle.car
sample_annotation_token: f1ae3f713ba946069fa084a6b8626fbf, category: movable_object.barrier
sample_annotation_token: d7af8ede316546f68d4ab4f3dbf03f88, category: movable_object.barrier
sample_annotation_token: 91cb8f15ed4444e99470d43515e50c1d, category: vehicle.construction
sample_annotation_token: bc638d33e89848f58c0b3ccf3900c8bb, category: movable_object.barrier
sample_annotation_token: 26fb370c13f844de9d1830f6176ebab6, category: vehicle.car
sample_annotation_token: 7e66fdf908d84237943c833e6c1b317a, category: human.pedestrian.adult
sample_annotation_token: 67c5dbb3ddcc4aff8ec5140930723c37, category: human.pedestrian.adult
sample_annotation_token: eaf2532c820740ae905bb7ed78fb1037, category: human.pedestrian.adult
sample_annotation_token: 3e2d17fa9aa5484d9cabc1dfca532193, category: movable_object.trafficcone
sample_annotation_token: de6bd5ffbed24aa59c8891f8d9c32c44, category: human.pedestrian.adult
sample_annotation_token: 9d51d699f635478fbbcd82a70396dd62, category: human.pedestrian.adult
sample_annotation_token: b7cbc6d0e80e4dfda7164871ece6cb71, category: vehicle.truck
sample_annotation_token: 563a3f547bd64a2f9969278c5ef447fd, category: human.pedestrian.adult
sample_annotation_token: df8917888b81424f8c0670939e61d885, category: human.pedestrian.adult
sample_annotation_token: bb3ef5ced8854640910132b11b597348, category: human.pedestrian.adult
sample_annotation_token: a522ce1d7f6545d7955779f25d01783b, category: human.pedestrian.adult
sample_annotation_token: 1fafb2468af5481ca9967407af219c32, category: human.pedestrian.adult
sample_annotation_token: 05de82bdb8484623906bb9d97ae87542, category: human.pedestrian.adult
sample_annotation_token: bfedb0d85e164b7697d1e72dd971fb72, category: movable_object.pushable_pullable
sample_annotation_token: ca0f85b4f0d44beb9b7ff87b1ab37ff5, category: movable_object.barrier
sample_annotation_token: bca4bbfdef3d4de980842f28be80b3ca, category: movable_object.barrier
sample_annotation_token: a834fb0389a8453c810c3330e3503e16, category: human.pedestrian.adult
sample_annotation_token: 6c804cb7d78943b195045082c5c2d7fa, category: movable_object.barrier
sample_annotation_token: adf1594def9e4722b952fea33b307937, category: movable_object.barrier
sample_annotation_token: 49f76277d07541c5a584aa14c9d28754, category: vehicle.car
sample_annotation_token: 15a3b4d60b514db5a3468e2aef72a90c, category: movable_object.barrier
sample_annotation_token: 18cc2837f2b9457c80af0761a0b83ccc, category: movable_object.barrier
sample_annotation_token: 2bfcc693ae9946daba1d9f2724478fd4, category: movable_object.barrier
样本数据 sample_data
对场景下的每个快照,提供从传感器收集的一系列数据的引用。
my_sample['data']
输出:
{'RADAR_FRONT': '37091c75b9704e0daa829ba56dfa0906',
'RADAR_FRONT_LEFT': '11946c1461d14016a322916157da3c7d',
'RADAR_FRONT_RIGHT': '491209956ee3435a9ec173dad3aaf58b',
'RADAR_BACK_LEFT': '312aa38d0e3e4f01b3124c523e6f9776',
'RADAR_BACK_RIGHT': '07b30d5eb6104e79be58eadf94382bc1',
'LIDAR_TOP': '9d9bf11fb0e144c8b446d54a8a00184f',
'CAM_FRONT': 'e3d495d4ac534d54b321f50006683844',
'CAM_FRONT_RIGHT': 'aac7867ebf4f446395d29fbd60b63b3b',
'CAM_BACK_RIGHT': '79dbb4460a6b40f49f9c150cb118247e',
'CAM_BACK': '03bea5763f0f4722933508d5999c5fd8',
'CAM_BACK_LEFT': '43893a033f9c46d4a51b5e08a67a1eb7',
'CAM_FRONT_LEFT': 'fe5422747a7d4268a4b07fc396707b23'}
从CAM_FRONT获取的一个示例:
sensor = 'CAM_FRONT'
cam_front_data = nusc.get('sample_data', my_sample['data'][sensor])
cam_front_data
输出:
{'token': 'e3d495d4ac534d54b321f50006683844',
'sample_token': 'ca9a282c9e77460f8360f564131a8af5',
'ego_pose_token': 'e3d495d4ac534d54b321f50006683844',
'calibrated_sensor_token': '1d31c729b073425e8e0202c5c6e66ee1',
'timestamp': 1532402927612460,
'fileformat': 'jpg',
'is_key_frame': True,
'height': 900,
'width': 1600,
'filename': 'samples/CAM_FRONT/n015-2018-07-24-11-22-45+0800__CAM_FRONT__1532402927612460.jpg',
'prev': '',
'next': '68e8e98cf7b0487baa139df808641db7',
'sensor_modality': 'camera',
'channel': 'CAM_FRONT'}
显示样本数据:
nusc.render_sample_data(cam_front_data['token'])
输出:
样本标注sample_annotation
my_annotation_token = my_sample['anns'][18]
my_annotation_metadata = nusc.get('sample_annotation', my_annotation_token)
my_annotation_metadata
输出:
{'token': '83d881a6b3d94ef3a3bc3b585cc514f8',
'sample_token': 'ca9a282c9e77460f8360f564131a8af5',
'instance_token': 'e91afa15647c4c4994f19aeb302c7179',
'visibility_token': '4',
'attribute_tokens': ['58aa28b1c2a54dc88e169808c07331e3'],
'translation': [409.989, 1164.099, 1.623],
'size': [2.877, 10.201, 3.595],
'rotation': [-0.5828819500503033, 0.0, 0.0, 0.812556848660791],
'prev': '',
'next': 'f3721bdfd7ee4fd2a4f94874286df471',
'num_lidar_pts': 495,
'num_radar_pts': 13,
'category_name': 'vehicle.truck'}
渲染注释以便于仔细观察:
nusc.render_annotation(my_annotation_token)
输出:
实例
目标实例:需要AV(Autonomous Vehicles) 检测或跟踪的实例。
my_instance = nusc.instance[599]
my_instance
通常在特定场景跨不同帧跟踪,在特定场景为该实例提供16个带注释的示例。
instance_token = my_instance['token']
nusc.render_instance(instance_token)
记录的第一个和最后一个标注:
print("First annotated sample of this instance:")
nusc.render_annotation(my_instance['first_annotation_token'])
输出:
print("Last annotated sample of this instance")
nusc.render_annotation(my_instance['last_annotation_token'])
输出:
分类
分类是标注的目标值,包含目录与子目录,类别表:
nusc.list_categories()
输出:
Category stats for split v1.0-mini:
human.pedestrian.adult n= 4765, width= 0.68±0.11, len= 0.73±0.17, height= 1.76±0.12, lw_aspect= 1.08±0.23
human.pedestrian.child n= 46, width= 0.46±0.08, len= 0.45±0.09, height= 1.37±0.06, lw_aspect= 0.97±0.05
human.pedestrian.constructi n= 193, width= 0.69±0.07, len= 0.74±0.12, height= 1.78±0.05, lw_aspect= 1.07±0.16
human.pedestrian.personal_m n= 25, width= 0.83±0.00, len= 1.28±0.00, height= 1.87±0.00, lw_aspect= 1.55±0.00
human.pedestrian.police_off n= 11, width= 0.59±0.00, len= 0.47±0.00, height= 1.81±0.00, lw_aspect= 0.80±0.00
movable_object.barrier n= 2323, width= 2.32±0.49, len= 0.61±0.11, height= 1.06±0.10, lw_aspect= 0.28±0.09
movable_object.debris n= 13, width= 0.43±0.00, len= 1.43±0.00, height= 0.46±0.00, lw_aspect= 3.35±0.00
movable_object.pushable_pul n= 82, width= 0.51±0.06, len= 0.79±0.10, height= 1.04±0.20, lw_aspect= 1.55±0.18
movable_object.trafficcone n= 1378, width= 0.47±0.14, len= 0.45±0.07, height= 0.78±0.13, lw_aspect= 0.99±0.12
static_object.bicycle_rack n= 54, width= 2.67±1.46, len=10.09±6.19, height= 1.40±0.00, lw_aspect= 5.97±4.02
vehicle.bicycle n= 243, width= 0.64±0.12, len= 1.82±0.14, height= 1.39±0.34, lw_aspect= 2.94±0.41
vehicle.bus.bendy n= 57, width= 2.83±0.09, len= 9.23±0.33, height= 3.32±0.07, lw_aspect= 3.27±0.22
vehicle.bus.rigid n= 353, width= 2.95±0.26, len=11.46±1.79, height= 3.80±0.62, lw_aspect= 3.88±0.57
vehicle.car n= 7619, width= 1.92±0.16, len= 4.62±0.36, height= 1.69±0.21, lw_aspect= 2.41±0.18
vehicle.construction n= 196, width= 2.58±0.35, len= 5.57±1.57, height= 2.38±0.33, lw_aspect= 2.18±0.62
vehicle.motorcycle n= 471, width= 0.68±0.21, len= 1.95±0.38, height= 1.47±0.20, lw_aspect= 3.00±0.62
vehicle.trailer n= 60, width= 2.28±0.08, len=10.14±5.69, height= 3.71±0.27, lw_aspect= 4.37±2.41
vehicle.truck n= 649, width= 2.35±0.34, len= 6.50±1.56, height= 2.62±0.68, lw_aspect= 2.75±0.37
单个目录:
nusc.category[9]
输出:
{'token': 'dfd26f200ade4d24b540184e16050022',
'name': 'vehicle.motorcycle',
'description': 'Gasoline or electric powered 2-wheeled vehicle designed to move rapidly (at the speed of standard cars) on the road surface. This category includes all motorcycles, vespas and scooters.'}
详细定义参考instructions.md。
属性
属性是实例的属性,当类别保持不变时,该属性可能在场景的不同部分发生变化。这里我们列出了提供的属性和与特定属性关联的注释的数量。
nusc.list_attributes()
输出:
cycle.with_rider: 305
cycle.without_rider: 434
pedestrian.moving: 3875
pedestrian.sitting_lying_down: 111
pedestrian.standing: 1029
vehicle.moving: 2715
vehicle.parked: 4674
vehicle.stopped: 1545
一个场景中的属性变化:
my_instance = nusc.instance[27]
first_token = my_instance['first_annotation_token']
last_token = my_instance['last_annotation_token']
nbr_samples = my_instance['nbr_annotations']
current_token = first_token
i = 0
found_change = False
while current_token != last_token:
current_ann = nusc.get('sample_annotation', current_token)
current_attr = nusc.get('attribute', current_ann['attribute_tokens'][0])['name']
if i == 0:
pass
elif current_attr != last_attr:
print("Changed from `{}` to `{}` at timestamp {} out of {} annotated timestamps".format(last_attr, current_attr, i, nbr_samples))
found_change = True
next_token = current_ann['next']
current_token = next_token
last_attr = current_attr
i += 1
从行人移动转换为行人站立。
可见性
可见性被定义为在6个摄影机输入上可见的特定标注的像素分数,分4个等级。
nusc.visibility
以80%到100%可见性为例:
anntoken = 'a7d0722bce164f88adf03ada491ea0ba'
visibility_token = nusc.get('sample_annotation', anntoken)['visibility_token']
print("Visibility: {}".format(nusc.get('visibility', visibility_token)))
nusc.render_annotation(anntoken)
输出:
Visibility: {'description': 'visibility of whole object is between 80 and 100%', 'token': '4', 'level': 'v80-100'}
0~40%可见度:
anntoken = '9f450bf6b7454551bbbc9a4c6e74ef2e'
visibility_token = nusc.get('sample_annotation', anntoken)['visibility_token']
print("Visibility: {}".format(nusc.get('visibility', visibility_token)))
nusc.render_annotation(anntoken)
输出:
Visibility: {'description': 'visibility of whole object is between 0 and 40%', 'token': '1', 'level': 'v0-40'}
传感器
1 x LIDAR
5 x RADAR
6 x cameras
nusc.sensor
输出:
[{'token': '725903f5b62f56118f4094b46a4470d8',
'channel': 'CAM_FRONT',
'modality': 'camera'},
{'token': 'ce89d4f3050b5892b33b3d328c5e82a3',
'channel': 'CAM_BACK',
'modality': 'camera'},
{'token': 'a89643a5de885c6486df2232dc954da2',
'channel': 'CAM_BACK_LEFT',
'modality': 'camera'},
{'token': 'ec4b5d41840a509984f7ec36419d4c09',
'channel': 'CAM_FRONT_LEFT',
'modality': 'camera'},
{'token': '2f7ad058f1ac5557bf321c7543758f43',
'channel': 'CAM_FRONT_RIGHT',
'modality': 'camera'},
{'token': 'ca7dba2ec9f95951bbe67246f7f2c3f7',
'channel': 'CAM_BACK_RIGHT',
'modality': 'camera'},
{'token': 'dc8b396651c05aedbb9cdaae573bb567',
'channel': 'LIDAR_TOP',
'modality': 'lidar'},
{'token': '47fcd48f71d75e0da5c8c1704a9bfe0a',
'channel': 'RADAR_FRONT',
'modality': 'radar'},
{'token': '232a6c4dc628532e81de1c57120876e9',
'channel': 'RADAR_FRONT_RIGHT',
'modality': 'radar'},
{'token': '1f69f87a4e175e5ba1d03e2e6d9bcd27',
'channel': 'RADAR_FRONT_LEFT',
'modality': 'radar'},
{'token': 'df2d5b8be7be55cca33c8c92384f2266',
'channel': 'RADAR_BACK_LEFT',
'modality': 'radar'},
{'token': '5c29dee2f70b528a817110173c2e71b9',
'channel': 'RADAR_BACK_RIGHT',
'modality': 'radar'}]
某个传感器:
nusc.sample_data[10]
输出:
{'token': '2ecfec536d984fb491098c9db1404117',
'sample_token': '356d81f38dd9473ba590f39e266f54e5',
'ego_pose_token': '2ecfec536d984fb491098c9db1404117',
'calibrated_sensor_token': 'f4d2a6c281f34a7eb8bb033d82321f79',
'timestamp': 1532402928269133,
'fileformat': 'pcd',
'is_key_frame': False,
'height': 0,
'width': 0,
'filename': 'sweeps/RADAR_FRONT/n015-2018-07-24-11-22-45+0800__RADAR_FRONT__1532402928269133.pcd',
'prev': 'b933bbcb4ee84a7eae16e567301e1df2',
'next': '79ef24d1eba84f5abaeaf76655ef1036',
'sensor_modality': 'radar',
'channel': 'RADAR_FRONT'}
标定相机
nusc.calibrated_sensor[0]
输出:
{'token': 'f4d2a6c281f34a7eb8bb033d82321f79',
'sensor_token': '47fcd48f71d75e0da5c8c1704a9bfe0a',
'translation': [3.412, 0.0, 0.5],
'rotation': [0.9999984769132877, 0.0, 0.0, 0.0017453283658983088],
'camera_intrinsic': []}
平移和旋转参数相对于自身车辆框架。
自姿态
包含ego相对于全局坐标系的位置(平移)和方向(旋转)。
nusc.ego_pose[0]
输出:
{'token': '5ace90b379af485b9dcb1584b01e7212',
'timestamp': 1532402927814384,
'rotation': [0.5731787718287827,
-0.0015811634307974854,
0.013859363182046986,
-0.8193116095230444],
'translation': [410.77878632230204, 1179.4673290964536, 0.0]}
ego_pose记录的数量与sample_data记录的数量相同,显示了一对一的对应关系。
日志
记录了沿着预定路线的车程。
print("Number of `logs` in our loaded database: {}".format(len(nusc.log)))
输出:
Number of `logs` in our loaded database: 8
nusc.log[0]
输出:
{'token': '7e25a2c8ea1f41c5b0da1e69ecfa71a2',
'logfile': 'n015-2018-07-24-11-22-45+0800',
'vehicle': 'n015',
'date_captured': '2018-07-24',
'location': 'singapore-onenorth',
'map_token': '53992ee3023e5494b90c316c183be829'}
一个日志可以包含多个不重叠场景。
地图
地图信息以自顶向下的方式存储为二进制语义掩码。
print("There are {} maps masks in the loaded dataset".format(len(nusc.map)))
输出:
There are 4 maps masks in the loaded dataset
nusc.map[0]
输出:
{'category': 'semantic_prior',
'token': '53992ee3023e5494b90c316c183be829',
'filename': 'maps/53992ee3023e5494b90c316c183be829.png',
'log_tokens': ['0986cb758b1d43fdaa051ab23d45582b',
'1c9b302455ff44a9a290c372b31aa3ce',
'e60234ec7c324789ac7c8441a5e49731',
'46123a03f41e4657adc82ed9ddbe0ba2',
'a5bb7f9dd1884f1ea0de299caefe7ef4',
'bc41a49366734ebf978d6a71981537dc',
'f8699afb7a2247e38549e4d250b4581b',
'd0450edaed4a46f898403f45fa9e5f0d',
'f38ef5a1e9c941aabb2155768670b92a',
'7e25a2c8ea1f41c5b0da1e69ecfa71a2',
'ddc03471df3e4c9bb9663629a4097743',
'31e9939f05c1485b88a8f68ad2cf9fa4',
'783683d957054175bda1b326453a13f4',
'343d984344e440c7952d1e403b572b2a',
'92af2609d31445e5a71b2d895376fed6',
'47620afea3c443f6a761e885273cb531',
'd31dc715d1c34b99bd5afb0e3aea26ed',
'34d0574ea8f340179c82162c6ac069bc',
'd7fd2bb9696d43af901326664e42340b',
'b5622d4dcb0d4549b813b3ffb96fbdc9',
'da04ae0b72024818a6219d8dd138ea4b',
'6b6513e6c8384cec88775cae30b78c0e',
'eda311bda86f4e54857b0554639d6426',
'cfe71bf0b5c54aed8f56d4feca9a7f59',
'ee155e99938a4c2698fed50fc5b5d16a',
'700b800c787842ba83493d9b2775234a'],
'mask': <nuscenes.utils.map_mask.MapMask at 0x26082d4cd08>}