Xingang Pan, Jianping Shi, Ping Luo, Xiaogang Wang, Xiaoou Tang. "Spatial As Deep: Spatial CNN for Traffic Scene Understanding", AAAI2018
This code is modified from fb.resnet.torch.
- Spatial CNN enables explicit and effective spatial information propagation between neurons in the same layer of a CNN.
- It is extremly effective in cases where objects have strong shape priors like the long thin continuous property of lane lines.
vgg16+SCNN outperforms resnet101 on lane detection.
- Torch, please follow the installation instructions at fb.resnet.torch.
- matlab (for tools/prob2lines)
- opencv (for tools/lane_evaluation)
- Hardware: For testing, GPU with 3G memory suffices. For training, we recommend 4xGPU with 12G memory.
-
Clone the SCNN repository
git clone https://github.com/XingangPan/SCNN.git
We'll call the directory that you cloned SCNN as
$SCNN_ROOT -
Download CULane dataset
mkdir data/CULane cd data/CULaneDownload CULane dataset and extract here.
You should have structure like this:$SCNN_ROOT/data/CULane/driver_xx_xxframe # data folders x6 $SCNN_ROOT/data/CULane/laneseg_label_w16 # lane segmentation labels $SCNN_ROOT/data/CULane/list # data lists
-
Download our pre-trained models to
./experiments/pretrainedcd $SCNN_ROOT/experiments/pretrained
Download our best performed model here.
-
Run test script
cd $SCNN_ROOT sh ./experiments/test.sh
Testing results (probability map of lane markings) are saved in
experiments/predicts/by default. -
Get curve line from probability map
cd tools/prob2lines matlab -nodisplay -r "main;exit" # or you may simply run main.m from matlab interface
The generated line coordinates would be saved in
tools/prob2lines/output/by default. -
Calculate precision, recall, and F-measure
cd $SCNN_ROOT/tools/lane_evaluation make sh Run.sh # it may take over 30min to evaluate
Note:
Run.shevaluate each scenario separately whilerun.shevaluate the whole. You may usecalTotal.mto calculate overall performance from all senarios.
By now, you should be able to reproduce our result in the paper.
- Download vgg16 pretrained on ImageNet
Download vgg16 model here and move it to
cd $SCNN_ROOT/experiments/models
$SCNN_ROOT/experiments/models/vgg. - Generate SCNN model
The generated model will be saved in
th SCNN-gen.lua
./vgg_SCNN_DULR9_w9by default. - Training SCNN
The training process should start and trained models would be saved in
cd $SCNN_ROOT sh ./experiments/train.sh
$SCNN_ROOT/experiments/models/vgg_SCNN_DULR_w9by default.
Then you can test the trained model following the Testing steps above. If your model position or name is changed, remember to set them to yours accordingly.
@inproceedings{pan2018SCNN,
author = {Xingang Pan, Jianping Shi, Ping Luo, Xiaogang Wang, and Xiaoou Tang},
title = {Spatial As Deep: Spatial CNN for Traffic Scene Understanding},
booktitle = {AAAI Conference on Artificial Intelligence (AAAI)},
month = {February},
year = {2018}
}