han2ids v0.5
Read an ideographic description sequence (IDS) from a Mincho/宋体 glyph image. v0.5 continues v0.4 with labels that follow the printed form, ink-fitted renders and glyphs composed from two components.
Results
Held-out characters, character-macro agreement with BabelStone-derived references; 181 of the references were checked against the image by one reviewer. Full tables, intervals and limits are in benchmark/RESULTS.md.
| Track | v0.4 exact | v0.5 exact | v0.5 same-axis structure |
|---|---|---|---|
| Clean renders, 8,730 images of 4,752 characters | 80.05% | 83.77% | 84.07% |
| Other styles, 1,346 images | 87.15% | 90.64% | 90.64% |
| Reviewed sample, 181 images | 82.67% | 83.50% | 83.50% |
On the clean track the paired gain over v0.4 is 3.72 points (95% interval 3.09 to 4.31); on the reviewed sample the gain is within noise. v0.5 saw the clean track's framing in training, on training characters only.
A reading names the printed form. 䦳 (U+49B3) reads ⿵門鄉 in Noto Serif CJK JP, ⿵門鄕󠄂
(U+9115 U+E0102) in IPAmj Mincho and ⿵門鄕󠄁 (U+9115 U+E0101) in Jigmo; the unified reading of all
three is ⿵門鄉. Only the 鄉 family has form labels so far.
Files
han2ids-v0.5.pt: the PyTorch checkpoint, aGlyphIDSstate dict withitosandargs. SHA-256d5eba57784977a8e09384da6bba79dec1328bd44ea7a271af25dada39a90688d.onnx/: split encoder and decoder in fp32 and int8, the vocabularyitos.json, the unified-forms tableforms.jsonand a manifest with hashes. The int8 pair (40.2 MB) is what the browser demo runs.
Usage
pip install git+https://github.com/mkpoli/han2ids
hf download mkpoli/han2ids-v0.5 han2ids-v0.5.pt --local-dir models
han2ids glyph.png --checkpoint models/han2ids-v0.5.pt
Each line prints the reading, the unified reading and the confidence. --top-k 3 returns ranked
beam candidates.
Architecture
35.2M parameters: ViT-S/16 encoder, four 384-wide decoder layers, 224 px input, 10,428-token vocabulary in which a character with a variation selector is one token, IDS operand-stack mask.
Training data
- 159,521 images over 95,927 Han characters in Noto Serif CJK JP, IPAmj Mincho 006.01 and Jigmo, with test and validation characters held out.
- Half of the rows drawn ink-fitted with a 6 to 30 px margin; a fifth of each batch composed as
⿰ABor⿱ABfrom two glyphs of one face, never one whose unified reading is a validation or test label. - Three epochs from v0.4; AdamW encoder 1e-5, decoder 5e-5, batch 32, bf16, one seed.
Limits
Mincho and Song serif faces only; Kai, sans and handwriting are out of scope. The references are mostly unreviewed, and a regional sequence can differ from the form a font prints. Confidence is a geometric mean of token probabilities and is not calibrated.
Sources and terms
Labels: Andrew West, BabelStone IDS, 2025-06-27.
Fonts: Noto CJK (SIL OFL 1.1),
IPAmj Mincho (IPA Font License 1.0),
Jigmo (CC0). Code and weights MIT; fonts and labels keep
their own terms, see NOTICE.md.
- Downloads last month
- 27