ConvNetwork
A convolutional neural network written entirely by hand in C++, trained on MNIST to 97.4 % accuracy — with no deep learning library at all.
A complete CNN implemented by hand in C++ — convolution, max pooling, dense layers, backpropagation and an Adam optimiser — in the same spirit as TransformerCpp: understanding every operation by writing and testing it yourself rather than relying on an existing library.
The project starts from a home-made Matrix class (raw allocation, rule of five, He initialisation) and builds the layers of a classic CNN on top: multi-channel 2D convolution with “same” padding, 2×2 max pooling, fully connected layers. These assemble into reusable blocks (Conv2D → MaxPooling → ReLU) and then into a complete network, ending with a flatten, a dense layer and a softmax fused with cross-entropy for a numerically stable gradient.
The most demanding part is the backward pass, derived and hand-coded for each layer: the convolution gradient with respect to both filters and input, and routing the max pooling gradient back to the single position that won the maximum on the forward pass. A home-made Adam optimiser (first and second moments, bias correction) is wired into the Conv2D and Dense layers. All of it is validated by a deliberate overfitting test: the network must drive the loss down on a single repeated example — if backpropagation is wrong anywhere, that test fails immediately.
On MNIST the chosen architecture stays deliberately simple — one convolutional block of 8 filters 3×3, pooling that brings the image down to 14×14×8, then a dense layer to the 10 classes — and reaches 97.4 % accuracy on the test set after a single training epoch, with Adam at a learning rate of 0.001. Everything runs on CPU, one image at a time, at roughly 1,200 examples per second.
The network was then plugged into TrainerApp, the graphical interface built for TransformerCpp: it became a small multi-model training platform, able to drive the CUDA Transformer and this CPU CNN alike through a dedicated adapter, with the same live monitoring of loss and accuracy curves.
That monitoring makes the model's main limitation very legible: over a long run, training loss collapses towards 0.001 while test loss climbs sharply from the third epoch onwards, and accuracy plateaus around 96 %. It is a textbook case of overfitting, expected for a network with neither regularisation nor data augmentation — the obvious levers to go further being batching, dropout, and a GPU port in the spirit of TransformerCpp.

Key points
- Convolution, max pooling and dense layers hand-coded in C++, forward and backward alike
- Home-made Adam optimiser, validated by an overfitting test on a single example
- 97.4 % accuracy on MNIST after a single epoch, with no deep learning library
- Integrated as TrainerApp's second model, alongside TransformerCpp