【发布时间】:2021-10-06 14:20:08
【问题描述】:
我有一个大数据集,我想通过这个数据集训练efficientnetb0,但是 google colab 运行超时,所以我想训练模型的全连接层并保存它,然后在几个小时后再次加载并进行微调基本模型(efficientnetb0)。我该怎么做?
【问题讨论】:
标签: tensorflow deep-learning transfer-learning efficientnet
我有一个大数据集,我想通过这个数据集训练efficientnetb0,但是 google colab 运行超时,所以我想训练模型的全连接层并保存它,然后在几个小时后再次加载并进行微调基本模型(efficientnetb0)。我该怎么做?
【问题讨论】:
标签: tensorflow deep-learning transfer-learning efficientnet
您可以通过以下方式执行此操作。请根据您的要求进行更改。这是起点的快照。
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')
【讨论】: