SCNN is a segmentation-tasked lane detection algorithm, described in 'Spatial As Deep: Spatial CNN for Traffic Scene Understanding'. The official implementation is in lua torch.
This repository contains a re-implementation in Pytorch.
- 2019 / 08 / 14: Code refined including more convenient test & evaluation script.
- 2019 / 08 / 12: Trained model on both dataset provided.
- 2019 / 05 / 08: Evaluation is provided.
- 2019 / 04 / 23: Trained model converted from official t7 model is provided.
The dataset is available in CULane. Please download and unzip the files in one folder, which later is represented as CULane_path
. Then modify the path of CULane_path
in config.py
. Also, modify the path of CULane_path
as data_dir
in utils/lane_evaluation/CULane/Run.sh
.
CULane_path
├── driver_100_30frame
├── driver_161_90frame
├── driver_182_30frame
├── driver_193_90frame
├── driver_23_30frame
├── driver_37_30frame
├── laneseg_label_w16
├── laneseg_label_w16_test
└── list
Note: absolute path is encouraged.
The dataset is available in here. Please download and unzip the files in one folder, which later is represented as Tusimple_path
. Then modify the path of Tusimple_path
in config.py
.
Tusimple_path
├── clips
├── label_data_0313.json
├── label_data_0531.json
├── label_data_0601.json
└── test_label.json
Note: seg_label images and gt.txt, as in CULane dataset format, will be generated the first time Tusimple
object is instantiated. It may take time.
-
Model trained on CULane Dataset can be converted from official implementation, which can be downloaded here. Please put the
vgg_SCNN_DULR_w9.t7
file intoexperiments/vgg_SCNN_DULR_w9
.python experiments/vgg_SCNN_DULR_w9/t7_to_pt.py
Model will be cached into
experiments/vgg_SCNN_DULR_w9/vgg_SCNN_DULR_w9.pth
.Note:
torch.utils.serialization
is obsolete in Pytorch 1.0+. You can directly download the converted model here. -
My trained model on Tusimple can be downloaded here. Its configure file is in
exp0
.
Accuracy | FP | FN |
---|---|---|
94.16% | 0.0735 | 0.0825 |
- My trained model on CULane can be downloaded here. Its configure file is in
exp10
.
Category | F1-measure |
---|---|
Normal | 90.26 |
Crowded | 68.23 |
HLight | 61.84 |
Shadow | 61.16 |
No line | 43.44 |
Arrow | 84.64 |
Curve | 61.74 |
Crossroad | 2728 (FP measure) |
Night | 65.32 |
For single image demo test:
python demo_test.py -i demo/demo.jpg
-w experiments/vgg_SCNN_DULR_w9/vgg_SCNN_DULR_w9.pth
[--visualize / -v]
-
Specify an experiment directory, e.g.
experiments/exp0
. -
Modify the hyperparameters in
experiments/exp0/cfg.json
. -
Start training:
python train.py --exp_dir ./experiments/exp0 [--resume/-r]
-
Monitor on tensorboard:
tensorboard --logdir='experiments/exp0'
Note
- My model is trained with
torch.nn.DataParallel
. Modify it according to your hardware configuration. - Currently the backbone is vgg16 from torchvision. Several modifications are done to the torchvision model according to paper, i.e., i). dilation of last three conv layer is changed to 2, ii). last two maxpooling layer is removed.
-
CULane Evaluation code is ported from official implementation and an extra
CMakeLists.txt
is provided.- Please build the CPP code first.
- Then modify
root
as absolute project path inutils/lane_evaluation/CULane/Run.sh
.
cd utils/lane_evaluation/CULane mkdir build && cd build cmake .. make
Just run the evaluation script. Result will be saved into corresponding
exp_dir
directory,python test_CULane.py --exp_dir ./experiments/exp10
-
Tusimple Evaluation code is ported from tusimple repo.
python test_tusimple.py --exp_dir ./experiments/exp0
This repos is build based on official implementation.