Back to projects

Project

CNN From Scratch in C++

Implemented a Convolutional Neural Network from scratch in C++ without using any deep learning libraries. Actually wrote the computation for each matrix operation, convolution, and backpropagation step manually.

As a part of my Machine Learning course at BITS Pilani, we had to implement a CNN from scratch in C++. The catch was that we couldn't use any deep learning libraries or frameworks and had to write the computation for each matrix operation, convolution, and backpropagation step manually.

Extremely intimidating at first, but it really did shape the way I now understand any ML/DL concept now. When you have to write the code for a convolution operation yourself, you really understand what it does and how it works. When you have to write the backpropagation code yourself, you really understand how gradients flow and how the model learns. It was a lot of work but I'm really glad I did it because it gave me a much deeper understanding of the foundations of machine learning and deep learning.

Since we werent allowed to use any external libraries whatsoever, we had to do everything ourselves, from optimisations to even the data augmentations. It achieved a ~60% accuracy on the CIFAR-10 dataset which was pretty good considering the constraints of the task and the fact that we had to write everything from scratch.

To test the methodology's efficacy, we were also asked to compare it against standard logistic regression on the same dataset, which performed poorly with a 39.8% accuracy on the same dataset.

Easily one of the more challenging courses I took in college, but happy that I did!

ChittemGPTAsk anything from the site