我已经加载了概述的成立模型:
if FLAGS.pretrained_model_checkpoint_path:
assert tf.gfile.Exists(FLAGS.pretrained_model_checkpoint_path)
variables_to_restore = tf.get_collection(
slim.variables.VARIABLES_TO_RESTORE)
restorer = tf.train.Saver(variables_to_restore)
restorer.restore(sess, FLAGS.pretrained_model_checkpoint_path)
print('%s: Pre-trained model restored from %s' %
(datetime.now(), FLAGS.pretrained_model_checkpoint_path))
并通过使用Flowers_train.py
火车完成后,损失约为1.0,模型保存在指定的目录中。
现在我想继续培训,因此,我还原模型:
if FLAGS.checkpoint_dir is not None:
# restoring from the checkpoint file
ckpt = tf.train.get_checkpoint_state(FLAGS.checkpoint_dir)
tf.train.Saver().restore(sess, ckpt.model_checkpoint_path)
和继续火车模型,但第一步的损失约为6.5,实际上,该模型根本没有初始化。
这是inception_train.py的全部内容,它是根据inception_train.py
修改的第一列火车是我开始的:
bazel-bin/inception/flowers_train --train_dir="{$TRAIN_DIR}" --data_dir="{$DATA_DIR}" --fine_tune=True --initial_learning_rate=0.001 --input_queue_memory_factor=1 --batch_size=64 --max_steps=100 --pretrained_model_checkpoint_path="/home/tensorflow/inception-v3/model.ckpt-157585"
我试图通过此命令继续训练:
bazel-bin/inception/flowers_train --train_dir="{$TRAIN_NEW_DIR}" --data_dir="{$DATA_DIR}" --fine_tune=False --initial_learning_rate=0.001 --input_queue_memory_factor=1 --batch_size=64 --max_steps=2000 --checkpoint_dir="{$TRAIN_DIR}"
拜托,谁能解释我,初始化训练的模型时我做错了什么?
我通过使用正确的arg_scope如下:
with slim.arg_scope(inception_v3.inception_v3_arg_scope()):
logits, _ = inception_v3.inception_v3(eval_inputs, num_classes=1001, is_training=False)