私はKerasライブラリで作業していますが、VGG16モデルを初期化しようとしていますが、このグラフの要素ではないすべての入力についてエラーが発生しています。私はTensorflowバックエンドを使用しています。ValueError:フェッチ引数<tf.Operation 'init_8' type = NoOp>はテンソルとして解釈できません。
入力:
from keras.applications.vgg16 import VGG16
model = VGG16()
出力:私はオープン引っ張らVGG16コードとドキュメントがkeras設定JSONに含ま
"image_data_format": "channels_last"
を有する上述
runfile('C:/Users/joshu/Documents/Code/Testing/vgg_tester.py', wdir='C:/Users/joshu/Documents/Code/Testing') Traceback (most recent call last):
File "", line 1, in runfile('C:/Users/joshu/Documents/Code/Testing/vgg_tester.py', wdir='C:/Users/joshu/Documents/Code/Testing')
File "C:\Users\joshu\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile execfile(filename, namespace)
File "C:\Users\joshu\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/joshu/Documents/Code/Testing/vgg_tester.py", line 11, in model = VGG16()
File "C:\Users\joshu\Anaconda3\lib\site-packages\keras\applications\vgg16.py", line 163, in VGG16 model.load_weights(weights_path)
File "C:\Users\joshu\Anaconda3\lib\site-packages\keras\engine\topology.py", line 2708, in load_weights self.load_weights_from_hdf5_group(f)
File "C:\Users\joshu\Anaconda3\lib\site-packages\keras\engine\topology.py", line 2794, in load_weights_from_hdf5_group K.batch_set_value(weight_value_tuples)
File "C:\Users\joshu\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 1860, in batch_set_value get_session().run(assign_ops, feed_dict=feed_dict)
File "C:\Users\joshu\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 121, in get_session _initialize_variables()
File "C:\Users\joshu\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 273, in _initialize_variables sess.run(tf.variables_initializer(uninitialized_variables))
File "C:\Users\joshu\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 778, in run run_metadata_ptr)
File "C:\Users\joshu\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 969, in _run fetch_handler = _FetchHandler(self._graph, fetches, feed_dict_string)
File "C:\Users\joshu\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 408, in init self._fetch_mapper = _FetchMapper.for_fetch(fetches)
File "C:\Users\joshu\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 238, in for_fetch return _ElementFetchMapper(fetches, contraction_fn)
File "C:\Users\joshu\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 274, in init 'Tensor. (%s)' % (fetch, str(e)))
ValueError: Fetch argument cannot be interpreted as a Tensor. (Operation name: "init_11" op: "NoOp" input: "^block1_conv1_W_8/Assign" input: "^block1_conv1_b_8/Assign" input: "^block1_conv2_W_8/Assign" input: "^block1_conv2_b_8/Assign" input: "^block2_conv1_W_8/Assign" input: "^block2_conv1_b_8/Assign" input: "^block2_conv2_W_8/Assign" input: "^block2_conv2_b_8/Assign" input: "^block3_conv1_W_8/Assign" input: "^block3_conv1_b_8/Assign" input: "^block3_conv2_W_8/Assign" input: "^block3_conv2_b_8/Assign" input: "^block3_conv3_W_8/Assign" input: "^block3_conv3_b_8/Assign" input: "^block4_conv1_W_8/Assign" input: "^block4_conv1_b_8/Assign" input: "^block4_conv2_W_8/Assign" input: "^block4_conv2_b_8/Assign" input: "^block4_conv3_W_8/Assign" input: "^block4_conv3_b_8/Assign" input: "^block5_conv1_W_8/Assign" input: "^block5_conv1_b_8/Assign" input: "^block5_conv2_W_8/Assign" input: "^block5_conv2_b_8/Assign" input: "^block5_conv3_W_8/Assign" input: "^block5_conv3_b_8/Assign" input: "^fc1_W_4/Assign" input: "^fc1_b_4/Assign" input: "^fc2_W_4/Assign" input: "^fc2_b_4/Assign" input: "^predictions_W_4/Assign" input: "^predictions_b_4/Assign" input: "^cond_153/switch_f" is not an element of this graph.)
データ形式はNHWCおよびNCHWと異なる場合があります。https://www.tensorflow.org/performance/performance_guide – LKT