简体中文 | English
车道线检测是自动驾驶算法的一个范畴,可以用来辅助进行车辆定位和进行决策,早期已有基于传统图像处理的车道线检测方法,但是随着技术的演进,车道线检测任务所应对的场景越来越多样化,目前更多的方式是寻求在语义上对车道线存在位置的检测。本项目主要使用PaddleSeg进行车道线检测。
版本要求
PaddlePaddle >= 2.0.2
Python >= 3.7+
由于车道线模型计算开销大,推荐在GPU版本的PaddlePaddle下使用PaddleSeg。推荐安装10.0以上的CUDA环境。安装教程请见PaddlePaddle官网。
git clone https://github.com/PaddlePaddle/PaddleSeg
cd PaddleSeg/contrib/LaneSeg
pip install scikit-learn
pip install opencv-python
pip install scikit-image
pip install paddleseg==2.5.0
基于TuSimple评估方法的评估,您可以从TuSimple exampe 获取更多信息
车道线检测模型在Tusimple数据集上的性能
Method | Acc | FP | FN | Link |
---|---|---|---|---|
BiseNetV2 | 96.38% | 0.04545 | 0.03363 | model |
FastScnn | 96.04% | 0.04909 | 0.04058 | model |
注意:模型输入大小为(640, 368), GPU为Tesla V100 32G。
利用Tusimple开源的Tusimple数据集作为我们教程的示例数据集,百度网盘下载, 提取码: 9568。需要下载的数据有train_set.zip, test_set.zip, test_label.json,
分别将train_set.zip,test_set.zip解压, 并将数据集置于data/tusimple目录下,同时将test_label.json放置在test_set目录下。
cd data
mkdir tusimple && cd tusimple
unzip -d train_set train_set.zip
unzip -d test_set test_set.zip
cd ../../
数据集整理结构如下:
LaneSeg
|-- data
|-- tusimple
|-- train_set
|-- clips
|-- 0313-1
|-- 0313-2
|-- 0531
|-- 0601
|-- label_data_0313.json
|-- label_data_0531.json
|-- label_data_0601.json
|-- test_set
|-- clips
|-- 0530
|-- 0531
|-- 0601
|-- test_tasks_0627.json
|-- test_label.json
执行如下命令:
python third_party/generate_tusimple_dataset.py --root data/tusimple
数据生成结果如下:
The folder structure is as follow:
LaneSeg
|-- data
|-- tusimple
|-- train_set
...
|-- labels
|-- 0313-1
|-- 0313-2
|-- 0531
|-- 0601
|-- train_list.txt
|-- test_set
...
|-- labels
|-- 0530
|-- 0531
|-- 0601
|-- train_list.txt
train_list.txt的内容如下:
/train_set/clips/0313-1/6040/20.jpg /train_set/labels/0313-1/6040/20.png
/train_set/clips/0313-1/5320/20.jpg /train_set/labels/0313-1/5320/20.png
/train_set/clips/0313-1/23700/20.jpg /train_set/labels/0313-1/23700/20.png
...
test_list.txt的内容如下:
/test_set/clips/0530/1492626760788443246_0/20.jpg /test_set/labels/0530/1492626760788443246_0/20.png
/test_set/clips/0530/1492627171538356342_0/20.jpg /test_set/labels/0530/1492627171538356342_0/20.png
/test_set/clips/0530/1492627288467128445_0/20.jpg /test_set/labels/0530/1492627288467128445_0/20.png
...
export CUDA_VISIBLE_DEVICES=0
python train.py \
--config configs/bisenetV2_tusimple_640x368_300k.yml \
--do_eval \
--use_vdl \
--save_interval 2000 \
--num_workers 5 \
--save_dir output
note: 使用--do_eval会影响训练速度及增加显存消耗,根据需求进行开闭。
--num_workers
多进程数据读取,加快数据预处理速度
更多参数信息请运行如下命令进行查看:
python train.py --help
如需使用多卡,请用python -m paddle.distributed.launch
进行启动
export CUDA_VISIBLE_DEVICES=0
python val.py \
--config configs/bisenetV2_tusimple_640x368_300k.yml \
--model_path output/best_model/model.pdparams \
--save_dir ./output/results \
--is_view True
--is_view
开启会保留图片的预测结果,可选择关闭以加快评估速度。
你可以直接下载我们提供的模型进行评估。
更多参数信息请运行如下命令进行查看:
python val.py --help
export CUDA_VISIBLE_DEVICES=0
python predict.py \
--config configs/bisenetV2_tusimple_640x368_300k.yml \
--model_path output/best_model/model.pdparams \
--image_path data/test_images/3.jpg \
--save_dir output/result
你可以直接下载我们提供的模型进行预测。
更多参数信息请运行如下命令进行查看:
python predict.py --help
python export.py \
--config configs/bisenetV2_tusimple_640x368_300k.yml \
--model_path output/best_model/model.pdparams \
--save_dir output/export
更多参数信息请运行如下命令进行查看:
python export.py --help
python deploy/python/infer.py \
--config output/export/deploy.yaml \
--image_path data/test_images/3.jpg \
--save_dir ouput/results
更多参数信息请运行如下命令进行查看:
python deploy/python/infer.py --help
本项目使用的C++源文件在LaneSeg/deploy/cpp目录下
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》