/ Модель

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

Лицензия
MIT
Библиотека
onnx
Опубликована
3 авг 2026

FontDNA-V2

Эмбеддинги изображенийИзображение → embedding

FontDNA-V2 извлекает признаки шрифта и форматирования из изображений слов, чтобы сопоставлять их с образцами шрифтов.

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

Бенчмарки

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

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

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

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

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

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

FontDNA-V2 — модель ClosedBrain в формате ONNX для анализа типографики на изображениях слов. Она принимает серые изображения отдельных слов, масштабированные до высоты 40 пикселей с сохранением пропорций, и выдаёт векторное представление шрифта и предсказания типографических признаков для каждого слова.

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

Модель не распознаёт и не транскрибирует текст, а точное название шрифта можно определить только сравнением с собственной коллекцией образцов. Лицензия — MIT.

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

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

Ограничения

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

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

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

Открыть на Hugging Face

FontDNA

FontDNA is an ONNX model for recognizing typography from word-image crops.

It returns a font embedding plus word-local typography predictions. Font family is not a fixed classifier: compare the embedding against embeddings of your own reference fonts.

Model I/O

Inputs

  • img — float32, shape (B, 1, 40, W)
  • cols — int64, shape (B,); real crop width divided by 8

Word crops are grayscale, resized to height 40 while preserving aspect ratio. Width is aligned to multiples of 8 (max 320). Scale pixels to [0,1], then normalize each crop with:

x = (x - x.mean()) / (x.std() + 1e-4)

Outputs, in order

#OutputDecode as
0font embeddingL2-normalize, then use cosine similarity
1style logits [4]sigmoid → bold, italic, underline, strikethrough
2category logits [5]softmax → serif, sans-serif, display, handwriting, monospace
3confidence logitsigmoid
4script logits [14]softmax → mapping below

Script indices:

0 latin          5 hangul          10 tamil
1 cyrillic       6 arabic          11 thai
2 greek          7 hebrew          12 armenian
3 han            8 devanagari      13 georgian
4 kana           9 bengali

Styles are per word. For example, one underlined word can still share the same font-family embedding/section as the surrounding regular words.

Raw ONNX Runtime example

import numpy as np
import onnxruntime as ort

session = ort.InferenceSession("glyphdna.onnx")

# img: preprocessed float32 array shaped (B, 1, 40, W)
# cols: int64 array shaped (B,), where cols[i] = real_width // 8
embedding, style_logits, category_logits, confidence_logits, script_logits = (
    session.run(None, {"img": img, "cols": cols})
)

sigmoid = lambda x: 1 / (1 + np.exp(-np.clip(x, -60, 60)))
softmax = lambda x: np.exp(x - x.max(-1, keepdims=True)) / np.exp(
    x - x.max(-1, keepdims=True)
).sum(-1, keepdims=True)

embedding = embedding / np.maximum(
    np.linalg.norm(embedding, axis=1, keepdims=True), 1e-8
)
styles = sigmoid(style_logits)
categories = softmax(category_logits)
confidence = sigmoid(confidence_logits).reshape(-1)
scripts = softmax(script_logits)

# Example: first word
print("bold:", styles[0, 0])
print("italic:", styles[0, 1])
print("underline:", styles[0, 2])
print("strikethrough:", styles[0, 3])
print("category index:", categories[0].argmax())
print("script index:", scripts[0].argmax())

If your exported ONNX uses different tensor names, inspect them with:

print([x.name for x in session.get_inputs()])
print([x.name for x in session.get_outputs()])

Font matching

To recognize a font family, embed reference word renders from each candidate font with the same model and preprocessing. L2-normalize the vectors and rank candidates by cosine similarity. Combining several neighboring word embeddings is usually more reliable than trusting a single word, because some words contain few font-discriminative glyphs.

A standalone Python library for indexing fonts, segmenting images, clustering same-font sections, and preserving per-word formatting is planned separately and is expected to be released in a few weeks.

Notes

  • This model is not OCR and does not transcribe text.
  • Exact font names come from your own reference/index collection.
  • Bold, italic, underline, strikethrough, category, and script are predicted per word.
  • Precompiled font indexes must use the same model weights and preprocessing.

License

MIT.

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

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

GPU в ailist

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

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

В репозитории нет весов в формате PyTorch/safetensors.

Ревизия весов
8f92600

0 моделей