<p dir="auto">I trained a model with tensorflow1.4， and want to finetune in tensorflow 1.3，following is part of my code:<br>
1）train code with tf1.4:<br>
with slim.arg_scope(inception_v3.inception_v3_arg_scope()):<br>
y, endpoints = inception_v3.inception_v3(x, CLASSES, True)<br>
2）test code with master:<br>
with slim.arg_scope(inception_v3.inception_v3_arg_scope()):<br>
y, end_points = inception_v3.inception_v3(x, label_dim, False)<br>
with tf.name_scope('train'):<br>
loss = custom_function.loss_function(y, y_)<br>
train_op = custom_function.train_function(loss, learn_rate)<br>
accuracy_op = custom_function.accuracy_function(y, y_)<br>
output_result = custom_function.output_result(y)<br>
init_op = tf.group(tf.global_variables_initializer(), tf.local_variables_initializer())<br>
saver = tf.train.Saver()<br>
sess_config = tf.ConfigProto(allow_soft_placement=True, log_device_placement=False)<br>
sess_config.gpu_options.allow_growth = True<br>
sess = tf.Session(config=sess_config)<br>
merged_summary = tf.summary.merge_all()<br>
train_writer = tf.summary.FileWriter(log_dir, sess.graph)<br>
#saver = tf.train.import_meta_graph('model_meishi/inception-v3/graph-1205-190241.meta',clear_devices=True)<br>
sess.run(init_op)<br>
coord = tf.train.Coordinator()<br>
threads = tf.train.start_queue_runners(sess=sess, coord=coord)<br>
#saver.restore(sess, "model_meishi/model-6690")<br>
saver.restore(sess, "model_meishi/inception-v3/model-12042")<br>
error is:NotFoundError (see above for traceback): Key InceptionV3/Mixed_7b/Branch_2/Conv2d_0a_1x1/BatchNorm/gamma not found in checkpoint<br>
at first, i think the reason is slim.argscope is not the same in these two version tensorflow and<br>
I tried to replace the slim of tf1.4 with the slim of master，but the error still exist.<br>
what's the problem of my code ?thx</p>
<p dir="auto">I am trying to use the given pretrained inception v3 model in research/slim, but the weights don't match</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import tensorflow as tf
from nets.inception_v3 import inception_v3_base
tf_images = tf.placeholder(tf.float32, [None, 299, 299, 3])
inception,inception_layers=inception_v3_base(tf_images)
saver = tf.train.Saver()
with tf.Session() as sess:
    saver.restore(sess,'models/weights/inception_v3.ckpt')"><pre class="notranslate"><code class="notranslate">import tensorflow as tf
from nets.inception_v3 import inception_v3_base
tf_images = tf.placeholder(tf.float32, [None, 299, 299, 3])
inception,inception_layers=inception_v3_base(tf_images)
saver = tf.train.Saver()
with tf.Session() as sess:
    saver.restore(sess,'models/weights/inception_v3.ckpt')
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="NotFoundError: Tensor name &quot;InceptionV3/Mixed_5c/Branch_2/Conv2d_0a_1x1/biases&quot; not found in checkpoint files models/weights/inception_v3.ckpt
	 [[Node: save/RestoreV2_30 = RestoreV2[dtypes=[DT_FLOAT], _device=&quot;/job:localhost/replica:0/task:0/device:CPU:0&quot;](_arg_save/Const_0_0, save/RestoreV2_30/tensor_names, save/RestoreV2_30/shape_and_slices)]]
	 [[Node: save/RestoreV2_184/_5 = _Recv[client_terminated=false, recv_device=&quot;/job:localhost/replica:0/task:0/device:GPU:0&quot;, send_device=&quot;/job:localhost/replica:0/task:0/device:CPU:0&quot;, send_device_incarnation=1, tensor_name=&quot;edge_384_save/RestoreV2_184&quot;, tensor_type=DT_FLOAT, _device=&quot;/job:localhost/replica:0/task:0/device:GPU:0&quot;]()]]"><pre class="notranslate"><code class="notranslate">NotFoundError: Tensor name "InceptionV3/Mixed_5c/Branch_2/Conv2d_0a_1x1/biases" not found in checkpoint files models/weights/inception_v3.ckpt
	 [[Node: save/RestoreV2_30 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2_30/tensor_names, save/RestoreV2_30/shape_and_slices)]]
	 [[Node: save/RestoreV2_184/_5 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_384_save/RestoreV2_184", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
</code></pre></div>
<p dir="auto">Looking at the variables they indeed don't match</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from tensorflow.python import pywrap_tensorflow
reader = pywrap_tensorflow.NewCheckpointReader('models/weights/inception_v3.ckpt')
var_to_shape_map = reader.get_variable_to_shape_map()
print(sorted(var_to_shape_map))
print([var.name for var in saver._var_list])"><pre class="notranslate"><code class="notranslate">from tensorflow.python import pywrap_tensorflow
reader = pywrap_tensorflow.NewCheckpointReader('models/weights/inception_v3.ckpt')
var_to_shape_map = reader.get_variable_to_shape_map()
print(sorted(var_to_shape_map))
print([var.name for var in saver._var_list])
</code></pre></div>
<p dir="auto">For the checkpoint a subsample is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="'InceptionV3/Conv2d_1a_3x3/BatchNorm/beta',
 'InceptionV3/Conv2d_1a_3x3/BatchNorm/moving_mean',
 'InceptionV3/Conv2d_1a_3x3/BatchNorm/moving_variance',
 'InceptionV3/Conv2d_1a_3x3/weights',
 'InceptionV3/Conv2d_2a_3x3/BatchNorm/beta',
 'InceptionV3/Conv2d_2a_3x3/BatchNorm/moving_mean',
 'InceptionV3/Conv2d_2a_3x3/BatchNorm/moving_variance',
 'InceptionV3/Conv2d_2a_3x3/weights',
 'InceptionV3/Conv2d_2b_3x3/BatchNorm/beta',
 'InceptionV3/Conv2d_2b_3x3/BatchNorm/moving_mean',
 'InceptionV3/Conv2d_2b_3x3/BatchNorm/moving_variance',
 'InceptionV3/Conv2d_2b_3x3/weights',
 'InceptionV3/Conv2d_3b_1x1/BatchNorm/beta',
 'InceptionV3/Conv2d_3b_1x1/BatchNorm/moving_mean',
 'InceptionV3/Conv2d_3b_1x1/BatchNorm/moving_variance',
 'InceptionV3/Conv2d_3b_1x1/weights',
 'InceptionV3/Conv2d_4a_3x3/BatchNorm/beta',
 'InceptionV3/Conv2d_4a_3x3/BatchNorm/moving_mean',
 'InceptionV3/Conv2d_4a_3x3/BatchNorm/moving_variance',
 'InceptionV3/Conv2d_4a_3x3/weights',"><pre class="notranslate"><code class="notranslate">'InceptionV3/Conv2d_1a_3x3/BatchNorm/beta',
 'InceptionV3/Conv2d_1a_3x3/BatchNorm/moving_mean',
 'InceptionV3/Conv2d_1a_3x3/BatchNorm/moving_variance',
 'InceptionV3/Conv2d_1a_3x3/weights',
 'InceptionV3/Conv2d_2a_3x3/BatchNorm/beta',
 'InceptionV3/Conv2d_2a_3x3/BatchNorm/moving_mean',
 'InceptionV3/Conv2d_2a_3x3/BatchNorm/moving_variance',
 'InceptionV3/Conv2d_2a_3x3/weights',
 'InceptionV3/Conv2d_2b_3x3/BatchNorm/beta',
 'InceptionV3/Conv2d_2b_3x3/BatchNorm/moving_mean',
 'InceptionV3/Conv2d_2b_3x3/BatchNorm/moving_variance',
 'InceptionV3/Conv2d_2b_3x3/weights',
 'InceptionV3/Conv2d_3b_1x1/BatchNorm/beta',
 'InceptionV3/Conv2d_3b_1x1/BatchNorm/moving_mean',
 'InceptionV3/Conv2d_3b_1x1/BatchNorm/moving_variance',
 'InceptionV3/Conv2d_3b_1x1/weights',
 'InceptionV3/Conv2d_4a_3x3/BatchNorm/beta',
 'InceptionV3/Conv2d_4a_3x3/BatchNorm/moving_mean',
 'InceptionV3/Conv2d_4a_3x3/BatchNorm/moving_variance',
 'InceptionV3/Conv2d_4a_3x3/weights',
</code></pre></div>
<p dir="auto">And for the saver:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="'InceptionV3/Conv2d_1a_3x3/weights:0',
 'InceptionV3/Conv2d_1a_3x3/biases:0',
 'InceptionV3/Conv2d_2a_3x3/weights:0',
 'InceptionV3/Conv2d_2a_3x3/biases:0',
 'InceptionV3/Conv2d_2b_3x3/weights:0',
 'InceptionV3/Conv2d_2b_3x3/biases:0',
 'InceptionV3/Conv2d_3b_1x1/weights:0',
 'InceptionV3/Conv2d_3b_1x1/biases:0',
 'InceptionV3/Conv2d_4a_3x3/weights:0',
 'InceptionV3/Conv2d_4a_3x3/biases:0',"><pre class="notranslate"><code class="notranslate">'InceptionV3/Conv2d_1a_3x3/weights:0',
 'InceptionV3/Conv2d_1a_3x3/biases:0',
 'InceptionV3/Conv2d_2a_3x3/weights:0',
 'InceptionV3/Conv2d_2a_3x3/biases:0',
 'InceptionV3/Conv2d_2b_3x3/weights:0',
 'InceptionV3/Conv2d_2b_3x3/biases:0',
 'InceptionV3/Conv2d_3b_1x1/weights:0',
 'InceptionV3/Conv2d_3b_1x1/biases:0',
 'InceptionV3/Conv2d_4a_3x3/weights:0',
 'InceptionV3/Conv2d_4a_3x3/biases:0',
</code></pre></div>
<p dir="auto">Looks like a mismatch with the biases and the batchnorms. I am using tensorflow version 1.4.0 and models commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/tensorflow/models/commit/69cf6fca2106c41946a3c395126bdd6994d36e6b/hovercard" href="https://github.com/tensorflow/models/commit/69cf6fca2106c41946a3c395126bdd6994d36e6b"><tt>69cf6fc</tt></a> if that is relevant. The checkpoint file is taken from inception_v3_2016_08_28.tar.gz</p>