【发布时间】:2019-08-13 20:18:29
【问题描述】:
我收到会话图为空的错误消息。我在 stackoverflow 页面上查看了不同的问题,但对我没有任何帮助。
import os
import sys
import scipy.io
import scipy.misc
import matplotlib.pyplot as plt
from matplotlib.pyplot import imshow
from PIL import Image
from nst_utils import *
import numpy as np
import tensorflow as tf
model = load_vgg_model("imagenet-vgg-verydeep-19.mat")
tf.reset_default_graph()
# Start interactive session
sess = tf.InteractiveSession()
content_image = scipy.misc.imresize(arr = scipy.misc.imread("content.jpeg"), size=(300,400,3))
content_image = reshape_and_normalize_image(content_image)
style_image = scipy.misc.imresize(arr = scipy.misc.imread("monet.jpg"), size=(300,400,3))
style_image = reshape_and_normalize_image(style_image)
generated_image = generate_noise_image(content_image)
imshow(generated_image[0])
# Assign the content image to be the input of the VGG model.
with tf.Session() as sess:
sess.run(model['input'].assign(content_image))
我收到“RuntimeError:会话图为空。在调用 run() 之前向图中添加操作。”感谢我能得到的每一个建议:)
【问题讨论】:
-
请发布一个可重现的示例,以便有人可以帮助您。
-
嗨,我更新了代码示例
标签: tensorflow session