fastai load learner
2019-07-11 本文已影响0人
五长生
It's too tedious to use "learn.load()" function. We need to prepare the data for another time. So I think if there is a way we can load the entire learner. Then we can find the "learner_loader" function in docs.
image.png1、We will save the learner
learn = unet_learner(data, models.resnet34, wd=wd,metrics=metrics)
learn.export('/home/shiyi/beshe/seg_competition/model/0711trained_model.pkl')
2、 save the path
path = str(learn.path)
3、load the learner
learn = load_learner(('dataset/training/images'),'/home/shiyi/beshe/seg_competition/model/0711trained_model.pkl')
Note: If you used any customized classes when creating your learner, you must first define these classes first before executing load_learner
.
You can find more information and multiple examples in this tutorial.