Instead of the fop loop you could directly use torch.argmax(output, dim=1), but your code should also work.
I guess the correspondence between the data and labels might be broken. Could you check some random examples from your ground truth file and the input image manually?
Hi @ptrblck
Thank you for your reply.
And you are right!
I checked the images in the validation folder manually against the class names listed here. I noticed that the ILSVRC2012_validation_ground_truth.txt file has INCORRECT class names listed. For example, the first image in the folder is of a snake, but groundtruth lists it as a goldfish. Also, the second image was correctly classified when I checked manually, but groundtruth said otherwise.
In this case, I found out I should use the groundtruth files from here:
Thank you again.
update:
New validation accuracy based on the groundtruth in the zip file in the link:
Top_1 = 56.522%
Top_5 = 79.066%