Issues When Applying Model.predict() Inside Data Generator With Fit_generator()
Basically I am implementing a model that employs perceptual loss to perform single image super-resolution. I constructed my full model such that the input will first pass through t
Solution 1:
The problem here is mutli-threading. When you are calling the 6 workers, block2_conv2/Relu:0
is created after graph is terminated.
The problem is with _make_predict_function()
. You can check this file in your PC for the reasons(i got this from your error text) File "/home/lucien/anaconda3/envs/fyp/lib/python3.6/site-packages/keras/engine/training.py"
, line 1273, in predict_on_batch self._make_predict_function().
Some ways in which you can remove the errors are :
- Use
theano
backend. - call
model._make_predict_function()
right after loading the trained model. - Use global model :
Functions :
defload_model():
global model
model = yourmodel(weights=xx111122)
# this is key : save the graph after loading the modelglobal graph
graph = tf.get_default_graph()
While predicting:
with graph.as_default():
preds = model.predict(image)
#... etc
Post a Comment for "Issues When Applying Model.predict() Inside Data Generator With Fit_generator()"