关于神经网络模型再训练问题
tensorflow吧
全部回复
仅看楼主
level 1
saver=tf.train.Saver(max_to_keep=1)
max_acc = 0.6
with tf.Session() as sess:
#sess.run(tf.global_variables_initializer())
saver.restore(sess, tf.train.latest_checkpoint('./self_study_model/'))
batch_size=32
for step in range(6000):#迭代6000次
x_batch,y_batch=get_batch(batch_size,image_size=32,class_size=2)
_,train_loss,acc=sess.run([opt,loss,accuracy],feed_dict={X:x_batch,Y:y_batch,keep_prob:0.5})
print('step=',step)
if (step+1)%10==0:
print(' acc=',acc,
' loss=',train_loss)
if acc>=0.8:
break
saver.save(sess, './self_study_model/my_model.ckpt')
print('模型更新了')
请问,把第四行注释掉后(如上述代码),能否实现模型的读取再训练呢?
2019年03月03日 01点03分 1
1