Object Detection
akhaliq HF staff commited on
Commit
3212d20
1 Parent(s): e3ca310

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +271 -0
README.md ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - object-detection
4
+ ---
5
+
6
+ <div align="left">
7
+
8
+ ## You Only Look Once for Panoptic ​ Driving Perception
9
+ > [**You Only Look at Once for Panoptic driving Perception**](https://arxiv.org/abs/2108.11250)
10
+ >
11
+ > by Dong Wu, Manwen Liao, Weitian Zhang, [Xinggang Wang](https://xinggangw.info/) [*School of EIC, HUST*](http://eic.hust.edu.cn/English/Home.htm)
12
+ >
13
+ > *arXiv technical report ([arXiv 2108.11250](https://arxiv.org/abs/2108.11250))*
14
+
15
+ ---
16
+
17
+ ### The Illustration of YOLOP
18
+
19
+ ![yolop](pictures/yolop.png)
20
+
21
+ ### Contributions
22
+
23
+ * We put forward an efficient multi-task network that can jointly handle three crucial tasks in autonomous driving: object detection, drivable area segmentation and lane detection to save computational costs, reduce inference time as well as improve the performance of each task. Our work is the first to reach real-time on embedded devices while maintaining state-of-the-art level performance on the `BDD100K `dataset.
24
+
25
+ * We design the ablative experiments to verify the effectiveness of our multi-tasking scheme. It is proved that the three tasks can be learned jointly without tedious alternating optimization.
26
+
27
+
28
+
29
+ ### Results
30
+
31
+ #### Traffic Object Detection Result
32
+
33
+ | Model | Recall(%) | mAP50(%) | Speed(fps) |
34
+ | -------------- | --------- | -------- | ---------- |
35
+ | `Multinet` | 81.3 | 60.2 | 8.6 |
36
+ | `DLT-Net` | 89.4 | 68.4 | 9.3 |
37
+ | `Faster R-CNN` | 77.2 | 55.6 | 5.3 |
38
+ | `YOLOv5s` | 86.8 | 77.2 | 82 |
39
+ | `YOLOP(ours)` | 89.2 | 76.5 | 41 |
40
+ #### Drivable Area Segmentation Result
41
+
42
+ | Model | mIOU(%) | Speed(fps) |
43
+ | ------------- | ------- | ---------- |
44
+ | `Multinet` | 71.6 | 8.6 |
45
+ | `DLT-Net` | 71.3 | 9.3 |
46
+ | `PSPNet` | 89.6 | 11.1 |
47
+ | `YOLOP(ours)` | 91.5 | 41 |
48
+
49
+ #### Lane Detection Result:
50
+
51
+ | Model | mIOU(%) | IOU(%) |
52
+ | ------------- | ------- | ------ |
53
+ | `ENet` | 34.12 | 14.64 |
54
+ | `SCNN` | 35.79 | 15.84 |
55
+ | `ENet-SAD` | 36.56 | 16.02 |
56
+ | `YOLOP(ours)` | 70.50 | 26.20 |
57
+
58
+ #### Ablation Studies 1: End-to-end v.s. Step-by-step:
59
+
60
+ | Training_method | Recall(%) | AP(%) | mIoU(%) | Accuracy(%) | IoU(%) |
61
+ | --------------- | --------- | ----- | ------- | ----------- | ------ |
62
+ | `ES-W` | 87.0 | 75.3 | 90.4 | 66.8 | 26.2 |
63
+ | `ED-W` | 87.3 | 76.0 | 91.6 | 71.2 | 26.1 |
64
+ | `ES-D-W` | 87.0 | 75.1 | 91.7 | 68.6 | 27.0 |
65
+ | `ED-S-W` | 87.5 | 76.1 | 91.6 | 68.0 | 26.8 |
66
+ | `End-to-end` | 89.2 | 76.5 | 91.5 | 70.5 | 26.2 |
67
+
68
+ #### Ablation Studies 2: Multi-task v.s. Single task:
69
+
70
+ | Training_method | Recall(%) | AP(%) | mIoU(%) | Accuracy(%) | IoU(%) | Speed(ms/frame) |
71
+ | --------------- | --------- | ----- | ------- | ----------- | ------ | --------------- |
72
+ | `Det(only)` | 88.2 | 76.9 | - | - | - | 15.7 |
73
+ | `Da-Seg(only)` | - | - | 92.0 | - | - | 14.8 |
74
+ | `Ll-Seg(only)` | - | - | - | 79.6 | 27.9 | 14.8 |
75
+ | `Multitask` | 89.2 | 76.5 | 91.5 | 70.5 | 26.2 | 24.4 |
76
+
77
+ **Notes**:
78
+
79
+ - The works we has use for reference including `Multinet` ([paper](https://arxiv.org/pdf/1612.07695.pdf?utm_campaign=affiliate-ir-Optimise%20media%28%20South%20East%20Asia%29%20Pte.%20ltd._156_-99_national_R_all_ACQ_cpa_en&utm_content=&utm_source=%20388939),[code](https://github.com/MarvinTeichmann/MultiNet)),`DLT-Net` ([paper](https://ieeexplore.ieee.org/abstract/document/8937825)),`Faster R-CNN` ([paper](https://proceedings.neurips.cc/paper/2015/file/14bfa6bb14875e45bba028a21ed38046-Paper.pdf),[code](https://github.com/ShaoqingRen/faster_rcnn)),`YOLOv5s`([code](https://github.com/ultralytics/yolov5)) ,`PSPNet`([paper](https://openaccess.thecvf.com/content_cvpr_2017/papers/Zhao_Pyramid_Scene_Parsing_CVPR_2017_paper.pdf),[code](https://github.com/hszhao/PSPNet)) ,`ENet`([paper](https://arxiv.org/pdf/1606.02147.pdf),[code](https://github.com/osmr/imgclsmob)) `SCNN`([paper](https://www.aaai.org/ocs/index.php/AAAI/AAAI18/paper/download/16802/16322),[code](https://github.com/XingangPan/SCNN)) `SAD-ENet`([paper](https://openaccess.thecvf.com/content_ICCV_2019/papers/Hou_Learning_Lightweight_Lane_Detection_CNNs_by_Self_Attention_Distillation_ICCV_2019_paper.pdf),[code](https://github.com/cardwing/Codes-for-Lane-Detection)). Thanks for their wonderful works.
80
+ - In table 4, E, D, S and W refer to Encoder, Detect head, two Segment heads and whole network. So the Algorithm (First, we only train Encoder and Detect head. Then we freeze the Encoder and Detect head as well as train two Segmentation heads. Finally, the entire network is trained jointly for all three tasks.) can be marked as ED-S-W, and the same for others.
81
+
82
+ ---
83
+
84
+ ### Visualization
85
+
86
+ #### Traffic Object Detection Result
87
+
88
+ ![detect result](pictures/detect.png)
89
+
90
+ #### Drivable Area Segmentation Result
91
+
92
+ ![](pictures/da.png)
93
+
94
+ #### Lane Detection Result
95
+
96
+ ![](pictures/ll.png)
97
+
98
+ **Notes**:
99
+
100
+ - The visualization of lane detection result has been post processed by quadratic fitting.
101
+
102
+ ---
103
+
104
+ ### Project Structure
105
+
106
+ ```python
107
+ ├─inference
108
+ │ ├─images # inference images
109
+ │ ├─output # inference result
110
+ ├─lib
111
+ │ ├─config/default # configuration of training and validation
112
+ │ ├─core
113
+ │ │ ├─activations.py # activation function
114
+ │ │ ├─evaluate.py # calculation of metric
115
+ │ │ ├─function.py # training and validation of model
116
+ │ │ ├─general.py #calculation of metric、nms、conversion of data-format、visualization
117
+ │ │ ├─loss.py # loss function
118
+ │ │ ├─postprocess.py # postprocess(refine da-seg and ll-seg, unrelated to paper)
119
+ │ ├─dataset
120
+ │ │ ├─AutoDriveDataset.py # Superclass dataset,general function
121
+ │ │ ├─bdd.py # Subclass dataset,specific function
122
+ │ │ ├─hust.py # Subclass dataset(Campus scene, unrelated to paper)
123
+ │ │ ├─convect.py
124
+ │ │ ├─DemoDataset.py # demo dataset(image, video and stream)
125
+ │ ├─models
126
+ │ │ ├─YOLOP.py # Setup and Configuration of model
127
+ │ │ ├─light.py # Model lightweight(unrelated to paper, zwt)
128
+ │ │ ├─commom.py # calculation module
129
+ │ ├─utils
130
+ │ │ ├─augmentations.py # data augumentation
131
+ │ │ ├─autoanchor.py # auto anchor(k-means)
132
+ │ │ ├─split_dataset.py # (Campus scene, unrelated to paper)
133
+ │ │ ├─utils.py # logging、device_select、time_measure、optimizer_select、model_save&initialize 、Distributed training
134
+ │ ├─run
135
+ │ │ ├─dataset/training time # Visualization, logging and model_save
136
+ ├─tools
137
+ │ │ ├─demo.py # demo(folder、camera)
138
+ │ │ ├─test.py
139
+ │ │ ├─train.py
140
+ ├─toolkits
141
+ │ │ ├─depoly # Deployment of model
142
+ ├─weights # Pretraining model
143
+ ```
144
+
145
+ ---
146
+
147
+ ### Requirement
148
+
149
+ This codebase has been developed with python version 3.7, PyTorch 1.7+ and torchvision 0.8+:
150
+
151
+ ```
152
+ conda install pytorch==1.7.0 torchvision==0.8.0 cudatoolkit=10.2 -c pytorch
153
+ ```
154
+
155
+ See `requirements.txt` for additional dependencies and version requirements.
156
+
157
+ ```setup
158
+ pip install -r requirements.txt
159
+ ```
160
+
161
+ ### Data preparation
162
+
163
+ #### Download
164
+
165
+ - Download the images from [images](https://bdd-data.berkeley.edu/).
166
+
167
+ - Download the annotations of detection from [det_annotations](https://drive.google.com/file/d/1Ge-R8NTxG1eqd4zbryFo-1Uonuh0Nxyl/view?usp=sharing).
168
+ - Download the annotations of drivable area segmentation from [da_seg_annotations](https://drive.google.com/file/d/1xy_DhUZRHR8yrZG3OwTQAHhYTnXn7URv/view?usp=sharing).
169
+ - Download the annotations of lane line segmentation from [ll_seg_annotations](https://drive.google.com/file/d/1lDNTPIQj_YLNZVkksKM25CvCHuquJ8AP/view?usp=sharing).
170
+
171
+ We recommend the dataset directory structure to be the following:
172
+
173
+ ```
174
+ # The id represent the correspondence relation
175
+ ├─dataset root
176
+ │ ├─images
177
+ │ │ ├─train
178
+ │ │ ├─val
179
+ │ ├─det_annotations
180
+ │ │ ├─train
181
+ │ │ ├─val
182
+ │ ├─da_seg_annotations
183
+ │ │ ├─train
184
+ │ │ ├─val
185
+ │ ├─ll_seg_annotations
186
+ │ │ ├─train
187
+ │ │ ├─val
188
+ ```
189
+
190
+ Update the your dataset path in the `./lib/config/default.py`.
191
+
192
+ ### Training
193
+
194
+ You can set the training configuration in the `./lib/config/default.py`. (Including: the loading of preliminary model, loss, data augmentation, optimizer, warm-up and cosine annealing, auto-anchor, training epochs, batch_size).
195
+
196
+ If you want try alternating optimization or train model for single task, please modify the corresponding configuration in `./lib/config/default.py` to `True`. (As following, all configurations is `False`, which means training multiple tasks end to end).
197
+
198
+ ```python
199
+ # Alternating optimization
200
+ _C.TRAIN.SEG_ONLY = False # Only train two segmentation branchs
201
+ _C.TRAIN.DET_ONLY = False # Only train detection branch
202
+ _C.TRAIN.ENC_SEG_ONLY = False # Only train encoder and two segmentation branchs
203
+ _C.TRAIN.ENC_DET_ONLY = False # Only train encoder and detection branch
204
+
205
+ # Single task
206
+ _C.TRAIN.DRIVABLE_ONLY = False # Only train da_segmentation task
207
+ _C.TRAIN.LANE_ONLY = False # Only train ll_segmentation task
208
+ _C.TRAIN.DET_ONLY = False # Only train detection task
209
+ ```
210
+
211
+ Start training:
212
+
213
+ ```shell
214
+ python tools/train.py
215
+ ```
216
+
217
+
218
+
219
+ ### Evaluation
220
+
221
+ You can set the evaluation configuration in the `./lib/config/default.py`. (Including: batch_size and threshold value for nms).
222
+
223
+ Start evaluating:
224
+
225
+ ```shell
226
+ python tools/test.py --weights weights/End-to-end.pth
227
+ ```
228
+
229
+
230
+
231
+ ### Demo Test
232
+
233
+ We provide two testing method.
234
+
235
+ #### Folder
236
+
237
+ You can store the image or video in `--source`, and then save the reasoning result to `--save-dir`
238
+
239
+ ```shell
240
+ python tools/demo --source inference/images
241
+ ```
242
+
243
+
244
+
245
+ #### Camera
246
+
247
+ If there are any camera connected to your computer, you can set the `source` as the camera number(The default is 0).
248
+
249
+ ```shell
250
+ python tools/demo --source 0
251
+ ```
252
+
253
+ ### Deployment
254
+
255
+ Our model can reason in real-time on `Jetson Tx2`, with `Zed Camera` to capture image. We use `TensorRT` tool for speeding up. We provide code for deployment and reasoning of model in `./toolkits/deploy`.
256
+
257
+
258
+
259
+ ## Citation
260
+
261
+ If you find our paper and code useful for your research, please consider giving a star and citation:
262
+
263
+ ```BibTeX
264
+ @misc{2108.11250,
265
+ Author = {Dong Wu and Manwen Liao and Weitian Zhang and Xinggang Wang},
266
+ Title = {YOLOP: You Only Look Once for Panoptic Driving Perception},
267
+ Year = {2021},
268
+ Eprint = {arXiv:2108.11250},
269
+ }
270
+ ```
271
+