Built to order

Handwritten Equation Solver using CNN

A system that reads a handwritten math equation from a photo and returns the solved answer. A CNN classifier trained on EMNIST (Cohen et al., 2017) plus CROHME competition symbols recognizes each digit, letter and operator; a segmentation stage splits the equation into symbols; a structural parser recovers the two-dimensional layout into an expression tree; and SymPy evaluates or simplifies it. The included notebook runs a symbol-accuracy procedure on a held-out symbol set and logs solve-rate on a curated equation sheet during your own build, so every number in the report comes from your run.

Handwritten Equation Solver using CNN - project prototype demo screenshot

The problem

Point-and-shoot equation solving is a classic "could a machine do it" demo that hides a serious pipeline: segmentation, symbol recognition, two-dimensional parsing and symbolic computation. A photo of "3x + 2 = 11" is trivial for a person and hard for software, because the symbols must first be cut apart, each one classified, their spatial relationships (superscript, fraction bar, subscript) recovered, and only then the mathematics evaluated. This project builds that full chain: a CNN trained on public handwritten-symbol data classifies every segment, a baseline-structure parser turns the classified symbols into an expression tree, and SymPy evaluates, simplifies or solves the resulting expression exactly.

The recognizer is trained on EMNIST (Cohen et al., 2017) for digits and letters plus CROHME competition data (ICDAR 2011-2019) for math operators and Greek letters, covering roughly 100 symbol classes. The included Jupyter notebook runs a symbol-accuracy procedure on a held-out symbol set and logs the solve rate on a curated equation sheet during your own build, so the report's numbers come from your run rather than a claim.

How it works

  1. The equation photo is binarized and deskewed with OpenCV, then split into connected components.
  2. Each component is normalized to the classifier's input size and classified by the CNN into a digit, letter or operator with a confidence score.
  3. Spatial relationships between symbols are analyzed with recursive baseline-structure parsing to recover fractions, superscripts and roots.
  4. The parser assembles the symbols and relationships into an expression tree.
  5. The tree is converted to a SymPy expression and evaluated, simplified or solved symbolically.
  6. The evaluation notebook runs the held-out symbol-accuracy procedure and logs solve-rate over the equation sheet.

Tech stack:

  • Python 3.10, PyTorch (CNN training and inference)
  • EMNIST dataset (Cohen et al. 2017, digits and letters)
  • CROHME competition symbols (ICDAR 2011-2019, math operators)
  • OpenCV (binarization, deskewing, connected components)
  • SymPy (symbolic evaluation and solving)
  • Jupyter notebook (evaluation with symbol-accuracy procedure)
  • NumPy, matplotlib (confusion analysis and annotated outputs)
Parameter Value
Model CNN symbol classifier, around 100 symbol classes
Datasets EMNIST (digits, letters), CROHME competition symbols (operators, Greek letters)
Segmentation Binarization, deskewing, connected-component splitting
Parsing Recursive baseline-structure analysis into an expression tree
Solver SymPy evaluation, simplification and symbolic solving
Evaluation Held-out symbol-accuracy procedure and equation-sheet solve-rate log, run by the notebook during your build
Input Photograph of a handwritten equation
Output Recognized expression, parsed tree visualization, solved answer

Project features

  • CNN symbol classifier trained on EMNIST plus CROHME math symbols (around 100 classes)
  • Connected-component segmentation with deskewing and size normalization
  • Two-dimensional structural parser recovering superscripts, fractions and roots
  • SymPy backend for evaluation, simplification and symbolic solving
  • Annotated equation images showing segments, labels and confidence
  • Equation-sheet mode: batch-solve a page of photographed equations
  • Evaluation notebook with held-out symbol-accuracy procedure and solve-rate log
  • Demo app for uploading equation photos and stepping through the parse

What is included

  • Complete source code (preprocessing, CNN training, segmentation, parser, solver, demo app)
  • Jupyter training and evaluation notebook (symbol accuracy, confusion analysis, solve-rate log)
  • Project report PDF (background, EMNIST and CROHME, methodology, evaluation, error analysis)
  • PPT presentation for final review
  • Viva Q&A preparation document (CNNs, segmentation, structural parsing, SymPy, dataset coverage)
  • Setup guide (environment, dataset download, training, running on your own equation photos)

Limitations & prerequisites

  • Recognition covers the symbol classes present in EMNIST and the CROHME symbol inventory: handwriting styles far outside that training mix classify worse, and the report documents this coverage gap openly.
  • Heavily cursive writing, overlapping symbols and poor lighting break the segmentation stage before recognition even starts; the pipeline assumes clearly separated, legible handwriting.
  • This is an educational prototype combining recognition with symbolic computation, not a certified math-assessment tool — results are advisory and should be verified independently.

Frequently Asked Questions

What do CROHME and EMNIST contribute?

EMNIST (Cohen et al., 2017) supplies digits and letters; the CROHME competition datasets (ICDAR 2011-2019) add math operators and Greek letters, giving around 100 symbol classes for the classifier.

How does it handle fractions and exponents?

After classification, a recursive baseline-structure parser analyzes spatial relationships — what sits above a fraction bar, what is raised as an exponent — and builds an expression tree before SymPy ever sees the equation.

What kinds of equations can it solve?

Arithmetic evaluation, algebraic simplification and symbolic solving for what the grammar covers — the parser handles the standard school-level layout set, not arbitrary two-dimensional notation.

How is accuracy measured?

The notebook runs a held-out symbol-accuracy procedure for the CNN and logs solve-rate on a curated equation sheet, so both numbers come from your own training run and are documented in the report.

Does it work from a phone photo?

Yes — the pipeline starts with binarization and deskewing precisely so photographed equations are handled, though clear lighting and separated symbols give the best results.

What is SymPy used for?

SymPy takes the parsed expression tree and performs exact symbolic computation: evaluation, simplification and solving, with no floating-point heuristics involved. Suitable for B.E./B.Tech final-year projects in Computer Science, AI/ML and Data Science.

Components & software requirements
  • Python 3.10, PyTorch (CNN training and inference)
  • EMNIST dataset (Cohen et al. 2017, digits and letters)
  • CROHME competition symbols (ICDAR 2011-2019, math operators)
  • OpenCV (binarization, deskewing, connected components)
  • SymPy (symbolic evaluation and solving)
  • Jupyter notebook (evaluation with symbol-accuracy procedure)
  • NumPy, matplotlib (confusion analysis and annotated outputs)
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download abstract (PDF)

Related guides

All guides
Illustration of object tracking showing video frames with bounding boxes and persistent ID labels following people and vehicles, comparing motion prediction and appearance matching.B.E./B.Tech Computer Science and Electronics students building video analytics projects — people counting, vehicle tracking, sports analysis — who have detection working and need

Object Tracking: DeepSORT and ByteTrack Explained

Detection finds objects per frame; tracking keeps their identities across frames. This guide explains tracking-by-detection, Kalman motion models, DeepSORT's appearance embeddings vs ByteTrack's low-confidence box recovery, tracking metrics (HOTA, IDF1, ID switches), and the tuning parameters that determine real-world quality.

Read guide
Illustration of image segmentation showing U-Net's U-shaped encoder-decoder with skip connections producing pixel masks, alongside Mask R-CNN detecting instances with masks.B.E./B.Tech Computer Science and AI/ML students moving from image classification or detection to pixel-level understanding — medical imaging, defect detection, autonomous driving

Image Segmentation: U-Net and Mask R-CNN

When projects need pixel-level answers, segmentation delivers. This guide explains semantic vs instance vs panoptic segmentation, U-Net's encoder-decoder with skip connections, Mask R-CNN's parallel mask head, Dice and IoU evaluation, paired augmentation, and how to choose the right architecture for your data and question.

Read guide
Illustration of Whisper speech-to-text showing sound waves flowing into a neural network and emerging as transcribed text with timestamps and speaker labels.B.E./B.Tech Computer Science and AI/ML students adding speech-to-text to projects — voice assistants, meeting transcription, accessibility tools

Whisper for Speech-to-Text in Student Projects

Whisper transcribes speech in dozens of languages with no training required. This guide covers how it works, choosing among model sizes, running it locally with faster-whisper, handling hour-long audio, timestamps and speaker diarization, multilingual quirks, and honest evaluation with word error rate.

Read guide
Get a quotation