hangul-font-finder
Identifies the free Korean font used in an image of a single line of Hangul text.
ํ๊ธ ํ ์คํธ ํ ์ค ์ด๋ฏธ์ง์์ ์ฌ์ฉ๋ ๋ฌด๋ฃ ํ๊ธ ํฐํธ๋ฅผ ์๋ณํ๋ ๋ชจ๋ธ์ ๋๋ค.
- Identifies 1,279 free Korean fonts (1,393 font families, Fonts List)
- Robust to outlines, shadows, 3D extrusion, gradients, horizontal scaling, partial occlusion, low resolution and compression
- One line image in, no OCR or character segmentation
- Outputs calibrated font probabilities
- Trained on synthetic data
Usage
pip install torch transformers safetensors pillow numpy huggingface_hub
import sys
from huggingface_hub import snapshot_download
from PIL import Image
path = snapshot_download("prenny/hangul-font-finder")
sys.path.insert(0, path)
from inference import FontIdentifier
model = FontIdentifier(path)
model.predict(Image.open("line.png"), top=5)
# [{'font': 'Jua', 'same_shape_fonts': ['BM JUA_TTF', 'Jua'],
# 'korean_name': '๋ฐฐ๋ฌ์๋ฏผ์กฑ ์ฃผ์', 'probability': 0.9955}, ...]
- Input is an image of one cropped text line. Text detection is not included.
- Fonts with identical Hangul glyphs (OTF/TTF builds, English/Korean names, Google Fonts releases) are returned as one font, with all names in
same_shape_fonts. - Runs on CUDA, MPS and CPU.
Evaluation
| Test set | Lines | Top-1 | Top-3 | Top-5 |
|---|---|---|---|---|
| Hard (mixed effects) | 2,702 | 93.3% | 97.9% | 98.7% |
| Clean | 1,351 | 97.4% | โฅ 99.2% | โฅ 99.8% |
Predictions with probability โฅ 0.95 cover 84% of the hard set at 99.6% accuracy.
Training
- Architecture: SigLIP 2 Base vision encoder (fully fine-tuned) + 512-d projection + linear classifier
- Input encoding: greyscale, resized to 56 px height (aspect preserved), folded into 4 rows of a 224ร224 image; long lines averaged over 3 windows
- Data: about 400k synthetic line images (about 300 per font)
- Schedule: 6 epochs, AdamW (lr 3e-5), batch 128, label smoothing 0.1, temperature-calibrated (T = 0.690), 1ร RTX 5080 (about 85 min)
Limitations
- Fonts outside the 1,279 known fonts are answered with the most similar known font, usually with a low probability.
- All reported numbers are measured on synthetic images.
- Designed for Hangul; lines with only Latin letters or digits were not evaluated.
- The model only provides font names. Check each font's licence before use.
License
MIT. Weights are fine-tuned from SigLIP 2 (Apache-2.0); see LICENSE-SIGLIP2-APACHE-2.0 and NOTICE.
- Downloads last month
- 29
Model tree for prenny/hangul-font-finder
Base model
google/siglip2-base-patch16-224

