A handwritten digit recognition system built from scratch using Python. This project demonstrates high-performance optimization by integrating C extensions, Fortran, and OpenBLAS with a custom Python CNN implementation.
- From-scratch implementation using NumPy and SciPy.
- Performance optimizations:
- C extensions for core functions (Softmax, ReLU, Loss, Weight/Bias updates).
- Fortran
f2pyextension for vector operations. - OpenBLAS integration for accelerated matrix multiplication.
- Custom compiled modules loaded via
ctypes. - Complete training pipeline included in
lab.ipynb.
- Python 3.8+
- NumPy
- SciPy
- Jupyter Notebook
-
Clone the repository:
git clone https://github.com/77AXEL/Digit-Recognizer cd Digit-Recognizer -
Extract the dataset:
unzip data.zip
Note: This step is required before training.
-
Install dependencies:
pip install numpy scipy jupyter
-
(Optional) Rebuild binaries: If you need to recompile for your specific environment:
cd lib makeRequires
gfortranandg++(MinGW on Windows).
Open and run the main notebook to train and test the model:
jupyter notebook lab.ipynbThis project explores low-level neural network optimization. Instead of relying on frameworks like PyTorch or TensorFlow, it implements the forward and backward passes manually.
- Architecture: Standard CNN with alternating Convolutional/Pooling layers and Fully Connected layers.
- Optimization: Computationally intensive tasks (loops, dense math) are offloaded to compiled C/Fortran code to remove Python interpreter bottlenecks.
This project is licensed under the MIT License.

