私はDCGANモデルを訓練しました。画像空間最適化によるニューロンの活性化のドライバを視覚化するライブラリにロードしたいと考えています。テンソルフローモデルをメタデータファイルからインポートする際にinput_mapを設定する
次のコードは機能しますが、次の画像解析を行うときには(1、幅、高さ、チャンネル)画像で作業する必要があります。これは痛みです(ネットワーク入力の形状に関するライブラリの仮定)。
graph = tf.Graph()
sess = tf.InteractiveSession(graph=graph)
t_input = tf.placeholder(np.float32, name='images') # define the input tensor
t_preprocessed = tf.expand_dims(t_input, 0)
new_saver = tf.train.import_meta_graph(model_fn, input_map={'images': t_input})
new_saver.restore(sess, './')
しかし、エラーが発生しました:
# creating TensorFlow session and loading the model
graph = tf.Graph()
sess = tf.InteractiveSession(graph=graph)
new_saver = tf.train.import_meta_graph(model_fn)
new_saver.restore(sess, './')
私はinput_mapを変更したいのですが、ソースを読んだ後、私はこのコードが動作するように期待
ValueError: tf.import_graph_def() requires a non-empty
name
ifinput_map
is used.
するとスタックtf.import_graph_def()
になって、名前フィールドがimport_scopeに設定されているので、私は以下を試しました:
KeyError
を相殺
10:私は「input_map」を設定するか否か
KeyError: "The name 'gradients/discriminator/minibatch/map/while/TensorArrayWrite/TensorArrayWriteV3_grad/TensorArrayReadV3/RefEnter:0' refers to a Tensor which does not exist. The operation, 'gradients/discriminator/minibatch/map/while/TensorArrayWrite/TensorArrayWriteV3_grad/TensorArrayReadV3/RefEnter', does not exist in the graph."
私は「import_scope」を設定した場合は、私は同じエラーを取得します。
ここからどこに行くのかわかりません。
自立した例がある場合は、それを見てうれしいです。 'input_map'がどのように[test](https://www.github.com/tensorflow/tensorflow/blob/master/tensorflow/python/framework/meta_graph_test.py#L262)で使われているかを見ることができます。私は可能な限り試験に近づき、それがどこで分かれるのかを見てみよう。 – drpng
@drpng私がオープンしたgithubの問題の完全な例があります(https://github.com/tensorflow/tensorflow/issues/7634)。テストを見ていただきありがとうございます。下位レベルの機能のためのアプローチを試してみます。 – Sevenless