Keras, TensorFlow : “TypeError: Cannot interpret feed_dict key as Tensor”

后端 未结 1 920
猫巷女王i
猫巷女王i 2021-02-06 11:44

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

相关标签:
1条回答
  • 2021-02-06 12:25

    I found that there are a couple of workarounds, depending on various context:

    1. 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()
      
    2. Calling _make_predict_function():

      After you load your trained model call:

      model._make_predict_function()
      

      See explanation

    3. 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

    0 讨论(0)
提交回复
热议问题