/ Модель

Характеристики

Лицензия
Apache 2.0
Опубликована
7 июл 2026

hangul-font-classification

Классификация изображенийИзображение → label

HFC распознаёт шрифт и корейский слог по отдельному печатному символу хангыль на изображении.

0скачиваний за 30 дней1лайквеса обновлены7 июл 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Hangul Font Classification Model (HFC) — PyTorch-модель для распознавания шрифта и слога по отдельному печатному корейскому символу хангыль. Она использует общий ResNet-подобный сверточный энкодер и отдельные представления содержания и стиля: по стилю классифицирует шрифт среди 3 480 классов, а по содержанию предсказывает начальную, среднюю и конечную части слога. На вход подаётся одно изображение глифа в градациях серого размером 64×64; модель выдаёт оценки классов шрифта и компонентов слога.

Модель предназначена для идентификации шрифтов в анализе документов, каталогизации шрифтов и инструментах цифровой типографики, а также для исследований распознавания корейских символов. Она обучена на закрытом наборе сканированных изображений печатных символов, подготовленных с использованием нескольких шрифтов. Лицензия репозитория — Apache-2.0.

Модель распознаёт только шрифты из списка из 3 480 классов и ожидает один примерно центрированный глиф, а не строку или страницу: обнаружение и сегментация текста не выполняются. Результаты на цифровых сглаженных изображениях могут отличаться от результатов на изображениях, полученных печатью и сканированием. Декодер реконструкции используется как вспомогательный сигнал обучения и не предназначен для генерации глифов.

Сценарии применения

  • определение шрифта отдельного корейского глифа
  • классификация шрифтов хангыль в сканированных документах
  • каталогизация корейских шрифтов по образцам символов
  • распознавание компонентов слога хангыль на изображении

Ограничения

Распознаются только шрифты из 3 480 классов обучения; неизвестные шрифты модель корректно определить не сможет. Модель принимает отдельный примерно центрированный глиф, не выполняет обнаружение или сегментацию текста, а качество на цифровых сглаженных изображениях может отличаться от качества на сканах.

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Hangul Font Classification Model (HFC)

A PyTorch model that recognizes which font a printed Hangul (Korean) syllable glyph was rendered in, and jointly recognizes which syllable the glyph represents.

Given a single 64x64 grayscale glyph image, the model predicts:

  • Font — the source font, out of 3,480 classes (model/index.csv)
  • Character — the Hangul syllable, decoded from separately predicted cho (initial consonant) / jung (medial vowel) / jong (final consonant) logits

Model Details

  • Architecture: shared ResNet-style CNN encoder → global average pooling → two projection heads that split the pooled feature into a content code (128-dim, describes which syllable it is) and a style code (512-dim, L2 normalized, describes which font it is)
    • Hangul head: three small MLPs on the content code, predicting cho / jung / jong logits independently (19 / 21 / 28 classes)
    • Font head: an MLP + linear classifier on the style code, predicting font logits (3,480 classes)
    • Decoder: reconstructs the 64x64 input from concat(content, style); used only as an auxiliary training signal, not required for inference
  • Input: single-channel (grayscale) 64x64 image, black glyph on white background, pixel values scaled to [0, 1] (no further normalization)
  • Output: cho_logits, jung_logits, jong_logits, font_logits (plus the intermediate content / style codes and, if forward() is used, a reconstructed image)
  • Framework: PyTorch (torch>=2.6)
  • File: model/hfc.pt — a checkpoint dict with a "model" key holding the state_dict
  • Font label map: model/index.csv — maps each id (0-3479) used by font_logits to its human-readable font_name

Intended Use

This model is intended for font identification / classification of printed Hangul glyphs (e.g. document analysis, digital typography tooling, font cataloguing) and for research on Hangul character recognition. It is not intended to generate, synthesize, or reproduce font glyphs — the decoder exists only to regularize training and is not distributed as a generative tool.

Usage

Model definition and a runnable example live under example/:

  • example/model.py — FontRecognitionModel and the Hangul cho/jung/jong composition/decomposition utilities
  • example/demo.py — loads the checkpoint, runs inference on a sample glyph, and prints the predicted character and top-k font candidates
uv sync
uv run python example/demo.py --image path/to/glyph.png --topk 10

Minimal inference snippet:

import torch
from PIL import Image

from example.model import CHAR_SIZE, FontRecognitionModel, decode_open, decode_restricted

checkpoint = torch.load("model/hfc.pt", map_location="cpu", weights_only=False)

num_font_classes = 3480  # number of rows in model/index.csv
model = FontRecognitionModel(num_font_classes)
model.load_state_dict(checkpoint["model"])
model.eval()

image = Image.open("path/to/glyph.png").convert("L").resize((CHAR_SIZE, CHAR_SIZE))
x = torch.frombuffer(bytearray(image.tobytes()), dtype=torch.uint8)
x = x.reshape(1, 1, CHAR_SIZE, CHAR_SIZE).float() / 255.0

with torch.no_grad():
    out = model.encode(x)

print(decode_restricted(out.cho_logits, out.jung_logits, out.jong_logits))  # KS X 1001, 2,350 chars
print(decode_open(out.cho_logits, out.jung_logits, out.jong_logits))        # all 11,172 syllables
print(out.font_logits.softmax(-1).topk(5))

The image must be a single Hangul glyph, roughly centered, black-on-white, and will be resized to 64x64 if it isn't already.

Training Data

This model was trained on a private dataset of scanned images of printed Hangul characters. The dataset contains Hangul syllable images generated from multiple fonts and collected through a print-and-scan process.

The training dataset is not redistributed with this model.

Users should note that the source fonts may be governed by their respective licenses. This model is intended for font classification and research use, and it is not designed to reproduce or generate font glyphs.

Limitations

  • Font coverage is limited to the 3,480 fonts listed in model/index.csv; fonts not seen during training cannot be predicted correctly.
  • The model expects a single, roughly-centered glyph per image, not full lines or pages of text — it does not perform text detection or segmentation.
  • Because training images come from a print-and-scan pipeline, performance on purely digital (anti-aliased, vector-rendered) glyphs may differ from the reported training-time behavior.

License

The model weights and code in this repository are released under the Apache License 2.0. This license covers the model and code only — it does not extend any rights to the third-party fonts referenced in model/index.csv, which remain governed by their own respective licenses.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм

Нельзя запустить

В репозитории нет config.json: не понять архитектуру модели.

Ревизия весов
ef19bfe

0 моделей