A comprehensive C++ implementation of Convolutional Neural Networks for MNIST digit classification, featuring both LeNet-5 and VGG16 architectures with a modern Qt-based graphical interface.
- LeNet-5 Implementation: Custom C++ implementation achieving >99.8% accuracy on MNIST
- VGG16 Architecture: Complete VGG16 implementation (provided as reference)
- From-Scratch Implementation: Custom CNN layers (convolutional, pooling, fully connected)
- Multiple Activation Functions: ReLU, Leaky ReLU, Sigmoid, Tanh
- Advanced Initialization: Gaussian, Xavier, He initialization methods
- Interactive Canvas: Draw digits with customizable brush colors
- Real-time Recognition: Instant digit detection with bounding boxes
- Image Import: Support for PNG, JPG, JPEG, BMP formats
- Undo/Redo System: 16-step history for canvas operations
- Training Monitor: Real-time progress bars and accuracy tracking
- Binary Model Format: Custom
.cnnformat with magic number validation - Model Persistence: Save and load trained models
- Training Configuration: Adjustable batch size, epochs, learning rates
- Multiple Training Modes: Simple and detailed training with progress monitoring
- Setup Model
- Choose Model Type: LeNet-5 (recommended) or VGG16
- Create New Model: File → New Model or load existing
.cnnfile - Configure training parameters in the Model panel
- Prepare Data
- Set paths to MNIST dataset files:
- Train Data:
train-images.idx3-ubyte - Train Labels:
train-labels.idx1-ubyte - Test Data:
t10k-images.idx3-ubyte - Test Labels:
t10k-labels.idx1-ubyte
- Train Model
- Click Start Training or use Train menu
- Monitor real-time progress with accuracy and loss
- Stop training anytime with Stop Training
- Recognize Digits
- Draw on canvas or Import image file
- Click Recognize to detect and label digits
- Export recognized digits for further analysis
The application automatically saves settings to config.ini
- Custom CNN Implementation: All layers implemented from scratch
- Efficient Linear Algebra: Eigen3 for matrix operations
- Image Processing: OpenCV for digit extraction and preprocessing
- Multi-threading: OpenMP support for parallel computation
- Binary Serialization: Custom format for model persistence
- Models:
.cnn(custom binary format with magic number 1128) - Images: PNG, JPG, JPEG, BMP
- MNIST Data: IDX3/IDX1 binary formats
MIT License; This project was developed as part of Sichuan University C++ coursework, demonstrating complete CNN implementation from scratch.