nuscenes数据集

本文介绍了Nuscenes数据集中的时间戳表示法,单位旋转矩阵和传感器外参,以及对象检测和跟踪结果的格式。同时涉及了使用NuScenes库进行数据验证、配置文件cfg_和TrackingEval函数的应用,以及如何处理和可视化二进制激光雷达点云文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

数据格式:

1.时间戳取值为秒*1000000,nuscenes devkit在解析时以精度作为转换。

2.单位旋转矩阵对应的四元数为:[1,0,0,0]

3.传感器外参为传感器到ego的转换

验证数据格式:

1.检测结果格式:

https://www.nuscenes.org/object-detection/?externalData=all&mapData=all&modalities=Anyicon-default.png?t=N7T8https://www.nuscenes.org/object-detection/?externalData=all&mapData=all&modalities=Any

2.跟踪结果格式:

跟踪结果格式:https://www.nuscenes.org/tracking/?externalData=all&mapData=all&modalities=Anyicon-default.png?t=N7T8https://www.nuscenes.org/tracking/?externalData=all&mapData=all&modalities=Any

submission {
    "meta": {
        "use_camera":   <bool>  -- Whether this submission uses camera data as an input.
        "use_lidar":    <bool>  -- Whether this submission uses lidar data as an input.
        "use_radar":    <bool>  -- Whether this submission uses radar data as an input.
        "use_map":      <bool>  -- Whether this submission uses map data as an input.
        "use_external": <bool>  -- Whether this submission uses external data as an input.
    },
    "results": {
        sample_token <str>: List[sample_result] -- Maps each sample_token to a list of sample_results.
    }
}
sample_result {
    "sample_token":   <str>         -- Foreign key. Identifies the sample/keyframe for which objects are detected.
    "translation":    <float> [3]   -- Estimated bounding box location in meters in the global frame: center_x, center_y, center_z.
    "size":           <float> [3]   -- Estimated bounding box size in meters: width, length, height.
    "rotation":       <float> [4]   -- Estimated bounding box orientation as quaternion in the global frame: w, x, y, z.
    "velocity":       <float> [2]   -- Estimated bounding box velocity in m/s in the global frame: vx, vy.
    "tracking_id":    <str>         -- Unique object id that is used to identify an object track across samples.
    "tracking_name":  <str>         -- The predicted class for this sample_result, e.g. car, pedestrian.
                                       Note that the tracking_name cannot change throughout a track.
    "tracking_score": <float>       -- Object prediction score between 0 and 1 for the class identified by tracking_name.
                                       We average over frame level scores to compute the track level score.
                                       The score is used to determine positive and negative tracks via thresholding.
}

devkit:

验证方法:

cfg_ = config_factory('tracking_nips_2019')
nusc_eval = TrackingEval(config=cfg_,result_path=elv_json,eval_set='train',output_dir="/data/nuscenes/eval",nusc_version='V1.0-trainval',nusc_dataroot='/data/pipeline_data/liujiao/bicv/nuscenes/data0202',)
nusc_eval.main()

可视化:

nusc = NuScenes(version='V1.0-trainval', dataroot='/data/pipeline_data/liujiao/bicv/nuscenes/data0202', verbose=True)
nusc.list_scenes()
my_scene = nusc.scene[0]
first_sample_token = my_scene['first_sample_token']  #获取第一个sample的token值
my_sample = nusc.get("sample",first_sample_token)
aa = nusc.list_sample(my_sample["token"])
annotation_token = my_sample["anns"][0]
annotation_metadata = nusc.get("sample_annotation",annotation_token)
nusc.render_annotation(annotation_token,out_path="annotation.jpg")
nusc.render_sample_data(my_sample["data"]["CAM_FRONT_LEFT"],out_path="camfrontleft.jpg")
my_instace = nusc.instance[0]
nusc.render_annotation(my_instace['first_annotation_token'],out_path="first_annotation.jpg")

二进制pcd文件

nuscenes数据集中激光雷达点云文件为二进制文件,pcd转二进制文件方法:

def read_pcd_binary(pcd_file,bin_save_file):
    with open(pcd_file, 'rb') as f:
        # 读取pcd文件头信息
        for line in f:
            line = line.decode('utf-8')
            if line.startswith("DATA"):
                break
        # 从文件内容中读取三维坐标点云数据
        dtype = np.dtype(
            [('x', np.float32), ('y', np.float32), ('z', np.float32), ('i', np.uint16), ('r', np.uint16),
                ('t', np.float64)])
        data = np.fromfile(f, dtype=dtype)
        data = np.array(data.tolist())
        data = np.delete(data, np.where(np.isnan(data))[0], axis=0)
        data = np.delete(data, 5, axis=1)
        binary_data = data.astype(np.float32).tobytes()
        with open(bin_save_file, 'wb') as f:
            f.write(binary_data)

点云二进制文件可视化代码:

import os
import open3d as o3d
import numpy as np

def read_bin_point_cloud(bin_file):
    try:
        with open(bin_file, 'rb') as f:
            data = np.fromfile(f, dtype=np.float32)
    except FileNotFoundError:
        print(f"Error: File '{bin_file}' not found.")
        return None
    points = data.reshape(-1, 5)
    points = points[:,:3]

    point_cloud = o3d.geometry.PointCloud()
    point_cloud.points = o3d.utility.Vector3dVector(points)

    return point_cloud

def visualize_point_cloud(point_cloud):
    vis = o3d.visualization.Visualizer()
    vis.create_window()
    vis.add_geometry(point_cloud)
    render_options = vis.get_render_option()
    render_options.point_size = 2
    vis.run()
    vis.destroy_window()

if __name__ == "__main__":
    bin_file_path = "output02.pcd.bin"
    point_cloud = read_bin_point_cloud(bin_file_path)
    if point_cloud:
        visualize_point_cloud(point_cloud)

### Nuscenes 数据集介绍 Nuscenes 是一个大规模的自动驾驶数据集,旨在促进机器学习算法的发展。此数据集不仅提供了丰富的传感器数据(如摄像头、激光雷达等),还包含了详细的标注信息,适用于多种研究场景[^2]。 #### 特征概述 - **多模态感知**:支持视觉和LiDAR等多种传感模式的数据融合。 - **高质量标签**:提供精确的对象检测框以及语义分割掩码。 - **多样化环境覆盖**:涵盖了城市道路、高速公路等多个典型驾驶场景下的样本采集。 - **丰富注释类型**:除了常见的车辆外,还包括行人和其他交通参与者的行为轨迹记录。 --- ### 使用与下载指南 对于希望利用 Linux 系统自行获取并验证该数据集完整性的用户而言,可以借助特定脚本来简化这一过程[^1]。考虑到官方提供的直接链接可能随时间而更新变动,在实际操作前建议访问[Nuscenes官方网站](https://www.nuscenes.org/download)[^3]确认最新的分发渠道。 为了便于初次使用者快速上手测试功能而不必等待长时间传输大量文件,推荐先尝试下载体积较小的 mini 版本 (约4GB),这已足以满足大多数初步探索的需求。 ```bash # 示例命令用于展示如何通过wget或其他工具基于获得的有效URL来抓取压缩包形式的小型化子集 wget https://example.com/path/to/v1.0-mini.tar.gz -O v1.0-mini.tar.gz tar zxvf v1.0-mini.tar.gz ``` 完成上述步骤之后,可以通过 Python 脚本加载本地存储的数据片段: ```python from nuscenes.nuscenes import NuScenes # 初始化NuScenes对象实例,指定要使用的版本号及根目录路径 nus = NuScenes(version='v1.0-mini', dataroot='./v1.0-mini/', verbose=True) print(f"Loaded {len(nus.sample)} samples.") ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值