ResNet implementation trained on CIFAR-100 dataset. Achieved 73% test accuracy with test-time augmentation applied
The easiest way to just run a few predictions and try the model @ Open Google Colab
Python 3.10 is recommended. Clone the repo and install dependencies:
# PIP
pip install .
# Poetry
poetry install
Download model weights from
Github release
and put the file in ./bin
folder
Prepare some image and run the inference:
# PIP
python -m image_classifier.main classify --image-path ./image.jpg
# Poetry
poetry run image-classifier classify --image-path ./image.jpg
Basic info | |
---|---|
Neural net architecture | ResNet 18 with bottleneck blocks |
Optimizer | SGD with CosineAnnelingLR scheduler |
Optimizer params | Initial learning rate: 0.02. Weight decay: 0.0005. Momentum: 0.9 |
Loss function | Cross entropy loss |
Data processing | |
---|---|
Dataset | CIFAR-100 |
Batch size | 128 |
Transforms | Upscaling to 64x64, applying TrivialAugmentWide and normalization |
Test-time augmentation is used for inference to increase test accuracy by 3 percent
The ~73% test accuracy is far from ideal. The model is currently overfitting, probably due to shortage of data to train on
The possible solution is to train on other additional larger dataset (e.g. ImageNet). Switching to more performant neural net architecture is also a great idea (e.g. PyramidNet)
- hf project with ResNet 18 hyperparams tuned for CIFAR-100 - https://huggingface.co/edadaltocg/resnet18_cifar100
- "Deep Residual Learning for Image Recognition" paper - https://arxiv.org/abs/1512.03385
- "How to Use Test-Time Augmentation to Make Better Predictions" - https://machinelearningmastery.com/how-to-use-test-time-augmentation-to-improve-model-performance-for-image-classification/