Handwritten LaTeX Formula Recognition
Upload or draw any handwritten mathematical equation to extract accurate, copy-ready LaTeX code powered by Deep Learning.
Upload Handwritten Formula
Drag & drop your handwritten formula image here
or click to browse files (PNG, JPG, WEBP, BMP up to 10MB)Recognized Formula Result
Formula Recognition History
All your previously recognized handwritten equations saved locally.
End-to-End System Workflow
Step 1: Preprocessing & Detection
Applies OpenCV Gaussian Adaptive Thresholding and Horizontal Projection Profiling (HPP) to segment handwritten ink strokes from ruled notebook paper and crop individual equation lines.
Step 2: Visual Feature Extraction
Fine-tuned EfficientNet-B0 backbone extracts spatial feature maps ($128 \times 512$ canvas) projected into a 256-dimensional feature space.
Step 3: Neural Sequence Generation
A 4-layer Transformer Decoder with 8 attention heads generates token-by-token LaTeX code using Beam Search ($k=5$) decoding over a 241-symbol vocabulary.
Step 4: Symbolic Solving & Plotting
SymPy Symbolic Engine evaluates roots, integrals, and summations, while Matplotlib renders dark-mode function curve plots.
Key Technologies Used
- Python 3.10+: Core Programming Language
- PyTorch: Deep Neural Network Training & Inference
- OpenCV: Adaptive Thresholding & Line Segmentation
- EfficientNet-B0: Pretrained Transfer Learning Backbone
- Transformer Decoder: Multi-Head Sequence Generation
- HME100K Dataset: 100,000+ Handwritten Math Expressions
- SymPy: Symbolic Math Computation Engine
- Matplotlib & NumPy: Function Plotting & Curve Generation
- FastAPI & Uvicorn: High-Performance REST API Server
- KaTeX & Vanilla CSS: Real-Time LaTeX Rendering & Web Client
Key System Features
- Detects handwritten equations from notebook paper images.
- Automatically crops equation regions using OpenCV projection.
- Extracts deep visual features using EfficientNet-B0.
- Generates LaTeX expressions using a Transformer Decoder.
- Supports fractions, powers, roots, Greek symbols, integrals, and limits.
- Employs transfer learning for higher accuracy and faster convergence.
- Provides a FastAPI-based REST API for seamless external integration.
- Saves best-performing model weights with checkpoint support.
Real-World Applications
EdTech & E-Learning
Automated homework grading, interactive learning platforms, and digital math tutoring systems.
Academic & Research Digitization
Converting handwritten research notes, whiteboard derivations, and lecture slides into publication-ready LaTeX.
Stylus Note-Taking Apps
Integration into digital tablet apps (iPad, Android stylus, e-ink devices) for instant formula recognition.