I am currently having an issue, while executing my model predict of keras inside a tensorflow session.
with tf.Session(graph=graph) as sess:
sess.run(tf.global_variables_initializer())
## want to know how to add model.predict() inside this condition
predictions = model.predict(#my_model)
#predictions output is same not appending
or any alternative method will be helpful.
Any help would be appreciated.
from keras import backend as K
with tf.Graph().as_default():
with tf.Session() as sess:
K.set_session(sess)
model = load_model(model_path)
preds = model.predict(in_data)
from keras.models import load_model
with tf.Session(graph=K.get_session().graph) as session:
session.run(tf.global_variables_initializer())
model = load_model('model.h5')
predictions = model.predict(input)
Above code works for me. I am using keras mobilenet inside tensorflow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With