You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fluid/PaddleCV/rcnn/README.md
+47-18Lines changed: 47 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@
12
12
13
13
## Installation
14
14
15
-
Running sample code in this directory requires PaddelPaddle Fluid v.1.0.0 and later. If the PaddlePaddle on your device is lower than this version, please follow the instructions in [installation document](http://www.paddlepaddle.org/documentation/docs/zh/0.15.0/beginners_guide/install/install_doc.html#paddlepaddle) and make an update.
15
+
Running sample code in this directory requires PaddelPaddle Fluid v.1.3.0 and later. If the PaddlePaddle on your device is lower than this version, please follow the instructions in [installation document](http://paddlepaddle.org/documentation/docs/en/1.3/beginners_guide/install/index_en.html) and make an update.
16
16
17
17
## Introduction
18
18
@@ -37,6 +37,25 @@ Train the model on [MS-COCO dataset](http://cocodataset.org/#download), download
37
37
cd dataset/coco
38
38
./download.sh
39
39
40
+
The data catalog structure is as follows:
41
+
42
+
```
43
+
data/coco/
44
+
├── annotations
45
+
│ ├── instances_train2014.json
46
+
│ ├── instances_train2017.json
47
+
│ ├── instances_val2014.json
48
+
│ ├── instances_val2017.json
49
+
| ...
50
+
├── train2017
51
+
│ ├── 000000000009.jpg
52
+
│ ├── 000000580008.jpg
53
+
| ...
54
+
├── val2017
55
+
│ ├── 000000000139.jpg
56
+
│ ├── 000000000285.jpg
57
+
| ...
58
+
```
40
59
41
60
## Training
42
61
@@ -51,9 +70,8 @@ Please make sure that pretrained_model is downloaded and loaded correctly, other
51
70
52
71
To train the model, [cocoapi](https://github.com/cocodataset/cocoapi) is needed. Install the cocoapi:
@@ -66,25 +84,29 @@ After data preparation, one can start the training step by:
66
84
67
85
- Faster RCNN
68
86
87
+
```
69
88
python train.py \
70
89
--model_save_dir=output/ \
71
90
--pretrained_model=${path_to_pretrain_model} \
72
91
--data_dir=${path_to_data} \
73
92
--MASK_ON=False
93
+
```
74
94
75
95
- Mask RCNN
76
96
97
+
```
77
98
python train.py \
78
99
--model_save_dir=output/ \
79
100
--pretrained_model=${path_to_pretrain_model} \
80
101
--data_dir=${path_to_data} \
81
102
--MASK_ON=True
103
+
```
82
104
83
-
- Set ```export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7``` to specifiy 8 GPU to train.
84
-
- Set ```MASK_ON``` to choose Faster RCNN or Mask RCNN model.
85
-
- For more help on arguments:
105
+
- Set ```export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7``` to specifiy 8 GPU to train.
106
+
- Set ```MASK_ON``` to choose Faster RCNN or Mask RCNN model.
107
+
- For more help on arguments:
86
108
87
-
python train.py --help
109
+
python train.py --help
88
110
89
111
**data reader introduction:**
90
112
@@ -116,20 +138,25 @@ Evaluation is to evaluate the performance of a trained model. This sample provid
116
138
117
139
- Faster RCNN
118
140
141
+
```
119
142
python eval_coco_map.py \
120
143
--dataset=coco2017 \
121
-
--pretrained_model=${path_to_pretrain_model} \
144
+
--pretrained_model=${path_to_trained_model} \
122
145
--MASK_ON=False
146
+
```
123
147
124
148
- Mask RCNN
125
149
150
+
```
126
151
python eval_coco_map.py \
127
152
--dataset=coco2017 \
128
-
--pretrained_model=${path_to_pretrain_model} \
153
+
--pretrained_model=${path_to_trainde_model} \
129
154
--MASK_ON=True
155
+
```
130
156
131
-
- Set ```export CUDA_VISIBLE_DEVICES=0``` to specifiy one GPU to eval.
132
-
- Set ```MASK_ON``` to choose Faster RCNN or Mask RCNN model.
157
+
- Set ```--pretrained_model=${path_to_trained_model}``` to specifiy the trained model, not the initialized model.
158
+
- Set ```export CUDA_VISIBLE_DEVICES=0``` to specifiy one GPU to eval.
159
+
- Set ```MASK_ON``` to choose Faster RCNN or Mask RCNN model.
133
160
134
161
Evalutaion result is shown as below:
135
162
@@ -159,12 +186,14 @@ Mask RCNN:
159
186
160
187
Inference is used to get prediction score or image features based on trained models. `infer.py` is the main executor for inference, one can start infer step by:
Please set the model path and image path correctly. GPU device is used by default, you can set `--use_gpu=False` to switch to CPU device. And you can set `draw_threshold` to tune score threshold to control the number of output detection boxes.
0 commit comments