Created
September 22, 2019 16:05
-
-
Save GiulioCMSanto/b5491b7ba47e8bdc8598c96271da0b83 to your computer and use it in GitHub Desktop.
Classifying Flowers With Transfer Learning
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Extract the class_to_idx transformation | |
model.class_to_idx = train_data.class_to_idx | |
#Put the model in CPU mode to allow predictions without having CUDA | |
model.to('cpu') | |
#Create the checkpoint | |
checkpoint = {'input_size':25088, | |
'output_size':102, | |
'hidden_layers':[each.out_features for each in classifier.hidden_layers], | |
'drop_p':0.2, | |
'state_dict':model.state_dict(), | |
'class_to_idx': model.class_to_idx} | |
filepath = 'checkpoint.pth' | |
#Save the model | |
torch.save(checkpoint, filepath) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment