This project presents a complete implementation of a Convolutional Neural Network (CNN) from first principles using the CuPy library, enabling efficient GPU-accelerated computation in Python. It aims to explore the internal workings of CNNs beyond the abstraction provided by widely used frameworks such as TensorFlow or PyTorch. You can read
CuPy is an open-source array library for GPU-accelerated computing with Python. It offers a NumPy-compatible interface and leverages NVIDIA CUDA libraries such as cuBLAS, cuDNN, and cuFFT to perform high-speed numerical operations on the GPU. CuPy enables seamless transition from CPU-based NumPy code to GPU execution, making it ideal for scientific computing and deep learning research.
- Develop essential CNN components (e.g., convolutional layers, pooling, activation functions, fully connected layers, dropout, and loss functions) as modular Python classes
- Employ optimization strategies like
im2col,col2im, and memory-efficient techniques such asas_stridedfor convolution operations - Construct a training pipeline using a custom
Sequentialmodel and implement the AdamOptimizer for gradient-based learning - Validate the model using the MNIST dataset by assessing classification accuracy, loss, and training time across various batch sizes
- Preprocess MNIST images: convert to grayscale
.pngformat and normalize input values - Implement forward and backward propagation without loops, leveraging matrix operations and GPU acceleration
- Analyze model performance through validation curves and confusion matrices
This implementation confirms the feasibility of building a performant CNN purely with CuPy, highlighting both computational efficiency and the educational value of low-level deep learning architectures. It provides a foundation for extending the model to more complex datasets and deeper network designs.---
A full project report detailing methodology, implementation, results, and analysis is available in the DOCS folder:
Track the progress of the project here: GitHub Project Board