Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mini-Digits

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.

Features

Neural Network Core

  • 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

User Interface

  • 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

Model Management

  • Binary Model Format: Custom .cnn format 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

Quick Start Guide

  1. Setup Model
  • Choose Model Type: LeNet-5 (recommended) or VGG16
  • Create New Model: File → New Model or load existing .cnn file
  • Configure training parameters in the Model panel
  1. 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
  1. Train Model
  • Click Start Training or use Train menu
  • Monitor real-time progress with accuracy and loss
  • Stop training anytime with Stop Training
  1. Recognize Digits
  • Draw on canvas or Import image file
  • Click Recognize to detect and label digits
  • Export recognized digits for further analysis

Configuration

The application automatically saves settings to config.ini

Development

Key Technical Features

  • 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

File Formats

  • Models: .cnn (custom binary format with magic number 1128)
  • Images: PNG, JPG, JPEG, BMP
  • MNIST Data: IDX3/IDX1 binary formats

License

MIT License; This project was developed as part of Sichuan University C++ coursework, demonstrating complete CNN implementation from scratch.

About

Sichuan University C++ Course End-of-term Project - A handwriting digit recognizer with Qt

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages