DAIR-V2X数据集转为kitti数据集格式(保姆级教程)
拉取DAIR-V2X文件
git clone https://github.com/AIR-THU/DAIR-V2X.git
DAIR数据集放至正确的位置
DAIR数据集下载链接
可以挑选自己适合的数据集
我选择的是车路协同里路侧端数据集
先使用车路协同里路侧端数据集的example进行测试,example里只有84张数据,方便测试
如果example可以通过,理论上车路协同里的数据集都可以通过
创建数据集文件夹
cd DAIR-V2X-main/ mkdir ./data/DAIR-V2X
将infrastructure-side放到DAIR-V2X文件夹内
创建虚拟环境
conda create -n dair-test python=3.7
官方要求python为3.7
转化所需要的库,报错时根据错再安装
运行转化命令
官方命令
python tools/dataset_converter/dair2kitti.py --source-root ./data/DAIR-V2X/single-infrastructure-side \ --target-root ./data/DAIR-V2X/single-infrastructure-side \ --split-path ./data/split_datas/single-infrastructure-split-data.json \ --label-type lidar --sensor-view infrastructure
source-root 就是原始dair数据集放置的位置
target-root就是kitti格式数据集生成位置
split-path就是放置数据集划分train val test 的json文件
–no-classmerge 可选参数 如果加上 有一些相似类的标签不会融合为同一类
本人自己制作了一个json文件,只用于测试车路协同的路侧端example数据
{
"train": ["000009", "000010", "000011", "000012", "000013", "000014", "000015", "000016", "000017", "000018", "000019", "000020", "000021", "000022", "000023", "000024", "000025", "000026", "000027", "000028", "000029", "000030", "000031", "000032", "000033", "000034", "000035", "000036", "000037", "000038", "000039", "000040", "000041", "000042", "000043", "000044", "000045", "000046", "000047", "000048", "000049", "000050", "000051", "000052", "000053", "000054", "000055", "000056", "000057", "000058", "000059", "000060", "000061", "000062", "000063", "000064", "000065", "000066", "000067", "000068", "000069", "000070", "000071", "000072", "000073", "000074", "000075", "000076", "000077", "000078", "000079", "000080", "000081", "000082", "000083", "000084", "000085", "000086", "000087", "000088", "000089", "000090", "000091", "000092"], "val": [], "test": []}
无val和test
命令如下:
python tools/dataset_converter/dair2kitti.py --source-root ./data/DAIR-V2X/infrastructure-side/ --target-root ./data/DAIR-V2X/infrastructure-side/ --split-path ./data/split_datas/cooperative-infra-scq.json --label-type lidar --sensor-view infrastructure --no-classmerge
解决环境问题
环境2:ModuleNotFoundError: No module named ‘pypcd’
千万不能pip install pypcd
默认的pypcd适配的是python2版本的,安装的python3.7,后面会发生一些不适配的问题(cstring之类的)
按照如下命令安装,适配python3版本的pypcd
git clone https://github.com/klintan/pypcd.git cd pypcd python setup.py install
错误3:
File “/home/songcq/DAIR-V2X-main/tools/dataset_converter/gen_kitti/label_json2kitti.py”, line 22, in write_kitti_in_txt
i15 = str(-eval(item[“rotation”]))
TypeError: eval() arg 1 must be a string, bytes or code object
需要str类型的
那么line22修改为
i15 = str(-eval(str(item["rotation"])))
再次运行
出现以下代码
应该是转化成功了
转化后的数据集
应该如下所示
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/bian-cheng-ji-chu/85416.html