File "hsv_train.py", line 252, in <module>
train(FLAGS)
File "hsv_train.py", line 230, in train
_, loss_t, step = sess.run([train_op, loss, global_step], feed_dict=feed_dict)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 789, in run
run_metadata_ptr)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 997, in _run
feed_dict_string, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1132, in _do_run
target_list, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1152, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Tried to explicitly squeeze dimension 0 but dimension was not 1: 4
[[Node: Squeeze_11 = Squeeze[T=DT_FLOAT, squeeze_dims=[0], _device="/job:localhost/replica:0/task:0/cpu:0"](div_5)]]
Caused by op u'Squeeze_11', defined at:
File "hsv_train.py", line 252, in <module>
train(FLAGS)
File "hsv_train.py", line 126, in train
style_features_prev, style_features_curr = losses.get_style_features_flow(sess, FLAGS, images_placeholder, network_fn)
File "/home/zhangyule/fast-neural-style-flow-tensorflow/fast-neural-style-tensorflow/hsv_losses.py", line 131, in get_style_features_flow
return getFeatures(prev_image), getFeatures(curr_image)
File "/home/zhangyule/fast-neural-style-flow-tensorflow/fast-neural-style-tensorflow/hsv_losses.py", line 127, in getFeatures
feature = tf.squeeze(gram(feature), [0]) # remove the batch dimension
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 2281, in squeeze
return gen_array_ops._squeeze(input, axis, name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 3329, in _squeeze
squeeze_dims=squeeze_dims, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2506, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1269, in __init__
self._traceback = _extract_stack()
InvalidArgumentError (see above for traceback): Tried to explicitly squeeze dimension 0 but dimension was not 1: 4
[[Node: Squeeze_11 = Squeeze[T=DT_FLOAT, squeeze_dims=[0], _device="/job:localhost/replica:0/task:0/cpu:0"](div_5)]]
我想要在这个代码里实现preserving style的论文。 问下我如果需要share vgg网络的话,需要怎么做呢。我尝试果使用scope.reuse方式,但是似乎有问题。我在loss.py里修改get_style_features_flow函数如下,并在vgg.py中添加了reuse选项:
tensorflow运行时报错: