Cannot run the method freeze_graph,index out of range

  python, tensorflow

I’m trying to export mine .h5 model to .pb file. I did export it once using tensorflow and it worked fine.
I am using Jypiter with tensorflow 1.1.13 and latest keras.

The code lokes like that :

from keras import backend as k
from tensorflow.python.tools import freeze_graph, optimize_for_inference_lib
import tensorflow as tf

input_node_name = ['lstm_1_input']
output_node_name = 'output/Softmax'
model_name='har_model'

tf.train.write_graph(k.get_session().graph_def, 'models', model_name + '_graph.pbtxt')
saver=tf.train.Saver()
saver.save(k.get_session(), 'models/'+model_name + '.chkp')

And i get the .chkp file which is fine,proof below:
enter image description here

But after i try to run the cell with freeze i got an error,I can’t understand why,month ago it just worked. As there any other way to convert this to .pb? I need the extension for mine Android project.

freeze_graph.freeze_graph('models/'+model_name + '_graph.pbtxt', None, False, 'models/'+model_name+'.chkp',
                         output_node_name, 'save/restore_all', 'save/Const:0', 'models/frozen_' + model_name + '.pb', True, "") 

Source: Python Questions

LEAVE A COMMENT