Add adaptive preprocessing escalation and single-receipt test scripts
build / build (push) Successful in 2m57s

Preprocessing now tries progressively heavier variants per receipt
(plain -> high-pass -> edge-enhance -> both), stopping as soon as a
cheap LLM-free arithmetic check on the OCR text looks plausible, so
the extra processing only applies to receipts that need it. A flat
version of the same heavier processing regressed the full batch by
helping hard receipts but hurting easy ones; the adaptive version
improves date-matching 37/52 -> 40/52 with no regression (see
testing/2026_10_04_gimp_highpass_nlfilter_experiment.md).

Also adds test_ocr.sh and test_single.sh for checking a single
receipt's OCR text or full pipeline result without a batch run.
This commit is contained in:
ml
2026-10-04 10:25:41 +02:00
parent 9bb1844cf4
commit ca85530b5a
11 changed files with 694 additions and 52 deletions
+17
View File
@@ -45,6 +45,10 @@ tooling-container/ Pipeline source (preprocess.py, ocr.py, extract.py,
test_batch.sh Runs the full pipeline over a directory of test
receipts and compares against its ground-truth
.ods - see AGENT.md's "Current state".
test_single.sh test_batch.sh for one receipt instead of a
directory - re-check a single known failure.
test_ocr.sh Preprocessing + OCR only, prints the raw OCR
text to stdout - no files left behind.
docker-compose.yml Runs the pipeline as a long-lived HTTP job API
(api + ollama services) for the Android app.
android/ The Android app: Kotlin + Jetpack Compose, Room
@@ -134,6 +138,19 @@ receipt at a time:
# file in that directory
```
**Re-check one receipt** (ground truth optional - compared if a `*.ods`
is found next to the photo):
```bash
./test_single.sh -in testdata/<some-set>/some-receipt.jpg
```
**Just see what Tesseract reads**, no LLM call, no files left behind:
```bash
./test_ocr.sh -in testdata/<some-set>/some-receipt.jpg
```
**Serve it for the app**:
```bash