Different fine-tuning results between Torch and PyTorch
I’m fine-tuning a same custom dataset using Torch and PyTorch based on ResNet 34. 
With Torch, I use fb.resnet.torch 11 with learning rate 0.001. After 50 epoch:
 
top1: 89.267  top5:  97.933
 
With PyTorch, I use code below for fine-tuing. After 90 epoch:

learning rate = 0.01, top1: 78.500, top5: 94.083
learning rate = 0.001, top1: 74.792, top5: 92.583

 learning rate = 0.01, top1: 78.500, top5: 94.083 learning rate = 0.001, top1: 74.792, top5: 92.583 You can see that PyTorch fine-tuning result is still not so good as Torch. Fine-tuning ResNet 18 has similar results. Any suggestion or guidance? PyTorch code used for fine-tuning: <SCODE>class FineTuneModel(nn.Module):
    def __init__(self, original_model, arch, num_classes):
        super(FineTuneModel, self).__init__()
            # Everything except the last linear layer
            self.features = nn.Sequential(*list(original_model.children())[:-1])
            self.classifier = nn.Sequential(
                nn.Linear(512, num_classes)
            )

        # Freeze those weights
        for p in self.features.parameters():
            p.requires_grad = False


    def forward(self, x):
        f = self.features(x)
        f = f.view(f.size(0), -1)
        y = self.classifier(f)
        return y<ECODE>
panovr
Your fine tune model looks OK to me. I don’t have enough context to see what could be different. Can you post your fine-tuning code?
colesbury
panovr
one possible reason is that, torch adopts more image transforms for data augmentation than pytorch.
shicai
I think that the difference comes from the fact that you fix all the weights in the pytorch model (except from the last classifier), while in lua torch you are fine-tuning the whole network.
fmassa
apaszke
different data augmentations or image transforms “hard” fine-tuning and “soft” fine-tuning From my dataset experiment result, I think maybe “soft” fine-tuning is better than “hard” fine-tuning.
panovr