Tutorials

Learning tasks

How To

Reference

Background

How to train a model from scratch

When training a model from scratch, using a one-cycle learning rate schedule is a good starting point.

using FastAI

We’ll set up a Learner in the usual way. Note that Models.xresnet18(), the backbone we’re using, doesn’t have pretrained weights.

data = Datasets.loadtaskdata(Datasets.datasetpath("imagenette2-160"), ImageClassificationTask)
method = ImageClassification(Datasets.getclassesclassification("imagenette2-160"), (160, 160))
learner = methodlearner(method, data, Models.xresnet18(), ToGPU(), Metrics(accuracy))

And then simply call fitonecycle!:

fitonecycle!(learner, 5)