数据集辅助工具

为了方便您的使用,我们也提供了一些数据集辅助工具,下方将以使用的场景为您介绍。

获取相机内外参数

使用方法

运行 tools/gen_camera_param_nusc.py,从nuscenes中获取相机内外参。

参数介绍

参数描述
--data-pathnuScenes 数据集所在根目录。
--save-path保存的路径。
--save-by-city是否根据城市保存。
--version数据集版本。

使用示例

按城市保存 NuScenes 相机内外参矩阵。

python3 tools/gen_camera_param_nusc.py --data-path /path/to/nuscenes --save-path ./camera_params_city --save-by-city --version v1.0-trainval

获取模型输入参考点

使用方法

运行 tools/gen_reference_points_nusc.py,从nuscenes中获取模型输入参考点。

参数介绍

参数描述
--data-path数据集所在根目录。
--save-path保存的路径。
--save-by-city是否根据城市保存。
--version数据集版本。
--config CONFIG, -c CONFIGconfig文件路径。

使用示例

python3 tools/gen_reference_points_nusc.py \
        --data-path /path/to/nuscenes \
        --save-path ./output/ref_points_city \
        --save-by-city True \
        --version v1.0-trainval \
        -c configs/bev/bevformer_tiny_resnet50_detection_nuscenes.py

计算转换矩阵

使用方法

运行 tools/homography_generator.py,计算ego到图像的转换矩阵。

参数介绍

参数描述
--sensor2ego-translation传感器到ego坐标系的平移矩阵。
--sensor2ego-rotation传感器到ego坐标系的旋转矩阵。
--camera-intrinsic相机内外参矩阵。
--save-path保存的路径。

使用示例

python3 tools/homography_generator.py \
    --sensor2ego-translation ./data/s2e_translation.npy \
    --sensor2ego-rotation ./data/s2e_rotation.npy \
    --camera-intrinsic ./data/camera_intrinsic.npy \
    --save-path ./output/homography

计算模型输入参考点

使用方法

运行tools/reference_points_generator.py,从单应性矩阵计算模型输入参考点。

参数介绍

参数描述
--config, -cconfig文件路径。
--homography转换矩阵路径。
--save-path保存的路径。

使用示例

config配置文件的详细介绍可参考config配置章节。

python3 tools/reference_points_generator.py \
        --config ./configs/bev/bevformer_tiny_resnet50_detection_nuscenes.py \
        --homography ./output/homography.npy \
        --save-path ./output/reference_points

config配置文件的详细介绍可参考config配置章节。