Skip to content

Commit 441c329

Browse files
authored
Update docs (tusen-ai#219)
* stash * stash * stash * add * update * fix lr scheduler * update merging description * update lr scheduler for finetune * update finetune * update test * update rpn test * add json to roidb * update * stash * allow negative iter step * stash * update * fix * add support for tensorboard * fix * update * fix py3.5 * trident with gn * update create voc roidb * update for dataset other than coco * add doc for datasets * take time * cleanup * update * update readme * wording * update distributed * use 2017 split * smaller diagram * smaller * update data preparation * add all-in-one script
1 parent 23a55ab commit 441c329

File tree

118 files changed

+1870
-689
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+1870
-689
lines changed

README.md

Lines changed: 74 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
## SimpleDet - A Simple and Versatile Framework for Object Detection and Instance Recognition
22
### Major Features
3-
![](./doc/image/diagram.png)
3+
![](./doc/image/diagram_v2.png)
44
- FP16 training for memory saving and up to **2.5X** acceleration
55
- Highly scalable distributed training available **out of box**
6-
- Full coverage of state-of-the-art models including FasterRCNN, MaskRCNN, CascadeRCNN, RetinaNet, **[TridentNet](./models/tridentnet)**, **[NASFPN](./models/NASFPN)** and **[EfficientNet](./models/efficientnet)**
7-
- Extensive feature set including **large batch BN**, **loss synchronization**, **automatic BN fusion**, deformable convolution, soft NMS, multi-scale train/test
6+
- Full coverage of state-of-the-art models including FasterRCNN, MaskRCNN, CascadeRCNN, RetinaNet, [DCNv1/v2](./models/dcn), **[TridentNet](./models/tridentnet)**, **[NASFPN](./models/NASFPN)** , **[EfficientNet](./models/efficientnet)**, and **[Kownledge Distillation](./models/KD)**
7+
- Extensive feature set including **large batch BN**, **loss synchronization**, **automatic BN fusion**, soft NMS, multi-scale train/test
88
- Modular design for coding-free exploration of new experiment settings
9+
- Extensive documentations including [annotated config](./doc/fully_annotated_config.py), [Fintuning Guide](./doc/FINETUNE.md)
910

1011
### Recent Updates
1112
- Add RPN test (2019.05.28)
@@ -21,80 +22,94 @@
2122
- Add python wheel for easy local installation (2019.08.20)
2223
- Add FitNet based Knowledge Distill (2019.08.27)
2324
- Add SE and train from scratch (2019.08.30)
25+
- Add a lot of docs (2019.09.03)
2426

2527
### Setup
28+
#### All-in-one Script
29+
We provide a [setup script](./scripts/setup.sh) for install simpledet and preppare the coco dataset.
30+
2631
#### Install
27-
SimpleDet contains a lot of C++ operators not in MXNet offical repo, so one has to build MXNet from scratch. Please refer to [INSTALL.md](./doc/INSTALL.md) more details
32+
We provide a local installation here for Debian/Ubuntu system. To use a pre-built docker or singularity images, please refer to [INSTALL.md](./doc/INSTALL.md) for more information.
2833

29-
#### Preparing Data
30-
SimpleDet requires groundtruth annotation organized as following format
31-
```
32-
[
33-
{
34-
"gt_class": (nBox, ),
35-
"gt_bbox": (nBox, 4),
36-
"flipped": bool,
37-
"h": int,
38-
"w": int,
39-
"image_url": str,
40-
"im_id": int,
41-
42-
# this fields are generated on the fly during test
43-
"rec_id": int,
44-
"resize_h": int,
45-
"resize_w": int,
46-
...
47-
},
48-
...
49-
]
50-
```
34+
```bash
35+
# install dependency
36+
sudo apt update && sudo apt install -y git wget make python3-dev libglib2.0-0 libsm6 libxext6 libxrender-dev unzip
5137

52-
Especially, for experimenting on coco datatet, one can organize coco data in
53-
```
54-
data/
55-
coco/
56-
annotations/
57-
instances_train2014.json
58-
instances_valminusminival2014.json
59-
instances_minival2014.json
60-
image_info_test-dev2017.json
61-
images/
62-
train2014
63-
val2014
64-
test2017
65-
```
38+
# install python dependency
39+
pip3 install 'matplotlib<3.1' opencv-python pytz --user
6640

67-
and run the helper script to generate roidb
68-
```bash
69-
python3 utils/generate_roidb.py --dataset coco --dataset-split train2014
70-
python3 utils/generate_roidb.py --dataset coco --dataset-split valminusminival2014
71-
python3 utils/generate_roidb.py --dataset coco --dataset-split minival2014
72-
python3 utils/generate_roidb.py --dataset coco --dataset-split test-dev2017
41+
# download and intall pre-built wheel for CUDA 10.0
42+
# check INSTALL.md for wheels for other CUDA version
43+
wget https://bit.ly/2jRGqdc -O mxnet_cu100-1.6.0b20190820-py2.py3-none-manylinux1_x86_64.whl
44+
pip3 install mxnet_cu100-1.6.0b20190820-py2.py3-none-manylinux1_x86_64.whl --user
45+
46+
# install pycocotools
47+
pip3 install 'git+https://github.com/RogerChern/cocoapi.git#subdirectory=PythonAPI' --user
48+
49+
# install mxnext, a wrapper around MXNet symbolic API
50+
pip3 install 'git+https://github.com/RogerChern/mxnext#egg=mxnext' --user
51+
52+
# get simpledet
53+
git clone https://github.com/tusimple/simpledet
54+
cd simpledet
55+
make
56+
57+
# test simpledet installation
58+
mkdir -p experiments/faster_r50v1_fpn_1x
59+
python3 detection_infer_speed.py --config config/faster_r50v1_fpn_1x.py --shape 800 1333
7360
```
7461

75-
#### Deploy dependency and compile extension
76-
1. setup mxnext, a wrapper of mxnet symbolic API
62+
If the last line execute successfully, the average running speed of Faster R-CNN R-50 FPN will be reported. And you have successfuly setup SimpleDet. Now you can head up to the next section to prepare your dataset.
63+
64+
65+
#### Preparing Data
66+
We provide a step by step preparation for the COCO dataset below.
7767
```bash
78-
cd $SIMPLEDET_DIR
79-
pip install git+https://github.com/RogerChern/mxnext#egg=mxnext
68+
cd simpledet
69+
70+
# make data dir
71+
mkdir -p data/coco/images data/src
72+
73+
# skip this if you have the zip files
74+
wget -c http://images.cocodataset.org/zips/train2017.zip -O data/src/train2017.zip
75+
wget -c http://images.cocodataset.org/zips/val2017.zip -O data/src/val2017.zip
76+
wget -c http://images.cocodataset.org/zips/test2017.zip -O data/src/test2017.zip
77+
wget -c http://images.cocodataset.org/annotations/annotations_trainval2017.zip -O data/src/annotations_trainval2017.zip
78+
wget -c http://images.cocodataset.org/annotations/image_info_test2017.zip -O data/src/image_info_test2017.zip
79+
80+
unzip data/src/train2017.zip -d data/coco/images
81+
unzip data/src/val2017.zip -d data/coco/images
82+
unzip data/src/test2017.zip -d data/coco/images
83+
unzip data/src/annotations_trainval2017.zip -d data/coco
84+
unzip data/src/image_info_test2017.zip -d data/coco
85+
86+
python3 utils/create_coco_roidb.py --dataset coco --dataset-split train2017
87+
python3 utils/create_coco_roidb.py --dataset coco --dataset-split val2017
88+
python3 utils/create_coco_roidb.py --dataset coco --dataset-split test-dev2017
8089
```
81-
2. run make in simpledet directory to install cython extensions
90+
91+
For other datasets or your own data, please check [DATASET.md](doc/DATASET.md) for more details.
8292

8393
#### Quick Start
8494

8595
```bash
8696
# train
87-
python3 detection_train.py --config config/detection_config.py
97+
python3 detection_train.py --config config/faster_r50v1_fpn_1x.py
8898

8999
# test
90-
python3 detection_test.py --config config/detection_config.py
100+
python3 detection_test.py --config config/faster_r50v1_fpn_1x.py
91101
```
92102

103+
#### Finetune
104+
Please check [FINTUNE.md](doc/FINETUNE.md)
93105

94-
### Project Design
95106
#### Model Zoo
96107
Please refer to [MODEL_ZOO.md](./MODEL_ZOO.md) for available models
97108

109+
### Distributed Training
110+
Please refer to [DISTRIBUTED.md](./doc/DISTRIBUTED.md)
111+
112+
### Project Organization
98113
#### Code Structure
99114
```
100115
detection_train.py
@@ -135,8 +150,10 @@ experiments/
135150
#### Models
136151
The `models` directory contains SOTA models implemented in SimpletDet.
137152

138-
#### How is Faster-RCNN built
139-
**Simpledet** supports many popular detection methods and here we take [**Faster-RCNN**](https://arxiv.org/abs/1506.01497) as a typical example to show how a detector is built.
153+
#### How is Faster R-CNN built
154+
![Faster R-CNN](doc/image/detector.png)
155+
156+
**Simpledet** supports many popular detection methods and here we take [**Faster R-CNN**](https://arxiv.org/abs/1506.01497) as a typical example to show how a detector is built.
140157

141158
- *Preprocessing*. The preprocessing methods of the detector is implemented through `DetectionAugmentation`.
142159
- Image/bbox-related preprocessing, such as `Norm2DImage` and `Resize2DImageBbox`.
@@ -149,18 +166,14 @@ The `models` directory contains SOTA models implemented in SimpletDet.
149166
- *Bounding Box Head*. `BboxHead` builds the R-CNN layers for proposal refinement.
150167

151168
#### How to build a custom detector
152-
The flexibility of **simpledet** framework makes it easy to build different detectors. We take [**TridentNet**](https://arxiv.org/abs/1901.01892) as an example to demonstrate how to build a custom detector simply based on the **Faster-RCNN** framework.
169+
The flexibility of **simpledet** framework makes it easy to build different detectors. We take [**TridentNet**](https://arxiv.org/abs/1901.01892) as an example to demonstrate how to build a custom detector simply based on the Faster R-CNN framework.
153170

154171
- *Preprocessing*. The additional processing methods could be provided accordingly by inheriting from `DetectionAugmentation`.
155172
- In TridentNet, a new `TridentAnchorTarget2D` is implemented to generate anchors for multiple branches and filter anchors for scale-aware training scheme.
156173
- *Network Structure*. The new network structure could be constructed easily for a custom detector by modifying some required components as needed and
157174
- For TridentNet, we build trident blocks in the `Backbone` according to the descriptions in the paper. We also provide a `TridentRpnHead` to generate filtered proposals in RPN to implement the scale-aware scheme. Other components are shared the same with original Faster-RCNN.
158175

159176

160-
### Distributed Training
161-
Please refer to [DISTRIBUTED.md](./doc/DISTRIBUTED.md)
162-
163-
164177
### Contributors
165178
Yuntao Chen, Chenxia Han, Yanghao Li, Zehao Huang, Yi Jiang, Naiyan Wang
166179

config/cascade_r101v1_fpn_1x.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ class RoiParam:
175175

176176
class DatasetParam:
177177
if is_train:
178-
image_set = ("coco_train2014", "coco_valminusminival2014")
178+
image_set = ("coco_train2017", )
179179
else:
180-
image_set = ("coco_minival2014", )
180+
image_set = ("coco_val2017", )
181181

182182
backbone = Backbone(BackboneParam)
183183
neck = Neck(NeckParam)

config/cascade_r101v2_c5_red_1x.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ class RoiParam:
176176

177177
class DatasetParam:
178178
if is_train:
179-
image_set = ("coco_train2014", "coco_valminusminival2014")
179+
image_set = ("coco_train2017", )
180180
else:
181-
image_set = ("coco_minival2014", )
181+
image_set = ("coco_val2017", )
182182

183183
backbone = Backbone(BackboneParam)
184184
neck = Neck(NeckParam)

config/cascade_r50v1_fpn_1x.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ class RoiParam:
175175

176176
class DatasetParam:
177177
if is_train:
178-
image_set = ("coco_train2014", "coco_valminusminival2014")
178+
image_set = ("coco_train2017", )
179179
else:
180-
image_set = ("coco_minival2014", )
180+
image_set = ("coco_val2017", )
181181

182182
backbone = Backbone(BackboneParam)
183183
neck = Neck(NeckParam)

config/cascade_r50v2_c5_red_1x.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ class RoiParam:
176176

177177
class DatasetParam:
178178
if is_train:
179-
image_set = ("coco_train2014", "coco_valminusminival2014")
179+
image_set = ("coco_train2017", )
180180
else:
181-
image_set = ("coco_minival2014", )
181+
image_set = ("coco_val2017", )
182182

183183
backbone = Backbone(BackboneParam)
184184
neck = Neck(NeckParam)

config/dcn/faster_dcn_r101v1bc4_c5_512roi_1x.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ class RoiParam:
9999

100100
class DatasetParam:
101101
if is_train:
102-
image_set = ("coco_train2014", "coco_valminusminival2014")
102+
image_set = ("coco_train2017", )
103103
else:
104-
image_set = ("coco_minival2014", )
104+
image_set = ("coco_val2017", )
105105

106106
backbone = Backbone(BackboneParam)
107107
neck = Neck(NeckParam)

config/dcn/faster_dcn_r50v1bc4_c5_512roi_1x.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ class RoiParam:
100100

101101
class DatasetParam:
102102
if is_train:
103-
image_set = ("coco_train2014", "coco_valminusminival2014")
103+
image_set = ("coco_train2017", )
104104
else:
105-
image_set = ("coco_minival2014", )
105+
image_set = ("coco_val2017", )
106106

107107
backbone = Backbone(BackboneParam)
108108
neck = Neck(NeckParam)

config/dcn/faster_dcnv2_r101v1bc4_c5_512roi_1x.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ class RoiParam:
9999

100100
class DatasetParam:
101101
if is_train:
102-
image_set = ("coco_train2014", "coco_valminusminival2014")
102+
image_set = ("coco_train2017", )
103103
else:
104-
image_set = ("coco_minival2014", )
104+
image_set = ("coco_val2017", )
105105

106106
backbone = Backbone(BackboneParam)
107107
neck = Neck(NeckParam)

config/dcn/faster_dcnv2_r101v1bc4_c5_512roi_2x.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ class RoiParam:
9999

100100
class DatasetParam:
101101
if is_train:
102-
image_set = ("coco_train2014", "coco_valminusminival2014")
102+
image_set = ("coco_train2017", )
103103
else:
104-
image_set = ("coco_minival2014", )
104+
image_set = ("coco_val2017", )
105105

106106
backbone = Backbone(BackboneParam)
107107
neck = Neck(NeckParam)

config/dcn/faster_dcnv2_r50v1bc4_c5_512roi_1x.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ class RoiParam:
9999

100100
class DatasetParam:
101101
if is_train:
102-
image_set = ("coco_train2014", "coco_valminusminival2014")
102+
image_set = ("coco_train2017", )
103103
else:
104-
image_set = ("coco_minival2014", )
104+
image_set = ("coco_val2017", )
105105

106106
backbone = Backbone(BackboneParam)
107107
neck = Neck(NeckParam)

0 commit comments

Comments
 (0)