facebookarchive/fb.resnet.torch

classification using best model gives strange results

gabricampanella opened this issue · 3 comments

I trained an 18 layer resnet. The validation error was around 1%. I saved the best model and used that to classify again the validation set to get the labels and build a confusion matrix. However, when pushing the images forward through the network, I obtained completely wrong labels (mostly 1s and a few 2s on a 6 class task). I didn't calculate accuracy, but it is nowhere near 99%.
The gist below is the code I used for classifying the images given my best model.
https://gist.github.com/gabricampanella/b7f6941b05b087a557c202a519ee0b11

It sounds like you have a bug in your classification script or the modifications to fb.resnet.torch.

There's a classification script at:
https://github.com/facebook/fb.resnet.torch/blob/master/pretrained/classify.lua

You just have to change imagenetLabel to the labels for your dataset (in the same order used during training)

I tried to train with cifar10 and got the model_best.t7 with resnet-44. Now when I do classify.lua with the test images of cifar10 one by one, it always predicting cat. I have made the following changes in classify.lua(changed the imagenetLabel to use cifar10 label file that i created and also changed the mean(std) and transform in the classify.lua according to the mean(std) used in cifar10 in /datasets/cifar10.lua)

Can someone help me please from the authors

It sounds like you have a bug in your classification script or the modifications to fb.resnet.torch.

There's a classification script at:
https://github.com/facebook/fb.resnet.torch/blob/master/pretrained/classify.lua

You just have to change imagenetLabel to the labels for your dataset (in the same order used during training)
If you see the sample of the imagenetLabel file it's not alphabetically arranged and it's written that classes are alphabetically arranged during training.