from fastai.gen_doc.nbdoc import * from fastai.vision import * path = untar_data(URLs.MNIST_SAMPLE) path data = ImageDataBunch.from_folder(path) learn = cnn_learner(data, models.resnet18, metrics=accuracy) learn.fit(1) data = ImageDataBunch.from_folder(path) ds = data.train_ds 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))] fig,axes = plt.subplots(1,4,figsize=(8,2)) for ax in axes: ds[0][0].apply_tfms(tfms).show(ax=ax) data = ImageDataBunch.from_folder(path, ds_tfms=(tfms, [])) learn = cnn_learner(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() img = learn.data.train_ds[0][0] learn.predict(img)