blitz-bayesian-deep-learning icon indicating copy to clipboard operation
blitz-bayesian-deep-learning copied to clipboard

classification with freeze_ and unfreeze_

Open yongjin-shin opened this issue 3 years ago • 2 comments

Hi, First of all, I very much appreciate your wonderful work! Currently, I am testing CIFAR10 classification task with your example code. I would like to ask whether 10% of the test performance is an usual case when I call freeze_() in the test time.

# Test Time
    with torch.no_grad():
        for data in test_loader:
            images, labels = data
            classifier.freeze_()
            outputs = classifier(images.to(device))
            _, predicted = torch.max(outputs.data, 1)
            total += labels.size(0)
            correct += (predicted == labels.to(device)).sum().item()
    print(f'Freeze Epoch {epoch} | {str(100 * correct / total)}% | Elpased: {time.time() - tic:.1f}s')
    classifier.unfreeze_()

I only add classifier.freeze_() before getting outputs. I thought the accuracy should be similar with unfreeeze_(), however, it seems not. When I activated freezemode, I got 10%, but unfreeze mode reach 45% at the first epoch. Since I only activate it at the test time, the training loss keeps going down.

Best Regards, YJ

yongjin-shin avatar Nov 02 '20 10:11 yongjin-shin

This is not usual and should be fixed by now.

piEsposito avatar Jun 18 '21 14:06 piEsposito

The problem is still there. image

jinqijinqi avatar Dec 09 '21 06:12 jinqijinqi