Two OCR applications built in Python, developed as a B.Eng. thesis at University of Pitești (grade 9.33/10). The project focuses on understanding neural networks from first principles, implementing everything from scratch before introducing a framework.
A fully hand-rolled neural network for handwritten character recognition. No ML libraries — every component implemented manually.
Architecture:
- Feedforward neural network with configurable input, hidden, and output layers
- Sigmoid activation function throughout
- Backpropagation implemented from scratch: delta computation for output and hidden neurons, weight update via gradient descent
- Template-based training: each character drawn by hand in the template editor becomes a training sample
Applications:
- Template Editor (
tkinterGUI) — draw training shapes on a pixel canvas, save as templates - Neural Network Model — trains on the saved templates, learns character-to-output associations
- Test Shape Editor (
tkinterGUI) — draw new test inputs to feed to the trained network - Test Application — runs inference, shows predicted character
Key detail: The network learns that the same character drawn in a different style should map to the same output — generalization from hand-drawn variation, not pixel matching.
Note: The source code is written in Romanian. Feel free to fork and create an English version.
Usage:
- Run
EditorSabloaneAntrenament.py— draw one or more training patterns for the network to learn. Saves pixel values (0/1) tosabloane antrenament.txt. More patterns = better training. - Run
ReteaNeuronalaAntrenament.py— trains the network until the gradient descends below a configurable threshold. Saves weights toponderi.txt. You can also set a fixed number of epochs instead. - Run
EditorSabloaneTest.py— draw a test pattern for inference. Saves tosabloane test.txt. One pattern per run; running again overwrites the previous one. - Run
ReteaNeuronalaTest.py— loads weights and test pattern, computes output neuron activations, and prints the highest activation as the predicted label. Supports 10 labels (digits 0–9).
A cleaner reimplementation using Keras/TensorFlow, trained on the MNIST dataset.
Architecture:
- Dense layers with ReLU and Softmax activations
- Adam optimizer
- Trained on 60,000 MNIST samples, tested on 10,000
- 97.5% accuracy on the test set
Applications:
- Tensor Visualizer — displays MNIST images as 3D tensor graphs (raw pixel values) and grayscale, before and after normalization, using Matplotlib
- Neural Network Model — Keras model definition and training
- Test Application — inference on MNIST test samples (
x_test[0],x_test[1000], etc.)
| Concept | Project 1 | Project 2 |
|---|---|---|
| Forward pass | Manual | Keras |
| Backpropagation | Manual (from scratch) | Keras (autograd) |
| Activation functions | Sigmoid (manual) | ReLU + Softmax |
| Training data | Hand-drawn templates | MNIST (60k samples) |
| Accuracy | Template-dependent | 97.5% |
| GUI | Tkinter (template + test editors) | — |
| Visualization | — | Matplotlib 3D tensor display |
| Layer | Technology |
|---|---|
| Language | Python 3 |
| ML (Project 1) | None — from scratch |
| ML (Project 2) | Keras / TensorFlow |
| Data | Custom templates / MNIST |
| Visualization | Matplotlib |
| GUI | Tkinter |
| Numerics | NumPy |
B.Eng. thesis — "Application with neural networks in the Python language"
Faculty of Electronics, Communications and Computers, University of Pitești, 2020.
Grade: 9.33/10
Follow-up work: deepfake-animator — deepfake-powered 2D animation pipeline built on First Order Model (M.Sc. dissertation, grade 10/10).