I am trying to use keras fune-tuning to develop image classify applications. I deployed that application to a web server and the image classification is succeeded.
Howev
I found that there are a couple of workarounds, depending on various context:
Using clear_session()
function:
from keras import backend as K
Then do following at the beginning or at the end of the function, after predicting all the data:
K.clear_session()
Calling _make_predict_function()
:
After you load your trained model call:
model._make_predict_function()
See explanation
Disable threading:
If you are running django server use this command:
python manage.py runserver --nothreading
For flask use this:
flask run --without-threads
If none of the above solutions work, check these links keras issue#6462, keras issue#2397