/cifar10-resnet

PyTorch implementation of a 9-layer ResNet for CIFAR-10.

Primary LanguagePython

PyTorch ResNet9 for CIFAR-10

I implemented the architecture described in this blog post. It is a 9-layer ResNet (He et al. 2015) for image classification on CIFAR-10 (Krizhevsky 2009).

Dependencies

Usage

Training

from resnet import ResNet

net = ResNet()
net.train(save_dir='saves', num_epochs=75, batch_size=256, learning_rate=0.001, verbose=True)
accuracy = net.test()
print('Test accuracy: {}'.format(accuracy))

Load pretrained weights

from resnet import ResNet

net = ResNet()
net.load_parameters(path='saves/resnet__epoch_75.pth')
accuracy = net.test()
print('Test accuracy: {}'.format(accuracy))

Architecture

Training

Hyperparameter Value
Number of Epochs 75
Batch Size 256
Learning Rate 0.001
Weight Decay (Adam) 1e-5

Results

Training accuracy Test accuracy
97.64 % 92.05 %

References

Kaiming H, Zhang X, Ren S, and Sun J. (2016). Deep Residual Learning for Image Recognition. Conference on Computer Vision and Pattern Recognition (CVPR).

Krizhevsky A. (2009). Learning multiple layers of features from tiny images. Technical Report.

License

This project is licensed under the MIT Licence