How krishnaharesh/optical-character-recognition works
This repository is a comparative OCR study with three independent command-line implementations: MNIST digit classification using an SVM, handwritten text recognition using TrOCR, and zero-shot transcription using an Ollama vision-language model. Each follows its own image or dataset-to-prediction path; only the deep-learning script computes character-level metrics and displays a dashboard. The README describes a broader cross-method evaluation, but the sampled code does not show a shared comparison runner, so that capability is represented as documented rather than as an implemented integration.
Main entry points: app.py Image loading and TrOCR inference · README.md Comparative evaluation · Machine Learning Appraoch/main.py SVM training and prediction · LLM Approach/main.py Image preparation and prompt
Components 12
Machine Learning OCR
- MNIST data
Machine Learning Appraoch/main.py - SVM training and prediction
Machine Learning Appraoch/main.py - Classification metrics and samples
Machine Learning Appraoch/main.py
Deep Learning OCR
- Image loading and TrOCR inference
Deep Learning Approach/app.py - Pretrained TrOCR model
Deep Learning Approach/app.py - Character metrics
Deep Learning Approach/app.py - OCR results dashboard
Deep Learning Approach/app.py
LLM OCR
- Image preparation and prompt
LLM Approach/main.py - Ollama vision inference
- Transcription output
LLM Approach/main.py
Evaluation
- Comparative evaluation
README.md
Other components
- Image user
Connections 13
- Image user → Image loading and TrOCR inference: provides image
README.md - Image user → Image preparation and prompt: provides image
README.md - MNIST data → SVM training and prediction: trains and tests
Machine Learning Appraoch/main.py - SVM training and prediction → Classification metrics and samples: evaluates predictions
Machine Learning Appraoch/main.py - Image loading and TrOCR inference → Pretrained TrOCR model: runs inference
Deep Learning Approach/app.py - Pretrained TrOCR model → Character metrics: supplies prediction
Deep Learning Approach/app.py - Character metrics → OCR results dashboard: supplies metrics
Deep Learning Approach/app.py - Image loading and TrOCR inference → OCR results dashboard: supplies image and text
Deep Learning Approach/app.py - Image preparation and prompt → Ollama vision inference: sends image and prompt
LLM Approach/main.py - Ollama vision inference → Transcription output: returns transcription
LLM Approach/main.py - Classification metrics and samples → Comparative evaluation: contributes evaluation
README.md - Character metrics → Comparative evaluation: contributes evaluation
README.md - Transcription output → Comparative evaluation: contributes evaluation
README.md