/ Модель

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

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

document-classification-v1

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

Модель Nutrient классифицирует изображения документов по произвольным текстовым меткам без обучения под каждый класс.

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

Бенчмарки

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

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

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

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

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

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

document-classification-v1 — модель с открытыми весами от Nutrient для классификации изображений документов по произвольным текстовым меткам. Она сравнивает изображение документа с переданными при запросе метками и возвращает оценку соответствия для каждой; фиксированный набор классов и отдельное обучение для новых классов не нужны.

Модель включает две ONNX-сети: визуальную и текстовую, с размерностью эмбеддингов 1024. Оценки рассчитываются по косинусному сходству с калибровкой и сигмоидой. Для запуска нужны onnxruntime, файлы предобработки и токенизатора из репозитория. В README приведены результаты zero-shot оценки на DocLayNet, Forms и Tobacco; точность ниже, чем у коммерческой версии document-classification-v2 и крупных облачных VLM. Особенно слабее модель справляется с задачами, где нужно читать заголовок документа. Указана скорость около 5,7 страниц в секунду на A40 при совместной обработке изображений и текстов. Лицензия Apache-2.0.

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

  • классификация сканов по заданным типам документов
  • поиск счетов, форм и других документов в архиве
  • сортировка документов по категориям, заданным текстовыми метками

Ограничения

В бенчмарках модель уступает коммерческой версии document-classification-v2 и крупным облачным VLM; особенно заметно это на задачах, требующих чтения заголовков. Для запуска требуются onnxruntime и файлы предобработки и токенизатора из репозитория.

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

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

Открыть на Hugging Face

document-classification-v1 — open-weight

An open-weight, open-vocabulary document classifier you can download and run. Supply any set of text labels at inference; the model scores a document image against them by calibrated cosine and returns a per-label match probability. No fixed class list, no per-class training.

The open-weight sibling of the commercial flagship document-classification-v2. It ships as two self-contained ONNX graphs — an image tower and a text tower — that you run with onnxruntime. embed_dim: 1024; classification p = sigmoid(scale·cos + bias) (calibration in modules/omni-image/config.json).

Results (macro-F1, zero-shot)

Benchmarkv1 (open)v2 (commercial)best cloud VLM
DocLayNet0.750.970.83
Forms0.801.001.00
Tobacco0.610.740.85
OOD (unseen types)0.860.95—
OOV (synonym wording)0.730.83—

Every entry is scored by the same open scorer — full ranking, plus a generalist zero-shot baseline and each cloud model, on the leaderboard. v1 is the free, open-weight sibling: it trails the commercial v2 and the large cloud VLMs on accuracy, but it's Apache-2.0 and downloadable. Like all embedding models it trails VLMs most on Tobacco (a read-the-header task). ~5.7 pages/s on an A40 (fused image+text).

Usage (ONNX)

import numpy as np, onnxruntime as ort, json
from transformers import AutoImageProcessor, AutoTokenizer
from huggingface_hub import hf_hub_download
from PIL import Image

R = "nutrientdocs/document-classification-v1"
img_sess = ort.InferenceSession(hf_hub_download(R, "modules/omni-image/image_model.onnx"))   # SigLIP image tower
txt_sess = ort.InferenceSession(hf_hub_download(R, "modules/omni-image/text_model.onnx"))     # Qwen text tower
cal = json.load(open(hf_hub_download(R, "modules/omni-image/config.json")))["calibration"]
proc = AutoImageProcessor.from_pretrained(R, subfolder="modules/omni-image")   # SigLIP image processor
tok  = AutoTokenizer.from_pretrained(R, subfolder="modules/omni-image")         # Qwen tokenizer

labels = ["invoice", "letter", "memo", "form", "scientific article", "resume"]
calib = lambda cos: 1 / (1 + np.exp(-(cal["scale"] * cos + cal["bias"])))

def embed_text(texts, maxlen):
    e = tok(texts, padding=True, truncation=True, max_length=maxlen, return_tensors="np")
    return txt_sess.run(["text_emb"], {"input_ids": e["input_ids"].astype(np.int64),
                                       "attention_mask": e["attention_mask"].astype(np.int64)})[0]  # [.,1024] L2

lab = embed_text(labels, 64)                                              # label embeds, once

# --- image branch: page image vs labels (image ONNX has batch=1; loop+pool for multi-page) ---
pix = proc(images=[Image.open("doc.png").convert("RGB")], return_tensors="np")["pixel_values"].astype(np.float16)
ie  = img_sess.run(["image_emb"], {"pixel_values": pix})[0]              # [1,1024] L2
image_probs = calib((ie @ lab.T)[0])                                     # [N]

# --- text branch: the page's OCR text vs labels (up to ~2048 tokens) ---
doc_text = open("doc.txt").read()
text_probs = calib((embed_text([doc_text], 2048) @ lab.T)[0])            # [N]

# --- reliability fusion: weight each branch by how DECISIVE it is (top1-top2 margin) ---
margin = lambda p: float(np.partition(p, -2)[-1] - np.partition(p, -2)[-2])
wi, wt = margin(image_probs), margin(text_probs); s = wi + wt + 1e-9
fused = (wi / s) * image_probs + (wt / s) * text_probs
print(dict(zip(labels, fused.round(3).tolist())))

What's in this repo

  • modules/omni-image/{image_model.onnx, text_model.onnx} — the image + text towers (fp16, onnxruntime).
  • modules/omni-image/{config.json, preprocessor_config.json, tokenizer.json} — calibration + the preprocessor and tokenizer needed to run them. That's it — nothing else required.

Open weights under Apache-2.0 — free to download and run. For the higher-accuracy commercial flagship (on-prem, calibrated), see document-classification-v2.

About the author

This project is maintained and funded by Nutrient - The deterministic document infrastructure enterprises run their highest-stakes workflows on: replayable output, clear exceptions, and full audit trails on the messy, regulated documents where AI alone breaks.

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

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

GPU в ailist

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

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

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

Ревизия весов
6c930d5

0 моделей