3
3
[ 1] Mingxing Tan, Ruoming Pang, Quoc V. Le. EfficientDet: Scalable and Efficient Object Detection. CVPR 2020.
4
4
Arxiv link: https://arxiv.org/abs/1911.09070
5
5
6
- Updates:
7
-
8
- - ** Jul20: Added keras/TF2 and new SOTA D7x: 55.1mAP with 153ms**
9
- - Apr22: Sped up end-to-end latency: D0 has up to >200 FPS throughput on Tesla V100.
10
- * A great collaboration with [ @fsx950223 ] ( https://github.com/fsx950223 ) .
11
- - Apr1: Updated results for test-dev and added EfficientDet-D7.
12
- - Mar26: Fixed a few bugs and updated all checkpoints/results.
13
- - Mar24: Added tutorial with visualization and coco eval.
14
- - Mar 13: Released the initial code and models.
15
-
16
6
** Quick start tutorial: [ tutorial.ipynb] ( tutorial.ipynb ) **
17
7
18
8
** Quick install dependencies: ``` pip install -r requirements.txt ``` **
@@ -25,7 +15,7 @@ EfficientDets are a family of object detection models, which achieve state-of-th
25
15
EfficientDets are developed based on the advanced backbone, a new BiFPN, and a new scaling technique:
26
16
27
17
<p align =" center " >
28
- <img src =" ./g3doc/network.png " width =" 800 " />
18
+ <img src =" .. /g3doc/network.png " width =" 800 " />
29
19
</p >
30
20
31
21
* ** Backbone** : we employ [ EfficientNets] ( https://arxiv.org/abs/1905.11946 ) as our backbone networks.
@@ -38,10 +28,10 @@ Our model family starts from EfficientDet-D0, which has comparable accuracy as [
38
28
<table border =" 0 " >
39
29
<tr >
40
30
<td>
41
- <img src="./g3doc/flops.png" width="100%" />
31
+ <img src=".. /g3doc/flops.png" width="100%" />
42
32
</td>
43
33
<td>
44
- <img src="./g3doc/params.png", width="100%" />
34
+ <img src=".. /g3doc/params.png", width="100%" />
45
35
</td>
46
36
</tr >
47
37
</table >
@@ -56,15 +46,15 @@ We have provided a list of EfficientDet checkpoints and results as follows:
56
46
57
47
| Model | AP<sup >test</sup > | AP<sub >50</sub > | AP<sub >75</sub > | AP<sub >S</sub > | AP<sub >M</sub > | AP<sub >L</sub > | AP<sup >val</sup > | | #params | #FLOPs |
58
48
| ---------- | ------ | ------ | ------ | -------- | ------| ------| ------ | ------ | ------ | :------: |
59
- | EfficientDet-D0 ([ h5 ] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d0.h5 ) , [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d0.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d0_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d0_coco_test-dev2017.txt ) ) | 34.6 | 53.0 | 37.1 | 12.4 | 39.0 | 52.7 | 34.3 | | 3.9M | 2.54B |
60
- | EfficientDet-D1 ([ h5 ] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d1.h5 ) , [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d1.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d1_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d1_coco_test-dev2017.txt ) ) | 40.5 | 59.1 | 43.7 | 18.3 | 45.0 | 57.5 | 40.2 | | 6.6M | 6.10B |
61
- | EfficientDet-D2 ([ h5 ] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d2.h5 ) , [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d2.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d2_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d2_coco_test-dev2017.txt ) ) | 43.0 | 62.3 | 46.2 | 22.5 | 47.0 | 58.4 | 42.5 | | 8.1M | 11.0B |
62
- | EfficientDet-D3 ([ h5 ] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d3.h5 ) , [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d3.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d3_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d3_coco_test-dev2017.txt ) ) | 47.5 | 66.2 | 51.5 | 27.9 | 51.4 | 62.0 | 47.2 | | 12.0M | 24.9B |
63
- | EfficientDet-D4 ([ h5 ] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d4.h5 ) , [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d4.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d4_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d4_coco_test-dev2017.txt ) ) | 49.7 | 68.4 | 53.9 | 30.7 | 53.2 | 63.2 | 49.3 | | 20.7M | 55.2B |
64
- | EfficientDet-D5 ([ h5 ] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d5.h5 ) , [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d5.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d5_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d5_coco_test-dev2017.txt ) ) | 51.5 | 70.5 | 56.1 | 33.9 | 54.7 | 64.1 | 51.2 | | 33.7M | 130B |
65
- | EfficientDet-D6 ([ h5 ] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d6.h5 ) , [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d6.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d6_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d6_coco_test-dev2017.txt ) ) | 52.6 | 71.5 | 57.2 | 34.9 | 56.0 | 65.4 | 52.1 | | 51.9M | 226B |
66
- | EfficientDet-D7 ([ h5 ] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d7.h5 ) , [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d7.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d7_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d7_coco_test-dev2017.txt ) ) | 53.7 | 72.4 | 58.4 | 35.8 | 57.0 | 66.3 | 53.4 | | 51.9M | 325B |
67
- | EfficientDet-D7x ([ h5 ] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d7x.h5 ) , [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d7x.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d7x_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d7x_coco_test-dev2017.txt ) ) | 55.1 | 74.3 | 59.9 | 37.2 | 57.9 | 68.0 | 54.4 | | 77.0M | 410B |
49
+ | EfficientDet-D0 ([ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d0.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d0_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d0_coco_test-dev2017.txt ) ) | 34.6 | 53.0 | 37.1 | 12.4 | 39.0 | 52.7 | 34.3 | | 3.9M | 2.54B |
50
+ | EfficientDet-D1 ([ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d1.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d1_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d1_coco_test-dev2017.txt ) ) | 40.5 | 59.1 | 43.7 | 18.3 | 45.0 | 57.5 | 40.2 | | 6.6M | 6.10B |
51
+ | EfficientDet-D2 ([ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d2.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d2_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d2_coco_test-dev2017.txt ) ) | 43.0 | 62.3 | 46.2 | 22.5 | 47.0 | 58.4 | 42.5 | | 8.1M | 11.0B |
52
+ | EfficientDet-D3 ([ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d3.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d3_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d3_coco_test-dev2017.txt ) ) | 47.5 | 66.2 | 51.5 | 27.9 | 51.4 | 62.0 | 47.2 | | 12.0M | 24.9B |
53
+ | EfficientDet-D4 ([ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d4.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d4_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d4_coco_test-dev2017.txt ) ) | 49.7 | 68.4 | 53.9 | 30.7 | 53.2 | 63.2 | 49.3 | | 20.7M | 55.2B |
54
+ | EfficientDet-D5 ([ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d5.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d5_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d5_coco_test-dev2017.txt ) ) | 51.5 | 70.5 | 56.1 | 33.9 | 54.7 | 64.1 | 51.2 | | 33.7M | 130B |
55
+ | EfficientDet-D6 ([ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d6.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d6_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d6_coco_test-dev2017.txt ) ) | 52.6 | 71.5 | 57.2 | 34.9 | 56.0 | 65.4 | 52.1 | | 51.9M | 226B |
56
+ | EfficientDet-D7 ([ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d7.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d7_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d7_coco_test-dev2017.txt ) ) | 53.7 | 72.4 | 58.4 | 35.8 | 57.0 | 66.3 | 53.4 | | 51.9M | 325B |
57
+ | EfficientDet-D7x ([ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d7x.tar.gz ) , [ val] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/val/d7x_coco_val.txt ) , [ test-dev] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/testdev/d7x_coco_test-dev2017.txt ) ) | 55.1 | 74.3 | 59.9 | 37.2 | 57.9 | 68.0 | 54.4 | | 77.0M | 410B |
68
58
69
59
<sup ><em >val</em > denotes validation results, <em >test-dev</em > denotes test-dev2017 results. AP<sup >val</sup > is for validation accuracy, all other AP results in the table are for COCO test-dev2017. All accuracy numbers are for single-model single-scale without ensemble or test-time augmentation. EfficientDet-D0 to D6 are trained for 300 epochs and D7/D7x are trained for 600 epochs.</sup >
70
60
@@ -73,11 +63,11 @@ In addition, the following table includes a list of models trained with fixed 64
73
63
74
64
| Model | mAP | Latency |
75
65
| ------ | ------ | ------ |
76
- | D2(640) [ h5 ] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco640/efficientdet-d2-640.h5 ) , [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco640/efficientdet-d2-640.tar.gz ) | 41.7 | 14.8ms |
77
- | D3(640) [ h5 ] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco640/efficientdet-d3-640.h5 ) , [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco640/efficientdet-d3-640.tar.gz ) | 44.0 | 18.7ms |
78
- | D4(640) [ h5 ] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco640/efficientdet-d4-640.h5 ) , [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco640/efficientdet-d4-640.tar.gz ) | 45.7 | 21.7ms |
79
- | D5(640 [ h5 ] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco640/efficientdet-d5-640.h5 ) , [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco640/efficientdet-d5-640.tar.gz ) | 46.6 | 26.6ms |
80
- | D6(640) [ h5 ] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco640/efficientdet-d6-640.h5 ) , [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco640/efficientdet-d6-640.tar.gz ) | 47.9 | 33.8ms |
66
+ | D2(640) [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco640/efficientdet-d2-640.tar.gz ) | 41.7 | 14.8ms |
67
+ | D3(640) [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco640/efficientdet-d3-640.tar.gz ) | 44.0 | 18.7ms |
68
+ | D4(640) [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco640/efficientdet-d4-640.tar.gz ) | 45.7 | 21.7ms |
69
+ | D5(640) [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco640/efficientdet-d5-640.tar.gz ) | 46.6 | 26.6ms |
70
+ | D6(640) [ ckpt] ( https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco640/efficientdet-d6-640.tar.gz ) | 47.9 | 33.8ms |
81
71
82
72
83
73
@@ -96,10 +86,9 @@ Then you will get:
96
86
- saved model under ` savedmodeldir/ `
97
87
- frozen graph with name ` savedmodeldir/efficientdet-d0_frozen.pb `
98
88
- TensorRT saved model under ` savedmodeldir/tensorrt_fp32/ `
99
- - tflite file with name ` efficientdet-d0 .tflite`
89
+ - tflite file with name ` savedmodeldir/fp32 .tflite`
100
90
101
91
Notably,
102
- --tflite_path only works after 2.3.0-dev20200521 ,
103
92
--model_dir=xx/archive is the folder for exporting the best model.
104
93
105
94
@@ -154,12 +143,12 @@ latency and throughput are:
154
143
155
144
# Step2: inference image.
156
145
!python inspector.py --mode=infer \
157
- --model_name=efficientdet-d0 --model_dir=efficientdet-d0 \
146
+ --model_name=efficientdet-d0 --saved_model_dir=/tmp/saved_model \
158
147
--hparams="image_size=1920x1280" \
159
148
--input_image=img.png --output_image_dir=/tmp/
160
149
161
150
162
- Alternatively, if you want to do inference using frozen graph instead of saved model , you can run
151
+ If you want to do inference using frozen graph, you can run
163
152
164
153
# Step 1 is the same as before.
165
154
# Step 2: do inference with frozen graph.
@@ -168,18 +157,28 @@ Alternatively, if you want to do inference using frozen graph instead of saved m
168
157
--saved_model_dir=/tmp/saved_model/efficientdet-d0_frozen.pb \
169
158
--input_image=img.png --output_image_dir=/tmp/
170
159
160
+ If you want to do inference using tflite, you can run
161
+
162
+ # Step 1 is the same as before.
163
+ # Step 2: do inference with frozen graph.
164
+ !python inspector.py --mode=infer \
165
+ --model_name=efficientdet-d0 \
166
+ --saved_model_dir=/tmp/saved_model/fp32.tflite \
167
+ --input_image=img.png --output_image_dir=/tmp/
168
+
171
169
Lastly, if you only have one image and just want to run a quick test, you can also run the following command (it is slow because it needs to construct the graph from scratch):
172
170
173
171
# Run inference for a single image.
174
- !python inspector.py --mode=infer --model_name=$MODEL \
172
+ !python inspector.py --mode=infer \
173
+ --model_name=efficientdet-d0 --model_dir=$CKPT_PATH \
175
174
--hparams="image_size=1920x1280" \
176
- --model_dir=$CKPT_PATH -- input_image=img.png --output_image_dir=/tmp
175
+ --input_image=img.png --output_image_dir=/tmp/
177
176
# you can visualize the output /tmp/0.jpg
178
177
179
178
Here is an example of EfficientDet-D0 visualization: more on [ tutorial] ( tutorial.ipynb )
180
179
181
180
<p align =" center " >
182
- <img src =" ./g3doc/street.jpg " width =" 800 " />
181
+ <img src =" .. /g3doc/street.jpg " width =" 800 " />
183
182
</p >
184
183
185
184
## 6. Inference for videos.
@@ -243,67 +242,25 @@ Create a config file for the PASCAL VOC dataset called voc_config.yaml and put t
243
242
var_freeze_expr: '(efficientnet|fpn_cells|resample_p6)'
244
243
label_map: {1: aeroplane, 2: bicycle, 3: bird, 4: boat, 5: bottle, 6: bus, 7: car, 8: cat, 9: chair, 10: cow, 11: diningtable, 12: dog, 13: horse, 14: motorbike, 15: person, 16: pottedplant, 17: sheep, 18: sofa, 19: train, 20: tvmonitor}
245
244
246
- Finetune needs to use --ckpt rather than --backbone_ckpt .
245
+ Finetune needs to use --pretrained_ckpt .
247
246
248
247
!python train.py
249
248
--training_file_pattern=tfrecord/pascal*.tfrecord \
250
249
--val_file_pattern=tfrecord/pascal*.tfrecord \
250
+ --val_file_pattern=tfrecord/*.json \
251
251
--model_name=efficientdet-d0 \
252
252
--model_dir=/tmp/efficientdet-d0-finetune \
253
- --ckpt =efficientdet-d0 \
253
+ --pretrained_ckpt =efficientdet-d0 \
254
254
--batch_size=64 \
255
255
--eval_samples=1024 \
256
256
--num_examples_per_epoch=5717 --num_epochs=50 \
257
257
--hparams=voc_config.yaml
258
258
259
259
If you want to continue to train the model, simply re-run the above command because the ` num_epochs ` is a maximum number of epochs. For example, to reproduce the result of efficientdet-d0, set ` --num_epochs=300 ` then run the command multiple times until the training is finished.
260
260
261
- If you want to do inference for custom data, you can run
262
-
263
- # Setting hparams-flag is needed sometimes.
264
- !python inspector.py --mode=infer \
265
- --model_name=efficientdet-d0 --model_dir=efficientdet-d0 \
266
- --hparams=voc_config.yaml \
267
- --input_image=img.png --output_image_dir=/tmp/
268
-
269
- You should check more details of runmode which is written in caption-4.
270
-
271
261
## 9. Train on multi GPUs.
272
262
273
- Create a config file for the PASCAL VOC dataset called voc_config.yaml and put this in it.
274
-
275
- num_classes: 21
276
- var_freeze_expr: '(efficientnet|fpn_cells|resample_p6)'
277
- label_map: {1: aeroplane, 2: bicycle, 3: bird, 4: boat, 5: bottle, 6: bus, 7: car, 8: cat, 9: chair, 10: cow, 11: diningtable, 12: dog, 13: horse, 14: motorbike, 15: person, 16: pottedplant, 17: sheep, 18: sofa, 19: train, 20: tvmonitor}
278
-
279
- Download efficientdet coco checkpoint.
280
-
281
- !wget https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco/efficientdet-d0.tar.gz
282
- !tar xf efficientdet-d0.tar.gz
283
-
284
- Finetune needs to use --ckpt rather than --backbone_ckpt.
285
-
286
- python train.py \
287
- --training_file_pattern=tfrecord/pascal*.tfrecord \
288
- --val_file_pattern=tfrecord/pascal*.tfrecord \
289
- --model_name=efficientdet-d0 \
290
- --model_dir=/tmp/efficientdet-d0-finetune \
291
- --ckpt=efficientdet-d0 \
292
- --batch_size=64 \
293
- --eval_samples=1024 \
294
- --num_examples_per_epoch=5717 --num_epochs=50 \
295
- --hparams=voc_config.yaml \
296
- --strategy=gpus
297
-
298
- If you want to do inference for custom data, you can run
299
-
300
- # Setting hparams-flag is needed sometimes.
301
- !python inspector.py --mode=infer \
302
- --model_name=efficientdet-d0 --model_dir=efficientdet-d0 \
303
- --hparams=voc_config.yaml \
304
- --input_image=img.png --output_image_dir=/tmp/
305
-
306
- You should check more details of runmode which is written in caption-4.
263
+ Just add ``` --strategy=gpus ```
307
264
308
265
## 10. Training EfficientDets on TPUs.
309
266
@@ -335,7 +292,7 @@ EfficientDets use a lot of GPU memory for a few reasons:
335
292
* Large internal activations for backbone: our backbone uses a relatively large expansion ratio (6), causing the large expanded activations.
336
293
* Deep BiFPN: our BiFPN has multiple top-down and bottom-up paths, which leads to a lot of intermediate memory usage during training.
337
294
338
- To train this model on GPU with low memory there is an experimental option gradient_checkpointing .
295
+ To train this model on GPU with low memory there is an experimental option grad_checkpoint .
339
296
340
297
Check these links for a high-level idea of what gradient checkpointing is doing:
341
298
1 . https://medium.com/tensorflow/fitting-larger-networks-into-memory-583e3c758ff9
0 commit comments