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
p,t = learn.get_preds(ds_type=DatasetType.Test) | |
p = to_np(p); | |
p.shape | |
ids = np.array([f.name for f in (combined_test)]); | |
ids.shape | |
sample_sub = Path('data/SampleSubmission.csv') | |
df_sample = pd.read_csv(sample_sub) |
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.fit_one_cycle(5, slice(1e-4)) |
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
tfms = get_transforms(flip_vert=True, max_lighting=0.1, max_zoom=1.05, max_warp=0.) | |
data = (src.transform(tfms, size=256) | |
.databunch().normalize(imagenet_stats)) | |
learn.data = data | |
data.train_ds[0][0].shape |
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.fit_one_cycle(5, 1e-6) |
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
tfms = get_transforms(flip_vert=True, max_lighting=0.1, max_zoom=1.05, max_warp=0.) | |
data = (src.transform(tfms, size=200) | |
.databunch().normalize(imagenet_stats)) | |
learn.data = data | |
data.train_ds[0][0].shape |
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
probs,val_labels = learn.get_preds(ds_type=DatasetType.Valid) | |
print('Accuracy',accuracy(probs,val_labels)), | |
print('Error Rate', error_rate(probs, val_labels)) | |
print('AUC', auc_score(probs,val_labels)) |
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.fit_one_cycle(7, max_lr=slice(1e-6,1e-4)) |
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
interp = ClassificationInterpretation.from_learner(learn) | |
interp.plot_confusion_matrix(dpi=120) |
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.save('resnet50-stg1') |
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
from sklearn.metrics import roc_auc_score | |
def auc_score(y_score,y_true): | |
return torch.tensor(roc_auc_score(y_true,y_score[:,1])) | |
probs,val_labels = learn.get_preds(ds_type=DatasetType.Valid) | |
print('Accuracy',accuracy(probs,val_labels)), | |
print('Error Rate', error_rate(probs, val_labels)) | |
print('AUC', auc_score(probs,val_labels)) |
NewerOlder