Ultra-Fast-Lane-Detection代码复现(车道线检测)

Ultra-Fast-Lane-Detection

code: https://github.com/cfzd/Ultra-Fast-Lane-Detection
作者博客: https://zhuanlan.zhihu.com/p/157530787
参考博客: https://www.cnblogs.com/ziyuzhu-edward/p/13639494.html
Ultra-Fast-Lane-Detection代码复现(车道线检测)_第1张图片

  • our formulation is proposed to
    select locations of lanes at predefined rows of the image using global features
    instead of segmenting every pixel of lanes based on a local receptive field,
    which significantly reduces the computational cost.

  • we present a structural loss which explicitly
    utilizes prior information of lanes.

  • 准确率速度都很高,300+fps

相关工作

VPGNet, SCNN, Selfattention distillation (SAD)

Method

  • 将车道线检测定义为寻找车道线在图像中某些行的位置的集合,即基于行方向上的位置选择、分类(row-based classification)
  • 就是giridding一下变成大方块这样
  • 每一行是一个anchor
  • 我们可以发现向量的长度是w+1而不是w, 因为有可能这一行里所有的grid都不属于第i条车道, 这个时候需要多出一个grid来代表不存在, 此时向量前w个grid都是0, 第w+1个元素为1
    Ultra-Fast-Lane-Detection代码复现(车道线检测)_第2张图片
  • Lane structural loss
    Ultra-Fast-Lane-Detection代码复现(车道线检测)_第3张图片

环境准备

  1. Clone the project

    git clone https://github.com/cfzd/Ultra-Fast-Lane-Detection
    cd Ultra-Fast-Lane-Detection
    
  2. Create a conda virtual environment and activate it

    conda create -n lane-det python=3.7 -y
    conda activate lane-det
    
  3. Install dependencies

    # If you dont have pytorch
    conda install pytorch torchvision cudatoolkit=10.1 -c pytorch 
    
    pip install -r requirements.txt
    

数据集存放

$TUSIMPLEROOT
|──clips
|──label_data_0313.json
|──label_data_0531.json
|──label_data_0601.json
|──test_tasks_0627.json
|──test_label.json
|──readme.md

convert_tusimple

对于Tusimple,没有提供分割注释,因此我们需要从json注释生成分割。

python scripts/convert_tusimple.py --root /home/stone/disk/Lane_detection/Ultra-Fast-Lane-Detection-master/TuSimple

# this will generate segmentations and two list files: train_gt.txt and test.txt

测试

python test.py configs/tusimple.py --test_model ./tusimple_18.pth  --test_work_dir ./tmp

可视化

python demo.py configs/tusimple.py --test_model path_to_tusimple_18.pth

大部分图片的预测效果还可以,但是中间和右图的预测效果就特别差,感觉这两张图的车道特征还挺明显的,偏移比较大
Ultra-Fast-Lane-Detection代码复现(车道线检测)_第4张图片

训练

 python train.py configs/tusimple.py

你可能感兴趣的:(随手翻)