https://github.com/matthias-wright/cifar10-resnet
PyTorch implementation of a 9-layer ResNet for CIFAR-10.
https://github.com/matthias-wright/cifar10-resnet
cifar-10 classification convolutional-neural-network deep-learning pytorch resnet
Last synced: 24 days ago
JSON representation
PyTorch implementation of a 9-layer ResNet for CIFAR-10.
- Host: GitHub
- URL: https://github.com/matthias-wright/cifar10-resnet
- Owner: matthias-wright
- Created: 2019-06-22T13:11:19.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-08T10:43:12.000Z (over 1 year ago)
- Last Synced: 2025-04-02T06:35:46.510Z (6 months ago)
- Topics: cifar-10, classification, convolutional-neural-network, deep-learning, pytorch, resnet
- Language: Python
- Homepage:
- Size: 25.3 MB
- Stars: 12
- Watchers: 0
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PyTorch ResNet9 for CIFAR-10
I implemented the architecture described in [this](https://myrtle.ai/learn/how-to-train-your-resnet-4-architecture/) blog post. It is a 9-layer ResNet (He et al. 2015) for image classification on [CIFAR-10](https://www.cs.toronto.edu/~kriz/cifar.html) (Krizhevsky 2009).
## Dependencies
* [Python (Anaconda 3.6.5)](https://anaconda.org/)
* [PyTorch (1.0.0)](https://pytorch.org/)
* [NumPy (1.15.4)](http://www.numpy.org/)
* [PIL (1.1.7)](https://pillow.readthedocs.io/en/stable/)## Usage
### Training
```python
from resnet import ResNetnet = 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
```python
from resnet import ResNetnet = 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](https://choosealicense.com/licenses/mit/)