from fastai.gen_doc.nbdoc import * from fastai.vision import * from fastai import * path = untar_data(URLs.MNIST_SAMPLE) path data = ImageDataBunch.from_folder(path) learn = create_cnn(data, models.resnet18, metrics=accuracy) learn.fit(1) ds = ImageClassificationDataset.from_folder(path/'train') img,label = ds[0] img img.show(figsize=(2,2), title='MNIST digit') img.rotate(35) help(get_transforms) tfms = [rotate(degrees=(-20,20)), symmetric_warp(magnitude=(-0.3,0.3))] tds = DatasetTfm(ds, tfms) fig,axes = plt.subplots(1,4,figsize=(8,2)) for ax in axes: tds[0][0].show(ax=ax) data = ImageDataBunch.from_folder(path, ds_tfms=(tfms, [])) learn = create_cnn(data, models.resnet18, metrics=accuracy) learn.fit(1) interp = ClassificationInterpretation.from_learner(learn) interp.plot_top_losses(9, figsize=(6,6)) interp.plot_confusion_matrix()