@@ -9,17 +9,17 @@ Create an Inception-v3 style-A module
9
9
- `pool_proj`: the number of output feature maps for the pooling projection
10
10
"""
11
11
function inception_a (inplanes, pool_proj)
12
- branch1x1 = Chain (conv_bn ((1 , 1 ), inplanes, 64 )... )
13
-
14
- branch5x5 = Chain (conv_bn ((1 , 1 ), inplanes, 48 )... ,
15
- conv_bn ((5 , 5 ), 48 , 64 ; pad = 2 )... )
12
+ branch1x1 = conv_bn ((1 , 1 ), inplanes, 64 )
16
13
17
- branch3x3 = Chain (conv_bn ((1 , 1 ), inplanes, 64 )... ,
18
- conv_bn ((3 , 3 ), 64 , 96 ; pad = 1 )... ,
19
- conv_bn ((3 , 3 ), 96 , 96 ; pad = 1 )... )
14
+ branch5x5 = Chain (conv_bn ((1 , 1 ), inplanes, 48 ),
15
+ conv_bn ((5 , 5 ), 48 , 64 ; pad = 2 ))
16
+
17
+ branch3x3 = Chain (conv_bn ((1 , 1 ), inplanes, 64 ),
18
+ conv_bn ((3 , 3 ), 64 , 96 ; pad = 1 ),
19
+ conv_bn ((3 , 3 ), 96 , 96 ; pad = 1 ))
20
20
21
21
branch_pool = Chain (MeanPool ((3 , 3 ), pad = 1 , stride = 1 ),
22
- conv_bn ((1 , 1 ), inplanes, pool_proj)... )
22
+ conv_bn ((1 , 1 ), inplanes, pool_proj))
23
23
24
24
return Parallel (cat_channels,
25
25
branch1x1, branch5x5, branch3x3, branch_pool)
@@ -35,13 +35,13 @@ Create an Inception-v3 style-B module
35
35
- `inplanes`: number of input feature maps
36
36
"""
37
37
function inception_b (inplanes)
38
- branch3x3_1 = Chain ( conv_bn ((3 , 3 ), inplanes, 384 ; stride = 2 ) ... )
38
+ branch3x3_1 = conv_bn ((3 , 3 ), inplanes, 384 ; stride = 2 )
39
39
40
- branch3x3_2 = Chain (conv_bn ((1 , 1 ), inplanes, 64 )... ,
41
- conv_bn ((3 , 3 ), 64 , 96 ; pad = 1 )... ,
42
- conv_bn ((3 , 3 ), 96 , 96 ; stride = 2 )... )
40
+ branch3x3_2 = Chain (conv_bn ((1 , 1 ), inplanes, 64 ),
41
+ conv_bn ((3 , 3 ), 64 , 96 ; pad = 1 ),
42
+ conv_bn ((3 , 3 ), 96 , 96 ; stride = 2 ))
43
43
44
- branch_pool = Chain ( MaxPool ((3 , 3 ), stride = 2 ) )
44
+ branch_pool = MaxPool ((3 , 3 ), stride = 2 )
45
45
46
46
return Parallel (cat_channels,
47
47
branch3x3_1, branch3x3_2, branch_pool)
@@ -59,20 +59,20 @@ Create an Inception-v3 style-C module
59
59
- `n`: the "grid size" (kernel size) for the convolution layers
60
60
"""
61
61
function inception_c (inplanes, inner_planes, n = 7 )
62
- branch1x1 = Chain ( conv_bn ((1 , 1 ), inplanes, 192 ) ... )
62
+ branch1x1 = conv_bn ((1 , 1 ), inplanes, 192 )
63
63
64
- branch7x7_1 = Chain (conv_bn ((1 , 1 ), inplanes, inner_planes)... ,
65
- conv_bn ((1 , n), inner_planes, inner_planes; pad = (0 , 3 ))... ,
66
- conv_bn ((n, 1 ), inner_planes, 192 ; pad = (3 , 0 ))... )
64
+ branch7x7_1 = Chain (conv_bn ((1 , 1 ), inplanes, inner_planes),
65
+ conv_bn ((1 , n), inner_planes, inner_planes; pad = (0 , 3 )),
66
+ conv_bn ((n, 1 ), inner_planes, 192 ; pad = (3 , 0 )))
67
67
68
- branch7x7_2 = Chain (conv_bn ((1 , 1 ), inplanes, inner_planes)... ,
69
- conv_bn ((n, 1 ), inner_planes, inner_planes; pad = (3 , 0 ))... ,
70
- conv_bn ((1 , n), inner_planes, inner_planes; pad = (0 , 3 ))... ,
71
- conv_bn ((n, 1 ), inner_planes, inner_planes; pad = (3 , 0 ))... ,
72
- conv_bn ((1 , n), inner_planes, 192 ; pad = (0 , 3 ))... )
68
+ branch7x7_2 = Chain (conv_bn ((1 , 1 ), inplanes, inner_planes),
69
+ conv_bn ((n, 1 ), inner_planes, inner_planes; pad = (3 , 0 )),
70
+ conv_bn ((1 , n), inner_planes, inner_planes; pad = (0 , 3 )),
71
+ conv_bn ((n, 1 ), inner_planes, inner_planes; pad = (3 , 0 )),
72
+ conv_bn ((1 , n), inner_planes, 192 ; pad = (0 , 3 )))
73
73
74
- branch_pool = Chain (MeanPool ((3 , 3 ), pad = 1 , stride= 1 ),
75
- conv_bn ((1 , 1 ), inplanes, 192 )... )
74
+ branch_pool = Chain (MeanPool ((3 , 3 ), pad = 1 , stride= 1 ),
75
+ conv_bn ((1 , 1 ), inplanes, 192 ))
76
76
77
77
return Parallel (cat_channels,
78
78
branch1x1, branch7x7_1, branch7x7_2, branch_pool)
@@ -88,15 +88,15 @@ Create an Inception-v3 style-D module
88
88
- `inplanes`: number of input feature maps
89
89
"""
90
90
function inception_d (inplanes)
91
- branch3x3 = Chain (conv_bn ((1 , 1 ), inplanes, 192 )... ,
92
- conv_bn ((3 , 3 ), 192 , 320 ; stride = 2 )... )
91
+ branch3x3 = Chain (conv_bn ((1 , 1 ), inplanes, 192 ),
92
+ conv_bn ((3 , 3 ), 192 , 320 ; stride = 2 ))
93
93
94
- branch7x7x3 = Chain (conv_bn ((1 , 1 ), inplanes, 192 )... ,
95
- conv_bn ((1 , 7 ), 192 , 192 ; pad = (0 , 3 ))... ,
96
- conv_bn ((7 , 1 ), 192 , 192 ; pad = (3 , 0 ))... ,
97
- conv_bn ((3 , 3 ), 192 , 192 ; stride = 2 )... )
94
+ branch7x7x3 = Chain (conv_bn ((1 , 1 ), inplanes, 192 ),
95
+ conv_bn ((1 , 7 ), 192 , 192 ; pad = (0 , 3 )),
96
+ conv_bn ((7 , 1 ), 192 , 192 ; pad = (3 , 0 )),
97
+ conv_bn ((3 , 3 ), 192 , 192 ; stride = 2 ))
98
98
99
- branch_pool = Chain ( MaxPool ((3 , 3 ), stride= 2 ) )
99
+ branch_pool = MaxPool ((3 , 3 ), stride= 2 )
100
100
101
101
return Parallel (cat_channels,
102
102
branch3x3, branch7x7x3, branch_pool)
@@ -112,26 +112,26 @@ Create an Inception-v3 style-E module
112
112
- `inplanes`: number of input feature maps
113
113
"""
114
114
function inception_e (inplanes)
115
- branch1x1 = Chain ( conv_bn ((1 , 1 ), inplanes, 320 ) ... )
115
+ branch1x1 = conv_bn ((1 , 1 ), inplanes, 320 )
116
116
117
- branch3x3_1 = Chain ( conv_bn ((1 , 1 ), inplanes, 384 ) ... )
118
- branch3x3_1a = Chain ( conv_bn ((1 , 3 ), 384 , 384 ; pad = (0 , 1 )) ... )
119
- branch3x3_1b = Chain ( conv_bn ((3 , 1 ), 384 , 384 ; pad = (1 , 0 )) ... )
117
+ branch3x3_1 = conv_bn ((1 , 1 ), inplanes, 384 )
118
+ branch3x3_1a = conv_bn ((1 , 3 ), 384 , 384 ; pad = (0 , 1 ))
119
+ branch3x3_1b = conv_bn ((3 , 1 ), 384 , 384 ; pad = (1 , 0 ))
120
120
121
- branch3x3_2 = Chain (conv_bn ((1 , 1 ), inplanes, 448 )... ,
122
- conv_bn ((3 , 3 ), 448 , 384 ; pad = 1 )... )
123
- branch3x3_2a = Chain ( conv_bn ((1 , 3 ), 384 , 384 ; pad = (0 , 1 )) ... )
124
- branch3x3_2b = Chain ( conv_bn ((3 , 1 ), 384 , 384 ; pad = (1 , 0 )) ... )
121
+ branch3x3_2 = Chain (conv_bn ((1 , 1 ), inplanes, 448 ),
122
+ conv_bn ((3 , 3 ), 448 , 384 ; pad = 1 ))
123
+ branch3x3_2a = conv_bn ((1 , 3 ), 384 , 384 ; pad = (0 , 1 ))
124
+ branch3x3_2b = conv_bn ((3 , 1 ), 384 , 384 ; pad = (1 , 0 ))
125
125
126
126
branch_pool = Chain (MeanPool ((3 , 3 ), pad = 1 , stride = 1 ),
127
- conv_bn ((1 , 1 ), inplanes, 192 )... )
127
+ conv_bn ((1 , 1 ), inplanes, 192 ))
128
128
129
129
return Parallel (cat_channels,
130
130
branch1x1,
131
131
Chain (branch3x3_1,
132
132
Parallel (cat_channels,
133
133
branch3x3_1a, branch3x3_1b)),
134
-
134
+
135
135
Chain (branch3x3_2,
136
136
Parallel (cat_channels,
137
137
branch3x3_2a, branch3x3_2b)),
@@ -150,12 +150,12 @@ Create an Inception-v3 model ([reference](https://arxiv.org/abs/1512.00567v3)).
150
150
`inception3` does not currently support pretrained weights.
151
151
"""
152
152
function inception3 (; nclasses = 1000 )
153
- layer = Chain (Chain (conv_bn ((3 , 3 ), 3 , 32 ; stride = 2 )... ,
154
- conv_bn ((3 , 3 ), 32 , 32 )... ,
155
- conv_bn ((3 , 3 ), 32 , 64 ; pad = 1 )... ,
153
+ layer = Chain (Chain (conv_bn ((3 , 3 ), 3 , 32 ; stride = 2 ),
154
+ conv_bn ((3 , 3 ), 32 , 32 ),
155
+ conv_bn ((3 , 3 ), 32 , 64 ; pad = 1 ),
156
156
MaxPool ((3 , 3 ), stride = 2 ),
157
- conv_bn ((1 , 1 ), 64 , 80 )... ,
158
- conv_bn ((3 , 3 ), 80 , 192 )... ,
157
+ conv_bn ((1 , 1 ), 64 , 80 ),
158
+ conv_bn ((3 , 3 ), 80 , 192 ),
159
159
MaxPool ((3 , 3 ), stride = 2 ),
160
160
inception_a (192 , 32 ),
161
161
inception_a (256 , 64 ),
0 commit comments