This repository has been archived by the owner on May 24, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 415
/
symbol.py
269 lines (258 loc) · 25.8 KB
/
symbol.py
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
import mxnet as mx
data = mx.symbol.Variable(name='data')
conv_3a_1x1 = mx.symbol.Convolution(name='conv_3a_1x1',kernel=(1, 1),num_filter=64,pad=(0, 0),stride=(1, 1),data=data)
bn_3a_1x1 = mx.symbol.BatchNorm(name='bn_3a_1x1',data=conv_3a_1x1)
relu_3a_1x1 = mx.symbol.Activation(act_type='relu',name='relu_3a_1x1',data=bn_3a_1x1)
conv_3a_3x3_reduce = mx.symbol.Convolution(name='conv_3a_3x3_reduce',kernel=(1, 1),num_filter=64,pad=(0, 0),stride=(1, 1),data=data)
bn_3a_3x3_reduce = mx.symbol.BatchNorm(name='bn_3a_3x3_reduce',data=conv_3a_3x3_reduce)
relu_3a_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_3a_3x3_reduce',data=bn_3a_3x3_reduce)
conv_3a_3x3 = mx.symbol.Convolution(name='conv_3a_3x3',kernel=(3, 3),num_filter=64,pad=(1, 1),stride=(1, 1),data=relu_3a_3x3_reduce)
bn_3a_3x3 = mx.symbol.BatchNorm(name='bn_3a_3x3',data=conv_3a_3x3)
relu_3a_3x3 = mx.symbol.Activation(act_type='relu',name='relu_3a_3x3',data=bn_3a_3x3)
conv_3a_double_3x3_reduce = mx.symbol.Convolution(name='conv_3a_double_3x3_reduce',kernel=(1, 1),num_filter=64,pad=(0, 0),stride=(1, 1),data=data)
bn_3a_double_3x3_reduce = mx.symbol.BatchNorm(name='bn_3a_double_3x3_reduce',data=conv_3a_double_3x3_reduce)
relu_3a_double_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_3a_double_3x3_reduce',data=bn_3a_double_3x3_reduce)
conv_3a_double_3x3_0 = mx.symbol.Convolution(name='conv_3a_double_3x3_0',kernel=(3, 3),num_filter=96,pad=(1, 1),stride=(1, 1),data=relu_3a_double_3x3_reduce)
bn_3a_double_3x3_0 = mx.symbol.BatchNorm(name='bn_3a_double_3x3_0',data=conv_3a_double_3x3_0)
relu_3a_double_3x3_0 = mx.symbol.Activation(act_type='relu',name='relu_3a_double_3x3_0',data=bn_3a_double_3x3_0)
conv_3a_double_3x3_1 = mx.symbol.Convolution(name='conv_3a_double_3x3_1',kernel=(3, 3),num_filter=96,pad=(1, 1),stride=(1, 1),data=relu_3a_double_3x3_0)
bn_3a_double_3x3_1 = mx.symbol.BatchNorm(name='bn_3a_double_3x3_1',data=conv_3a_double_3x3_1)
relu_3a_double_3x3_1 = mx.symbol.Activation(act_type='relu',name='relu_3a_double_3x3_1',data=bn_3a_double_3x3_1)
avg_pool_3a_pool = mx.symbol.Pooling(pool_type='avg',name='avg_pool_3a_pool',kernel=(3, 3),stride=(1, 1),pad=(1, 1),data=data)
conv_3a_proj = mx.symbol.Convolution(name='conv_3a_proj',kernel=(1, 1),num_filter=32,pad=(0, 0),stride=(1, 1),data=avg_pool_3a_pool)
bn_3a_proj = mx.symbol.BatchNorm(name='bn_3a_proj',data=conv_3a_proj)
relu_3a_proj = mx.symbol.Activation(act_type='relu',name='relu_3a_proj',data=bn_3a_proj)
ch_concat_3a_chconcat = mx.symbol.Concat(name='ch_concat_3a_chconcat',*[relu_3a_1x1,relu_3a_3x3,relu_3a_double_3x3_1,relu_3a_proj])
conv_3b_1x1 = mx.symbol.Convolution(name='conv_3b_1x1',kernel=(1, 1),num_filter=64,pad=(0, 0),stride=(1, 1),data=ch_concat_3a_chconcat)
bn_3b_1x1 = mx.symbol.BatchNorm(name='bn_3b_1x1',data=conv_3b_1x1)
relu_3b_1x1 = mx.symbol.Activation(act_type='relu',name='relu_3b_1x1',data=bn_3b_1x1)
conv_3b_3x3_reduce = mx.symbol.Convolution(name='conv_3b_3x3_reduce',kernel=(1, 1),num_filter=64,pad=(0, 0),stride=(1, 1),data=ch_concat_3a_chconcat)
bn_3b_3x3_reduce = mx.symbol.BatchNorm(name='bn_3b_3x3_reduce',data=conv_3b_3x3_reduce)
relu_3b_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_3b_3x3_reduce',data=bn_3b_3x3_reduce)
conv_3b_3x3 = mx.symbol.Convolution(name='conv_3b_3x3',kernel=(3, 3),num_filter=96,pad=(1, 1),stride=(1, 1),data=relu_3b_3x3_reduce)
bn_3b_3x3 = mx.symbol.BatchNorm(name='bn_3b_3x3',data=conv_3b_3x3)
relu_3b_3x3 = mx.symbol.Activation(act_type='relu',name='relu_3b_3x3',data=bn_3b_3x3)
conv_3b_double_3x3_reduce = mx.symbol.Convolution(name='conv_3b_double_3x3_reduce',kernel=(1, 1),num_filter=64,pad=(0, 0),stride=(1, 1),data=ch_concat_3a_chconcat)
bn_3b_double_3x3_reduce = mx.symbol.BatchNorm(name='bn_3b_double_3x3_reduce',data=conv_3b_double_3x3_reduce)
relu_3b_double_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_3b_double_3x3_reduce',data=bn_3b_double_3x3_reduce)
conv_3b_double_3x3_0 = mx.symbol.Convolution(name='conv_3b_double_3x3_0',kernel=(3, 3),num_filter=96,pad=(1, 1),stride=(1, 1),data=relu_3b_double_3x3_reduce)
bn_3b_double_3x3_0 = mx.symbol.BatchNorm(name='bn_3b_double_3x3_0',data=conv_3b_double_3x3_0)
relu_3b_double_3x3_0 = mx.symbol.Activation(act_type='relu',name='relu_3b_double_3x3_0',data=bn_3b_double_3x3_0)
conv_3b_double_3x3_1 = mx.symbol.Convolution(name='conv_3b_double_3x3_1',kernel=(3, 3),num_filter=96,pad=(1, 1),stride=(1, 1),data=relu_3b_double_3x3_0)
bn_3b_double_3x3_1 = mx.symbol.BatchNorm(name='bn_3b_double_3x3_1',data=conv_3b_double_3x3_1)
relu_3b_double_3x3_1 = mx.symbol.Activation(act_type='relu',name='relu_3b_double_3x3_1',data=bn_3b_double_3x3_1)
avg_pool_3b_pool = mx.symbol.Pooling(pool_type='avg',name='avg_pool_3b_pool',kernel=(3, 3),stride=(1, 1),pad=(1, 1),data=ch_concat_3a_chconcat)
conv_3b_proj = mx.symbol.Convolution(name='conv_3b_proj',kernel=(1, 1),num_filter=64,pad=(0, 0),stride=(1, 1),data=avg_pool_3b_pool)
bn_3b_proj = mx.symbol.BatchNorm(name='bn_3b_proj',data=conv_3b_proj)
relu_3b_proj = mx.symbol.Activation(act_type='relu',name='relu_3b_proj',data=bn_3b_proj)
ch_concat_3b_chconcat = mx.symbol.Concat(name='ch_concat_3b_chconcat',*[relu_3b_1x1,relu_3b_3x3,relu_3b_double_3x3_1,relu_3b_proj])
conv_3c_3x3_reduce = mx.symbol.Convolution(name='conv_3c_3x3_reduce',kernel=(1, 1),num_filter=128,pad=(0, 0),stride=(1, 1),data=ch_concat_3b_chconcat)
bn_3c_3x3_reduce = mx.symbol.BatchNorm(name='bn_3c_3x3_reduce',data=conv_3c_3x3_reduce)
relu_3c_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_3c_3x3_reduce',data=bn_3c_3x3_reduce)
conv_3c_3x3 = mx.symbol.Convolution(name='conv_3c_3x3',kernel=(3, 3),num_filter=160,pad=(1, 1),stride=(2, 2),data=relu_3c_3x3_reduce)
bn_3c_3x3 = mx.symbol.BatchNorm(name='bn_3c_3x3',data=conv_3c_3x3)
relu_3c_3x3 = mx.symbol.Activation(act_type='relu',name='relu_3c_3x3',data=bn_3c_3x3)
conv_3c_double_3x3_reduce = mx.symbol.Convolution(name='conv_3c_double_3x3_reduce',kernel=(1, 1),num_filter=64,pad=(0, 0),stride=(1, 1),data=ch_concat_3b_chconcat)
bn_3c_double_3x3_reduce = mx.symbol.BatchNorm(name='bn_3c_double_3x3_reduce',data=conv_3c_double_3x3_reduce)
relu_3c_double_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_3c_double_3x3_reduce',data=bn_3c_double_3x3_reduce)
conv_3c_double_3x3_0 = mx.symbol.Convolution(name='conv_3c_double_3x3_0',kernel=(3, 3),num_filter=96,pad=(1, 1),stride=(1, 1),data=relu_3c_double_3x3_reduce)
bn_3c_double_3x3_0 = mx.symbol.BatchNorm(name='bn_3c_double_3x3_0',data=conv_3c_double_3x3_0)
relu_3c_double_3x3_0 = mx.symbol.Activation(act_type='relu',name='relu_3c_double_3x3_0',data=bn_3c_double_3x3_0)
conv_3c_double_3x3_1 = mx.symbol.Convolution(name='conv_3c_double_3x3_1',kernel=(3, 3),num_filter=96,pad=(1, 1),stride=(2, 2),data=relu_3c_double_3x3_0)
bn_3c_double_3x3_1 = mx.symbol.BatchNorm(name='bn_3c_double_3x3_1',data=conv_3c_double_3x3_1)
relu_3c_double_3x3_1 = mx.symbol.Activation(act_type='relu',name='relu_3c_double_3x3_1',data=bn_3c_double_3x3_1)
max_pool_3c_pool = mx.symbol.Pooling(pool_type='max',name='max_pool_3c_pool',kernel=(3, 3),stride=(2, 2),data=ch_concat_3b_chconcat)
ch_concat_3c_chconcat = mx.symbol.Concat(name='ch_concat_3c_chconcat',*[relu_3c_3x3,relu_3c_double_3x3_1,max_pool_3c_pool])
conv_4a_1x1 = mx.symbol.Convolution(name='conv_4a_1x1',kernel=(1, 1),num_filter=224,pad=(0, 0),stride=(1, 1),data=ch_concat_3c_chconcat)
bn_4a_1x1 = mx.symbol.BatchNorm(name='bn_4a_1x1',data=conv_4a_1x1)
relu_4a_1x1 = mx.symbol.Activation(act_type='relu',name='relu_4a_1x1',data=bn_4a_1x1)
conv_4a_3x3_reduce = mx.symbol.Convolution(name='conv_4a_3x3_reduce',kernel=(1, 1),num_filter=64,pad=(0, 0),stride=(1, 1),data=ch_concat_3c_chconcat)
bn_4a_3x3_reduce = mx.symbol.BatchNorm(name='bn_4a_3x3_reduce',data=conv_4a_3x3_reduce)
relu_4a_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_4a_3x3_reduce',data=bn_4a_3x3_reduce)
conv_4a_3x3 = mx.symbol.Convolution(name='conv_4a_3x3',kernel=(3, 3),num_filter=96,pad=(1, 1),stride=(1, 1),data=relu_4a_3x3_reduce)
bn_4a_3x3 = mx.symbol.BatchNorm(name='bn_4a_3x3',data=conv_4a_3x3)
relu_4a_3x3 = mx.symbol.Activation(act_type='relu',name='relu_4a_3x3',data=bn_4a_3x3)
conv_4a_double_3x3_reduce = mx.symbol.Convolution(name='conv_4a_double_3x3_reduce',kernel=(1, 1),num_filter=96,pad=(0, 0),stride=(1, 1),data=ch_concat_3c_chconcat)
bn_4a_double_3x3_reduce = mx.symbol.BatchNorm(name='bn_4a_double_3x3_reduce',data=conv_4a_double_3x3_reduce)
relu_4a_double_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_4a_double_3x3_reduce',data=bn_4a_double_3x3_reduce)
conv_4a_double_3x3_0 = mx.symbol.Convolution(name='conv_4a_double_3x3_0',kernel=(3, 3),num_filter=128,pad=(1, 1),stride=(1, 1),data=relu_4a_double_3x3_reduce)
bn_4a_double_3x3_0 = mx.symbol.BatchNorm(name='bn_4a_double_3x3_0',data=conv_4a_double_3x3_0)
relu_4a_double_3x3_0 = mx.symbol.Activation(act_type='relu',name='relu_4a_double_3x3_0',data=bn_4a_double_3x3_0)
conv_4a_double_3x3_1 = mx.symbol.Convolution(name='conv_4a_double_3x3_1',kernel=(3, 3),num_filter=128,pad=(1, 1),stride=(1, 1),data=relu_4a_double_3x3_0)
bn_4a_double_3x3_1 = mx.symbol.BatchNorm(name='bn_4a_double_3x3_1',data=conv_4a_double_3x3_1)
relu_4a_double_3x3_1 = mx.symbol.Activation(act_type='relu',name='relu_4a_double_3x3_1',data=bn_4a_double_3x3_1)
avg_pool_4a_pool = mx.symbol.Pooling(pool_type='avg',name='avg_pool_4a_pool',kernel=(3, 3),stride=(1, 1),pad=(1, 1),data=ch_concat_3c_chconcat)
conv_4a_proj = mx.symbol.Convolution(name='conv_4a_proj',kernel=(1, 1),num_filter=128,pad=(0, 0),stride=(1, 1),data=avg_pool_4a_pool)
bn_4a_proj = mx.symbol.BatchNorm(name='bn_4a_proj',data=conv_4a_proj)
relu_4a_proj = mx.symbol.Activation(act_type='relu',name='relu_4a_proj',data=bn_4a_proj)
ch_concat_4a_chconcat = mx.symbol.Concat(name='ch_concat_4a_chconcat',*[relu_4a_1x1,relu_4a_3x3,relu_4a_double_3x3_1,relu_4a_proj])
conv_4b_1x1 = mx.symbol.Convolution(name='conv_4b_1x1',kernel=(1, 1),num_filter=192,pad=(0, 0),stride=(1, 1),data=ch_concat_4a_chconcat)
bn_4b_1x1 = mx.symbol.BatchNorm(name='bn_4b_1x1',data=conv_4b_1x1)
relu_4b_1x1 = mx.symbol.Activation(act_type='relu',name='relu_4b_1x1',data=bn_4b_1x1)
conv_4b_3x3_reduce = mx.symbol.Convolution(name='conv_4b_3x3_reduce',kernel=(1, 1),num_filter=96,pad=(0, 0),stride=(1, 1),data=ch_concat_4a_chconcat)
bn_4b_3x3_reduce = mx.symbol.BatchNorm(name='bn_4b_3x3_reduce',data=conv_4b_3x3_reduce)
relu_4b_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_4b_3x3_reduce',data=bn_4b_3x3_reduce)
conv_4b_3x3 = mx.symbol.Convolution(name='conv_4b_3x3',kernel=(3, 3),num_filter=128,pad=(1, 1),stride=(1, 1),data=relu_4b_3x3_reduce)
bn_4b_3x3 = mx.symbol.BatchNorm(name='bn_4b_3x3',data=conv_4b_3x3)
relu_4b_3x3 = mx.symbol.Activation(act_type='relu',name='relu_4b_3x3',data=bn_4b_3x3)
conv_4b_double_3x3_reduce = mx.symbol.Convolution(name='conv_4b_double_3x3_reduce',kernel=(1, 1),num_filter=96,pad=(0, 0),stride=(1, 1),data=ch_concat_4a_chconcat)
bn_4b_double_3x3_reduce = mx.symbol.BatchNorm(name='bn_4b_double_3x3_reduce',data=conv_4b_double_3x3_reduce)
relu_4b_double_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_4b_double_3x3_reduce',data=bn_4b_double_3x3_reduce)
conv_4b_double_3x3_0 = mx.symbol.Convolution(name='conv_4b_double_3x3_0',kernel=(3, 3),num_filter=128,pad=(1, 1),stride=(1, 1),data=relu_4b_double_3x3_reduce)
bn_4b_double_3x3_0 = mx.symbol.BatchNorm(name='bn_4b_double_3x3_0',data=conv_4b_double_3x3_0)
relu_4b_double_3x3_0 = mx.symbol.Activation(act_type='relu',name='relu_4b_double_3x3_0',data=bn_4b_double_3x3_0)
conv_4b_double_3x3_1 = mx.symbol.Convolution(name='conv_4b_double_3x3_1',kernel=(3, 3),num_filter=128,pad=(1, 1),stride=(1, 1),data=relu_4b_double_3x3_0)
bn_4b_double_3x3_1 = mx.symbol.BatchNorm(name='bn_4b_double_3x3_1',data=conv_4b_double_3x3_1)
relu_4b_double_3x3_1 = mx.symbol.Activation(act_type='relu',name='relu_4b_double_3x3_1',data=bn_4b_double_3x3_1)
avg_pool_4b_pool = mx.symbol.Pooling(pool_type='avg',name='avg_pool_4b_pool',kernel=(3, 3),stride=(1, 1),pad=(1, 1),data=ch_concat_4a_chconcat)
conv_4b_proj = mx.symbol.Convolution(name='conv_4b_proj',kernel=(1, 1),num_filter=128,pad=(0, 0),stride=(1, 1),data=avg_pool_4b_pool)
bn_4b_proj = mx.symbol.BatchNorm(name='bn_4b_proj',data=conv_4b_proj)
relu_4b_proj = mx.symbol.Activation(act_type='relu',name='relu_4b_proj',data=bn_4b_proj)
ch_concat_4b_chconcat = mx.symbol.Concat(name='ch_concat_4b_chconcat',*[relu_4b_1x1,relu_4b_3x3,relu_4b_double_3x3_1,relu_4b_proj])
conv_4c_1x1 = mx.symbol.Convolution(name='conv_4c_1x1',kernel=(1, 1),num_filter=160,pad=(0, 0),stride=(1, 1),data=ch_concat_4b_chconcat)
bn_4c_1x1 = mx.symbol.BatchNorm(name='bn_4c_1x1',data=conv_4c_1x1)
relu_4c_1x1 = mx.symbol.Activation(act_type='relu',name='relu_4c_1x1',data=bn_4c_1x1)
conv_4c_3x3_reduce = mx.symbol.Convolution(name='conv_4c_3x3_reduce',kernel=(1, 1),num_filter=128,pad=(0, 0),stride=(1, 1),data=ch_concat_4b_chconcat)
bn_4c_3x3_reduce = mx.symbol.BatchNorm(name='bn_4c_3x3_reduce',data=conv_4c_3x3_reduce)
relu_4c_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_4c_3x3_reduce',data=bn_4c_3x3_reduce)
conv_4c_3x3 = mx.symbol.Convolution(name='conv_4c_3x3',kernel=(3, 3),num_filter=160,pad=(1, 1),stride=(1, 1),data=relu_4c_3x3_reduce)
bn_4c_3x3 = mx.symbol.BatchNorm(name='bn_4c_3x3',data=conv_4c_3x3)
relu_4c_3x3 = mx.symbol.Activation(act_type='relu',name='relu_4c_3x3',data=bn_4c_3x3)
conv_4c_double_3x3_reduce = mx.symbol.Convolution(name='conv_4c_double_3x3_reduce',kernel=(1, 1),num_filter=128,pad=(0, 0),stride=(1, 1),data=ch_concat_4b_chconcat)
bn_4c_double_3x3_reduce = mx.symbol.BatchNorm(name='bn_4c_double_3x3_reduce',data=conv_4c_double_3x3_reduce)
relu_4c_double_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_4c_double_3x3_reduce',data=bn_4c_double_3x3_reduce)
conv_4c_double_3x3_0 = mx.symbol.Convolution(name='conv_4c_double_3x3_0',kernel=(3, 3),num_filter=160,pad=(1, 1),stride=(1, 1),data=relu_4c_double_3x3_reduce)
bn_4c_double_3x3_0 = mx.symbol.BatchNorm(name='bn_4c_double_3x3_0',data=conv_4c_double_3x3_0)
relu_4c_double_3x3_0 = mx.symbol.Activation(act_type='relu',name='relu_4c_double_3x3_0',data=bn_4c_double_3x3_0)
conv_4c_double_3x3_1 = mx.symbol.Convolution(name='conv_4c_double_3x3_1',kernel=(3, 3),num_filter=160,pad=(1, 1),stride=(1, 1),data=relu_4c_double_3x3_0)
bn_4c_double_3x3_1 = mx.symbol.BatchNorm(name='bn_4c_double_3x3_1',data=conv_4c_double_3x3_1)
relu_4c_double_3x3_1 = mx.symbol.Activation(act_type='relu',name='relu_4c_double_3x3_1',data=bn_4c_double_3x3_1)
avg_pool_4c_pool = mx.symbol.Pooling(pool_type='avg',name='avg_pool_4c_pool',kernel=(3, 3),stride=(1, 1),pad=(1, 1),data=ch_concat_4b_chconcat)
conv_4c_proj = mx.symbol.Convolution(name='conv_4c_proj',kernel=(1, 1),num_filter=128,pad=(0, 0),stride=(1, 1),data=avg_pool_4c_pool)
bn_4c_proj = mx.symbol.BatchNorm(name='bn_4c_proj',data=conv_4c_proj)
relu_4c_proj = mx.symbol.Activation(act_type='relu',name='relu_4c_proj',data=bn_4c_proj)
ch_concat_4c_chconcat = mx.symbol.Concat(name='ch_concat_4c_chconcat',*[relu_4c_1x1,relu_4c_3x3,relu_4c_double_3x3_1,relu_4c_proj])
conv_4d_1x1 = mx.symbol.Convolution(name='conv_4d_1x1',kernel=(1, 1),num_filter=96,pad=(0, 0),stride=(1, 1),data=ch_concat_4c_chconcat)
bn_4d_1x1 = mx.symbol.BatchNorm(name='bn_4d_1x1',data=conv_4d_1x1)
relu_4d_1x1 = mx.symbol.Activation(act_type='relu',name='relu_4d_1x1',data=bn_4d_1x1)
conv_4d_3x3_reduce = mx.symbol.Convolution(name='conv_4d_3x3_reduce',kernel=(1, 1),num_filter=128,pad=(0, 0),stride=(1, 1),data=ch_concat_4c_chconcat)
bn_4d_3x3_reduce = mx.symbol.BatchNorm(name='bn_4d_3x3_reduce',data=conv_4d_3x3_reduce)
relu_4d_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_4d_3x3_reduce',data=bn_4d_3x3_reduce)
conv_4d_3x3 = mx.symbol.Convolution(name='conv_4d_3x3',kernel=(3, 3),num_filter=192,pad=(1, 1),stride=(1, 1),data=relu_4d_3x3_reduce)
bn_4d_3x3 = mx.symbol.BatchNorm(name='bn_4d_3x3',data=conv_4d_3x3)
relu_4d_3x3 = mx.symbol.Activation(act_type='relu',name='relu_4d_3x3',data=bn_4d_3x3)
conv_4d_double_3x3_reduce = mx.symbol.Convolution(name='conv_4d_double_3x3_reduce',kernel=(1, 1),num_filter=160,pad=(0, 0),stride=(1, 1),data=ch_concat_4c_chconcat)
bn_4d_double_3x3_reduce = mx.symbol.BatchNorm(name='bn_4d_double_3x3_reduce',data=conv_4d_double_3x3_reduce)
relu_4d_double_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_4d_double_3x3_reduce',data=bn_4d_double_3x3_reduce)
conv_4d_double_3x3_0 = mx.symbol.Convolution(name='conv_4d_double_3x3_0',kernel=(3, 3),num_filter=192,pad=(1, 1),stride=(1, 1),data=relu_4d_double_3x3_reduce)
bn_4d_double_3x3_0 = mx.symbol.BatchNorm(name='bn_4d_double_3x3_0',data=conv_4d_double_3x3_0)
relu_4d_double_3x3_0 = mx.symbol.Activation(act_type='relu',name='relu_4d_double_3x3_0',data=bn_4d_double_3x3_0)
conv_4d_double_3x3_1 = mx.symbol.Convolution(name='conv_4d_double_3x3_1',kernel=(3, 3),num_filter=192,pad=(1, 1),stride=(1, 1),data=relu_4d_double_3x3_0)
bn_4d_double_3x3_1 = mx.symbol.BatchNorm(name='bn_4d_double_3x3_1',data=conv_4d_double_3x3_1)
relu_4d_double_3x3_1 = mx.symbol.Activation(act_type='relu',name='relu_4d_double_3x3_1',data=bn_4d_double_3x3_1)
avg_pool_4d_pool = mx.symbol.Pooling(pool_type='avg',name='avg_pool_4d_pool',kernel=(3, 3),stride=(1, 1),pad=(1, 1),data=ch_concat_4c_chconcat)
conv_4d_proj = mx.symbol.Convolution(name='conv_4d_proj',kernel=(1, 1),num_filter=128,pad=(0, 0),stride=(1, 1),data=avg_pool_4d_pool)
bn_4d_proj = mx.symbol.BatchNorm(name='bn_4d_proj',data=conv_4d_proj)
relu_4d_proj = mx.symbol.Activation(act_type='relu',name='relu_4d_proj',data=bn_4d_proj)
ch_concat_4d_chconcat = mx.symbol.Concat(name='ch_concat_4d_chconcat',*[relu_4d_1x1,relu_4d_3x3,relu_4d_double_3x3_1,relu_4d_proj])
conv_4e_3x3_reduce = mx.symbol.Convolution(name='conv_4e_3x3_reduce',kernel=(1, 1),num_filter=128,pad=(0, 0),stride=(1, 1),data=ch_concat_4d_chconcat)
bn_4e_3x3_reduce = mx.symbol.BatchNorm(name='bn_4e_3x3_reduce',data=conv_4e_3x3_reduce)
relu_4e_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_4e_3x3_reduce',data=bn_4e_3x3_reduce)
conv_4e_3x3 = mx.symbol.Convolution(name='conv_4e_3x3',kernel=(3, 3),num_filter=192,pad=(1, 1),stride=(2, 2),data=relu_4e_3x3_reduce)
bn_4e_3x3 = mx.symbol.BatchNorm(name='bn_4e_3x3',data=conv_4e_3x3)
relu_4e_3x3 = mx.symbol.Activation(act_type='relu',name='relu_4e_3x3',data=bn_4e_3x3)
conv_4e_double_3x3_reduce = mx.symbol.Convolution(name='conv_4e_double_3x3_reduce',kernel=(1, 1),num_filter=192,pad=(0, 0),stride=(1, 1),data=ch_concat_4d_chconcat)
bn_4e_double_3x3_reduce = mx.symbol.BatchNorm(name='bn_4e_double_3x3_reduce',data=conv_4e_double_3x3_reduce)
relu_4e_double_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_4e_double_3x3_reduce',data=bn_4e_double_3x3_reduce)
conv_4e_double_3x3_0 = mx.symbol.Convolution(name='conv_4e_double_3x3_0',kernel=(3, 3),num_filter=256,pad=(1, 1),stride=(1, 1),data=relu_4e_double_3x3_reduce)
bn_4e_double_3x3_0 = mx.symbol.BatchNorm(name='bn_4e_double_3x3_0',data=conv_4e_double_3x3_0)
relu_4e_double_3x3_0 = mx.symbol.Activation(act_type='relu',name='relu_4e_double_3x3_0',data=bn_4e_double_3x3_0)
conv_4e_double_3x3_1 = mx.symbol.Convolution(name='conv_4e_double_3x3_1',kernel=(3, 3),num_filter=256,pad=(1, 1),stride=(2, 2),data=relu_4e_double_3x3_0)
bn_4e_double_3x3_1 = mx.symbol.BatchNorm(name='bn_4e_double_3x3_1',data=conv_4e_double_3x3_1)
relu_4e_double_3x3_1 = mx.symbol.Activation(act_type='relu',name='relu_4e_double_3x3_1',data=bn_4e_double_3x3_1)
max_pool_4e_pool = mx.symbol.Pooling(pool_type='max',name='max_pool_4e_pool',kernel=(3, 3),stride=(2, 2),data=ch_concat_4d_chconcat)
ch_concat_4e_chconcat = mx.symbol.Concat(name='ch_concat_4e_chconcat',*[relu_4e_3x3,relu_4e_double_3x3_1,max_pool_4e_pool])
conv_5a_1x1 = mx.symbol.Convolution(name='conv_5a_1x1',kernel=(1, 1),num_filter=352,pad=(0, 0),stride=(1, 1),data=ch_concat_4e_chconcat)
bn_5a_1x1 = mx.symbol.BatchNorm(name='bn_5a_1x1',data=conv_5a_1x1)
relu_5a_1x1 = mx.symbol.Activation(act_type='relu',name='relu_5a_1x1',data=bn_5a_1x1)
conv_5a_3x3_reduce = mx.symbol.Convolution(name='conv_5a_3x3_reduce',kernel=(1, 1),num_filter=192,pad=(0, 0),stride=(1, 1),data=ch_concat_4e_chconcat)
bn_5a_3x3_reduce = mx.symbol.BatchNorm(name='bn_5a_3x3_reduce',data=conv_5a_3x3_reduce)
relu_5a_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_5a_3x3_reduce',data=bn_5a_3x3_reduce)
conv_5a_3x3 = mx.symbol.Convolution(name='conv_5a_3x3',kernel=(3, 3),num_filter=320,pad=(1, 1),stride=(1, 1),data=relu_5a_3x3_reduce)
bn_5a_3x3 = mx.symbol.BatchNorm(name='bn_5a_3x3',data=conv_5a_3x3)
relu_5a_3x3 = mx.symbol.Activation(act_type='relu',name='relu_5a_3x3',data=bn_5a_3x3)
conv_5a_double_3x3_reduce = mx.symbol.Convolution(name='conv_5a_double_3x3_reduce',kernel=(1, 1),num_filter=160,pad=(0, 0),stride=(1, 1),data=ch_concat_4e_chconcat)
bn_5a_double_3x3_reduce = mx.symbol.BatchNorm(name='bn_5a_double_3x3_reduce',data=conv_5a_double_3x3_reduce)
relu_5a_double_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_5a_double_3x3_reduce',data=bn_5a_double_3x3_reduce)
conv_5a_double_3x3_0 = mx.symbol.Convolution(name='conv_5a_double_3x3_0',kernel=(3, 3),num_filter=224,pad=(1, 1),stride=(1, 1),data=relu_5a_double_3x3_reduce)
bn_5a_double_3x3_0 = mx.symbol.BatchNorm(name='bn_5a_double_3x3_0',data=conv_5a_double_3x3_0)
relu_5a_double_3x3_0 = mx.symbol.Activation(act_type='relu',name='relu_5a_double_3x3_0',data=bn_5a_double_3x3_0)
conv_5a_double_3x3_1 = mx.symbol.Convolution(name='conv_5a_double_3x3_1',kernel=(3, 3),num_filter=224,pad=(1, 1),stride=(1, 1),data=relu_5a_double_3x3_0)
bn_5a_double_3x3_1 = mx.symbol.BatchNorm(name='bn_5a_double_3x3_1',data=conv_5a_double_3x3_1)
relu_5a_double_3x3_1 = mx.symbol.Activation(act_type='relu',name='relu_5a_double_3x3_1',data=bn_5a_double_3x3_1)
avg_pool_5a_pool = mx.symbol.Pooling(pool_type='avg',name='avg_pool_5a_pool',kernel=(3, 3),stride=(1, 1),pad=(1, 1),data=ch_concat_4e_chconcat)
conv_5a_proj = mx.symbol.Convolution(name='conv_5a_proj',kernel=(1, 1),num_filter=128,pad=(0, 0),stride=(1, 1),data=avg_pool_5a_pool)
bn_5a_proj = mx.symbol.BatchNorm(name='bn_5a_proj',data=conv_5a_proj)
relu_5a_proj = mx.symbol.Activation(act_type='relu',name='relu_5a_proj',data=bn_5a_proj)
ch_concat_5a_chconcat = mx.symbol.Concat(name='ch_concat_5a_chconcat',*[relu_5a_1x1,relu_5a_3x3,relu_5a_double_3x3_1,relu_5a_proj])
conv_5b_1x1 = mx.symbol.Convolution(name='conv_5b_1x1',kernel=(1, 1),num_filter=352,pad=(0, 0),stride=(1, 1),data=ch_concat_5a_chconcat)
bn_5b_1x1 = mx.symbol.BatchNorm(name='bn_5b_1x1',data=conv_5b_1x1)
relu_5b_1x1 = mx.symbol.Activation(act_type='relu',name='relu_5b_1x1',data=bn_5b_1x1)
conv_5b_3x3_reduce = mx.symbol.Convolution(name='conv_5b_3x3_reduce',kernel=(1, 1),num_filter=192,pad=(0, 0),stride=(1, 1),data=ch_concat_5a_chconcat)
bn_5b_3x3_reduce = mx.symbol.BatchNorm(name='bn_5b_3x3_reduce',data=conv_5b_3x3_reduce)
relu_5b_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_5b_3x3_reduce',data=bn_5b_3x3_reduce)
conv_5b_3x3 = mx.symbol.Convolution(name='conv_5b_3x3',kernel=(3, 3),num_filter=320,pad=(1, 1),stride=(1, 1),data=relu_5b_3x3_reduce)
bn_5b_3x3 = mx.symbol.BatchNorm(name='bn_5b_3x3',data=conv_5b_3x3)
relu_5b_3x3 = mx.symbol.Activation(act_type='relu',name='relu_5b_3x3',data=bn_5b_3x3)
conv_5b_double_3x3_reduce = mx.symbol.Convolution(name='conv_5b_double_3x3_reduce',kernel=(1, 1),num_filter=192,pad=(0, 0),stride=(1, 1),data=ch_concat_5a_chconcat)
bn_5b_double_3x3_reduce = mx.symbol.BatchNorm(name='bn_5b_double_3x3_reduce',data=conv_5b_double_3x3_reduce)
relu_5b_double_3x3_reduce = mx.symbol.Activation(act_type='relu',name='relu_5b_double_3x3_reduce',data=bn_5b_double_3x3_reduce)
conv_5b_double_3x3_0 = mx.symbol.Convolution(name='conv_5b_double_3x3_0',kernel=(3, 3),num_filter=224,pad=(1, 1),stride=(1, 1),data=relu_5b_double_3x3_reduce)
bn_5b_double_3x3_0 = mx.symbol.BatchNorm(name='bn_5b_double_3x3_0',data=conv_5b_double_3x3_0)
relu_5b_double_3x3_0 = mx.symbol.Activation(act_type='relu',name='relu_5b_double_3x3_0',data=bn_5b_double_3x3_0)
conv_5b_double_3x3_1 = mx.symbol.Convolution(name='conv_5b_double_3x3_1',kernel=(3, 3),num_filter=224,pad=(1, 1),stride=(1, 1),data=relu_5b_double_3x3_0)
bn_5b_double_3x3_1 = mx.symbol.BatchNorm(name='bn_5b_double_3x3_1',data=conv_5b_double_3x3_1)
relu_5b_double_3x3_1 = mx.symbol.Activation(act_type='relu',name='relu_5b_double_3x3_1',data=bn_5b_double_3x3_1)
max_pool_5b_pool = mx.symbol.Pooling(pool_type='max',name='max_pool_5b_pool',kernel=(3, 3),stride=(1, 1),pad=(1, 1),data=ch_concat_5a_chconcat)
conv_5b_proj = mx.symbol.Convolution(name='conv_5b_proj',kernel=(1, 1),num_filter=128,pad=(0, 0),stride=(1, 1),data=max_pool_5b_pool)
bn_5b_proj = mx.symbol.BatchNorm(name='bn_5b_proj',data=conv_5b_proj)
relu_5b_proj = mx.symbol.Activation(act_type='relu',name='relu_5b_proj',data=bn_5b_proj)
ch_concat_5b_chconcat = mx.symbol.Concat(name='ch_concat_5b_chconcat',*[relu_5b_1x1,relu_5b_3x3,relu_5b_double_3x3_1,relu_5b_proj])
global_pool = mx.symbol.Pooling(pool_type='avg',name='global_pool',kernel=(7, 7),stride=(1, 1),data=ch_concat_5b_chconcat)
flatten = mx.symbol.Flatten(name='flatten',data=global_pool)
fc = mx.symbol.FullyConnected(name='fc',num_hidden=100,data=flatten)
softmax = mx.symbol.Softmax(name='softmax',data=fc)
####################
# load weight
import os
import numpy as np
ROOT = "./0001/"
candidates = os.listdir(ROOT)
arg_names = softmax.list_arguments()
aux_names = softmax.list_auxiliary_states()
arg_shapes, output_shapes, aux_shapes = softmax.infer_shape(data=(128,3,28,28))
arg_shape_dic = dict(zip(arg_names, arg_shapes))
aux_shape_dic = dict(zip(aux_names, aux_shapes))
args = {}
for item in candidates:
key = item[:-4]
tmp = np.load(ROOT + item)
if key in arg_shape_dic:
target_shape = arg_shape_dic[key]
if key in aux_shape_dic:
target_shape = aux_shape_dic[key]
tmp = tmp.reshape(target_shape)
args[key] = mx.nd.zeros(tmp.shape)
args[key][:] = tmp
arg_params = {}
aux_params = {}
for name in arg_names:
if name in args:
arg_params[name] = args[name]
for name in aux_names:
if name in args:
aux_params[name] = args[name]
model = mx.model.FeedForward(ctx=mx.cpu(), symbol=softmax,
arg_params=arg_params, aux_params=aux_params, num_round=1,
learning_rate=0.05, momentum=0.9, wd=0.0001)
model.save("cifar_100_cxx")