Skip to content

Commit 7ab7dac

Browse files
committed
update README and support support cmake compile
1 parent 0915cb6 commit 7ab7dac

File tree

5 files changed

+107
-53
lines changed

5 files changed

+107
-53
lines changed

INSTALL.md

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
2+
# Install
3+
1. Clone the project
4+
5+
```
6+
git clone https://github.com/cfzd/Ultra-Fast-Lane-Detection
7+
cd Ultra-Fast-Lane-Detection
8+
```
9+
10+
2. Create a conda virtual environment and activate it
11+
12+
```
13+
conda create -n lane-det python=3.7 -y
14+
conda activate lane-det
15+
```
16+
17+
3. Install dependencies
18+
19+
```
20+
# If you don't have pytorch
21+
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
22+
23+
pip install -r requirements.txt
24+
```
25+
26+
4. Install CULane evaluation tools.
27+
28+
This tools requires OpenCV C++. Please follow [here](https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html) to install OpenCV C++. ***When you build OpenCV, remove the paths of anaconda from PATH or it will be failed.***
29+
```
30+
# First you need to install OpenCV C++.
31+
# After installation, make a soft link of OpenCV include path.
32+
33+
ln -s /usr/local/include/opencv4/opencv2 /usr/local/include/opencv2
34+
```
35+
We provide three kinds of complie pipelines to build the evaluation tool of CULane.
36+
37+
Option 1:
38+
39+
```
40+
cd evaluation/culane
41+
make
42+
```
43+
44+
Option 2:
45+
```
46+
cd evaluation/culane
47+
mkdir build && cd build
48+
cmake ..
49+
make
50+
mv culane_evaluator ../evaluate
51+
```
52+
53+
For Windows user:
54+
```
55+
mkdir build-vs2017
56+
cd build-vs2017
57+
cmake .. -G "Visual Studio 15 2017 Win64"
58+
cmake --build . --config Release
59+
# or, open the "xxx.sln" file by Visual Studio and click build button
60+
move culane_evaluator ../evaluate
61+
```
62+
63+
64+
5. Data preparation
65+
66+
Download [CULane](https://xingangpan.github.io/projects/CULane.html) and [Tusimple](https://github.com/TuSimple/tusimple-benchmark/issues/3). Then extract them to `$CULANEROOT` and `$TUSIMPLEROOT`. The directory arrangement of Tusimple should look like:
67+
```
68+
$TUSIMPLEROOT
69+
|──clips
70+
|──label_data_0313.json
71+
|──label_data_0531.json
72+
|──label_data_0601.json
73+
|──test_tasks_0627.json
74+
|──test_label.json
75+
|──readme.md
76+
```
77+
The The directory arrangement of CULane should look like:
78+
```
79+
$CULANEROOT
80+
|──driver_100_30frame
81+
|──driver_161_90frame
82+
|──driver_182_30frame
83+
|──driver_193_90frame
84+
|──driver_23_30frame
85+
|──driver_37_30frame
86+
|──laneseg_label_w16
87+
|──list
88+
```
89+
90+
For Tusimple, the segmentation annotation is not provided, hence we need to generate segmentation from the json annotation.
91+
92+
```
93+
cd $TUSIMPLEROOT
94+
python scripts/convert_tusimple.py --root $TUSIMPLEROOT
95+
# this will generate segmentations and 2 list files train_gt.txt test.txt
96+
```

README.md

+4-46
Original file line numberDiff line numberDiff line change
@@ -14,50 +14,7 @@ alt="Demo" width="240" height="180" border="10" /></a>
1414

1515

1616
# Install
17-
18-
a. Clone the project
19-
20-
```
21-
git clone https://github.com/cfzd/Ultra-Fast-Lane-Detection
22-
cd Ultra-Fast-Lane-Detection
23-
```
24-
25-
b. Create a conda virtual environment and activate it
26-
27-
```
28-
conda create -n lane-det python=3.7 -y
29-
conda activate lane-det
30-
```
31-
32-
c. Install dependencies
33-
34-
```
35-
# If you don't have pytorch
36-
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
37-
38-
pip install -r requirements.txt
39-
```
40-
41-
d. Install CULane evaluation tools. This tools requires OpenCV C++. Please follow [here](https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html) to install OpenCV C++. ***When you build OpenCV, remove the paths of anaconda from PATH or it will be failed.***
42-
43-
```
44-
# First you need to install OpenCV C++.
45-
# After installation, make a soft link of OpenCV include path.
46-
ln -s /usr/local/include/opencv4/opencv2 /usr/local/include/opencv2
47-
48-
cd evaluation/culane
49-
make
50-
```
51-
52-
e. Data preparation
53-
54-
Download [CULane](https://xingangpan.github.io/projects/CULane.html) and [Tusimple](https://github.com/TuSimple/tusimple-benchmark/issues/3). Then extract them to `$CULANEROOT` and `$TUSIMPLEROOT`. For Tusimple, the segmentation annotation is not provided, hence we need to generate segmentation from the json annotation.
55-
56-
```
57-
cd $TUSIMPLEROOT
58-
python scripts/convert_tusimple.py --root $TUSIMPLEROOT
59-
# this will generate segmentations and 2 list files train_gt.txt test.txt
60-
```
17+
Please see [INSTALL.md](./INSTALL.md)
6118

6219
# Get Started
6320
Copy a config from ```configs/culane.py``` or ```configs/tusimple.py```, then
@@ -72,14 +29,14 @@ python train.py configs/path_to_your_config
7229
For multi-gpu training, run
7330
```
7431
sh launch_training.sh
75-
76-
# If there is no pretrained torchvision model, multi-gpu training may result in multiple downloading. You can first download the corresponding models manually, and then restart the multi-gpu training.
7732
```
7833
or
7934
```
8035
python -m torch.distributed.launch --nproc_per_node=$NGPUS train.py configs/path_to_your_config
8136
```
37+
If there is no pretrained torchvision model, multi-gpu training may result in multiple downloading. You can first download the corresponding models manually, and then restart the multi-gpu training.
8238

39+
Since our code has auto backup function which will copy all codes to the work_dir accordind to the gitignore. Additional temp files will also be copied and the training will be blocked if it is not filtered by gitignore. So you should keep the working directory clean.
8340
***
8441

8542
Besides config style settings, we also support command line style one. You can override a setting like
@@ -107,6 +64,7 @@ We provide two trained Res-18 models on CULane and Tusimple.
10764
For evaluation, run
10865
```
10966
mkdir tmp
67+
# This a bad example, you should put the temp files outside the project.
11068
11169
python test.py configs/culane.py --test_model path_to_culane_18.pth --test_work_dir ./tmp
11270

evaluation/culane/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
cmake_minimum_required(VERSION 3.16)
1+
cmake_minimum_required(VERSION 3.1)
22

3-
project(seg_label_generate)
3+
project(culane_evaluator)
44

55
set(CMAKE_CXX_STANDARD 11)
66

evaluation/culane/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ LIBRARY_DIRS := lib
1010
# then use `pkg-config opencv4 --cflags --libs` since `opencv4.pc` is found
1111

1212
COMMON_FLAGS := -DCPU_ONLY
13-
CXXFLAGS := -std=c++11 -fopenmp `pkg-config --cflags opencv`
14-
LDFLAGS := -fopenmp -Wl,-rpath,./lib `pkg-config --libs opencv`
13+
CXXFLAGS := -std=c++11 -fopenmp #`pkg-config --cflags opencv`
14+
LDFLAGS := -fopenmp -Wl,-rpath,./lib #`pkg-config --libs opencv`
1515

1616
BUILD_DIR := build
1717

launch_training.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export CUDA_VISIBLE_DEVICES=0,1,2,3
22
export NGPUS=4
3-
export OMP_NUM_THREADS=1
3+
export OMP_NUM_THREADS=1 # you can change this value according to your number of cpu cores
44

55

6-
# python -m torch.distributed.launch --nproc_per_node=$NGPUS train.py configs/culane.py
7-
python train.py configs/tusimple.py
6+
python -m torch.distributed.launch --nproc_per_node=$NGPUS train.py configs/culane.py
7+
# python train.py configs/tusimple.py

0 commit comments

Comments
 (0)