This project implements a Convolutional Neural Network (CNN) for image classification using the CIFAR-10 dataset. The model is trained to classify images into 10 categories and achieves an accuracy of 77.21%.
CIFAR-10 contains 60,000 color images (32×32 pixels) belonging to the following classes:
- Airplane
- Automobile
- Bird
- Cat
- Deer
- Dog
- Frog
- Horse
- Ship
- Truck
Dataset Split:
- Training Images: 50,000
- Testing Images: 10,000
- Python
- PyTorch
- Torchvision
- NumPy
- Matplotlib
- Scikit-learn
- Conv2D (32 Filters)
- ReLU
- Max Pooling
- Conv2D (64 Filters)
- ReLU
- Max Pooling
- Fully Connected Layer (512 Neurons)
- Dropout
- Output Layer (10 Classes)
- Optimizer: Adam
- Learning Rate: 0.001
- Epochs: 20
- Batch Size: 64
- Loss Function: CrossEntropyLoss
- Accuracy: 77.21%
- Precision: 77%
- Recall: 77%
- F1-Score: 77%
Generated Outputs:
- Training Loss Curve
- Confusion Matrix
- Cat and Dog Sample Images
- Trained CNN Model
ComputerVision_CNN_Project/
- model.py
- train.py
- evaluate.py
- show_samples.py
- requirements.txt
- README.md
results/
- loss_curve.png
- confusion_matrix.png
- cat_dog_samples.png
saved_models/
- cnn_cifar10.pth
Install dependencies:
pip install -r requirements.txt
Train the model:
python train.py
Evaluate the model:
python evaluate.py
Display sample images:
python show_samples.py
Muhammad Aman Fasihe
BS Artificial Intelligence
The Islamia University of Bahawalpur
Note: The trained model file (.pth) is included in the project submission package. The GitHub repository contains the source code, documentation, and result visualizations.