https://github.com/2j2h5/lenet-alexnet-vggnet-resnet-comparison
Implemetation of CNN models training with MNIST, CIFAR10 datasets
https://github.com/2j2h5/lenet-alexnet-vggnet-resnet-comparison
alexnet cifar10 cnn lenet lenet5 mnist pytorch resnet vggnet
Last synced: 3 months ago
JSON representation
Implemetation of CNN models training with MNIST, CIFAR10 datasets
- Host: GitHub
- URL: https://github.com/2j2h5/lenet-alexnet-vggnet-resnet-comparison
- Owner: 2j2h5
- License: apache-2.0
- Created: 2025-02-24T23:11:41.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-02-25T00:01:01.000Z (4 months ago)
- Last Synced: 2025-02-25T00:24:19.050Z (4 months ago)
- Topics: alexnet, cifar10, cnn, lenet, lenet5, mnist, pytorch, resnet, vggnet
- Language: Python
- Homepage:
- Size: 48.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CNN Models
This repository compares CNN models (LeNet, AlexNet, VGGNet, and ResNet). These models are trained on both the MNIST and CIFAR10 datasets. The implementations are based on the following papaers: LeNet is based on this [papar](https://ieeexplore.ieee.org/abstract/document/726791), AlexNet is based on this [paper](https://proceedings.neurips.cc/paper/2012/hash/c399862d3b9d6b76c8436e924a68c45b-Abstract.html), VGGNet is based on this [paper](https://arxiv.org/abs/1409.1556), and ResNet is based on this [paper](https://arxiv.org/abs/1512.03385)# Requirements
Install the required packages: [torch](https://pytorch.org/get-started/locally/), [torchvision](https://pytorch.org/vision/stable/index.html), [numpy](https://numpy.org/), [matplotlib](https://matplotlib.org/stable/install/index.html)
```bash
pip install -r requirements.txt
```
Additionally, you can utilize your GPU for training via CUDA. However, please note that when using CUDA, you need to ensure that its version is compatible with the version of torch being used.# Training
You can train all these models using the training.py script. The training hyperparameters can be set by adjusting the following variables: LEARNING_RATE, BATCH_SIZE, NUM_EPOCHS, MOMENTUM, and WEIGHT_DECAY. You can also specify the model to train by changing the net variable to the desired model class. The available models are as follows:
| Model | MNIST | CIFAR10 |
|:-------:|:-------:|:-------:|
| LeNet | LeNet5 | LeNet5_CIFAR10 |
| AlexNet | AlexNet | |
| VGGNet | | VGG16_CIFAR10 |
| ResNet | | resnet20, resnet32(), plain20(), plain32(), resnet110() |The best results on CIFAR10 are as follows:
| Hyperparameter | [Papers](https://arxiv.org/abs/1512.03385) | This Repository |
|:-------:|:-------:|:-------:|
| Model | ResNet110 | ResNet110 |
| Learning Rate | 0.1 | 0.1 |
| Batch Size | 128 | 128 |
| Num Epochs (iterations) | (64000) | 164 (64000) |
| Momentum | 0.9 | 0.9 |
| Weight Decay | 0.0001 | 0.0001 |
| Optimizer | SGD | SGD |
| Lr Scheduler(parameters:value) | MultiStepLR(milestones:32000, 48000; factor:0.1) | MultiStepLR(milestones:32000, 48000; factor:0.1) |
| Criterion | CrossEntropyLoss | CrossEntropyLoss |
| Data Augmentation | RandomCrop, RandomHorizontalFlip | RandomCrop, RandomHorizontalFlip, RandomAugment(magnitude:7) |
| Lass Test Accuracy | 94.48% |
|:-------:|:-------:|