Add EasyOCR engine for receipt image parsing
EasyOCR (deep-learning OCR) replaces Tesseract as the default engine for receipt images. It handles phone photos, thermal paper, dot-matrix fonts, and rotated images significantly better than Tesseract without requiring manual preprocessing pipelines. Key design decisions: - OCR_ENGINE=easyocr (default) | tesseract — switchable via .env, no rebuild - EasyOCR Reader is a module-level singleton: model loaded once per container start, not per receipt - Falls back to Tesseract automatically if EasyOCR fails or returns < 20 chars - EXIF rotation fix still applied before EasyOCR (phone photo orientation) - Images resized to max 2000px width for speed before passing to EasyOCR - _easyocr_to_text() groups detections into visual lines (y-overlap) and sorts left-to-right within each line for clean single-string output Revert: echo "OCR_ENGINE=tesseract" >> .env && docker compose up -d agent-service Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,5 +15,9 @@ ollama==0.3.3
|
||||
pdfplumber==0.11.4
|
||||
Pillow==10.4.0
|
||||
pytesseract==0.3.13
|
||||
# EasyOCR: deep-learning OCR, better on phone photos and difficult fonts.
|
||||
# Set OCR_ENGINE=tesseract in .env to use Tesseract instead.
|
||||
# Note: pulls in torch (~1.5GB) — only add if disk space allows.
|
||||
easyocr
|
||||
python-multipart==0.0.12
|
||||
docker==7.1.0
|
||||
|
||||
Reference in New Issue
Block a user