text_plain_output_1.png
import numpy as np # linear algebra

path = Path('../input/dataset')

train = path / 'training_set'
test = path / 'test_set'

np.random.seed(42)
data = ImageDataBunch.from_folder(train, train='.', valid_pct=0.2, ds_tfms=get_transforms(do_flip=True), size=224, num_workers=4).normalize(imagenet_stats)

data.classes

(data.classes, data.c, len(data.train_ds), len(data.valid_ds))

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

learn.fit_one_cycle(50)

learn.model_dir = '/kaggle/working'
learn.save('resnet50_224', return_path=True)

learn.unfreeze()
learn.lr_find(start_lr=1e-06, end_lr=0.0001)

learn.recorder.plot_losses()