Hi guys!
I am new to AI with Python and have trained a model with Unet18. This is the model:
1-Transfer learning:
learn = unet_learner(data, models.resnet18, metrics=metrics, wd=wd)
“Transfer learning was successful”.
2-The training of the model
lr =2e-3
learn.fit_one_cycle(10, slice(lr), pct_start=0.8)
learn.unfreeze()
start =5e-06
end = 4e-05
lrs = slice(start,end)
learn.fit_one_cycle(12, lrs, pct_start=0.8)
“The training of the model was also successful.”
3-Save, load and visualize model:
learn.save(’/content/gdrive/MyDrive/camvid/Stage_15’)
learn.load(’/content/gdrive/MyDrive/camvid/Stage_15’);
learn.show_results(rows=3, figsize=(20,20))
“until now everything is always good”
4-Export the model:
learn.export(“Unet18_Model”)
I try to export the model for a test, but I get the following error message:
AttributeError Traceback (most recent call last)
in ()
----> 1 learn.export(“Unet18_Modell.pkl”)
3 frames
/usr/local/lib/python3.7/dist-packages/torch/serialization.py in _save(obj, zip_file, pickle_module, pickle_protocol)
482 pickler = pickle_module.Pickler(data_buf, protocol=pickle_protocol)
483 pickler.persistent_id = persistent_id
→ 484 pickler.dump(obj)
485 data_value = data_buf.getvalue()
486 zip_file.write_record(‘data.pkl’, data_value, len(data_value))
AttributeError: Can’t pickle local object ‘DynamicUnet.init..’
Does anyone know what the problem is… And how to fix it?
Thanks