AttributeError: module 'tensorflow' has no attribute 'get_default_graph'

前端 未结 5 716
一生所求
一生所求 2021-01-05 11:26

I am doing some task related to image captioning and I have loaded the weights of inception model like this

model = InceptionV3(weights=\'imagenet\')
         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-05 11:47

    Keras integrated into TensorFlow 2.0

    The article below cleared this up for me. Key points are:

    1. Keras is included in the TensorFlow 2.0 package
    2. So no need to install the stand-alone Keras package in your environment
    3. And now the fore-mentioned solutions of using "from tensorflow.keras…" make sense.

    After recognizing that and making the change, my code samples work with some minor changes here and there. https://www.pyimagesearch.com/2019/10/21/keras-vs-tf-keras-whats-the-difference-in-tensorflow-2-0/

提交回复
热议问题