nfmcclure / tensorflow_cookbook

Code for Tensorflow Machine Learning Cookbook

Home Page:https://www.packtpub.com/big-data-and-business-intelligence/tensorflow-machine-learning-cookbook-second-edition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

05_Stylenet_NeuralStyle problem

atushi0624 opened this issue · comments

The following error message occurs in 05_stylenet_neuralstyle: How do I fix it?

error message:
RuntimeError Traceback (most recent call last)
in ()
7 original_minus_mean = original_image - normalization_mean
8 original_norm = np.array([original_minus_mean])
----> 9 original_features[original_layer] = sess.run(vgg_net[original_layer], feed_dict={image: original_norm})
.
.
.
RuntimeError: The Session graph is empty. Add operations to the graph before calling run().

I fixed the following in tf.Session, but the result was the same.
g = tf.Graph()
sess = tf.Session(graph=g)

commented

Thanks for the notice. I found the same bug earlier and couldn't find a quick fix. I do remember there being a pull request that someone made that addressed this issue. I'm working on a v2 of all the code over the next few months and will update accordingly. Thanks.

commented

I have revamped the style net. I couldn't get mine to work at all.

Instead, I have adapted the method from here: https://github.com/anishathalye/neural-style . The way the feed-forward features and loss is calculated is much better.

The link above also has better smoothing and styling. I recommend using the linked version. The fixed version is a bit basic at the moment and really touchy on paramters.