I would like to restore the session from keras training model.
I tried to restore it through following process.
1,Create checkpoint file trained by keras
from keras.models import *
import keras.backend as K
from keras.applications.vgg16 import VGG16
model = VGG16_convolutions()
model.fit_generator(...)
with tf.Session() as ksess:
ksess = K.get_session()
saver.save(ksess, "./ksess.cpkt", global_step=0, latest_filename="checkpoint_state")
2,Restore the session of tensorflow
import tensorflow as tf
with tf.name_scope("block1_conv1"):
block1_conv1_kernel = tf.Variable(initial_value=0, name="kernel")
block1_conv1_bias = tf.Variable(initial_value=0, name="bias")
with tf.name_scope("block1_conv2"):
block1_conv2_kernel = tf.Variable(initial_value=0, name="kernel")
block1_conv2_bias = tf.Variable(initial_value=0, name="bias")
...
sess = tf.Session()
saver = tf.train.Saver()
saver = tf.train.import_meta_graph("ksess.ckpt-0.meta")
saver.restore(sess, "./ksess.ckpt")
So, how can I restore session from keras training model?
Best regards.