PaperPod/config.yaml
ilia 5be9d5935d Fix clipped receipt margins, add time-of-day naming, speed up rotation detection
- vision/document.py: pad_quad() expands the detected quad outward
  before warping so a straight-line contour fit doesn't clip the first
  character of every line on a slightly curled/wrinkled receipt
- ocr/extract.py + llm/vision.py: extract transaction time (HH:MM) so
  same-day repeat visits to a vendor get distinct filenames
  (2023-03-20_1525_walmart.pdf vs. a later same-day trip)
- vision/orient.py: downscale before Tesseract OSD/confidence-sweep
  rotation detection — this was the dominant cost in the detection
  phase (7x speedup: 472s -> 67s on a 36s test video)
2026-07-08 18:55:37 -04:00

84 lines
3.3 KiB
YAML

# PaperPod tunable thresholds. All values here override the built-in defaults
# in paperpod/config.py; delete a key to fall back to the default.
capture:
# Frames per second to sample from the source video for analysis.
sample_fps: 8
# Frames are downscaled to this width for motion analysis (full resolution
# is still used for the final document crops).
processing_width: 960
audio:
# WAV sample rate for the extracted audio track (16 kHz mono = whisper-ready).
sample_rate: 16000
motion:
# Gaussian blur kernel applied before frame differencing (odd number).
blur_ksize: 21
# A pixel counts as "changed" if its gray level moved by more than this (0-255).
pixel_threshold: 12
# Fraction of changed pixels (0.0-1.0) above which a frame counts as "moving".
# Raise if sensor noise triggers false motion; lower if small gestures
# (page flips) are being missed.
threshold: 0.02
# A stable stretch must last at least this long (seconds) to count as a window.
stable_min_duration_s: 1.0
document:
# Contours smaller than this fraction of the frame area are ignored.
min_area_ratio: 0.04
# Contours larger than this fraction of the frame are rejected as likely
# background/lighting rather than a document.
max_area_ratio: 0.92
# Reject candidates whose long side is more than this many times their
# short side (filters out thin slivers/edge-strip false detections).
max_aspect: 6.0
# Canny edge detection thresholds.
canny_low: 50
canny_high: 150
# Contour search runs on a frame downscaled to this width (then the
# winning quad is scaled back up for the full-resolution crop). Keeps
# edge/gap-closing behavior consistent regardless of source resolution —
# important for 4K phone video.
detect_width: 1000
# Bake illumination-normalization + contrast enhancement into the saved
# crop/PDF (grayscale "flattened scan" look). OCR always uses this
# enhancement internally regardless of this setting.
enhance: false
# Auto-detect and correct 0/90/180/270 rotation before OCR/PDF export.
auto_rotate: true
# Expand the detected quad outward by this fraction before warping, to
# recover paper margins clipped by curl/wrinkles (straight-line quad vs.
# a slightly bowed real edge). refine.tighten below trims any extra
# mat/background this pulls in back off.
pad_margin: 0.04
# Tighten crops to the actual paper region (cuts mat margins/hands) and
# inpaint fingers pressing on the page.
refine: true
remove_fingers: true
# Split separate document placements when no contour is seen for this long.
event_gap_s: 2.0
# Ignore single-frame detection blips.
event_min_samples: 2
llm:
# Identify/name documents with a local Ollama vision model (all offline).
# Reads whole documents at once — far more robust than Tesseract for
# curled receipts and stylized logos — and flags quality issues
# (fingers_visible, blurry, glare) in export_summary.csv.
# Slower: ~20-40s per document. Falls back to Tesseract when Ollama is down.
enabled: true
model: qwen2.5vl
base_url: http://localhost:11434
timeout_s: 180
speech:
# Window around a capture event in which to look for a spoken description.
window_before_s: 3.0
window_after_s: 5.0
output:
dir: ./output
# Paperless-ngx consume directory (module 7, not wired up yet).
consume_dir: null