I am trying to load three different models into the same process. Only the first one works as expected, the rest return as random results. Basically the order is as follows:
- identify and compile the first model
- load trained weights to
- rename layers
- the same process for the second model
- the same process for the third model
So something like:
model1 = Model(inputs=Input(shape=input_size_im) , outputs=layers_firstmodel)
model1.compile(optimizer='sgd', loss='mse')
model1.load_weights(weights_first, by_name=True)
model2 = Model(inputs=Input(shape=input_size_im) , outputs=layers_secondmodel)
model2.compile(optimizer='sgd', loss='mse')
model2.load_weights(weights_second, by_name=True)
model3 = Model(inputs=Input(shape=input_size_im) , outputs=layers_thirdmodel)
model3.compile(optimizer='sgd', loss='mse')
model3.load_weights(weights_third, by_name=True)
for im in list_images:
results_firstmodel = model1.predict(im)
results_secondmodel = model2.predict(im)
results_thirdmodel = model2.predict(im)
I would like to draw some conclusions because of the heap of images. For this, the idea is to loop the images and perform the output with these three algorithms and return the results.
, . , . , ( , - , sess.run(tf.global_variables_initializer()) ). , , " tensorflow (/device: GPU: 0)".
Tensorflow 1.4.0-rc0, Keras 2.1.1 โโUbuntu 16.04 4.14.