I understood my mistakes with some help from stackoverflow (https://stackoverflow.com/questions/61901144/resnet50-torchvision-implementation-gives-low-accuracy-on-cifar-10 42) and I am posting a solution which can also be considered as a checklist to check if someone else comes across the same problem I have in the future.


Maybe the accuracy is low due to the low number of epochs


Try using the adapting backbone model (feature extractor) for the CIFAR-10 model by setting param.requires_grad=True for all parameters of resnet models because resnet models are trained on ImageNet data and need adaptation for CIFAR-10.


While calculating the training accuracy, divide the total loss by len(trainloader.dataset) and not len(trainloader).


To help test faster, enclose the testing loop in the with torch,no_grad() and test with the model in the eval state which can be done by model.eval() or model.train(false)


Check for any imbalances in the CIFAR-10 dataset.