2017-01-13 4 views
2

v10.1 버전의 tensorflow를 사용하여 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 파일 ..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 !