-1

我已经使用 tenserflow 和 keras 在 MAC 上训练了 cnn 模型。我可以将这个训练过的模型移动到另一台有 Windows 的 PC 上吗?如果是,那么我们可以在没有安装tenserflow、keras的情况下使用该训练有素的模型进行预测吗?

4

1 回答 1

-1

您可以使用save()方法保存经过训练的模型。要再次加载经过训练的模型,您可以使用库提供的函数:

from keras.models import load_model

model.save('my_model.h5')  # creates a HDF5 file 'my_model.h5'
del model  # deletes the existing model

# returns a compiled model
# identical to the previous one
model = load_model('my_model.h5')

如文档所示:文档

关于在没有安装 keras 或 tensorflow 的情况下执行模型的问题,简短的回答是否定的。长答案是肯定的,但您将不得不使用任何其他库或自己实现一个函数,该函数采用模型训练的权重和架构,并执行通用前馈以返回结果。

于 2019-03-09T18:58:47.677 回答