Hi,
I am trying to use some of the pretrained CNNs for a project of mine, but it seems to me that the accuracy is too low. I tried to look for the top 1 accuracy in the validation set of Imagenet (ILSVRC-2012), and I evaluated it on the smallest and largest resnet, comparing the results with the facebook results. https://github.com/facebook/fb.resnet.torch/blob/master/pretrained/README.md
I am doing just scaling (if I do random crop or center crop it works worse), and here are the accuracy results I am getting:
resnet18: mine 0.672 facebook 0.6957
resnet152: mine 0.7164 facebook 0.7784
Now, I am not doing anything ridiculous like data augmentation in the inference stage, and I am getting the net on eval mode before I start the evaluation. I am also using the correct normalization parameters:
r_mean, g_mean, b_mean = (0.485, 0.456, 0.406)
r_std, g_std, b_std = (0.229, 0.224, 0.225)
For what is worth, here is the code I am using for dataset preparation:
transform = torchvision.transforms.Compose([
torchvision.transforms.Scale((224, 224)),
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize(mean=(r_mean, g_mean, b_mean),
std=(r_std, g_std, b_std))
])
and here it is the code for the testing:
net.eval()
correct = 0
total = 0
for data in test_loader:
inputs, labels = data
inputs, labels = inputs.cuda(), labels.cuda()
outputs = net(torch.autograd.Variable(inputs))
_, predicted = torch.max(outputs.data, 1)
total += labels.size(0)
correct += (predicted == labels).sum()
accuracy = correct / float(total)
Am I doing some mistake (missing something), or just that the PyTorch resnets are not trained as well as the facebook resnets?