Kites Translation Pipeline — Algorithm Map

Kites Translation Pipeline — Algorithm Map A workflow diagram generated by Archify. 01 / Webpage Content 02 / Background Worker 03 / Offscreen Runtime 04 / Local Storage Select & Queue Detect, Merge & Compute Fit, Bake & Persist Blob Queue Scheduled AI Branches Editable Project Data DOM Image Selection · img ≥150×150 · Webpage Content › Select & Queue DOM Image Selection img ≥150×150 DOM Image Swap · baked PNG data URL · Webpage Content › Fit, Bake & Persist DOM Image Swap baked PNG data URL Blob Job Queue · Dexie · 1–5 workers · Background Worker › Blob Queue › Select & Queue Blob Job Queue Dexie · 1–5 workers 14-Gate + Kruskal MST · cut edge > mean+2σ · recurse · Offscreen Runtime › Scheduled AI Branches › Detect, Merge & Compute 14-Gate + Kruskal MST cut edge > mean+2σ · recurse PP-OCRv6 + 1D Tiler · h≥2500px tiles · DBNet + CRNN · Offscreen Runtime › Scheduled AI Branches › Detect, Merge & Compute PP-OCRv6 + 1D Tiler h≥2500px tiles · DBNet + CRNN Polygon-Only Inpaint · median · FMM · dynamic patch · Offscreen Runtime › Scheduled AI Branches › Detect, Merge & Compute Polygon-Only Inpaint median · FMM · dynamic patch Index-Safe Translation · GTX · WebLLM · Cloud Pool · Offscreen Runtime › Scheduled AI Branches › Detect, Merge & Compute Index-Safe Translation GTX · WebLLM · Cloud Pool Three-Strategy Typeset · Contour · Simple · Auto Balloon · Offscreen Runtime › Fit, Bake & Persist Three-Strategy Typeset Contour · Simple · Auto Balloon Dexie IndexedDB · clean Blob · layout · font bytes · Local Storage › Editable Project Data › Fit, Bake & Persist Dexie IndexedDB clean Blob · layout · font bytes Studio Editor · restore · reflow on edit · Local Storage › Editable Project Data › Fit, Bake & Persist Studio Editor restore · reflow on edit restore contours + positionedLines surviving text-ink polygons merged reading-order blocks clean plate after erase DBNet quads + CRNN text PROCESS_JOB · jobId only translated texts by index TRANSLATE_IMAGE · image URL clean plate + final layout metadata baked PNG data URL Legend User UI Agent logic Policy Context / trace Cloud service

OCR Detection, 1D Tiling & 14-Layer Noise Battery

  • • 1D Webtoon Tiler: images with h ≥2500 px are sliced into 1000 px vertical tiles with 300 px overlap, merging boundary polygons via IoU dedup.
  • • DBNet: max side 960 → probability ≥0.3 → 4-connected blobs ≥15 px → convex hull + minimum-area rectangle → score ≥0.5 → unclip 1.5.
  • • Crop recognition: projective homography + bicubic sampling; rotate vertical crops 90° when height/width ≥1.5.
  • • 1–5 Geometry: stray cleanup; giant ≥60% width and ≥120 px; tilt 12°/10°; margin ≤5 px; thin-sliver overlap rejection.
  • • 6–14 Text & Language: punctuation recovery; valuable text; short ASCII gate; watermark suffix rescale; furigana <0.45×; pure-Latin prune; weak-neighbor suppression.

Line Grouping — Cotrans Graph + Kruskal MST

  • • Direction graph: gap 2, char gap 0.6, alignment 1.5, font ratio 1.5, aspect tolerance 1; connected-component majority assigns horizontal/vertical.
  • • Merge graph: aspect tolerance 1.3, font ratio 2, char gaps 1/3; rotated candidates require angle ≤15° and relative font delta ≤0.25.
  • • For 3+ lines, build complete weighted graph → Kruskal MST → keep if max edge ≤ mean + 2σ or ≤1.5× font; else cut largest edge and recurse.
  • • Assemble blocks top-to-bottom or right-to-left; CJK joins without spaces; minimum line font wins; angle <3° snaps to zero; fit minimum-area rectangle.

Bubble Geometry & Three Typesetting Strategies

  • • Geometry: heuristic pixel carriers or YOLO11n segmentation; associate OCR boxes, resolve shared chambers, suppress small fragments, and measure candidates with the selected font. Curved shared chambers use reflex-neck decomposition then contour-clipped anchor partitioning; rejected groups can roll back.
  • • Contour DP (contour): fixed layouts with supplied contours take priority; rounded geometry can also select this route. Polygon scanline profiles, DP line selection, common horizontal center, and coarse-to-refined font probes produce positionedLines. Local font bounds are Kites policy, not proof of donor equivalence.
  • • Simple Rect (simple): backend runs the contour solver on a rectangle. Studio simple edits instead use greedy rectangular wrapping at the current font size; do not assume identical reflow behavior.
  • • Auto Balloon (balloon): free-box route without accepted fixed bubble geometry, using source-aware expansion and line fitting. Legacy ellipse values normalize to contour on restore; a generated ellipse is geometry fallback, not a fourth strategy.
  • • Mode labels alone do not prove the solver used: fixed contours can override simple, and rejected geometry can leave saved carrier metadata differing from the baked route. Canvas measurement, painting, and Studio lifecycle have no established end-to-end visual parity guarantee.

Parallel Compute + Output Contract

  • • Translation: Google GTX chunks ≤1800 chars with ⟦index⟧ delimiters; LLM batches 15 tagged segments and writes results back by tag index.
  • • Inpaint: raw surviving line polygons only; Simple uses luminance ≥180 RGB median, Telea-like FMM radius 3, neural tiers (LaMa/AOT-GAN) use 64px dynamic patch bucketing with UNCLIP 1.8 stroke expansion.
  • • Scheduling: network translation overlaps vision work; local GPU translation is serialized with vision inference. Composition waits for translated text and clean plate; raw DBNet masks remain rejected to protect non-text bubble art.
  • • Persist clean image plus editable fitted lines in Dexie; return a separate baked PNG data URL for immediate DOM replacement.