2017-01-13 15 views
2

テンソルフローのv0.12.1バージョンを使用して、http://download.tensorflow.org/models/vgg_16_2016_08_28.tar.gzで利用可能なチェックポイントを使用して、事前にトレーニングされたvgg16モデルを微調整しようとしています。TFSlimで保存したチェックポイントの読み込み中にエラーが発生しました

私は、次のエラーを取得しています:

W tensorflow/core/framework/op_kernel.cc:975] Not found: Tensor name "Variable" not found in checkpoint files /home/code/tensorflow/vgg-tensorflow/vgg_16.ckpt 
    [[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_INT32], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]] 
W tensorflow/core/framework/op_kernel.cc:975] Not found: Tensor name "Variable" not found in checkpoint files /home/code/tensorflow/vgg-tensorflow/vgg_16.ckpt 
    [[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_INT32], _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_save/Const_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]] 

は助けを必要としています。私は数ヶ月前に同様の質問を投稿しました - 私はそれを過ぎていますが、良い解決策を見つけることができませんでした。

tensorflow.contrib.slim.nets 

私はckptファイルの2つのバージョンがあることを理解しています.v1とv2。これは問題かもしれませんか?これを解決するにはどうすればいいですか?

答えて

0

モデル定義によって生成された変数と、ckptファイルに格納されている変数との間に不一致がありました。具体的には、これが最初の変数でした。これを行うことで解決しました。

variables_to_restore = slim.get_variables_to_restore(exclude=['vgg_16/fc6','vgg_16/fc7','vgg_16/fc8']) 
print [v.name for v in variables_to_restore] 
restorer = tf.train.Saver(variables_to_restore[1:]) # remove first entry ! 
関連する問題