Issue with learn.predict()

Hey guy, I was trying to implement image classification on a custom dataset.

I used the below function for getting the data loaders:

def get_dls(bs, size):
dblock = DataBlock(blocks=(ImageBlock, CategoryBlock),
               splitter = TrainTestSplitter(test_size=0.2, random_state=0),
               batch_tfms=[*aug_transforms(mult=1.0, size=size,min_scale=1.0, max_warp=0, max_rotate=0),
return dblock.dataloaders(path_images, bs=bs)

This has worked for me before, but for some reason, when I try to predict something with this,
the output is like:

I understand that if I take the argmax of the second and third tensors, I’ll get the index of my predicted class, but this does not normally happen, right?


Hi, would you please share with us the code for creating your learner object?

cutmix = CutMix(1.)
learn = cnn_learner(dls, resnet50, loss_func=LabelSmoothingCrossEntropy(), 

Although I figured out that when I remoe Cutmix/mixup, it works perfectly.

Hi, did you solve the issue of learn.predict with using cutmix/mixup call back? Could you share how you did if you had done it!

No I couldn’t solve it. It just doesn’t go away.

Thanks for the information.