#na# value in valid_loss when doing fit_one_cycle after ImageCleaner

Hello everyone,

I used the ImageCleaner for cleaning up the data as suggested in lesson 2. However, when I try to fit the learner with the new databunch I have two issues.
Issue 1: as the model is fitting the valid_loss column shows #na# values. That does not happen with the data bunch previous to using ImageCleaner.
Issue 2: if I ignore the #na# values and try to use ClassificationInterpretation.from_learner(), then I get: “IndexError: index 0 is out of bounds for axis 0 with size 0”.

has anyone have the same problem?

2 Likes

If you are getting nan values in valid loss, then maybe you should manually check the validation set.

Thanks! I will try to figure out how to do that.

Hello Monica ,i meet the same problem that all the valid_loss are #na#,can i ask you how to solve this problem
i use ImageDataBunch to get the dataset cifar10

I am also facing the same issue. @MDGODanille are you able to solve it?

I am able to solve the issue. I was using

.split_none()

while creating databunch using

imageList.from_df

instead of

split_by_rand_pct(0.2)

I hope this might help you as well.

5 Likes

Sorry Karana, I was very busy the past few weeks and could not look into the code. But Jasmeet suggested something below that we could try.

Sorry I could not look into this before, I was busy for the past weeks, but thank you for your suggestion. I will give it a try

Hi Jasmeet, I just tried your solution and it did work as well!, Thank you very much!

1 Like

Great! it work for you as well :slight_smile:

im having the same issue. how would you recommend manually checking the validation set?
I used my_data.valid_ds and my_data.valid_dl methods but I don’t understand the outputs enough for that to be helpful. Do you have another suggestion?

im using

np.random.seed(42)
data = ImageDataBunch.from_folder(path, train=".", valid_pct=0.2,
ds_tfms=get_transforms(), size=224, num_workers=4).normalize(imagenet_stats)

learn = cnn_learner(data, models.resnet34, metrics=error_rate)

learn.fit_one_cycle(4)

my cnn seems to work fine with the fit_one_cycle but when I try to learn.lr_find() I get #na# values in the valid_loss column.

2 Likes

You can refer to this post for some details.

In my case, I did not undertand the concept of validation. By this mistake now I learnt it. If it happens to you, read about validation. You would need to have a folder created for validation. Now it works for me.