Exploring Image Size & Accuracy of Transfer Learning in Lesson 1 Pets

I’m trying out Imagenette, based on code in a post by @jinudaniel at Imagenette

path = untar_data(URLs.IMAGENETTE)
tfms = get_transforms(max_rotate=25)

def error_rate_of(size:int, cycles:int=4, model=models.resnet18):
    np.random.seed(2)
    data = (ImageList.from_folder(path).split_by_folder(valid='val')
        .label_from_folder().transform(get_transforms(), size=size)
        .databunch(bs=bs)
        .normalize(imagenet_stats))

    learn = cnn_learner(data, model, metrics=error_rate)
    learn.fit_one_cycle(cycles)
    return [float(m[0]) for m in learn.recorder.metrics]

I’m seeing a really low error rate within 1 epoch: 0.010000

error_rate_of(size, 1, models.resnet18)

So either I’m incorrectly creating my databunch, or since resnet was trained on this data, the error rate is low since I’m asking it to transfer learn onto a subset of the classes it has already been trained on. (I’m pretty sure it is this)

While I think ideally I would want to test on new image classes, I think looking at how it scales is still valuable.


I’ll share the results once they are finished running.