Created
March 11, 2020 11:18
-
-
Save gurucharanmk/6f350e13384dd944ce3f32396c80153a to your computer and use it in GitHub Desktop.
Code snippet for medium article
This file contains 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
learn = cnn_learner(dls, resnet34, pretrained=True, metrics=accuracy).to_fp16() | |
learn.fit_one_cycle(4) | |
learn.save('stage_1') | |
#Understand which classes are misclassified | |
interp = ClassificationInterpretation.from_learner(learn) | |
losses,idxs = interp.top_losses() | |
interp.plot_top_losses(9, figsize=(15,10)) | |
interp.most_confused(min_val=3) | |
#Create confusion matrix | |
interp.plot_confusion_matrix(figsize=(12,12), dpi=60) | |
#Unfreeze and retrain | |
learn.load('stage_1') | |
learn.unfreeze() | |
#Inference | |
learn.show_results(figsize=(15,15)) | |
learn.lr_find() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment