1. 对数据集遍历
1.1 统计mini版本的nuScenes各模态数据和关键帧的数量
def nusc_count_sampledata(nusc):
"""
遍历sampledata统计每个类别的数量
"""
print('******* NuScenes Data Numbers *******')
print('nusc.scene: {}, nusc.sample: {}, nusc.sample_data: {}, nusc.sample_annotation: {}'
.format(len(nusc.scene), len(nusc.sample), len(nusc.sample_data), len(nusc.sample_annotation)))
from collections import defaultdict
countClass = defaultdict(int)
countKeyframe = defaultdict(int)
countChannel = defaultdict(int)
countKeyframChannel = defaultdict(int)
for sample_data in nusc.sample_data:
sensor_cls = sample_data['sensor_modality']
countClass[sensor_cls] += 1