image_output_1.png
import numpy as np # linear algebra

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

np.random.seed(42)
data = ImageDataBunch.from_folder(path, train='.', valid_pct=0.2, ds_tfms=get_transforms(do_flip=False), size=256, 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.densenet121, metrics=accuracy)

learn.fit_one_cycle(10)

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

learn.unfreeze()
learn.lr_find()