Thursday, 29 November 2018

Tensorflow to Keras: import graph def error on Keras model

I have a Tensorflow code for classifying images which I want to convert to Keras code. But I'm having trouble with the higher level API not having all codes which I desire. The problem which I have been stuck at is:

#net = get_vgg_model() <- got tf.VGG16 model
net = tf.keras.applications.VGG16()


g1 = tf.Graph()
with tf.Session(graph=g1, config=config) as sess, g1.device('/cpu:0'):
    tf.import_graph_def(net['graph_def'], name='vgg')

this code gives the error:

Traceback (most recent call last):
  File "app.py", line 16, in <module>
    from modules.xvision import Xvision
    File "/app/modules/xvision.py", line 84, in <module>
       tf.import_graph_def(net['graph_def'], name='vgg')
   TypeError: 'Model' object has no attribute '__getitem__'

Could someone help me with this graph?



from Tensorflow to Keras: import graph def error on Keras model

No comments:

Post a Comment