Skip to content

Commit abba1d5

Browse files
committed
Add AdvProp-AA weights ported from TF impl
1 parent 75e16c2 commit abba1d5

File tree

5 files changed

+112
-17
lines changed

5 files changed

+112
-17
lines changed

README.md

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ Aside from the default model configs, there is a lot of flexibility to facilitat
1616

1717
## Updates
1818

19+
### 2021-04-30
20+
* Add EfficientDet AdvProp-AA weights for D0-D5 from https://github.com/google/automl/blob/master/efficientdet/Det-AdvProp.md
21+
1922
### 2021-02-18
2023
* Add some new model weights with bilinear interpolation for upsample and downsample in FPN.
2124
* 40.9 mAP - `efficientdet_q1` (replace prev model at 40.6)
@@ -114,25 +117,31 @@ The table below contains models with pretrained weights. There are quite a numbe
114117

115118
| Variant | mAP (val2017) | mAP (test-dev2017) | mAP (TF official val2017) | mAP (TF official test-dev2017) | Params (M) |
116119
| --- | :---: | :---: | :---: | :---: | :---: |
117-
| tf_efficientdet_lite0.pth | 32.0 | TBD | N/A | N/A | 3.24 |
118-
| efficientdet_d0.pth | 33.6 | TBD | 33.5 | 33.8 | 3.88 |
119-
| tf_efficientdet_d0.pth | 34.2 | TBD | 34.3 | 34.6 | 3.88 |
120-
| efficientdet_q0.pth | 35.7 | TBD | N/A | N/A | 4.13 |
121-
| efficientdet_d1.pth | 39.4 | 39.5 | 39.1 | 39.6 | 6.62 |
122-
| tf_efficientdet_d1.pth | 40.1 | TBD | 40.2 | 40.5 | 6.63 |
123-
| efficientdet_q1.pth | 40.9 | TBD | N/A | N/A | 6.98 |
120+
| tf_efficientdet_lite0 | 32.0 | TBD | N/A | N/A | 3.24 |
121+
| efficientdet_d0 | 33.6 | TBD | 33.5 | 33.8 | 3.88 |
122+
| tf_efficientdet_d0 | 34.2 | TBD | 34.3 | 34.6 | 3.88 |
123+
| tf_efficientdet_d0_ap | 34.8 | TBD | 35.2 | 35.3 | 3.88 |
124+
| efficientdet_q0 | 35.7 | TBD | N/A | N/A | 4.13 |
125+
| efficientdet_d1 | 39.4 | 39.5 | 39.1 | 39.6 | 6.62 |
126+
| tf_efficientdet_d1 | 40.1 | TBD | 40.2 | 40.5 | 6.63 |
127+
| tf_efficientdet_d1_ap | 40.8 | TBD | 40.9 | 40.8 | 6.63 |
128+
| efficientdet_q1 | 40.9 | TBD | N/A | N/A | 6.98 |
124129
| cspresdext50pan | 41.2 | TBD | N/A | N/A | 22.2 |
125130
| resdet50 | 41.6 | TBD | N/A | N/A | 27.6 |
126-
| efficientdet_q2.pth | 43.1 | TBD | N/A | N/A | 8.81 |
131+
| efficientdet_q2 | 43.1 | TBD | N/A | N/A | 8.81 |
127132
| cspresdet50 | 43.2 | TBD | N/A | N/A | 24.3 |
128-
| tf_efficientdet_d2.pth | 43.4 | TBD | 42.5 | 43 | 8.10 |
133+
| tf_efficientdet_d2 | 43.4 | TBD | 42.5 | 43 | 8.10 |
134+
| tf_efficientdet_d2_ap | 44.2 | TBD | 44.3 | 44.3 | 8.10 |
129135
| cspdarkdet53m | 45.2 | TBD | N/A | N/A | 35.6 |
130-
| tf_efficientdet_d3.pth | 47.1 | TBD | 47.2 | 47.5 | 12.0 |
131-
| tf_efficientdet_d4.pth | 49.2 | TBD | 49.3 | 49.7 | 20.7 |
132-
| tf_efficientdet_d5.pth | 51.2 | TBD | 51.2 | 51.5 | 33.7 |
133-
| tf_efficientdet_d6.pth | 52.0 | TBD | 52.1 | 52.6 | 51.9 |
134-
| tf_efficientdet_d7.pth | 53.1 | 53.4 | 53.4 | 53.7 | 51.9 |
135-
| tf_efficientdet_d7x.pth | 54.3 | TBD | 54.4 | 55.1 | 77.1 |
136+
| tf_efficientdet_d3 | 47.1 | TBD | 47.2 | 47.5 | 12.0 |
137+
| tf_efficientdet_d3_ap | 47.7 | TBD | 48.0 | 47.7 | 12.0 |
138+
| tf_efficientdet_d4 | 49.2 | TBD | 49.3 | 49.7 | 20.7 |
139+
| tf_efficientdet_d4_ap | 50.2 | TBD | 50.4 | 50.4 | 20.7 |
140+
| tf_efficientdet_d5 | 51.2 | TBD | 51.2 | 51.5 | 33.7 |
141+
| tf_efficientdet_d6 | 52.0 | TBD | 52.1 | 52.6 | 51.9 |
142+
| tf_efficientdet_d5_ap | 52.1 | TBD | 52.2 | 52.5 | 33.7 |
143+
| tf_efficientdet_d7 | 53.1 | 53.4 | 53.4 | 53.7 | 51.9 |
144+
| tf_efficientdet_d7x | 54.3 | TBD | 54.4 | 55.1 | 77.1 |
136145

137146

138147
See [model configurations](effdet/config/model_config.py) for model checkpoint urls and differences.

effdet/config/model_config.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,87 @@ def default_detection_model_configs():
532532
url='https://github.com/rwightman/efficientdet-pytorch/releases/download/v0.1/tf_efficientdet_d7x-f390b87c.pth'
533533
),
534534

535+
# Models ported from Tensorflow AdvProp+AA weights
536+
# https://github.com/google/automl/blob/master/efficientdet/Det-AdvProp.md
537+
tf_efficientdet_d0_ap=dict(
538+
name='tf_efficientdet_d0_ap',
539+
backbone_name='tf_efficientnet_b0',
540+
image_size=(512, 512),
541+
fpn_channels=64,
542+
fpn_cell_repeats=3,
543+
box_class_repeats=3,
544+
mean=(0.5, 0.5, 0.5),
545+
std=(0.5, 0.5, 0.5),
546+
fill_color=0,
547+
backbone_args=dict(drop_path_rate=0.2),
548+
url='https://github.com/rwightman/efficientdet-pytorch/releases/download/v0.1/tf_efficientdet_d0_ap-d0cdbd0a.pth',
549+
),
550+
tf_efficientdet_d1_ap=dict(
551+
name='tf_efficientdet_d1_ap',
552+
backbone_name='tf_efficientnet_b1',
553+
image_size=(640, 640),
554+
fpn_channels=88,
555+
fpn_cell_repeats=4,
556+
box_class_repeats=3,
557+
mean=(0.5, 0.5, 0.5),
558+
std=(0.5, 0.5, 0.5),
559+
fill_color=0,
560+
backbone_args=dict(drop_path_rate=0.2),
561+
url='https://github.com/rwightman/efficientdet-pytorch/releases/download/v0.1/tf_efficientdet_d1_ap-7721d075.pth'
562+
),
563+
tf_efficientdet_d2_ap=dict(
564+
name='tf_efficientdet_d2_ap',
565+
backbone_name='tf_efficientnet_b2',
566+
image_size=(768, 768),
567+
fpn_channels=112,
568+
fpn_cell_repeats=5,
569+
box_class_repeats=3,
570+
mean=(0.5, 0.5, 0.5),
571+
std=(0.5, 0.5, 0.5),
572+
fill_color=0,
573+
backbone_args=dict(drop_path_rate=0.2),
574+
url='https://github.com/rwightman/efficientdet-pytorch/releases/download/v0.1/tf_efficientdet_d2_ap-a2995c19.pth',
575+
),
576+
tf_efficientdet_d3_ap=dict(
577+
name='tf_efficientdet_d3_ap',
578+
backbone_name='tf_efficientnet_b3',
579+
image_size=(896, 896),
580+
fpn_channels=160,
581+
fpn_cell_repeats=6,
582+
box_class_repeats=4,
583+
mean=(0.5, 0.5, 0.5),
584+
std=(0.5, 0.5, 0.5),
585+
fill_color=0,
586+
backbone_args=dict(drop_path_rate=0.2),
587+
url='https://github.com/rwightman/efficientdet-pytorch/releases/download/v0.1/tf_efficientdet_d3_ap-e4a2feab.pth',
588+
),
589+
tf_efficientdet_d4_ap=dict(
590+
name='tf_efficientdet_d4_ap',
591+
backbone_name='tf_efficientnet_b4',
592+
image_size=(1024, 1024),
593+
fpn_channels=224,
594+
fpn_cell_repeats=7,
595+
box_class_repeats=4,
596+
mean=(0.5, 0.5, 0.5),
597+
std=(0.5, 0.5, 0.5),
598+
fill_color=0,
599+
backbone_args=dict(drop_path_rate=0.2),
600+
url='https://github.com/rwightman/efficientdet-pytorch/releases/download/v0.1/tf_efficientdet_d4_ap-f601a5fc.pth',
601+
),
602+
tf_efficientdet_d5_ap=dict(
603+
name='tf_efficientdet_d5_ap',
604+
backbone_name='tf_efficientnet_b5',
605+
image_size=(1280, 1280),
606+
fpn_channels=288,
607+
fpn_cell_repeats=7,
608+
box_class_repeats=4,
609+
mean=(0.5, 0.5, 0.5),
610+
std=(0.5, 0.5, 0.5),
611+
fill_color=0,
612+
backbone_args=dict(drop_path_rate=0.2),
613+
url='https://github.com/rwightman/efficientdet-pytorch/releases/download/v0.1/tf_efficientdet_d5_ap-3673ae5d.pth',
614+
),
615+
535616
# The lite configs are in TF automl repository but no weights yet and listed as 'not final'
536617
tf_efficientdet_lite0=dict(
537618
name='tf_efficientdet_lite0',

effdet/factory.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ def create_model_from_config(
2323
pretrained_backbone = False # no point in loading backbone weights
2424

2525
# Config overrides, override some config values via kwargs.
26-
overrides = ('redundant_bias', 'label_smoothing', 'legacy_focal', 'jit_loss', 'soft_nms', 'max_det_per_image')
26+
overrides = (
27+
'redundant_bias', 'label_smoothing', 'legacy_focal', 'jit_loss', 'soft_nms', 'max_det_per_image', 'image_size')
2728
for ov in overrides:
2829
value = kwargs.pop(ov, None)
2930
if value is not None:

effdet/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.2.3'
1+
__version__ = '0.2.4'

validate.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ def validate(args):
107107

108108
# create model
109109
with set_layer_config(scriptable=args.torchscript):
110+
extra_args = {}
111+
if args.img_size is not None:
112+
extra_args = dict(image_size=(args.img_size, args.img_size))
110113
bench = create_model(
111114
args.model,
112115
bench_task='predict',
@@ -116,6 +119,7 @@ def validate(args):
116119
soft_nms=args.soft_nms,
117120
checkpoint_path=args.checkpoint,
118121
checkpoint_ema=args.use_ema,
122+
**extra_args,
119123
)
120124
model_config = bench.config
121125

0 commit comments

Comments
 (0)