Res2Net 解析
研究背景
近期在改良編碼器網路,偶然間找到這一篇主幹網路,便將模型程式碼拆開來解析分析內部架構,這篇的引用次數偏高。以往實作上,論文與實際程式碼實現都會有段差距,基於論文提出的想法來改量比較實際,實作上有些東西刪減也是解析程式碼時發現的,並非都是原先的模型架構,此程式碼主要來自論文提供的原始碼網站。
模型架構解析
- res2net50_26w_4s()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308Res2Net(
(conv1): Conv2d(1, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
(bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
(maxpool): MaxPool2d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False)
(layer1): Sequential(
(0): Bottle2neck(
(conv1): Conv2d(64, 104, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(pool): AvgPool2d(kernel_size=3, stride=1, padding=1)
(convs): ModuleList(
(0): Conv2d(26, 26, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(1): Conv2d(26, 26, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(2): Conv2d(26, 26, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
(bns): ModuleList(
(0): BatchNorm2d(26, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(1): BatchNorm2d(26, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): BatchNorm2d(26, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): Conv2d(104, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
(downsample): Sequential(
(0): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(1): Bottle2neck(
(conv1): Conv2d(256, 104, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(convs): ModuleList(
(0): Conv2d(26, 26, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(1): Conv2d(26, 26, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(2): Conv2d(26, 26, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
(bns): ModuleList(
(0): BatchNorm2d(26, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(1): BatchNorm2d(26, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): BatchNorm2d(26, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): Conv2d(104, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
(2): Bottle2neck(
(conv1): Conv2d(256, 104, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(convs): ModuleList(
(0): Conv2d(26, 26, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(1): Conv2d(26, 26, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(2): Conv2d(26, 26, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
(bns): ModuleList(
(0): BatchNorm2d(26, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(1): BatchNorm2d(26, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): BatchNorm2d(26, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): Conv2d(104, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
)
(layer2): Sequential(
(0): Bottle2neck(
(conv1): Conv2d(256, 208, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(208, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(pool): AvgPool2d(kernel_size=3, stride=2, padding=1)
(convs): ModuleList(
(0): Conv2d(52, 52, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
(1): Conv2d(52, 52, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
(2): Conv2d(52, 52, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
)
(bns): ModuleList(
(0): BatchNorm2d(52, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(1): BatchNorm2d(52, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): BatchNorm2d(52, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): Conv2d(208, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
(downsample): Sequential(
(0): Conv2d(256, 512, kernel_size=(1, 1), stride=(2, 2), bias=False)
(1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(1): Bottle2neck(
(conv1): Conv2d(512, 208, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(208, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(convs): ModuleList(
(0): Conv2d(52, 52, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(1): Conv2d(52, 52, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(2): Conv2d(52, 52, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
(bns): ModuleList(
(0): BatchNorm2d(52, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(1): BatchNorm2d(52, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): BatchNorm2d(52, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): Conv2d(208, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
(2): Bottle2neck(
(conv1): Conv2d(512, 208, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(208, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(convs): ModuleList(
(0): Conv2d(52, 52, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(1): Conv2d(52, 52, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(2): Conv2d(52, 52, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
(bns): ModuleList(
(0): BatchNorm2d(52, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(1): BatchNorm2d(52, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): BatchNorm2d(52, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): Conv2d(208, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
(3): Bottle2neck(
(conv1): Conv2d(512, 208, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(208, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(convs): ModuleList(
(0): Conv2d(52, 52, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(1): Conv2d(52, 52, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(2): Conv2d(52, 52, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
(bns): ModuleList(
(0): BatchNorm2d(52, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(1): BatchNorm2d(52, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): BatchNorm2d(52, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): Conv2d(208, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
)
(layer3): Sequential(
(0): Bottle2neck(
(conv1): Conv2d(512, 416, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(416, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(pool): AvgPool2d(kernel_size=3, stride=2, padding=1)
(convs): ModuleList(
(0): Conv2d(104, 104, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
(1): Conv2d(104, 104, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
(2): Conv2d(104, 104, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
)
(bns): ModuleList(
(0): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(1): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): Conv2d(416, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
(downsample): Sequential(
(0): Conv2d(512, 1024, kernel_size=(1, 1), stride=(2, 2), bias=False)
(1): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(1): Bottle2neck(
(conv1): Conv2d(1024, 416, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(416, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(convs): ModuleList(
(0): Conv2d(104, 104, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(1): Conv2d(104, 104, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(2): Conv2d(104, 104, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
(bns): ModuleList(
(0): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(1): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): Conv2d(416, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
(2): Bottle2neck(
(conv1): Conv2d(1024, 416, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(416, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(convs): ModuleList(
(0): Conv2d(104, 104, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(1): Conv2d(104, 104, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(2): Conv2d(104, 104, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
(bns): ModuleList(
(0): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(1): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): Conv2d(416, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
(3): Bottle2neck(
(conv1): Conv2d(1024, 416, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(416, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(convs): ModuleList(
(0): Conv2d(104, 104, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(1): Conv2d(104, 104, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(2): Conv2d(104, 104, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
(bns): ModuleList(
(0): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(1): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): Conv2d(416, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
(4): Bottle2neck(
(conv1): Conv2d(1024, 416, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(416, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(convs): ModuleList(
(0): Conv2d(104, 104, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(1): Conv2d(104, 104, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(2): Conv2d(104, 104, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
(bns): ModuleList(
(0): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(1): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): Conv2d(416, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
(5): Bottle2neck(
(conv1): Conv2d(1024, 416, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(416, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(convs): ModuleList(
(0): Conv2d(104, 104, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(1): Conv2d(104, 104, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(2): Conv2d(104, 104, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
(bns): ModuleList(
(0): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(1): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): BatchNorm2d(104, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): Conv2d(416, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
)
(layer4): Sequential(
(0): Bottle2neck(
(conv1): Conv2d(1024, 832, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(832, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(pool): AvgPool2d(kernel_size=3, stride=2, padding=1)
(convs): ModuleList(
(0): Conv2d(208, 208, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
(1): Conv2d(208, 208, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
(2): Conv2d(208, 208, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
)
(bns): ModuleList(
(0): BatchNorm2d(208, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(1): BatchNorm2d(208, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): BatchNorm2d(208, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): Conv2d(832, 2048, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
(downsample): Sequential(
(0): Conv2d(1024, 2048, kernel_size=(1, 1), stride=(2, 2), bias=False)
(1): BatchNorm2d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(1): Bottle2neck(
(conv1): Conv2d(2048, 832, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(832, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(convs): ModuleList(
(0): Conv2d(208, 208, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(1): Conv2d(208, 208, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(2): Conv2d(208, 208, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
(bns): ModuleList(
(0): BatchNorm2d(208, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(1): BatchNorm2d(208, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): BatchNorm2d(208, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): Conv2d(832, 2048, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
(2): Bottle2neck(
(conv1): Conv2d(2048, 832, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(832, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(convs): ModuleList(
(0): Conv2d(208, 208, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(1): Conv2d(208, 208, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(2): Conv2d(208, 208, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
)
(bns): ModuleList(
(0): BatchNorm2d(208, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(1): BatchNorm2d(208, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): BatchNorm2d(208, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
(conv3): Conv2d(832, 2048, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
)
(avgpool): AdaptiveAvgPool2d(output_size=1)
(fc): Linear(in_features=2048, out_features=1000, bias=True)
)
模型參數分析
- res2net50_26w_4s()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482----------------------------------------------------------------
Layer (type) Output Shape Param #
================================================================
Conv2d-1 [-1, 64, 120, 160] 3,136
BatchNorm2d-2 [-1, 64, 120, 160] 128
ReLU-3 [-1, 64, 120, 160] 0
MaxPool2d-4 [-1, 64, 60, 80] 0
(layer1)-Bottle2neck-0
width = 64 * (26/64) = 26
conv1 = width*scale = 26 * 4 = 104
bn1 = width*scale = 26 * 4 = 104
conv3 = planes * block.expansion = 64 * 4 = 256
downsample = planes * block.expansion = 64 * 4 = 256
Conv2d-5 [-1, 104, 60, 80] 6,656 conv1
BatchNorm2d-6 [-1, 104, 60, 80] 208 bn1
ReLU-7 [-1, 104, 60, 80] 0 relu
Conv2d-8 [-1, 26, 60, 80] 6,084 convs - 0
BatchNorm2d-9 [-1, 26, 60, 80] 52 bns - 0
ReLU-10 [-1, 26, 60, 80] 0 relu
Conv2d-11 [-1, 26, 60, 80] 6,084 convs - 1
BatchNorm2d-12 [-1, 26, 60, 80] 52 bns - 1
ReLU-13 [-1, 26, 60, 80] 0 relu
Conv2d-14 [-1, 26, 60, 80] 6,084 convs - 2
BatchNorm2d-15 [-1, 26, 60, 80] 52 bns - 2
ReLU-16 [-1, 26, 60, 80] 0 relu
AvgPool2d-17 [-1, 26, 60, 80] 0 pool
Conv2d-18 [-1, 256, 60, 80] 26,624 conv3
BatchNorm2d-19 [-1, 256, 60, 80] 512 bn3
Conv2d-20 [-1, 256, 60, 80] 16,384 downsample - 0
BatchNorm2d-21 [-1, 256, 60, 80] 512 downsample - 1
ReLU-22 [-1, 256, 60, 80] 0
(layer1)-Bottle2neck-1
width = 64 * (26/64) = 26
conv1 = width*scale = 26 * 4 = 104
bn1 = width*scale = 26 * 4 = 104
conv3 = planes * block.expansion = 64 * 4 = 256
downsample = planes * block.expansion = 64 * 4 = 256
Bottle2neck-23 [-1, 256, 60, 80] 0
Conv2d-24 [-1, 104, 60, 80] 26,624 conv1
BatchNorm2d-25 [-1, 104, 60, 80] 208 bn1
ReLU-26 [-1, 104, 60, 80] 0 relu
Conv2d-27 [-1, 26, 60, 80] 6,084 convs - 0
BatchNorm2d-28 [-1, 26, 60, 80] 52 bns - 0
ReLU-29 [-1, 26, 60, 80] 0 relu
Conv2d-30 [-1, 26, 60, 80] 6,084 convs - 1
BatchNorm2d-31 [-1, 26, 60, 80] 52 bns - 1
ReLU-32 [-1, 26, 60, 80] 0 relu
Conv2d-33 [-1, 26, 60, 80] 6,084 conv - 2
BatchNorm2d-34 [-1, 26, 60, 80] 52 bns - 2
ReLU-35 [-1, 26, 60, 80] 0 relu
Conv2d-36 [-1, 256, 60, 80] 26,624 conv3
BatchNorm2d-37 [-1, 256, 60, 80] 512 bn3
ReLU-38 [-1, 256, 60, 80] 0 relu
(layer1)-Bottle2neck-2
width = 64 * (26/64) = 26
conv1 = width*scale = 26 * 4 = 104
bn1 = width*scale = 26 * 4 = 104
conv3 = planes * block.expansion = 64 * 4 = 256
downsample = planes * block.expansion = 64 * 4 = 256
Bottle2neck-39 [-1, 256, 60, 80] 0
Conv2d-40 [-1, 104, 60, 80] 26,624 conv1
BatchNorm2d-41 [-1, 104, 60, 80] 208 bn1
ReLU-42 [-1, 104, 60, 80] 0 relu
Conv2d-43 [-1, 26, 60, 80] 6,084 convs - 0
BatchNorm2d-44 [-1, 26, 60, 80] 52 bns - 0
ReLU-45 [-1, 26, 60, 80] 0 relu
Conv2d-46 [-1, 26, 60, 80] 6,084 convs - 1
BatchNorm2d-47 [-1, 26, 60, 80] 52 bns - 1
ReLU-48 [-1, 26, 60, 80] 0 relu
Conv2d-49 [-1, 26, 60, 80] 6,084 convs - 2
BatchNorm2d-50 [-1, 26, 60, 80] 52 bns - 2
ReLU-51 [-1, 26, 60, 80] 0 relu
Conv2d-52 [-1, 256, 60, 80] 26,624 conv3
BatchNorm2d-53 [-1, 256, 60, 80] 512 bn3
ReLU-54 [-1, 256, 60, 80] 0 relu
(layer2)-Bottle2neck-0
width = 64 * (26/64) = 26
conv1 = width*scale = 26 * 4 = 104
bn1 = width*scale = 26 * 4 = 104
conv3 = planes * block.expansion = 64 * 4 = 256
downsample = planes * block.expansion = 64 * 4 = 256
Bottle2neck-55 [-1, 256, 60, 80] 0
Conv2d-56 [-1, 208, 60, 80] 53,248 conv1
BatchNorm2d-57 [-1, 208, 60, 80] 416 bn1
ReLU-58 [-1, 208, 60, 80] 0 relu
Conv2d-59 [-1, 52, 30, 40] 24,336 convs-0
BatchNorm2d-60 [-1, 52, 30, 40] 104 bns -0
ReLU-61 [-1, 52, 30, 40] 0 relu
Conv2d-62 [-1, 52, 30, 40] 24,336 convs-1
BatchNorm2d-63 [-1, 52, 30, 40] 104 bns -1
ReLU-64 [-1, 52, 30, 40] 0 relu
Conv2d-65 [-1, 52, 30, 40] 24,336 convs-2
BatchNorm2d-66 [-1, 52, 30, 40] 104 bns -2
ReLU-67 [-1, 52, 30, 40] 0 relu
AvgPool2d-68 [-1, 52, 30, 40] 0 pool
Conv2d-69 [-1, 512, 30, 40] 106,496 conv3
BatchNorm2d-70 [-1, 512, 30, 40] 1,024 bn3
Conv2d-71 [-1, 512, 30, 40] 131,072 downsample - 0
BatchNorm2d-72 [-1, 512, 30, 40] 1,024 downsample - 1
ReLU-73 [-1, 512, 30, 40] 0 relu
(layer2)-Bottle2neck-1
width = int(math.floor(planes * (baseWidth/64.0)))
width = 128 * (26/64)= 52
conv1 = width*scale = 52 * 4 = 208
bn1 = width*scale = 52 * 4 = 208
conv3 = planes * block.expansion = 128 * 4 = 512
downsample = planes * block.expansion = 128 * 4 = 512
Bottle2neck-74 [-1, 512, 30, 40] 0
Conv2d-75 [-1, 208, 30, 40] 106,496 conv1
BatchNorm2d-76 [-1, 208, 30, 40] 416 bn1
ReLU-77 [-1, 208, 30, 40] 0 relu
Conv2d-78 [-1, 52, 30, 40] 24,336 convs - 0
BatchNorm2d-79 [-1, 52, 30, 40] 104 bns - 0
ReLU-80 [-1, 52, 30, 40] 0 relu
Conv2d-81 [-1, 52, 30, 40] 24,336 convs - 1
BatchNorm2d-82 [-1, 52, 30, 40] 104 bns - 1
ReLU-83 [-1, 52, 30, 40] 0 relu
Conv2d-84 [-1, 52, 30, 40] 24,336 convs - 2
BatchNorm2d-85 [-1, 52, 30, 40] 104 bns - 2
ReLU-86 [-1, 52, 30, 40] 0 relu
Conv2d-87 [-1, 512, 30, 40] 106,496 conv3
BatchNorm2d-88 [-1, 512, 30, 40] 1,024 bn3
ReLU-89 [-1, 512, 30, 40] 0 relu
(layer2)-Bottle2neck-2
width = int(math.floor(planes * (baseWidth/64.0)))
width = 128 * (26/64)= 52
conv1 = width*scale = 52 * 4 = 208
bn1 = width*scale = 52 * 4 = 208
conv3 = planes * block.expansion = 128 * 4 = 512
downsample = planes * block.expansion = 128 * 4 = 512
Bottle2neck-90 [-1, 512, 30, 40] 0
Conv2d-91 [-1, 208, 30, 40] 106,496 conv1
BatchNorm2d-92 [-1, 208, 30, 40] 416 bn1
ReLU-93 [-1, 208, 30, 40] 0 relu
Conv2d-94 [-1, 52, 30, 40] 24,336 convs-0
BatchNorm2d-95 [-1, 52, 30, 40] 104 bn0
ReLU-96 [-1, 52, 30, 40] 0 relu
Conv2d-97 [-1, 52, 30, 40] 24,336 convs-1
BatchNorm2d-98 [-1, 52, 30, 40] 104 bn1
ReLU-99 [-1, 52, 30, 40] 0 relu
Conv2d-100 [-1, 52, 30, 40] 24,336 convs-2
BatchNorm2d-101 [-1, 52, 30, 40] 104 bn2
ReLU-102 [-1, 52, 30, 40] 0 relu
Conv2d-103 [-1, 512, 30, 40] 106,496 conv3
BatchNorm2d-104 [-1, 512, 30, 40] 1,024 bn3
ReLU-105 [-1, 512, 30, 40] 0 relu
(layer2)-Bottle2neck-3
width = int(math.floor(planes * (baseWidth/64.0)))
width = 128 * (26/64)= 52
conv1 = width*scale = 52 * 4 = 208
bn1 = width*scale = 52 * 4 = 208
conv3 = planes * block.expansion = 128 * 4 = 512
downsample = planes * block.expansion = 128 * 4 = 512
Bottle2neck-106 [-1, 512, 30, 40] 0
Conv2d-107 [-1, 208, 30, 40] 106,496 conv1
BatchNorm2d-108 [-1, 208, 30, 40] 416 bn1
ReLU-109 [-1, 208, 30, 40] 0 relu
Conv2d-110 [-1, 52, 30, 40] 24,336 convs-0
BatchNorm2d-111 [-1, 52, 30, 40] 104 bn0
ReLU-112 [-1, 52, 30, 40] 0 relu
Conv2d-113 [-1, 52, 30, 40] 24,336 convs-1
BatchNorm2d-114 [-1, 52, 30, 40] 104 bn1
ReLU-115 [-1, 52, 30, 40] 0 relu
Conv2d-116 [-1, 52, 30, 40] 24,336 convs-2
BatchNorm2d-117 [-1, 52, 30, 40] 104 bn2
ReLU-118 [-1, 52, 30, 40] 0 relu
Conv2d-119 [-1, 512, 30, 40] 106,496 conv3
BatchNorm2d-120 [-1, 512, 30, 40] 1,024 bn3
ReLU-121 [-1, 512, 30, 40] 0 relu
(layer3)-Bottle2neck-0
width = int(math.floor(planes * (baseWidth/64.0)))
width = 256 * (26/64)= 104
conv1 = width*scale = 104 * 4 = 416
bn1 = width*scale = 104 * 4 = 416
conv3 = planes * block.expansion = 256 * 4 = 1024
downsample = planes * block.expansion = 256 * 4 = 1024
Bottle2neck-122 [-1, 512, 30, 40] 0
Conv2d-123 [-1, 416, 30, 40] 212,992 conv1
BatchNorm2d-124 [-1, 416, 30, 40] 832 bn1
ReLU-125 [-1, 416, 30, 40] 0 relu
Conv2d-126 [-1, 104, 15, 20] 97,344 convs-0
BatchNorm2d-127 [-1, 104, 15, 20] 208 bn0
ReLU-128 [-1, 104, 15, 20] 0 relu
Conv2d-129 [-1, 104, 15, 20] 97,344 convs-1
BatchNorm2d-130 [-1, 104, 15, 20] 208 bn1
ReLU-131 [-1, 104, 15, 20] 0 relu
Conv2d-132 [-1, 104, 15, 20] 97,344 convs-2
BatchNorm2d-133 [-1, 104, 15, 20] 208 bn2
ReLU-134 [-1, 104, 15, 20] 0 relu
AvgPool2d-135 [-1, 104, 15, 20] 0
Conv2d-136 [-1, 1024, 15, 20] 425,984 conv3
BatchNorm2d-137 [-1, 1024, 15, 20] 2,048 bn3
Conv2d-138 [-1, 1024, 15, 20] 524,288 downsample-0
BatchNorm2d-139 [-1, 1024, 15, 20] 2,048 downsample-1
ReLU-140 [-1, 1024, 15, 20] 0 relu
(layer3)-Bottle2neck-1
width = int(math.floor(planes * (baseWidth/64.0)))
width = 256 * (26/64)= 104
conv1 = width*scale = 104 * 4 = 416
bn1 = width*scale = 104 * 4 = 416
conv3 = planes * block.expansion = 256 * 4 = 1024
downsample = planes * block.expansion = 256 * 4 = 1024
Bottle2neck-141 [-1, 1024, 15, 20] 0
Conv2d-142 [-1, 416, 15, 20] 425,984 conv1
BatchNorm2d-143 [-1, 416, 15, 20] 832 bn1
ReLU-144 [-1, 416, 15, 20] 0 relu
Conv2d-145 [-1, 104, 15, 20] 97,344 convs-0
BatchNorm2d-146 [-1, 104, 15, 20] 208 bns0
ReLU-147 [-1, 104, 15, 20] 0 relu
Conv2d-148 [-1, 104, 15, 20] 97,344 convs-1
BatchNorm2d-149 [-1, 104, 15, 20] 208 bns1
ReLU-150 [-1, 104, 15, 20] 0 relu
Conv2d-151 [-1, 104, 15, 20] 97,344 convs-2
BatchNorm2d-152 [-1, 104, 15, 20] 208 bns2
ReLU-153 [-1, 104, 15, 20] 0 relu
Conv2d-154 [-1, 1024, 15, 20] 425,984 conv3
BatchNorm2d-155 [-1, 1024, 15, 20] 2,048 bn3
ReLU-156 [-1, 1024, 15, 20] 0 relu
(layer3)-Bottle2neck-2
width = int(math.floor(planes * (baseWidth/64.0)))
width = 256 * (26/64)= 104
conv1 = width*scale = 104 * 4 = 416
bn1 = width*scale = 104 * 4 = 416
conv3 = planes * block.expansion = 256 * 4 = 1024
downsample = planes * block.expansion = 256 * 4 = 1024
Bottle2neck-157 [-1, 1024, 15, 20] 0
Conv2d-158 [-1, 416, 15, 20] 425,984 conv1
BatchNorm2d-159 [-1, 416, 15, 20] 832 bn1
ReLU-160 [-1, 416, 15, 20] 0 relu
Conv2d-161 [-1, 104, 15, 20] 97,344 convs0
BatchNorm2d-162 [-1, 104, 15, 20] 208 bns0
ReLU-163 [-1, 104, 15, 20] 0 relu
Conv2d-164 [-1, 104, 15, 20] 97,344 convs1
BatchNorm2d-165 [-1, 104, 15, 20] 208 bns1
ReLU-166 [-1, 104, 15, 20] 0 relu
Conv2d-167 [-1, 104, 15, 20] 97,344 convs2
BatchNorm2d-168 [-1, 104, 15, 20] 208 bns2
ReLU-169 [-1, 104, 15, 20] 0 relu
Conv2d-170 [-1, 1024, 15, 20] 425,984 conv3
BatchNorm2d-171 [-1, 1024, 15, 20] 2,048 bns3
ReLU-172 [-1, 1024, 15, 20] 0 relu
(layer3)-Bottle2neck-3
width = int(math.floor(planes * (baseWidth/64.0)))
width = 256 * (26/64)= 104
conv1 = width*scale = 104 * 4 = 416
bn1 = width*scale = 104 * 4 = 416
conv3 = planes * block.expansion = 256 * 4 = 1024
downsample = planes * block.expansion = 256 * 4 = 1024
Bottle2neck-173 [-1, 1024, 15, 20] 0
Conv2d-174 [-1, 416, 15, 20] 425,984 conv1
BatchNorm2d-175 [-1, 416, 15, 20] 832 bn1
ReLU-176 [-1, 416, 15, 20] 0 relu
Conv2d-177 [-1, 104, 15, 20] 97,344 convs0
BatchNorm2d-178 [-1, 104, 15, 20] 208 bns0
ReLU-179 [-1, 104, 15, 20] 0 relu
Conv2d-180 [-1, 104, 15, 20] 97,344 convs1
BatchNorm2d-181 [-1, 104, 15, 20] 208 bns1
ReLU-182 [-1, 104, 15, 20] 0 relu
Conv2d-183 [-1, 104, 15, 20] 97,344 convs2
BatchNorm2d-184 [-1, 104, 15, 20] 208 bns2
ReLU-185 [-1, 104, 15, 20] 0 relu
Conv2d-186 [-1, 1024, 15, 20] 425,984 conv3
BatchNorm2d-187 [-1, 1024, 15, 20] 2,048 bns3
ReLU-188 [-1, 1024, 15, 20] 0 relu
(layer3)-Bottle2neck-4
width = int(math.floor(planes * (baseWidth/64.0)))
width = 256 * (26/64)= 104
conv1 = width*scale = 104 * 4 = 416
bn1 = width*scale = 104 * 4 = 416
conv3 = planes * block.expansion = 256 * 4 = 1024
downsample = planes * block.expansion = 256 * 4 = 1024
Bottle2neck-189 [-1, 1024, 15, 20] 0
Conv2d-190 [-1, 416, 15, 20] 425,984 conv1
BatchNorm2d-191 [-1, 416, 15, 20] 832 bns1
ReLU-192 [-1, 416, 15, 20] 0 relu
Conv2d-193 [-1, 104, 15, 20] 97,344 convs0
BatchNorm2d-194 [-1, 104, 15, 20] 208 bns0
ReLU-195 [-1, 104, 15, 20] 0 relu
Conv2d-196 [-1, 104, 15, 20] 97,344 convs1
BatchNorm2d-197 [-1, 104, 15, 20] 208 bns1
ReLU-198 [-1, 104, 15, 20] 0 relu
Conv2d-199 [-1, 104, 15, 20] 97,344 convs2
BatchNorm2d-200 [-1, 104, 15, 20] 208 bns2
ReLU-201 [-1, 104, 15, 20] 0 relu
Conv2d-202 [-1, 1024, 15, 20] 425,984 conv3
BatchNorm2d-203 [-1, 1024, 15, 20] 2,048 bns3
ReLU-204 [-1, 1024, 15, 20] 0 relu
(layer3)-Bottle2neck-5
width = int(math.floor(planes * (baseWidth/64.0)))
width = 256 * (26/64)= 104
conv1 = width*scale = 104 * 4 = 416
bn1 = width*scale = 104 * 4 = 416
conv3 = planes * block.expansion = 256 * 4 = 1024
downsample = planes * block.expansion = 256 * 4 = 1024
Bottle2neck-205 [-1, 1024, 15, 20] 0
Conv2d-206 [-1, 416, 15, 20] 425,984 conv1
BatchNorm2d-207 [-1, 416, 15, 20] 832 bns1
ReLU-208 [-1, 416, 15, 20] 0 relu
Conv2d-209 [-1, 104, 15, 20] 97,344 convs0
BatchNorm2d-210 [-1, 104, 15, 20] 208 bns0
ReLU-211 [-1, 104, 15, 20] 0 relu
Conv2d-212 [-1, 104, 15, 20] 97,344 convs1
BatchNorm2d-213 [-1, 104, 15, 20] 208 bns1
ReLU-214 [-1, 104, 15, 20] 0 relu
Conv2d-215 [-1, 104, 15, 20] 97,344 convs2
BatchNorm2d-216 [-1, 104, 15, 20] 208 bns2
ReLU-217 [-1, 104, 15, 20] 0 relu
Conv2d-218 [-1, 1024, 15, 20] 425,984 conv3
BatchNorm2d-219 [-1, 1024, 15, 20] 2,048 bns3
ReLU-220 [-1, 1024, 15, 20] 0 relu
(layer4)-Bottle2neck-0
width = int(math.floor(planes * (baseWidth/64.0)))
width = 512 * (26/64)= 208
conv1 = width*scale = 208 * 4 = 832
bn1 = width*scale = 208 * 4 = 832
conv3 = planes * block.expansion = 512 * 4 = 2048
downsample = planes * block.expansion = 512 * 4 = 2048
Bottle2neck-221 [-1, 1024, 15, 20] 0
Conv2d-222 [-1, 832, 15, 20] 851,968
BatchNorm2d-223 [-1, 832, 15, 20] 1,664
ReLU-224 [-1, 832, 15, 20] 0
Conv2d-225 [-1, 208, 8, 10] 389,376
BatchNorm2d-226 [-1, 208, 8, 10] 416
ReLU-227 [-1, 208, 8, 10] 0
Conv2d-228 [-1, 208, 8, 10] 389,376
BatchNorm2d-229 [-1, 208, 8, 10] 416
ReLU-230 [-1, 208, 8, 10] 0
Conv2d-231 [-1, 208, 8, 10] 389,376
BatchNorm2d-232 [-1, 208, 8, 10] 416
ReLU-233 [-1, 208, 8, 10] 0
AvgPool2d-234 [-1, 208, 8, 10] 0
Conv2d-235 [-1, 2048, 8, 10] 1,703,936
BatchNorm2d-236 [-1, 2048, 8, 10] 4,096
Conv2d-237 [-1, 2048, 8, 10] 2,097,152
BatchNorm2d-238 [-1, 2048, 8, 10] 4,096
ReLU-239 [-1, 2048, 8, 10] 0
(layer4)-Bottle2neck-1
width = int(math.floor(planes * (baseWidth/64.0)))
width = 512 * (26/64)= 208
conv1 = width*scale = 208 * 4 = 832
bn1 = width*scale = 208 * 4 = 832
conv3 = planes * block.expansion = 512 * 4 = 2048
downsample = planes * block.expansion = 512 * 4 = 2048
Bottle2neck-240 [-1, 2048, 8, 10] 0
Conv2d-241 [-1, 832, 8, 10] 1,703,936
BatchNorm2d-242 [-1, 832, 8, 10] 1,664
ReLU-243 [-1, 832, 8, 10] 0
Conv2d-244 [-1, 208, 8, 10] 389,376
BatchNorm2d-245 [-1, 208, 8, 10] 416
ReLU-246 [-1, 208, 8, 10] 0
Conv2d-247 [-1, 208, 8, 10] 389,376
BatchNorm2d-248 [-1, 208, 8, 10] 416
ReLU-249 [-1, 208, 8, 10] 0
Conv2d-250 [-1, 208, 8, 10] 389,376
BatchNorm2d-251 [-1, 208, 8, 10] 416
ReLU-252 [-1, 208, 8, 10] 0
Conv2d-253 [-1, 2048, 8, 10] 1,703,936
BatchNorm2d-254 [-1, 2048, 8, 10] 4,096
ReLU-255 [-1, 2048, 8, 10] 0
(layer4)-Bottle2neck-2
width = int(math.floor(planes * (baseWidth/64.0)))
width = 512 * (26/64)= 208
conv1 = width*scale = 208 * 4 = 832
bn1 = width*scale = 208 * 4 = 832
conv3 = planes * block.expansion = 512 * 4 = 2048
downsample = planes * block.expansion = 512 * 4 = 2048
Bottle2neck-256 [-1, 2048, 8, 10] 0
Conv2d-257 [-1, 832, 8, 10] 1,703,936
BatchNorm2d-258 [-1, 832, 8, 10] 1,664
ReLU-259 [-1, 832, 8, 10] 0
Conv2d-260 [-1, 208, 8, 10] 389,376
BatchNorm2d-261 [-1, 208, 8, 10] 416
ReLU-262 [-1, 208, 8, 10] 0
Conv2d-263 [-1, 208, 8, 10] 389,376
BatchNorm2d-264 [-1, 208, 8, 10] 416
ReLU-265 [-1, 208, 8, 10] 0
Conv2d-266 [-1, 208, 8, 10] 389,376
BatchNorm2d-267 [-1, 208, 8, 10] 416
ReLU-268 [-1, 208, 8, 10] 0
Conv2d-269 [-1, 2048, 8, 10] 1,703,936
BatchNorm2d-270 [-1, 2048, 8, 10] 4,096
ReLU-271 [-1, 2048, 8, 10] 0
Bottle2neck-272 [-1, 2048, 8, 10] 0
AdaptiveAvgPool2d-273 [-1, 2048, 1, 1] 0
Linear-274 [-1, 1000] 2,049,000
================================================================
Total params: 25,692,848
Trainable params: 25,692,848
Non-trainable params: 0
----------------------------------------------------------------
Input size (MB): 0.29
Forward/backward pass size (MB): 494.21
Params size (MB): 98.01
Estimated Total Size (MB): 592.51
----------------------------------------------------------------
論文架構比對
簡化分析
Res2Net
1 | - (conv1) |
ResNet
PyTorch 筆記
nn.ModuleList()
https://pytorch.org/docs/stable/generated/torch.nn.ModuleList.html
torch.nn.init
https://pytorch.org/docs/stable/nn.init.html
torch.nn.init.kaiming_normal_()
torch.nn.init.constant_()
參考資料
SENet
[Hu19] Hu, J., Shen, L., & Sun, G. (2018). Squeeze-and-excitation networks. In Proceedings of the IEEE conference on computer vision and pattern recognition (pp. 7132-7141).Res2Net
[Gao19] Gao, S. H., Cheng, M. M., Zhao, K., Zhang, X. Y., Yang, M. H., & Torr, P. (2019). Res2net: A new multi-scale backbone architecture. IEEE transactions on pattern analysis and machine intelligence, 43(2), 652-662.
https://mmcheng.net/res2net/ResNet
[He16] He, K., Zhang, X., Ren, S., & Sun, J. (2016). Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition (pp. 770-778).Github
https://github.com/Res2Net/Res2Net-PretrainedModels/tree/3b9b078ae4c261d227449fe18504315c0740795aModuleList
https://clay-atlas.com/blog/2020/07/02/pytorch-cn-note-how-to-use-module-list/