Learning Rate finder not working

I am using feret gender data set (http://mivia.unisa.it/datasets/video-analysis-datasets/gender-recognition-dataset/) to work on Lesson 1.

I could see that the LR finding algorithm is not suggesting any value.LR_FInder.

The plot between Learning Rate vs Loss is blank.

After running lr_find(), to plot the graphs run:

learn.sched.plot_lr()

and

learn.sched.plot()

learn.lr_find() computes only on one Epoch in your case (see the 1/1 after the 100% after the green bar). It means that the plot between LR vs Loss will have only one point. So it is blank since no curves are drawn.
Why ?

Since the dataset has more elements than a batchsize, you have enough pictures. It doesn’t come from that.

“GENDER-FERET dataset is a balanced subset of the FERET dataset, adapted for gender recogntion purposes. It consists of 946 grayscale images, already divided in training set (237 m, 237 f) and test set (236 m, 236 f).” according to your link (http://mivia.unisa.it/datasets/video-analysis-datasets/gender-recognition-dataset/).
But fast.ai library works with train set and validation set. The test set is only for Kaggle competition submission. It is probably an error coming from the name of your paths which should be “train” and “valid” by default. (Be sure that your train set and validation set are labelled thanks to path per gender (i.e. “m” and “f”).) So look at your ImageClassifierData.from_paths by typing in your Jupyter Notebook :

??ImageClassifierData.from_paths()

I hope it helps.

1 Like

Thanks for detailed reply. I did change the name of the folder from ‘test’ ti ‘valid’ and I thought it will act as a validation set for my model.

fast_ai_0

You correctly pointed that, my LR finder is executing only one batch - I am not quite sure what is the reason.

I could notice that the default value for variable ‘bs’ is 64 and I have more than 64 images in my training set.

Are your validation set labelled? I mean: do you have the following subfolders in “valid”: “female”, “male”?

Yes, I have the labels for validation set

Have you tried to reduce the batch size anyway ? (for example to 2, 4, 8)

not so far - Let me give a try. I executed with default Batch Size.

Use lr_find2().

Open learner.py for further information.

By the way, it is my contribution to fastai.

2 Likes

I’m having the same problem - only one epoch gets trained when I run lr_find. Did anyone figure out why this happens?

Running lr_find2() gives an error
RuntimeError: cannot call .data on a torch.Tensor: did you intend to use autograd.Variable?