This repository contains the C implementation of a Convolutional Neural Network (CNN) model trained on the MNIST dataset for recognizing handwritten digits.
-
Clone the repository:
git clone https://github.com/yourusername/handwriting-to-text-recognition-c.git
-
Compile the code:
make
- Run the training file:
./main
- Run the test file:
./test
The model architecture is implemented in model_saver.c
and consists of functions for initializing the model, saving the model and loading the model.
The dataset used is included in /data
consisting of 60,000 training and 10,000 testing dataset in idx3-ubyte format for images and id1-ubyte format for labels. The file MNIST_data_loader.c
consists of funtion to load, unload and get data images and labels. +
The training data is loaded from the MNIST dataset and the model is trained using stochastic gradient descent.
After the training, the model parameter is saved in /reults/model.txt
that is stored and can be loaded using funtions
stored in model_saver.c
.
The model's performance is evaluated on the test dataset to measure its accuracy in recognizing handwritten digits.
Inference time: Inference time of C is far less than that observed by running that with the python
code which is about (1/10) of that.
The training reult is stored in /results
folder.
After training, the model achieved an accuracy of 99% on the training set and 98% on the vali-dation set.
On the test set, the model achieved an accuracy of 97%, demonstrating its effectiveness in recognizing handwritten digits.
Train Accuracy
Test Accuracy
Train Loss
Test Loss