You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wasm: lite-profile scanned pipeline in the browser (#157 stage 2)
Scanned PDFs and images now convert fully client-side through the real
pipeline shape: RT-DETR layout detection + PP-OCRv3 recognition via
ONNX Runtime Web, everything else in Rust — the native pipeline's own
functions, no second implementation.
docling-pdf (all under the existing ocr-prep feature, wasm-safe):
- layout.rs: input packing (640x640 CHW) and RT-DETR decoding (sigmoid
top-q, center->corners, per-label thresholds downstream) extracted as
layout_input/decode_layout; the native batch path now decodes through
the same function per page.
- ocr_prep: prep_region_lines — the exact region-crop/line-split/prep
gathering native ocr_page does — moved out and shared; ocr.rs
consumes it.
- new scanned module: the Worker::process refinement chain
(label thresholds -> resolve -> orphans -> false-picture drops ->
contained drops), page assembly with the geometric table fallback
(the lite profile: TableFormer is stage 3), and cross-page
continuation merging, re-exposed without the ml feature.
Native path byte-identical after the extraction — the scanned-tiff
conversion diffs empty against the pre-refactor output (rebuilt and
re-verified after a disk-full broke the first attempt), full
docling-pdf/docling suites green.
docling-wasm:
- ScannedConverter: feed pdf.js-rendered RGBA pages ({scale: 2} — the
native RENDER_SCALE) one by one, finish() assembles the document with
the same continuation merging as native; page_count() for progress.
- convert_scanned_image: one-shot image path (its own page at scale 1,
like native).
- LayoutSession interop mirrors RecSession: run(data) ->
{logits: {data, dims}, boxes: {data, dims}}.
- www/scan.html: complete demo — pdf.js from CDN, layout int8
(~165 MB, models-v1 release, browser-cached) + rec model + dict,
per-page progress, timing.
Stage 3 (TableFormer + enrichment in the browser) remains: the
autoregressive decoder loop is deeply ort-typed and needs its own
careful extraction pass; table regions meanwhile take the geometric
reconstruction, matching --no-table-former.
Refs #157
Signed-off-by: artiz <artem.kustikov@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EY5KAiquN4YpVf2PXEQkVT
0 commit comments