|
1 | 1 | # block configs for EfficientNetv2
|
2 |
| -# data organised as (k, i, o, e, s, n) |
| 2 | +# data organised as (k, c, e, s, n, r, a) |
3 | 3 | const EFFNETV2_CONFIGS = Dict(:small => [
|
4 |
| - (3, 24, 24, 1, 1, 2), |
5 |
| - (3, 24, 48, 4, 2, 4), |
6 |
| - (3, 48, 64, 4, 2, 4), |
7 |
| - (3, 64, 128, 4, 2, 6), |
8 |
| - (3, 128, 160, 6, 1, 9), |
9 |
| - (3, 160, 256, 6, 2, 15)], |
| 4 | + (3, 24, 1, 1, 2, nothing, swish), |
| 5 | + (3, 48, 4, 2, 4, nothing, swish), |
| 6 | + (3, 64, 4, 2, 4, nothing, swish), |
| 7 | + (3, 128, 4, 2, 6, 4, swish), |
| 8 | + (3, 160, 6, 1, 9, 4, swish), |
| 9 | + (3, 256, 6, 2, 15, 4, swish)], |
10 | 10 | :medium => [
|
11 |
| - (3, 24, 24, 1, 1, 3), |
12 |
| - (3, 24, 48, 4, 2, 5), |
13 |
| - (3, 48, 80, 4, 2, 5), |
14 |
| - (3, 80, 160, 4, 2, 7), |
15 |
| - (3, 160, 176, 6, 1, 14), |
16 |
| - (3, 176, 304, 6, 2, 18), |
17 |
| - (3, 304, 512, 6, 1, 5)], |
| 11 | + (3, 24, 1, 1, 3, nothing, swish), |
| 12 | + (3, 48, 4, 2, 5, nothing, swish), |
| 13 | + (3, 80, 4, 2, 5, nothing, swish), |
| 14 | + (3, 160, 4, 2, 7, 4, swish), |
| 15 | + (3, 176, 6, 1, 14, 4, swish), |
| 16 | + (3, 304, 6, 2, 18, 4, swish), |
| 17 | + (3, 512, 6, 1, 5, 4, swish)], |
18 | 18 | :large => [
|
19 |
| - (3, 32, 32, 1, 1, 4), |
20 |
| - (3, 32, 64, 4, 2, 7), |
21 |
| - (3, 64, 96, 4, 2, 7), |
22 |
| - (3, 96, 192, 4, 2, 10), |
23 |
| - (3, 192, 224, 6, 1, 19), |
24 |
| - (3, 224, 384, 6, 2, 25), |
25 |
| - (3, 384, 640, 6, 1, 7)], |
| 19 | + (3, 32, 1, 1, 4, nothing, swish), |
| 20 | + (3, 64, 4, 2, 7, nothing, swish), |
| 21 | + (3, 96, 4, 2, 7, nothing, swish), |
| 22 | + (3, 192, 4, 2, 10, 4, swish), |
| 23 | + (3, 224, 6, 1, 19, 4, swish), |
| 24 | + (3, 384, 6, 2, 25, 4, swish), |
| 25 | + (3, 640, 6, 1, 7, 4, swish)], |
26 | 26 | :xlarge => [
|
27 |
| - (3, 32, 32, 1, 1, 4), |
28 |
| - (3, 32, 64, 4, 2, 8), |
29 |
| - (3, 64, 96, 4, 2, 8), |
30 |
| - (3, 96, 192, 4, 2, 16), |
31 |
| - (3, 192, 224, 6, 1, 24), |
32 |
| - (3, 384, 512, 6, 2, 32), |
33 |
| - (3, 512, 768, 6, 1, 8)]) |
| 27 | + (3, 32, 1, 1, 4, nothing, swish), |
| 28 | + (3, 64, 4, 2, 8, nothing, swish), |
| 29 | + (3, 96, 4, 2, 8, nothing, swish), |
| 30 | + (3, 192, 4, 2, 16, 4, swish), |
| 31 | + (3, 384, 6, 1, 24, 4, swish), |
| 32 | + (3, 512, 6, 2, 32, 4, swish), |
| 33 | + (3, 768, 6, 1, 8, 4, swish)]) |
34 | 34 |
|
35 | 35 | """
|
36 | 36 | EfficientNetv2(config::Symbol; pretrain::Bool = false, width_mult::Real = 1,
|
@@ -58,9 +58,10 @@ function EfficientNetv2(config::Symbol; pretrain::Bool = false,
|
58 | 58 | layers = efficientnet(EFFNETV2_CONFIGS[config],
|
59 | 59 | vcat(fill(fused_mbconv_builder, 3),
|
60 | 60 | fill(mbconv_builder, length(EFFNETV2_CONFIGS[config]) - 3));
|
61 |
| - headplanes = 1280, inchannels, nclasses) |
| 61 | + inplanes = EFFNETV2_CONFIGS[config][1][2], headplanes = 1280, |
| 62 | + inchannels, nclasses) |
62 | 63 | if pretrain
|
63 |
| - loadpretrain!(layers, string("efficientnetv2")) |
| 64 | + loadpretrain!(layers, string("efficientnetv2-", config)) |
64 | 65 | end
|
65 | 66 | return EfficientNetv2(layers)
|
66 | 67 | end
|
|
0 commit comments