您好!我执行时报如下错误,这是什么原因导致的呢?求教
Traceback (most recent call last):
File "eval.py", line 62, in
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 44, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "eval.py", line 38, in main
image = reader.get_image(FLAGS.image_file, height, width, image_preprocessing_fn)
File "/home/minist/deep_learning/style transfer code/hzy46 fast-neural-style-tensorflow/fast-neural-style-tensorflow-master/reader.py", line 10, in get_image
return preprocess_fn(image, height, width)
File "/home/minist/deep_learning/style transfer code/hzy46 fast-neural-style-tensorflow/fast-neural-style-tensorflow-master/preprocessing/preprocessing_factory.py", line 70, in preprocessing_fn
image, output_height, output_width, is_training=is_training, **kwargs)
File "/home/minist/deep_learning/style transfer code/hzy46 fast-neural-style-tensorflow/fast-neural-style-tensorflow-master/preprocessing/vgg_preprocessing.py", line 388, in preprocess_image
resize_side_min)
File "/home/minist/deep_learning/style transfer code/hzy46 fast-neural-style-tensorflow/fast-neural-style-tensorflow-master/preprocessing/vgg_preprocessing.py", line 357, in preprocess_for_eval
return _mean_image_subtraction(image, [_R_MEAN, _G_MEAN, _B_MEAN])
File "/home/minist/deep_learning/style transfer code/hzy46 fast-neural-style-tensorflow/fast-neural-style-tensorflow-master/preprocessing/vgg_preprocessing.py", line 231, in _mean_image_subtraction
channels = tf.split(2, num_channels, image)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1319, in split
split_dim=axis, num_split=num_or_size_splits, value=value, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 3385, in _split
num_split=num_split, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 509, in apply_op
(prefix, dtypes.as_dtype(input_arg.type).name))
TypeError: Input 'split_dim' of 'Split' Op has type float32 that does not match expected type of int32.
因为tensorflow version > r0.12
, tf.split
的参数位置换了,打开vgg_preprocessing.py, 将 tf.split(2, num_channels, image)
修改为tf.split(image, num_channels, 2)
参考链接:http://stackoverflow.com/questions/41842440/tensorflow-input-split-dim-of-split-op-has-type-float32-that-does-not-matc
Feb 24
'17 14:02
Ocxs
python eval.py --model_file model/wave.ckpt-done --image_file img/test.jpg 执行报错 !y
Caused by op 'save/RestoreV2_15', defined at:
File "eval.py", line 77, in
tf.app.run()
File "/home/thomas/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "eval.py", line 54, in main
saver = tf.train.Saver(tf.global_variables(), write_version=tf.train.SaverDef.V1)
File "/home/thomas/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1056, in init
self.build()
File "/home/thomas/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1086, in build
restore_sequentially=self._restore_sequentially)
File "/home/thomas/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 691, in build
restore_sequentially, reshape)
File "/home/thomas/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 407, in _AddRestoreOps
tensors = self.restore_op(filename_tensor, saveable, preferred_shard)
File "/home/thomas/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 247, in restore_op
[spec.tensor.dtype])[0])
File "/home/thomas/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_io_ops.py", line 669, in restore_v2
dtypes=dtypes, name=name)
File "/home/thomas/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 768, in apply_op
op_def=op_def)
File "/home/thomas/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2336, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/home/thomas/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1228, in init
self._traceback = _extract_stack()
InvalidArgumentError (see above for traceback): Unsuccessful TensorSliceReader constructor: Failed to get matching files on /home/thomas/fast-neural-style-tensorflow/model/wave.ckpt-done: Not found: /home/thomas/fast-neural-style-tensorflow/model
[[Node: save/RestoreV2_15 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/RestoreV2_15/tensor_names, save/RestoreV2_15/shape_and_slices)]]
[[Node: save/RestoreV2_15/_7 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/gpu:0", send_device="/job:localhost/replica:0/task:0/cpu:0", send_device_incarnation=1, tensor_name="edge_56_save/RestoreV2_15", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/gpu:0"]]