2020-12-13
作者:互联网
Tensorflow保存模型,加载模型
#保存模型并删除:
model.save_weights('/content/data/cifar10_weights.ckpt')
del model
#加载模型并评估
model = My_Net() #实例化与之前的模型一样,不然参数不匹配
model.compile(optimizer=tf.optimizers.Adam(lr=1e-3),
loss=tf.losses.CategoricalCrossentropy(from_logits=True),
metrics=['accuracy'])
model.load_weights('/content/data/cifar10_weights.ckpt')
model.evaluate(test_db)
标签:13,12,cifar10,模型,ckpt,weights,2020,model,data 来源: https://blog.csdn.net/z1445056258/article/details/111144238