Skip to content

abhisheksharmaxdev/internship-task-2

Repository files navigation

Deep Learning Image Classification using PyTorch

Internship Details

Company: Codtech IT Solutions Private Limited
Name: Abhishek Sharma
Intern ID: CTIS9913
Domain: Data Science
Duration: 6 Weeks


Project Overview

This project was developed as part of the Data Science Internship program at Codtech IT Solutions Private Limited. The objective of this task was to implement a Deep Learning model for Image Classification using PyTorch and generate visual representations of the model's performance.

The project focuses on classifying handwritten digit images using a Convolutional Neural Network (CNN). The model is trained on the widely used MNIST dataset and learns to identify digits ranging from 0 to 9. The complete workflow includes data preprocessing, model development, training, evaluation, result visualization, and GitHub deployment.

This project provided practical exposure to Deep Learning concepts and helped in understanding how modern image classification systems are built and evaluated.


Objective

The primary objective of this project was to:

  • Understand the fundamentals of Deep Learning
  • Learn image classification using Convolutional Neural Networks (CNNs)
  • Implement a complete Deep Learning pipeline using PyTorch
  • Train and evaluate a CNN model on image data
  • Generate visualizations to analyze model performance
  • Organize the project using modular and maintainable code
  • Deploy the completed project on GitHub

Technologies and Libraries Used

The project was implemented using the following technologies:

  • Python
  • PyTorch
  • TorchVision
  • NumPy
  • Matplotlib
  • Seaborn
  • Scikit-learn

These libraries were used for model development, dataset handling, visualization, evaluation, and numerical computations.


Dataset Information

The project uses the MNIST handwritten digit dataset available through TorchVision.

Dataset Features

  • 60,000 training images
  • 10,000 testing images
  • Grayscale images
  • Image size: 28 × 28 pixels
  • 10 output classes (digits 0–9)

The dataset is automatically downloaded when the project is executed.


Model Architecture

A Convolutional Neural Network (CNN) was designed and implemented using PyTorch.

The architecture includes:

  1. Convolution Layer (32 Filters)
  2. ReLU Activation Function
  3. Max Pooling Layer
  4. Convolution Layer (64 Filters)
  5. ReLU Activation Function
  6. Max Pooling Layer
  7. Flatten Layer
  8. Fully Connected Layer (128 Neurons)
  9. Dropout Layer
  10. Output Layer (10 Classes)

The CNN automatically learns important image features and uses them to classify handwritten digits accurately.


Project Workflow

Data Preparation

  • Dataset loading
  • Tensor conversion
  • Data normalization
  • Train-validation split
  • DataLoader implementation

Model Development

  • CNN architecture creation
  • Layer configuration
  • Feature extraction setup
  • Classification layer implementation

Model Training

  • Forward propagation
  • Loss calculation
  • Backpropagation
  • Weight optimization using Adam Optimizer
  • Validation monitoring

Model Evaluation

  • Accuracy calculation
  • Classification report generation
  • Confusion matrix analysis
  • Prediction verification

Result Visualization

  • Accuracy and Loss Curves
  • Confusion Matrix Heatmap
  • Sample Prediction Visualization

Results

The trained CNN model achieved high classification accuracy on the MNIST dataset.

Generated outputs include:

  • Training and validation performance graphs
  • Confusion matrix visualization
  • Sample image predictions
  • Training history records
  • Saved trained model files

The model successfully learned handwritten digit patterns and produced reliable predictions on unseen test data.


Repository Structure

Task2/
│
├── data_loader.py
├── model.py
├── train.py
├── evaluate.py
├── visualize.py
├── README.md
├── requirements.txt
│
├── models/
│   ├── best_model.pth
│   └── final_model.pth
│
├── outputs/
│   ├── accuracy_loss_graph.png
│   ├── confusion_matrix.png
│   ├── sample_predictions.png
│   └── training_history.json

Learning Outcomes

Through this project, I gained practical knowledge of:

  • Deep Learning fundamentals
  • Image Classification
  • Convolutional Neural Networks (CNNs)
  • PyTorch framework
  • Dataset preprocessing
  • Model training and evaluation
  • Performance visualization
  • GitHub project deployment

This project significantly improved my understanding of Deep Learning workflows and provided hands-on experience in building and evaluating neural network models.


How to Run

Install dependencies:

pip install -r requirements.txt

Train the model:

python train.py

Evaluate the model:

python evaluate.py

Generate visualizations:

python visualize.py

Conclusion

This project successfully fulfilled the internship task requirement of implementing a Deep Learning model for Image Classification using PyTorch. A Convolutional Neural Network was developed, trained, evaluated, and visualized using the MNIST dataset. The project demonstrates the complete Deep Learning pipeline from data preparation to model deployment and serves as a strong foundation for future work in Artificial Intelligence and Machine Learning.

About

Deep Learning Image Classification using PyTorch and CNN on the MNIST dataset with training, evaluation, and visualization.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages