In [ ]:
In [ ]:
dls = get_data(URLs.IMAGENETTE_160, 160, 128)
We’ll create a ResNet-34 without pretraining, and pass along any arguments received:
In [ ]:
In [ ]:
Now let’s try plain SGD. We can pass opt_func
(optimization function) to cnn_learner
to get fastai to use any optimizer:
In [ ]:
The first thing to look at is :
Out[ ]:
It looks like we’ll need to use a higher learning rate than we normally use:
In [ ]:
learn.fit_one_cycle(3, 0.03, moms=(0,0,0))
epoch | train_loss | valid_loss | accuracy | time |
---|---|---|---|---|
0 | 2.969412 | 2.214596 | 0.242038 | 00:09 |
1 | 2.442730 | 1.845950 | 0.362548 | 00:09 |
2 | 2.157159 | 1.741143 | 0.408917 | 00:09 |
Clearly, plain SGD isn’t training as fast as we’d like. So let’s learn some tricks to get accelerated training!