Master's Thesis Project
# Multi-Line Amharic Handwritten Document OCR Using Hybrid Vision Transformers (ViT)
An end-to-end, high-performance Client-Server system designed for unconstrained Amharic handwritten text recognition. This project decouples heavy deep learning inference from mobile hardware by utilizing a lightweight mobile client for document acquisition and a GPU-accelerated server backend to execute layout segmentation and sequence transcription.
## 🏛️ System Architecture Overview
The system is structured into three discrete execution phases to optimize throughput and preserve mobile device battery efficiency:
* **Frontend Acquisition (Flutter):** Captures documents via a specialized camera interface powered by `google_mlkit_document_scanner` which performs native border tracking, perspective deskewing, and contrast normalization.
* **Layout Segmentation (FastAPI + Uvicorn):** Processes the image on the server using a **Hybrid A* Path-Planning algorithm** combined with an energy cost map (derived from a Distance Transform). The algorithm snakes dynamically between lines, safely bypassing overlapping ascenders and descenders and extracts isolated line images.
* **Sequence Recognition (PyTorch + CUDA):** Leverages a customized **HybridViT** network architecture. A CNN front-end extracts highly detailed, localized spatial character features, which are then serialized and passed directly into a Core **Vision Transformer (ViT)** to model global context across the Ethiopic character sequence. Final strings are decoded using CTC Greedy Decoding.
## Repository Structure
```
lib/
├── main.dart # entrypoint
├── app.dart # MaterialApp, theming
├── core/
│ ├── theme/ # Material 3 light/dark theme, color tokens
│ ├── constants/ # endpoint paths, pref keys, default URL
│ └── utils/result_formatter.dart
├── models/
│ ├── ocr_state.dart # OcrPhase enum (explicit state machine)
│ ├── ocr_model …