React · Node · FastAPI · TensorFlow · Symspell

Yours OCR

A web-based Optical Character Recognition (OCR) system for detecting and recognizing handwritten English text from images.

VIEW ON GITHUB

Yours OCR - Handwritten Text Recognition System

A web-based Optical Character Recognition (OCR) system for detecting and recognizing handwritten English text from images.

Developed For the Undergraduate IT project of TDTU

Myat Thiri Maung Faculty of Information Technology
Ton Duc Thang University

Demo Youtube Video

Project Overview

This project implements a complete handwritten OCR web application that converts handwritten English text images into editable digital text. The system uses a two-model pipeline combining word detection and word recognition with post-processing spelling correction.

Key Features

  • Single and multiple image upload support
  • Automatic word detection in handwritten documents
  • Handwritten text recognition using CNN-BiLSTM architecture
  • Spelling correction with SymSpell algorithm
  • Editable text interface
  • Copy to clipboard functionality
  • Download results as .txt files
  • Responsive React-based UI

System Architecture

Two-Model Pipeline

  1. Word Detection Model: Identifies and localizes handwritten word regions
  2. Word Recognition Model: Recognizes text from cropped word images

Technology Stack

  • Frontend: React.js
  • Backend: FastAPI (Python)
  • ML Framework: TensorFlow/Keras
  • Spelling Correction: SymSpell
  • Dataset: IAM Handwriting Database

Models

Word Detection Model

  • Source: WordDetectorNN
  • Type: Dense prediction model for pixel-wise word detection
  • Approach: Combines semantic segmentation with geometric regression
  • Dataset: IAM Handwriting Database (~1,500 pages, ~115,000 words)

Word Recognition Model

  • Architecture: CNN-BiLSTM with CTC (Connectionist Temporal Classification)
  • Base Model: Improved version of handwritten-model
  • Parameters: 1.67M (increased from 424K in base model)
  • Dataset: IAM_Words (96,456 cropped word images)

Model Improvements

AspectBase ModelImproved Model
Parameters~424K~1.67M
Batch NormalizationNoYes
Data AugmentationLimitedEnhanced
Learning RateFixedScheduled
Character Accuracy~74%83.65%
Word Accuracy~63%71.45%

Data Split

SplitPercentageImages
Training90%86,810
Validation5%4,823
Testing5%4,823
Total100%96,456

Performance

Word Recognition Model Metrics

  • Character-level Accuracy: 83.65%
  • Word-level Accuracy: 71.45%
  • Word-level Error Rate: 28.65%
  • Training Epochs: 11 (with early stopping)

Model Features

  • Distortion-free image resizing with padding
  • Random brightness and contrast augmentation
  • Batch normalization for stable training
  • CTC decoding for variable-length sequences

Installation & Setup

Prerequisites

  • Python 3.8+
  • Node.js 14+
  • npm or yarn

Backend Setup

  1. Clone the repository
git clone https://github.com/MyatThiriMaung3/yours_ocr_demo.git
cd yours_ocr_demo
  1. Navigate to backend directory
cd backend
  1. Install Python dependencies
pip install -r requirements.txt
  1. Start the FastAPI server
uvicorn main:app --reload
  1. Verify backend health
# Open browser and visit:
http://localhost:8000/health

Frontend Setup

  1. Open new terminal and navigate to frontend directory
cd frontend/yours_ocr_react
  1. Install dependencies
npm install
  1. Start development server
npm run dev
  1. Access the application
# Open browser and visit:
http://localhost:5173

API Endpoints

Health Check

GET /health

Returns backend status and model availability.

Extract Text (OCR)

POST /extract-text
Content-Type: multipart/form-data

Parameters:
- file: Image file (PNG, JPG, JPEG)

Response:
{
  "full_text": "recognized text...",
  "words": [...],
  "image_name": "example.png"
}

Spelling Correction

POST /check-spelling
Content-Type: application/json

Body:
{
  "text": "text to correct"
}

Response:
{
  "corrected_text": "corrected text..."
}

Spelling Correction Rules

The system excludes certain words from spell-checking to preserve accuracy:

  • Uppercase words (e.g., "OCR", "CNN")
  • Words with initial capital letters (e.g., proper nouns)
  • Words shorter than 3 characters

Key Achievements

  • Successfully implemented end-to-end handwritten OCR pipeline
  • Achieved 9.65% improvement in character-level accuracy over base model
  • Achieved 8.45% improvement in word-level accuracy over base model
  • Integrated word detection and recognition into functional web application
  • Implemented smart spelling correction with filtering rules
  • Created user-friendly interface with multiple export options

References

Datasets

Models & Code

Technologies

Design

License

This project is part of an undergraduate IT project at Ton Duc Thang University.

Contact

Myat Thiri Maung Ton Duc Thang University
Faculty of Information Technology


Project completed: January 2026