python - 如何重新训练/更新 keras 模型?
问题描述
如何在不从头开始重新训练的情况下更新/附加新数据到我的模型?我的数据集是图像,输出是预测情绪。
model.fit(x=train_image, y=train_label, epochs=1, batch_size=1)
Model.fit 似乎没有附加我的新数据,而是覆盖了模型。我的输出只有一个(我更新的最后一个)。
我已经搜索过这个,但效果不佳。
编辑 1: 当我们丢失之前训练的数据时,我们能做什么。简而言之,我们在训练完成后丢失了我们的训练数据,并且我们无法再次取回数据,我们必须保留的只是从中完成的学习,并在我们收到新数据时重新训练模型。
解决方案
It is really easy. For instance model.save()
in Keras can save the model weights, which is what you actually need to keep.
After that you can add new images to your training set, but just use the weights you saved.
Every new epoch will pass trough all the images (new and old).
推荐阅读
- html - 智能手机浏览器破坏 SVG 图像
- java - 我可以参数化@BeforeTest 以使其一个接一个地打开两个URL吗?
- ios - 是否有完整的 Swift 4.0 代码可以像在 FieldTest 模式中一样从天线获取当前的 MCC、MNC 和 LAC
- r - 如何根据特定条件删除 R 中的观察值
- jquery - 我需要使用 jQuery 打开的邮件程序发送表单数据
- java - 如何在子类中使用属性而不是扩展抽象类中的属性?
- c++ - 关闭qt应用程序时,想杀死qprocess
- unity3d - 图形问题不显示主角
- javascript - 如何从 Angular 服务中的行为主题中提取数据?
- laravel - 拉拉维尔。使用Session时如何调用对象中的特定数组?