Ir para o conteúdo
ModelListadosExterno
Browse files

Translator Ink

Per-strip ink model for offline-translator: given a dewarped text-detection box (RGB strip, 48px tall), it predicts two aligned channels at full resolution:

TipoOtherVersãoInk b16 l4 8kCnota

Fonte do modelo

Tipo
Other
Tamanho do arquivo
5,69–22,4 MB
Versão
vInk b16 l4 8k
Atualizado
1 de nov. de 2026
Fonte
Hugging Face

Descrição da fonte

Per-strip ink model for offline-translator: given a dewarped text-detection box (RGB strip, 48px tall), it predicts two aligned channels at full resolution:

  • ink coverage of the glyphs
  • stroke-width estimate

InkUNet, base=16, levels=4, ~1.94M params. Trained purely on synthetic strips (degraded renders over procedural backgrounds) across a broad multi-weight font set.

Load

import torch
from model import InkUNet

st = torch.load("ink_b16_l4_8k.pt", map_location="cpu")
m = InkUNet(base=st["base"], levels=st["levels"],
            bold_from=st["bold_from"], bold_head=st["bold_head"])
m.load_state_dict(st["model"]); m.eval()

# x: (N, 3, 48, W) RGB in 0..1.  out: (N, 2, 48, W) logits.
out = torch.sigmoid(m(x))
matte, bold = out[:, 0], out[:, 1]            # both 0..1, full resolution
ink = matte > 0.5
line_is_bold = bold[ink].mean() > 0.55        # pool over the line's ink, then threshold

Files

  • ink_b16_l4_8k.pt — fp32 checkpoint (load with model.py).
  • ink_int8.mnn — deployable int8 (weight-quantised) MNN, dynamic width, height 48.
  • model.py — architecture.
  • convert_ink_mnn.py — checkpoint → ONNX → MNN (--int8 / --fp16).

Training code

scripts/ink_model/ in translator-rs.

Fontes

1 fonte
Hugging FacePrimárioVersão a321ee4de00bfffe5d0f89b7c73c22a85d9070b3
huggingface.co/davidventura/translator-ink/tree/a321ee4de00bfffe5d0f89b7c73c22a85d9070b3

Verificado 1 de nov.

Download files

Artefatos de modelo

2 artefatos

ink_b16_l4_8k.pt

pt · 22,4 MB · SHA-256 4ecb3c7caace…1330 · Hugging Face

Download file

ink_b8_l4_12k.pt

pt · 5,69 MB · SHA-256 efad49557b13…ed3d · Hugging Face

Download file

Trechos de fonte

2 trechos

--- license: apache-2.0 tags: - ocr - image-segmentation - unet - mnn pipeline_tag: image-segmentation --- Per-strip ink model for [offline-translator](https://github.com/DavidVentura/translator-rs): given a dewarped text-detection box (RGB strip, 48px tall), it predicts two aligned channels at full resolution: - ink coverage of the glyphs - stroke-width estimate `InkUNet`, base=16, levels=4, ~1.94M params. Trained purely on synthetic strips (degraded renders over procedural backgrounds) across a broad multi-weight font set. ## Load ```python import torch from model import InkUNet st = torch.load("ink_b16_l4_8k.pt", map_location="cpu") m = InkUNet(base=st["base"], levels=st["levels"], bold_from=st["bold_from"], bold_head=st["bold_head"]) m.load_state_dict(st["model"]); m.eval() # x: (N, 3, 48, W) RGB in 0..1. out: (N, 2, 48, W) logits. out = torch.sigmoid(m(x)) matte, bold = out[:, 0], out[:, 1] # both 0..1, full resolution ink = matte > 0.5 line_is_bold = bold[ink].mean() > 0.55 # pool over the line's ink, then threshold ``` ## Files - `ink_b16_l4_8k.pt` — fp32 checkpoint (load with `model.py`). - `ink_int8.mnn` — deployable int8 (weight-quantised) MNN, dynamic width, height 48. - `model.py` — architecture. - `convert_ink_mnn.py` — checkpoint → ONNX → MNN (`--int8` / `--fp16`). ## Training code `scripts/ink_model/` in [translator-rs](https://github.com/DavidVentura/translator-rs).

Source context: 0 downloads · 0 likes · Pipeline image-segmentation · Repo davidventura/translator-ink