This project implements a Convolutional Neural Network (CNN) from scratch (without Keras/TensorFlow/PyTorch) to classify handwritten digits from the MNIST dataset.
To better understand how convolutional neural networks work under the hood by building one from scratch without high-level ML frameworks.
CNN/
├── checkpoints/ # Saved model weights
├── data/
│ └── mnist.pkl.gz # Compressed MNIST data file
├── model/
│ ├── CNN.py # Main CNN architecture
│ ├── ConvLayer.py # Custom convolutional layer
│ ├── init.py
│ └── FFNN/
│ └── NN.py # Fully-connected network
├── utils/
│ ├── activation_loss.py # Activation functions and loss functions
│ ├── mnist_loader.py # MNIST data loader
│ ├── init.py
├── main.py # Entry point for training and evaluation
├── training.py # Training loop
- Python 3.7+
- NumPy
- gzip, pickle (from Python standard library)
To install the required packages: pip install numpy
- Make sure
mnist.pkl.gzis present in thedata/folder. - Run training:
python main.py
- Custom implementation of convolutional layers
- Custom implementation for both CNN and FFNN architectures
- MNIST digit classification
- Modular and extensible codebase
⚠️ Training and hyperparameter tuning are still in progress. Results shown are preliminary.
