Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

CNN from Scratch — MNIST & Fashion-MNIST

A convolutional neural network built from scratch using only NumPy, trained and evaluated on both MNIST and Fashion-MNIST datasets. No PyTorch, no TensorFlow, just raw math.


What's in this project

This notebook implements every layer of a CNN by hand, including the forward pass and backpropagation:

  • Conv3x3 - Convolutional layer with 3×3 filters
  • MaxPool2 - 2×2 max pooling layer
  • Softmax - Fully connected output layer with softmax activation
  • Cross-entropy loss - Used as the training objective
  • SGD - Stochastic gradient descent for weight updates

Architecture

Input (28×28 grayscale)
    ↓
Conv3x3 (8 filters)   →  26×26×8
    ↓
MaxPool2              →  13×13×8
    ↓
Softmax (FC layer)    →  10 classes

Results

Trained for 3 epochs on 1,000 samples, tested on 1,000 samples.

Dataset Test Loss Test Accuracy
MNIST 0.4878 83.5%
Fashion-MNIST 0.6655 75.7%

Fashion-MNIST is a harder benchmark (clothing categories vs. handwritten digits), so the lower accuracy is expected.


Tech Stack

Tool Purpose
NumPy All layer math and backprop
TensorFlow / Keras Dataset loading only (mnist, fashion_mnist)
Matplotlib Loss & accuracy plots

Key Concepts Demonstrated

  • Manual implementation of convolution and max pooling
  • Backpropagation through each layer from first principles
  • Cross-entropy loss and softmax gradient derivation
  • Comparing CNN performance across datasets of different difficulty

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages