How sagarp-c/malayalam_ocr works
This repository is a personal Malayalam handwritten-OCR workflow: scanned pages are cleaned and segmented into lines, paired with Malayalam transcriptions, used to train a Kraken model, and then transcribed. It also includes augmentation and training-log visualization. The README documents training and prediction scripts whose contents were not sampled; those capabilities are shown at the documented level, without assuming their internal calls.
Main entry points: train_kraken.py Kraken model training · predict.sh Document prediction · lines Line images · vari.py Image augmentation
Components 19
Image preparation
- Scanned pages
images/raw - Image preprocessing
preprocess.py - Processed pages
images/processed - Line segmentation
segment_lines.py - Line images
lines - Manual line cropping
lines
Transcription data
- Transcriptions
ground_truth.txt - Split transcriptions
split_ground_truth.py - Line transcription files
lines - Image augmentation
vari.py - Augmented training pairs
lines
OCR training and use
- Kraken model training
train_kraken.py - Training entry script
train.sh - OCR model output
model_output - Document prediction
predict.sh - Digitized story
Training analysis
- Training log plots
plot_only.py - Training logs
model_output/training_log.txt
Other components
- Project user
Connections 21
- Project user → Scanned pages: provides scans
README.md - Scanned pages → Image preprocessing: reads scans
preprocess.py - Image preprocessing → Processed pages: writes pages
preprocess.py - Processed pages → Line segmentation: segments pages
segment_lines.py - Line segmentation → Line images: writes lines
segment_lines.py - Project user → Manual line cropping: crops lines
README.md - Manual line cropping → Line images: creates lines
- Project user → Transcriptions: writes transcriptions
README.md - Transcriptions → Split transcriptions: reads pairs
split_ground_truth.py - Split transcriptions → Line transcription files: writes text files
split_ground_truth.py - Line images → Image augmentation: reads images
- Line transcription files → Image augmentation: reads text
- Image augmentation → Augmented training pairs: writes pairs
vari.py - Augmented training pairs → Kraken model training: validates training pairs
train_kraken.py - Training entry script → Kraken model training: runs training
- Kraken model training → OCR model output: writes model
- Project user → Document prediction: requests transcription
README.md - Document prediction → OCR model output: uses trained model
- Document prediction → Digitized story: transcribes pages
README.md - Kraken model training → Training logs: writes logs
train_kraken.py - Training logs → Training log plots: reads metrics
plot_only.py