How breezedeus/cnocr works
CnOCR is a Python OCR toolkit: users submit an image through CnOcr, which detects text regions (or uses simple line splitting) and recognizes the resulting text. Recognition supports native CnOCR models and PP-OCR/RapidOCR alternatives. The repository also exposes CLI prediction and model-training workflows. The README documents these capabilities; some detector and training internals were not sampled, so uncertain implementation links are omitted.
Main entry points: cn_ocr.py OCR API · cli.py CLI commands · recognizer.py Native recognizer · trainer.py Model trainer
Components 17
OCR runtime
- OCR API
cnocr/cn_ocr.py - Text detection
- Line splitting
cnocr/line_split.py
Recognition engines
- Native recognizer
cnocr/recognizer.py - PP-OCR recognizer
cnocr/ppocr/pp_recognizer.py - RapidOCR recognizer
cnocr/ppocr/rapid_recognizer.py - PP postprocessing
cnocr/ppocr/postprocess/rec_postprocess.py
Model core
- Model registry
cnocr/consts.py - OCR network
cnocr/models/ocr_model.py - CTC decoding
cnocr/models/ctc.py
Training
- CLI commands
cnocr/cli.py - Model trainer
cnocr/trainer.py - OCR dataset
cnocr/dataset.py - Image augmentation
cnocr/data_utils/aug.py - Image transforms
cnocr/data_utils/transforms.py - Learning scheduler
cnocr/lr_scheduler.py
Other components
- Image user
Connections 17
- Image user → OCR API: submits image
README.md - OCR API → Text detection: locates text
README.md - OCR API → Line splitting: splits lines
cnocr/cn_ocr.py - OCR API → Native recognizer: dispatches recognition
cnocr/cn_ocr.py - OCR API → PP-OCR recognizer: dispatches recognition
- OCR API → RapidOCR recognizer: dispatches recognition
- Native recognizer → Model registry: resolves models
cnocr/recognizer.py - Native recognizer → OCR network: runs network
cnocr/recognizer.py - OCR network → CTC decoding: decodes logits
cnocr/models/ocr_model.py - PP-OCR recognizer → PP postprocessing: processes predictions
cnocr/ppocr/pp_recognizer.py - CLI commands → OCR API: runs prediction
README.md - CLI commands → Model trainer: starts training
cnocr/cli.py - CLI commands → OCR dataset: configures data
cnocr/cli.py - CLI commands → Image transforms: configures transforms
cnocr/cli.py - Model trainer → Learning scheduler: uses schedule
cnocr/trainer.py - Model trainer → OCR dataset: trains on data
- OCR dataset → Image augmentation: augments images