I am not able to train my ResNet model dues to incorrect matrix dimensions

  • For some reason, I am not able to train my custom ResNet model. The error is about incorrect matrix dimensions.

  • There might be a mistake with the ResNet model.

  • But a batch of tensor images is correctly being passed through the model, with the desired output dimensions.

  • The summary() function also confirms the above.

  • The dataset used is custom made by me. Each image has a different dimension unlike the CIFAR datasets. But I have used data augmentations and transformations to covert all images into the same dimension, for both the training and the validation sets/ dataloaders.

  • I have been racking my brain on this problem for days .Please check out my notebook. Any help on this topic would be greatly appreciated!

Why are you using a different size for validation images?

1 Like

Ah that was the error! I must have mistakenly set a different size for the validation images. The model is training now with no problems. Thank you very much!