CNNCreator_CifarClassifierNetwork.py 18.9 KB
Newer Older
1
from caffe2.python import workspace, core, model_helper, brew, optimizer
2
3
4
from caffe2.python.predictor import mobile_exporter
from caffe2.proto import caffe2_pb2
import numpy as np
5
import math
6
import logging
7
import os
8
import sys
9
import lmdb
10

11
12
13
class CNNCreator_CifarClassifierNetwork:

    module = None
14
15
16
    _current_dir_ = os.path.join('./')
    _data_dir_    = os.path.join(_current_dir_, 'data', 'CifarClassifierNetwork')
    _model_dir_   = os.path.join(_current_dir_, 'model', 'CifarClassifierNetwork')
17

18
19
    _init_net_    = os.path.join(_model_dir_, 'init_net.pb')
    _predict_net_ = os.path.join(_model_dir_, 'predict_net.pb')
20

21
22
23
24
25
26
27
28
29
30
31
    def get_total_num_iter(self, num_epoch, batch_size, dataset_size):
        #Force floating point calculation
        batch_size_float = float(batch_size)
        dataset_size_float = float(dataset_size)

        iterations_float = math.ceil(num_epoch*(dataset_size_float/batch_size_float))
        iterations_int = int(iterations_float)

        return iterations_int


32
33
    def add_input(self, model, batch_size, db, db_type, device_opts):
        with core.DeviceScope(device_opts):
34
35
36
37
38
39
40
            if not os.path.isdir(db):
                logging.error("Data loading failure. Directory '" + os.path.abspath(db) + "' does not exist.")
                sys.exit(1)
            elif not (os.path.isfile(os.path.join(db, 'data.mdb')) and os.path.isfile(os.path.join(db, 'lock.mdb'))):
                logging.error("Data loading failure. Directory '" + os.path.abspath(db) + "' does not contain lmdb files.")
                sys.exit(1)

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
            # load the data
            data_uint8, label = brew.db_input(
                model,
                blobs_out=["data_uint8", "label"],
                batch_size=batch_size,
                db=db,
                db_type=db_type,
            )
            # cast the data to float
            data = model.Cast(data_uint8, "data", to=core.DataType.FLOAT)

            # scale data from [0,255] down to [0,1]
            data = model.Scale(data, data, scale=float(1./256))

            # don't need the gradient for the backward pass
            data = model.StopGradient(data, data)
57
58
59
60

            dataset_size = int (lmdb.open(db).stat()['entries'])

            return data, label, dataset_size
61

62
    def create_model(self, model, data, device_opts, is_test):
63
64
65
66
    	with core.DeviceScope(device_opts):

    		data = data
    		# data, output shape: {[3,32,32]}
67
    		conv2_1_ = brew.conv(model, data, 'conv2_1_', dim_in=3, dim_out=8, kernel=3, stride=1, pad=1)
68
69
70
71
72
    		# conv2_1_, output shape: {[8,32,32]}
    		batchnorm2_1_ = mx.symbol.BatchNorm(data=conv2_1_,
    		    fix_gamma=True,
    		    name="batchnorm2_1_")
    		relu2_1_ = brew.relu(model, batchnorm2_1_, batchnorm2_1_)
73
    		conv3_1_ = brew.conv(model, relu2_1_, 'conv3_1_', dim_in=8, dim_out=8, kernel=3, stride=1, pad=1)
74
75
76
77
    		# conv3_1_, output shape: {[8,32,32]}
    		batchnorm3_1_ = mx.symbol.BatchNorm(data=conv3_1_,
    		    fix_gamma=True,
    		    name="batchnorm3_1_")
78
    		conv2_2_ = brew.conv(model, data, 'conv2_2_', dim_in=3, dim_out=8, kernel=1, stride=1, pad=1)
79
80
81
82
83
84
85
    		# conv2_2_, output shape: {[8,32,32]}
    		batchnorm2_2_ = mx.symbol.BatchNorm(data=conv2_2_,
    		    fix_gamma=True,
    		    name="batchnorm2_2_")
    		add4_ = batchnorm3_1_ + batchnorm2_2_
    		# add4_, output shape: {[8,32,32]}
    		relu4_ = brew.relu(model, add4_, add4_)
86
    		conv5_1_ = brew.conv(model, relu4_, 'conv5_1_', dim_in=8, dim_out=16, kernel=3, stride=2, pad=1)
87
88
89
90
91
    		# conv5_1_, output shape: {[16,16,16]}
    		batchnorm5_1_ = mx.symbol.BatchNorm(data=conv5_1_,
    		    fix_gamma=True,
    		    name="batchnorm5_1_")
    		relu5_1_ = brew.relu(model, batchnorm5_1_, batchnorm5_1_)
92
    		conv6_1_ = brew.conv(model, relu5_1_, 'conv6_1_', dim_in=16, dim_out=16, kernel=3, stride=1, pad=1)
93
94
95
96
    		# conv6_1_, output shape: {[16,16,16]}
    		batchnorm6_1_ = mx.symbol.BatchNorm(data=conv6_1_,
    		    fix_gamma=True,
    		    name="batchnorm6_1_")
97
    		conv5_2_ = brew.conv(model, relu4_, 'conv5_2_', dim_in=8, dim_out=16, kernel=1, stride=2, pad=1)
98
99
100
101
102
103
104
    		# conv5_2_, output shape: {[16,16,16]}
    		batchnorm5_2_ = mx.symbol.BatchNorm(data=conv5_2_,
    		    fix_gamma=True,
    		    name="batchnorm5_2_")
    		add7_ = batchnorm6_1_ + batchnorm5_2_
    		# add7_, output shape: {[16,16,16]}
    		relu7_ = brew.relu(model, add7_, add7_)
105
    		conv8_1_ = brew.conv(model, relu7_, 'conv8_1_', dim_in=16, dim_out=16, kernel=3, stride=1, pad=1)
106
107
108
109
110
    		# conv8_1_, output shape: {[16,16,16]}
    		batchnorm8_1_ = mx.symbol.BatchNorm(data=conv8_1_,
    		    fix_gamma=True,
    		    name="batchnorm8_1_")
    		relu8_1_ = brew.relu(model, batchnorm8_1_, batchnorm8_1_)
111
    		conv9_1_ = brew.conv(model, relu8_1_, 'conv9_1_', dim_in=16, dim_out=16, kernel=3, stride=1, pad=1)
112
113
114
115
116
117
118
    		# conv9_1_, output shape: {[16,16,16]}
    		batchnorm9_1_ = mx.symbol.BatchNorm(data=conv9_1_,
    		    fix_gamma=True,
    		    name="batchnorm9_1_")
    		add10_ = batchnorm9_1_ + relu7_
    		# add10_, output shape: {[16,16,16]}
    		relu10_ = brew.relu(model, add10_, add10_)
119
    		conv11_1_ = brew.conv(model, relu10_, 'conv11_1_', dim_in=16, dim_out=16, kernel=3, stride=1, pad=1)
120
121
122
123
124
    		# conv11_1_, output shape: {[16,16,16]}
    		batchnorm11_1_ = mx.symbol.BatchNorm(data=conv11_1_,
    		    fix_gamma=True,
    		    name="batchnorm11_1_")
    		relu11_1_ = brew.relu(model, batchnorm11_1_, batchnorm11_1_)
125
    		conv12_1_ = brew.conv(model, relu11_1_, 'conv12_1_', dim_in=16, dim_out=16, kernel=3, stride=1, pad=1)
126
127
128
129
130
131
132
    		# conv12_1_, output shape: {[16,16,16]}
    		batchnorm12_1_ = mx.symbol.BatchNorm(data=conv12_1_,
    		    fix_gamma=True,
    		    name="batchnorm12_1_")
    		add13_ = batchnorm12_1_ + relu10_
    		# add13_, output shape: {[16,16,16]}
    		relu13_ = brew.relu(model, add13_, add13_)
133
    		conv14_1_ = brew.conv(model, relu13_, 'conv14_1_', dim_in=16, dim_out=32, kernel=3, stride=2, pad=1)
134
135
136
137
138
    		# conv14_1_, output shape: {[32,8,8]}
    		batchnorm14_1_ = mx.symbol.BatchNorm(data=conv14_1_,
    		    fix_gamma=True,
    		    name="batchnorm14_1_")
    		relu14_1_ = brew.relu(model, batchnorm14_1_, batchnorm14_1_)
139
    		conv15_1_ = brew.conv(model, relu14_1_, 'conv15_1_', dim_in=32, dim_out=32, kernel=3, stride=1, pad=1)
140
141
142
143
    		# conv15_1_, output shape: {[32,8,8]}
    		batchnorm15_1_ = mx.symbol.BatchNorm(data=conv15_1_,
    		    fix_gamma=True,
    		    name="batchnorm15_1_")
144
    		conv14_2_ = brew.conv(model, relu13_, 'conv14_2_', dim_in=16, dim_out=32, kernel=1, stride=2, pad=1)
145
146
147
148
149
150
151
    		# conv14_2_, output shape: {[32,8,8]}
    		batchnorm14_2_ = mx.symbol.BatchNorm(data=conv14_2_,
    		    fix_gamma=True,
    		    name="batchnorm14_2_")
    		add16_ = batchnorm15_1_ + batchnorm14_2_
    		# add16_, output shape: {[32,8,8]}
    		relu16_ = brew.relu(model, add16_, add16_)
152
    		conv17_1_ = brew.conv(model, relu16_, 'conv17_1_', dim_in=32, dim_out=32, kernel=3, stride=1, pad=1)
153
154
155
156
157
    		# conv17_1_, output shape: {[32,8,8]}
    		batchnorm17_1_ = mx.symbol.BatchNorm(data=conv17_1_,
    		    fix_gamma=True,
    		    name="batchnorm17_1_")
    		relu17_1_ = brew.relu(model, batchnorm17_1_, batchnorm17_1_)
158
    		conv18_1_ = brew.conv(model, relu17_1_, 'conv18_1_', dim_in=32, dim_out=32, kernel=3, stride=1, pad=1)
159
160
161
162
163
164
165
    		# conv18_1_, output shape: {[32,8,8]}
    		batchnorm18_1_ = mx.symbol.BatchNorm(data=conv18_1_,
    		    fix_gamma=True,
    		    name="batchnorm18_1_")
    		add19_ = batchnorm18_1_ + relu16_
    		# add19_, output shape: {[32,8,8]}
    		relu19_ = brew.relu(model, add19_, add19_)
166
    		conv20_1_ = brew.conv(model, relu19_, 'conv20_1_', dim_in=32, dim_out=32, kernel=3, stride=1, pad=1)
167
168
169
170
171
    		# conv20_1_, output shape: {[32,8,8]}
    		batchnorm20_1_ = mx.symbol.BatchNorm(data=conv20_1_,
    		    fix_gamma=True,
    		    name="batchnorm20_1_")
    		relu20_1_ = brew.relu(model, batchnorm20_1_, batchnorm20_1_)
172
    		conv21_1_ = brew.conv(model, relu20_1_, 'conv21_1_', dim_in=32, dim_out=32, kernel=3, stride=1, pad=1)
173
174
175
176
177
178
179
    		# conv21_1_, output shape: {[32,8,8]}
    		batchnorm21_1_ = mx.symbol.BatchNorm(data=conv21_1_,
    		    fix_gamma=True,
    		    name="batchnorm21_1_")
    		add22_ = batchnorm21_1_ + relu19_
    		# add22_, output shape: {[32,8,8]}
    		relu22_ = brew.relu(model, add22_, add22_)
180
    		conv23_1_ = brew.conv(model, relu22_, 'conv23_1_', dim_in=32, dim_out=64, kernel=3, stride=2, pad=1)
181
182
183
184
185
    		# conv23_1_, output shape: {[64,4,4]}
    		batchnorm23_1_ = mx.symbol.BatchNorm(data=conv23_1_,
    		    fix_gamma=True,
    		    name="batchnorm23_1_")
    		relu23_1_ = brew.relu(model, batchnorm23_1_, batchnorm23_1_)
186
    		conv24_1_ = brew.conv(model, relu23_1_, 'conv24_1_', dim_in=64, dim_out=64, kernel=3, stride=1, pad=1)
187
188
189
190
    		# conv24_1_, output shape: {[64,4,4]}
    		batchnorm24_1_ = mx.symbol.BatchNorm(data=conv24_1_,
    		    fix_gamma=True,
    		    name="batchnorm24_1_")
191
    		conv23_2_ = brew.conv(model, relu22_, 'conv23_2_', dim_in=32, dim_out=64, kernel=1, stride=2, pad=1)
192
193
194
195
196
197
198
    		# conv23_2_, output shape: {[64,4,4]}
    		batchnorm23_2_ = mx.symbol.BatchNorm(data=conv23_2_,
    		    fix_gamma=True,
    		    name="batchnorm23_2_")
    		add25_ = batchnorm24_1_ + batchnorm23_2_
    		# add25_, output shape: {[64,4,4]}
    		relu25_ = brew.relu(model, add25_, add25_)
199
    		conv26_1_ = brew.conv(model, relu25_, 'conv26_1_', dim_in=64, dim_out=64, kernel=3, stride=1, pad=1)
200
201
202
203
204
    		# conv26_1_, output shape: {[64,4,4]}
    		batchnorm26_1_ = mx.symbol.BatchNorm(data=conv26_1_,
    		    fix_gamma=True,
    		    name="batchnorm26_1_")
    		relu26_1_ = brew.relu(model, batchnorm26_1_, batchnorm26_1_)
205
    		conv27_1_ = brew.conv(model, relu26_1_, 'conv27_1_', dim_in=64, dim_out=64, kernel=3, stride=1, pad=1)
206
207
208
209
210
211
212
    		# conv27_1_, output shape: {[64,4,4]}
    		batchnorm27_1_ = mx.symbol.BatchNorm(data=conv27_1_,
    		    fix_gamma=True,
    		    name="batchnorm27_1_")
    		add28_ = batchnorm27_1_ + relu25_
    		# add28_, output shape: {[64,4,4]}
    		relu28_ = brew.relu(model, add28_, add28_)
213
    		conv29_1_ = brew.conv(model, relu28_, 'conv29_1_', dim_in=64, dim_out=64, kernel=3, stride=1, pad=1)
214
215
216
217
218
    		# conv29_1_, output shape: {[64,4,4]}
    		batchnorm29_1_ = mx.symbol.BatchNorm(data=conv29_1_,
    		    fix_gamma=True,
    		    name="batchnorm29_1_")
    		relu29_1_ = brew.relu(model, batchnorm29_1_, batchnorm29_1_)
219
    		conv30_1_ = brew.conv(model, relu29_1_, 'conv30_1_', dim_in=64, dim_out=64, kernel=3, stride=1, pad=1)
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
    		# conv30_1_, output shape: {[64,4,4]}
    		batchnorm30_1_ = mx.symbol.BatchNorm(data=conv30_1_,
    		    fix_gamma=True,
    		    name="batchnorm30_1_")
    		add31_ = batchnorm30_1_ + relu28_
    		# add31_, output shape: {[64,4,4]}
    		relu31_ = brew.relu(model, add31_, add31_)
    		globalpooling31_ = mx.symbol.Pooling(data=relu31_,
    		    global_pool=True,
    		    kernel=(1,1),
    		    pool_type="avg",
    		    name="globalpooling31_")
    		# globalpooling31_, output shape: {[64,1,1]}
    		fc31_ = brew.fc(model, globalpooling31_, 'fc31_', dim_in=64, dim_out=128)
    		# fc31_, output shape: {[128,1,1]}
235
    		dropout31_ = brew.dropout(model, fc31_, 'dropout31_', ratio=0.5, is_test=False)
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
    		fc32_ = brew.fc(model, dropout31_, 'fc32_', dim_in=128, dim_out=10)
    		# fc32_, output shape: {[10,1,1]}
    		softmax = brew.softmax(model, fc32_, 'softmax')

    		return softmax

    # this adds the loss and optimizer
    def add_training_operators(self, model, output, label, device_opts, opt_type, base_learning_rate, policy, stepsize, epsilon, beta1, beta2, gamma, momentum) :
    	with core.DeviceScope(device_opts):
    		xent = model.LabelCrossEntropy([output, label], 'xent')
    		loss = model.AveragedLoss(xent, "loss")

    		model.AddGradientOperators([loss])

    		if opt_type == 'adam':
    		    if policy == 'step':
    		        opt = optimizer.build_adam(model, base_learning_rate=base_learning_rate, policy=policy, stepsize=stepsize, beta1=beta1, beta2=beta2, epsilon=epsilon)
    		    elif policy == 'fixed' or policy == 'inv':
    		        opt = optimizer.build_adam(model, base_learning_rate=base_learning_rate, policy=policy, beta1=beta1, beta2=beta2, epsilon=epsilon)
    		    print("adam optimizer selected")
    		elif opt_type == 'sgd':
    		    if policy == 'step':
    		        opt = optimizer.build_sgd(model, base_learning_rate=base_learning_rate, policy=policy, stepsize=stepsize, gamma=gamma, momentum=momentum)
    		    elif policy == 'fixed' or policy == 'inv':
    		        opt = optimizer.build_sgd(model, base_learning_rate=base_learning_rate, policy=policy, gamma=gamma, momentum=momentum)
    		    print("sgd optimizer selected")
    		elif opt_type == 'rmsprop':
    		    if policy == 'step':
    		        opt = optimizer.build_rms_prop(model, base_learning_rate=base_learning_rate, policy=policy, stepsize=stepsize, decay=gamma, momentum=momentum, epsilon=epsilon)
    		    elif policy == 'fixed' or policy == 'inv':
    		        opt = optimizer.build_rms_prop(model, base_learning_rate=base_learning_rate, policy=policy, decay=gamma, momentum=momentum, epsilon=epsilon)
    		    print("rmsprop optimizer selected")
    		elif opt_type == 'adagrad':
    		    if policy == 'step':
    		        opt = optimizer.build_adagrad(model, base_learning_rate=base_learning_rate, policy=policy, stepsize=stepsize, decay=gamma, epsilon=epsilon)
    		    elif policy == 'fixed' or policy == 'inv':
    		        opt = optimizer.build_adagrad(model, base_learning_rate=base_learning_rate, policy=policy, decay=gamma, epsilon=epsilon)
    		    print("adagrad optimizer selected")

    def add_accuracy(self, model, output, label, device_opts, eval_metric):
        with core.DeviceScope(device_opts):
            if eval_metric == 'accuracy':
                accuracy = brew.accuracy(model, [output, label], "accuracy")
            elif eval_metric == 'top_k_accuracy':
                accuracy = brew.accuracy(model, [output, label], "accuracy", top_k=3)
            return accuracy

283
284
    def train(self, num_epoch=1000, batch_size=64, context='gpu', eval_metric='accuracy', opt_type='adam', base_learning_rate=0.001, weight_decay=0.001, policy='fixed', stepsize=1, epsilon=1E-8, beta1=0.9, beta2=0.999, gamma=0.999, momentum=0.9) :
        if context == 'cpu':
285
286
            device_opts = core.DeviceOption(caffe2_pb2.CPU, 0)
            print("CPU mode selected")
287
        elif context == 'gpu':
288
289
290
            device_opts = core.DeviceOption(caffe2_pb2.CUDA, 0)
            print("GPU mode selected")

291
    	workspace.ResetWorkspace(self._model_dir_)
292
293
294
295

    	arg_scope = {"order": "NCHW"}
    	# == Training model ==
    	train_model= model_helper.ModelHelper(name="train_net", arg_scope=arg_scope)
296
    	data, label, train_dataset_size = self.add_input(train_model, batch_size=batch_size, db=os.path.join(self._data_dir_, 'train_lmdb'), db_type='lmdb', device_opts=device_opts)
297
    	softmax = self.create_model(train_model, data, device_opts=device_opts, is_test=False)
298
299
300
301
302
303
304
305
306
307
    	self.add_training_operators(train_model, softmax, label, device_opts, opt_type, base_learning_rate, policy, stepsize, epsilon, beta1, beta2, gamma, momentum)
    	self.add_accuracy(train_model, softmax, label, device_opts, eval_metric)
    	with core.DeviceScope(device_opts):
    		brew.add_weight_decay(train_model, weight_decay)

    	# Initialize and create the training network
    	workspace.RunNetOnce(train_model.param_init_net)
    	workspace.CreateNet(train_model.net, overwrite=True)

    	# Main Training Loop
308
309
310
    	iterations = self.get_total_num_iter(num_epoch, batch_size, train_dataset_size)
        print("** Starting Training for " + str(num_epoch) + " epochs = " + str(iterations) + " iterations **")
    	for i in range(iterations):
311
    		workspace.RunNet(train_model.net)
312
313
    		if i % 50 == 0:
    			print 'Iter ' + str(i) + ': ' + 'Loss ' + str(workspace.FetchBlob("loss")) + ' - ' + 'Accuracy ' + str(workspace.FetchBlob('accuracy'))
314
315
316
317
318
    	print("Training done")

    	print("== Running Test model ==")
    	# == Testing model. ==
    	test_model= model_helper.ModelHelper(name="test_net", arg_scope=arg_scope, init_params=False)
319
    	data, label, test_dataset_size = self.add_input(test_model, batch_size=batch_size, db=os.path.join(self._data_dir_, 'test_lmdb'), db_type='lmdb', device_opts=device_opts)
320
    	softmax = self.create_model(test_model, data, device_opts=device_opts, is_test=True)
321
322
323
324
325
    	self.add_accuracy(test_model, predictions, label, device_opts, eval_metric)
    	workspace.RunNetOnce(test_model.param_init_net)
    	workspace.CreateNet(test_model.net, overwrite=True)

    	# Main Testing Loop
326
327
    	test_accuracy = np.zeros(test_dataset_size/batch_size)
    	for i in range(test_dataset_size/batch_size):
328
329
330
331
332
333
334
335
336
337
    		# Run a forward pass of the net on the current batch
    		workspace.RunNet(test_model.net)
    		# Collect the batch accuracy from the workspace
    		test_accuracy[i] = workspace.FetchBlob('accuracy')

    	print('Test_accuracy: {:.4f}'.format(test_accuracy.mean()))

    	# == Deployment model. ==
    	# We simply need the main AddModel part.
    	deploy_model = model_helper.ModelHelper(name="deploy_net", arg_scope=arg_scope, init_params=False)
338
    	self.create_model(deploy_model, "data", device_opts, is_test=True)
339
340

    	print("Saving deploy model")
341
    	self.save_net(self._init_net_, self._predict_net_, deploy_model)
342
343
344
345
346
347
348
349
350

    def save_net(self, init_net_path, predict_net_path, model):

    	init_net, predict_net = mobile_exporter.Export(
    		workspace,
    		model.net,
    		model.params
    	)

351
        try:
352
            os.makedirs(self._model_dir_)
353
        except OSError:
354
            if not os.path.isdir(self._model_dir_):
355
356
                raise

357
    	print("Save the model to init_net.pb and predict_net.pb")
358
    	with open(predict_net_path, 'wb') as f:
359
    		f.write(model.net._net.SerializeToString())
360
    	with open(init_net_path, 'wb') as f:
361
362
363
    		f.write(init_net.SerializeToString())

    	print("Save the model to init_net.pbtxt and predict_net.pbtxt")
364
365

    	with open(init_net_path.replace('.pb','.pbtxt'), 'w') as f:
366
    		f.write(str(init_net))
367
    	with open(predict_net_path.replace('.pb','.pbtxt'), 'w') as f:
368
369
370
371
    		f.write(str(predict_net))
    	print("== Saved init_net and predict_net ==")

    def load_net(self, init_net_path, predict_net_path, device_opts):
372
373
374
375
376
377
378
379
380
        if not os.path.isfile(init_net_path):
            logging.error("Network loading failure. File '" + os.path.abspath(init_net_path) + "' does not exist.")
            sys.exit(1)
        elif not os.path.isfile(predict_net_path):
            logging.error("Network loading failure. File '" + os.path.abspath(predict_net_path) + "' does not exist.")
            sys.exit(1)

        init_def = caffe2_pb2.NetDef()
    	with open(init_net_path, 'rb') as f:
381
382
383
384
385
    		init_def.ParseFromString(f.read())
    		init_def.device_option.CopyFrom(device_opts)
    		workspace.RunNetOnce(init_def.SerializeToString())

    	net_def = caffe2_pb2.NetDef()
386
    	with open(predict_net_path, 'rb') as f:
387
388
389
    		net_def.ParseFromString(f.read())
    		net_def.device_option.CopyFrom(device_opts)
    		workspace.CreateNet(net_def.SerializeToString(), overwrite=True)
390
    	print("== Loaded init_net and predict_net ==")