Skip to content

Just another ResNet implementation trained on CIFAR-100 dataset achieving 73% test accuracy

Notifications You must be signed in to change notification settings

one-with-violets-in-her-lap/cifar-100-image-classification

Repository files navigation

CIFAR-100 image classification with ResNet

ResNet implementation trained on CIFAR-100 dataset. Achieved 73% test accuracy with test-time augmentation applied

Usage

Try on Google Colab

The easiest way to just run a few predictions and try the model @ Open Google Colab

Running locally

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

Implementation details

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

bar chart comparison between TTA (accuracy: 73%, loss: 0.975) and non-TTA (accuracy: 70%, loss: 1.141) inference

State of the model

The ~73% test accuracy is far from ideal. The model is currently overfitting, probably due to shortage of data to train on

line charts shows ~99 training accuracy curve and ~70 test accuracy curve

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)

References

About

Just another ResNet implementation trained on CIFAR-100 dataset achieving 73% test accuracy

Topics

Resources

Stars

Watchers

Forks