text_html_output_1.png
pets = 'https://s3.amazonaws.com/fast-ai-imageclas/oxford-iiit-pet'

path = untar_data(pets)
path

path.ls()

path_anno = path / 'annotations'
path_img = path / 'images'

fnames = get_image_files(path_img)
fnames[:5]

np.random.seed(2)
pat = '/([^/]+)_\\d+.jpg$'

data = ImageDataBunch.from_name_re(path_img, fnames, pat, ds_tfms=get_transforms(), size=224)
data.normalize(imagenet_stats)

help(data.show_batch)

len(data.classes)

learn = cnn_learner(data, models.resnet34, metrics=error_rate)

learn.fit_one_cycle(4)

learn.save('stage-1')

interp = ClassificationInterpretation.from_learner(learn)

doc(interp.plot_top_losses)

interp.most_confused(min_val=2)