I built a CNN from scratch in C!

Hey everyone!

Lately I started learning AI and I wanted to implement some all by myself to understand it better so after implementing a basic neural network in C I decided to move on to a bigger challenge : implementing a full CNN from scratch in C (no library at all) on the famous MNIST dataset.
Currently I'm able to reach 91% accuracy in 5 epochs but I believe I can go further.

For now it features :

  • Convolutional Layer (cross-correlation)
  • Pooling Layer (2x2 max pooling)
  • Dense Layer (fully connected)
  • Activation Function (softmax)
  • Loss Function (cross-entropy)

Do not hesitate to check the project out here : https://github.com/AxelMontlahuc/CNN and give me some pieces of advice for me to improve it!

I'm looking forward for your feedback.

Posted Jun 15, 2025, 3:18 PM UTC

53
Loading comments…