I run into a problem when I try to load a saved model written in tensorflow. The code is available here(code1). The code loads a pretrained model and uses the pretrained model to compute results with different inputs. The saved model files are available here. Actually the saved model was obtained by training a network which is a variation of pix2pixgan(code2).
The toy example is like
myinput_np, mytarget_np, bbox = my_readimg_np('test2.jpg')
#load gan graph
saver = tf.train.import_meta_graph(checkpoint_path + "model-210000.meta")
gan_graph = tf.get_default_graph()
convert_targets = gan_graph.get_tensor_by_name("convert_inputs/convert_image:0")
myinputs_p = tf.placeholder(tf.float32, shape=[1, 256, 256, 4])
mytargets_p = tf.placeholder(tf.float32, shape=[1, 256, 256, 3])
with tf.Session() as sess:
saver.restore(sess, tf.train.latest_checkpoint(checkpoint_path))
#coord = tf.train.Coordinator()
#threads = tf.train.start_queue_runners(sess=sess, coord=coord)
#load gan weights
results = sess.run(convert_targets, feed_dict={myinputs_p: myinput_np, mytargets_p: mytarget_np})
print(convert_targets.name)
print (results)
When I run code1 to load the pretrained model and compute results with inputs, the program seems blocked/suspend. The program is running but there isn't any output on the screen when "sess.run()" runs.
Some guys guessed it may be caused by the read thread of tensorlow and suggested to add
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess=sess, coord=coord).
After adding these two lines, I got the error "Process finished with exit code -1073741819 (0xC0000005)".
Could you please help me about it? Your help is of great importance to me. Thanks very much in advance.
User contributions licensed under CC BY-SA 3.0