facebookarchive / fb.resnet.torch

Torch implementation of ResNet from http://arxiv.org/abs/1512.03385 and training scripts
Other
2.29k stars 664 forks source link

classification using best model gives strange results #158

Open gabricampanella opened 7 years ago

gabricampanella commented 7 years ago

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

colesbury commented 7 years ago

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)

Soumali13 commented 7 years ago

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

surajitkundu29 commented 5 years ago

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.