Skip to content

Latest commit

 

History

History
67 lines (56 loc) · 2.48 KB

README.md

File metadata and controls

67 lines (56 loc) · 2.48 KB

MNIST Digit Classification: CNN vs. RNN (LSTM)

This project explores two different approaches to solving the classic MNIST handwritten digit classification problem using PyTorch. The goal was to compare a spatially-aware model (CNN) against a sequence-aware model (RNN/LSTM) to see how they perform on the same dataset.


📌 Project Overview

  • Dual Architectures: Implemented a 3-layer Convolutional Neural Network and a 2-layer LSTM-based Recurrent Neural Network.
  • Data Pipeline: Used torchvision for normalization and data augmentation.
  • GPU Acceleration: Utilized CUDA for efficient training on a T4 GPU.
  • Performance Tracking: Monitored training loss across 10 epochs for both models.

📊 Results Comparison

Model Test Accuracy Final Training Loss
CNN 98.79% 0.0103
RNN (LSTM) 98.78% 0.0189

🛠️ Tech Stack

  • Language: Python
  • Framework: PyTorch (torch, nn, optim)
  • Visualization: Matplotlib
  • Environment: Google Colab / GPU T4

🧠 Technical Deep Dive

Convolutional Neural Network (CNN)

The CNN utilizes three convolutional layers with increasing filters (32, 64, 128) and MaxPool layers to extract spatial features from the 28x28 images.

Recurrent Neural Network (RNN/LSTM)

The LSTM treats each image as a sequence of 28 rows, where each row contains 28 features. This approach treats image recognition as a temporal sequence problem.


This project was developed as part of the Prime AI/ML batch program.