feat: OCR engine abstraction layer and PaddleOCR integration (#115) #116

Closed
opened 2026-02-07 16:12:46 +00:00 by egullickson · 0 comments
Owner

Relates to #115

Create an OCR engine abstraction layer in ocr/app/engines/ to decouple extractors from Tesseract. Implement PaddleOCR as the primary engine using PP-OCRv4 models.

Changes

  • Create ocr/app/engines/base_engine.py - OcrEngine ABC with recognize(image_bytes, config) method
  • Create ocr/app/engines/paddle_engine.py - PaddleOCR wrapper with PP-OCRv4, angle classification, CPU-only
  • Create ocr/app/engines/engine_factory.py - Factory to instantiate configured engine
  • Update ocr/app/config.py - Add OCR_PRIMARY_ENGINE, OCR_CONFIDENCE_THRESHOLD env vars
  • Update ocr/requirements.txt - Add paddlepaddle, paddleocr dependencies

Acceptance Criteria

  • OcrEngine ABC defines recognize() returning structured OcrEngineResult (text, confidence, word boxes)
  • PaddleOcrEngine wraps paddleocr with PP-OCRv4 models
  • Engine supports VIN character whitelist mode and PSM-equivalent configurations
  • Engine factory reads config to instantiate correct engine
  • Existing Tesseract functionality preserved (TesseractEngine wrapper for backward compat)
Relates to #115 Create an OCR engine abstraction layer in `ocr/app/engines/` to decouple extractors from Tesseract. Implement PaddleOCR as the primary engine using PP-OCRv4 models. ## Changes - Create `ocr/app/engines/base_engine.py` - `OcrEngine` ABC with `recognize(image_bytes, config)` method - Create `ocr/app/engines/paddle_engine.py` - PaddleOCR wrapper with PP-OCRv4, angle classification, CPU-only - Create `ocr/app/engines/engine_factory.py` - Factory to instantiate configured engine - Update `ocr/app/config.py` - Add `OCR_PRIMARY_ENGINE`, `OCR_CONFIDENCE_THRESHOLD` env vars - Update `ocr/requirements.txt` - Add `paddlepaddle`, `paddleocr` dependencies ## Acceptance Criteria - [ ] OcrEngine ABC defines `recognize()` returning structured OcrEngineResult (text, confidence, word boxes) - [ ] PaddleOcrEngine wraps paddleocr with PP-OCRv4 models - [ ] Engine supports VIN character whitelist mode and PSM-equivalent configurations - [ ] Engine factory reads config to instantiate correct engine - [ ] Existing Tesseract functionality preserved (TesseractEngine wrapper for backward compat)
egullickson added the
status
backlog
type
feature
labels 2026-02-07 16:13:22 +00:00
egullickson added this to the Sprint 2026-02-02 milestone 2026-02-07 16:13:30 +00:00
egullickson added
status
in-progress
and removed
status
backlog
labels 2026-02-07 16:31:37 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: egullickson/motovaultpro#116