This repository contains the implementation of a ResNet34 convolutional neural network (CNN) for image classification on the CIFAR-10 dataset. The model is implemented using PyTorch, and training/testing has been done with the CIFAR-10 dataset, which consists of 10 classes of images.
- Installation
- Usage
- Model Architecture
- Training
- Evaluation
- Predicting on New Images
- Results
- References
-
Clone this repository:
git clone https://github.com/devs-mohanraj/implementation-Of-ResNet.git cd implementation-Of-ResNet -
Install the required packages:
pip install -r requirements.txt
-
Download the CIFAR-10 dataset during training, or you can manually download and place it in the
datadirectory.##to download the dataset wget https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz ##to extract the file tar -xvzf cifar-10-python.tar.gz
You can train the ResNet34 model on the CIFAR-10 dataset by running:
python train.pyYou can visualize the prediction by running the script with an image file, and it will display the image with the predicted label.
python predict.py --image-path /path/to/your/image.pngThe architecture used in this project is based on the ResNet34 model, a 34-layer deep residual network. It uses skip connections and batch normalization layers to avoid vanishing gradients during training. The key components of the model are:
BasicBlock: This forms the building block of the network.
ResNet: The main network class that stacks multiple layers of BasicBlock.
ResNet34(
(conv1): Conv2d(3, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
(bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(maxpool): MaxPool2d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False)
(layer1): Sequential(...)
(layer2): Sequential(...)
(layer3): Sequential(...)
(layer4): Sequential(...)
(avgpool): AdaptiveAvgPool2d(output_size=(1, 1))
(fc): Linear(in_features=512, out_features=10, bias=True)
)Validation Loss : 0.8831 / ~21.57%
Validation Accuracy : 78.43%

