我有一个大数据集,我想通过这个数据集训练efficientnetb0,但是 google colab 运行超时,所以我想训练模型的完全连接层并保存它,然后在几个小时后再次加载并微调基本模型(高效网络b0)。我怎样才能做到这一点?
问问题
60 次
1 回答
0
您可以通过以下方式执行此操作。请根据您的要求进行更改。这是起点的快照。
if not os.path.exists('e10.h5'):
model = get_model() #this method constructs the model and compiles it
else:
model = load_model('tf_keras_cifar10.h5') #load the model from file
print('lr is ', K.get_session().run(model.optimizer.lr))
initial_epoch=10
epochs=13
history = model.fit(x_train, y_train, batch_size=batch_size, epochs=epochs,validation_data=(x_test, y_test), initial_epoch=initial_epoch)
model.save('e.h5')
于 2021-07-31T10:24:46.797 回答