/ Модель

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

Лицензия
CC BY-NC 4.0
Архитектура
timm_wrapper · dense
Базовая модель
vit-base-patch16-224
Библиотека
transformers
Опубликована
7 мар 2025

vit-historical-page

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

Дообученный классификатор изображений UFAL распределяет сканы исторических архивных страниц по 11 категориям для выбора последующего способа обработки.

2 392скачиваний за 30 дней5лайковвеса обновлены16 ноя 2026

Бенчмарки

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

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

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

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

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

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

ufal/vit-historical-page — семейство дообученных классификаторов изображений страниц, разработанных UFAL для сортировки сканов исторических архивных документов по 11 категориям содержимого. По изображению страницы модель определяет, какой способ дальнейшей обработки подходит: OCR для печатного текста, распознавание рукописей, извлечение таблиц, рисунков или фотографий. Язык текста на странице не важен, поскольку модель анализирует только изображение.

В репозитории представлены ревизии на разных базовых архитектурах, включая Vision Transformer, EfficientNetV2 и RegNetY. Для моделей поколения vX.4 указано пять вариантов базовых моделей; в таблице приведены параметры отдельных вариантов от 54 до 305 млн и входное разрешение 384 пикселя. Для некоторых ревизий README приводит точность Top-1 около 95,6–95,9% на тестовых разбиениях; результат на документах, не попавших в обучающую выборку, несколько ниже. Модель предназначена для классификации архивных страниц, а не для распознавания или извлечения содержащегося в них текста. Репозиторий заявляет лицензию CC BY-NC 4.0, которая ограничивает коммерческое использование. Указывайте ревизию при загрузке: ветка main соответствует v4.3, а не текущим моделям поколения vX.4.

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

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

Ограничения

Модель классифицирует тип страницы, но сама не выполняет OCR, распознавание рукописей или извлечение таблиц. Показатели оценки относятся к конкретным наборам и разбиениям; лицензия CC BY-NC 4.0 запрещает коммерческое использование.

Для каких профессий подходит6

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

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

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

Открыть на Hugging Face

Page classification of historical archive scans

Fine-tuned image classifiers that sort scanned archive pages into eleven content categories, so that each page can be sent to the processing it needs: OCR for printed or typed text, handwriting recognition for manuscripts, table extraction for forms, image extraction for drawings and photographs. They look at the page image only, so the language of the page does not matter. The code, the command line and the HTTP service are in atrium-page-classification 1.

Licence and permitted use

The fine-tuned models of this repository, every revision and the ensemble of five, are licensed under CC BY-NC 4.0: you may use, share and adapt them for non-commercial purposes only, with attribution.

  • Why non-commercial. Every revision was fine-tuned on the annotated page dataset 2 3, which is published under CC BY-NC 4.0. The v4.3 and v4.4 revisions (and main, which holds v4.3) also start from the SWAG weights of timm/regnety_160.swag_ft_in1k 4, which are CC BY-NC 4.0 themselves.
  • The code is licensed separately. The code, the command line and the HTTP service 1 are MIT. That software licence does not cover these weights and does not lift their non-commercial condition.
  • Attribution. Name the model and the revision you used, link this page, cite the works under Citation, and say whether you changed the model.
  • Other uses. The licence does not cover commercial use. Questions about any use it does not clearly cover go to the contact under Acknowledgements before you start.
RevisionsBase modelBase model licenceThis repository's weights
v1.2, v1.3, v1.4, v4.2timm/tf_efficientnetv2_s, _m, _l 5 6 7Apache-2.0CC BY-NC 4.0
v2.0–v2.4, v3.2–v3.4, v5.2–v5.4google/vit-base-patch16-224, -384, vit-large-patch16-384 8 9 10Apache-2.0CC BY-NC 4.0
v4.3, v4.4 (main = v4.3)timm/regnety_160.swag_ft_in1k 4CC BY-NC 4.0CC BY-NC 4.0

Versions

Every version is a revision (branch) of this repository 11. They share the eleven categories and differ in their training data and base model: ViT 8 9 10, EfficientNetV2 5 6 7 or RegNetY 4. The current generation is vX.4: five base models, retrained on the licence-compatible public dataset 2. Name the revision when you load a model: main still holds v4.3, the generation before.

RevisionBase modelParameters (M)Input (px)Top-1, %Top-3, %Top-1, unseen documents, %
v1.4timm/tf_efficientnetv2_m.in21k_ft_in1k5438495.8799.9095.60
v4.4timm/regnety_160.swag_ft_in1k8438495.8199.7995.19
v5.4google/vit-large-patch16-38430538495.5899.7595.29
v3.4google/vit-base-patch16-3848738495.4999.7794.96
v2.4google/vit-base-patch16-2248722494.6499.8193.87

Each model was scored on the test partition of its own fold of the dataset (folds 1, 1, 2, 2 and 5; 4,791–4,795 pages each), on 22 October 2026. The five together, averaged, are the code's ensemble (--best, and the default of its HTTP service).

RevisionBase modelPagesDocumentsWhat changed
v2.0vit-base-patch16-224100733896annotations with mistakes, more heterogeneous data
v2.1vit-base-patch16-224119405002more diverse pages in each category, fewer annotation mistakes
v2.2vit-base-patch16-224158555730same data as v2.1 and some restored pages from v2.0
v3.2vit-base-patch16-384158555730same data as v2.2, a larger base model with a higher resolution
v5.2vit-large-patch16-384158555730same data as v2.2, the largest base model with a higher resolution
v1.2efficientnetv2_s.in21k158555730same data as v2.2, the smallest base model (CNN)
v4.2efficientnetv2_l.in21k_ft_in1k158555730same data as v2.2, a CNN base model smaller than the largest
v2.3vit-base-patch16-2243862537328the new annotation phase, more single-page documents
v3.3vit-base-patch16-3843862537328same data as v2.3, a larger base model with a higher resolution
v5.3vit-large-patch16-3843862537328same data as v2.3, the largest base model with a higher resolution
v1.3efficientnetv2_m.in21k_ft_in1k3862537328same data as v2.3, the smallest base model (CNN)
v4.3regnety_160.swag_ft_in1k3862537328same data as v2.3, a CNN base model bigger than the smallest (main)

The vX.4 revisions keep only the pages of the CC BY-NC 4.0 dataset: 38,307 pages from 37,316 documents.

How to use

With transformers (4.x) and timm:

import torch
from PIL import Image
from transformers import AutoImageProcessor, AutoModelForImageClassification

CATEGORIES = [
    "DRAW",
    "DRAW_L",
    "LINE_HW",
    "LINE_P",
    "LINE_T",
    "PHOTO",
    "PHOTO_L",
    "TEXT",
    "TEXT_HW",
    "TEXT_P",
    "TEXT_T",
]

revision = "v4.4"  # name it: `main` is v4.3
processor = AutoImageProcessor.from_pretrained("ufal/vit-historical-page", revision=revision)
model = AutoModelForImageClassification.from_pretrained("ufal/vit-historical-page", revision=revision).eval()

image = Image.open("page.png").convert("RGB")
with torch.no_grad():
    scores = model(**processor(images=image, return_tensors="pt")).logits.softmax(-1)[0]
best = scores.topk(3)
print([(CATEGORIES[i], round(s, 3)) for s, i in zip(best.values.tolist(), best.indices.tolist())])

The model configs name the outputs LABEL_0–LABEL_10; the order is the alphabetical one above.

The code 1 does the rest: folders and PDFs, the five-model ensemble, tables of the top-N categories, the ATRIUM document record and a paradata log of every run. For example, from a checkout:

python3 run.py --hf -rev v4.4 -f page.png              # one page, one model
python3 run.py --hf -rev v4.4 -f report.pdf --pages 1-3  # PDF pages, rendered at 300 dpi

It is also published as container images (ghcr.io/ufal/atrium-page-classification, and -api for the HTTP service).

Offline, with the weights staged once. On a shared server (a cluster, a Galaxy instance) the weights should be downloaded once, not by every job. --models-dir keeps the fine-tuned models, the base models and the image processors in one folder; with --hf it is filled, and without --hf a run reads only that folder, offline:

for r in v1.4 v2.4 v3.4 v4.4 v5.4; do python3 run.py --hf -rev "$r" --models-dir /srv/atrium-page-models; done
python3 run.py --models-dir /srv/atrium-page-models --best -d pages/   # the five models, averaged

Categories

LabelPages that hold
DRAWdrawings, maps, paintings, schematics or graphics, possibly with text labels or captions
DRAW_Ldrawings and the like laid out as a table, or with a legend formatted as a table
LINE_HWhandwritten text in a tabular or form-like structure
LINE_Pprinted text in a tabular or form-like structure
LINE_Tmachine-typed text in a tabular or form-like structure
PHOTOphotographs or photographic cutouts, possibly with text captions
PHOTO_Lphotographs laid out as a table, or with tabular annotations
TEXTa mixture of printed, handwritten and typed text, possibly with minor graphical elements
TEXT_HWonly handwritten text, in paragraphs or blocks (not tabular)
TEXT_Ponly printed text, in paragraphs or blocks (not tabular)
TEXT_Tonly machine-typed text, in paragraphs or blocks (not tabular)

dataset_timeline.png

Training data

The pages come from archival documents of 1920–2020 (collections in Prague and Brno), annotated by hand. The dataset, under CC BY-NC 4.0, has 48,499 page images from 37,328 documents. The public record 2 (LINDAT, with the fold assignments) leaves out 318 pages whose dissemination is restricted; the original annotated dataset with them is 3. The vX.4 models were trained on the public record's pages only.

CategoryDataset 0Dataset 1Dataset 2Dataset 3
DRAW1090 (9.1%)1368 (8.8%)1472 (9.3%)2709 (5.6%)
DRAW_L1091 (9.1%)1383 (8.9%)1402 (8.8%)2921 (6.0%)
LINE_HW1055 (8.8%)1113 (7.2%)1115 (7.0%)2514 (5.2%)
LINE_P1092 (9.1%)1540 (9.9%)1580 (10.0%)2439 (5.0%)
LINE_T1098 (9.2%)1664 (10.7%)1668 (10.5%)9883 (20.4%)
PHOTO1081 (9.1%)1632 (10.5%)1730 (10.9%)2691 (5.5%)
PHOTO_L1087 (9.1%)1087 (7.0%)1088 (6.9%)2830 (5.8%)
TEXT1091 (9.1%)1587 (10.3%)1592 (10.0%)14227 (29.3%)
TEXT_HW1091 (9.1%)1092 (7.1%)1092 (6.9%)2008 (4.1%)
TEXT_P1083 (9.1%)1540 (9.9%)1633 (10.3%)2312 (4.8%)
TEXT_T1081 (9.1%)1476 (9.5%)1482 (9.3%)3965 (8.2%)
Unique PDFs50015694572937328
Total Pages11,94015,48215,85448,499

The last column (Dataset 3) is the data of the vX.3 models, which used 14,000 of the TEXT pages; the other columns count every page used. Of each set, 80 % was used for training and 10 % each for development and test; the earliest version used 90 % for training and the other 10 % as both development and test set. The categories are unequal because the archive is, not by design.

Training pages: 8,950 (v2.0), 10,745 (v2.1), 14,565 (v2.X), 38,625 (vX.3), 38,307 (vX.4). Test pages: 1,586 (taken from the v2.2 annotations), 4,823 per fold (vX.3), 4,791–4,795 per fold (vX.4: the fold's test partition in the LINDAT record).

Augmentation: during training each of these was applied with a 50 % chance: ColorJitter of brightness, contrast, saturation and hue (0.5 each), a random sharpness change (factor 0.5–1.5), a Gaussian blur (radius 0–2).

Hyperparameters: learning rate 5e-5; batch size 8 (training and evaluation); 3 epochs; warm-up ratio 0.1; evaluation and saving every epoch; the best model by accuracy kept.

architecture.png

Evaluation

The vX.4 figures in the table at the top were measured on 22 October 2026, each model on the test partition of the fold it was trained on. The split is by page: a test page was never trained on, but about a quarter of the test pages come from documents with other pages in training. The last column leaves those out. Two models scored on the same pages do not differ significantly (95 % intervals of about ±0.6 points). The provenance, the figures by group and what was wrong with the figures published here before are in the repository's result/README.md.

v1.4, fold 1 (Top-1 95.87 %): TOP-1 confusion matrix

v4.4, fold 1 (Top-1 95.81 %): TOP-1 confusion matrix

v3.4, fold 2 (Top-1 95.49 %): TOP-1 confusion matrix

v5.4, fold 2 (Top-1 95.58 %): TOP-1 confusion matrix

v2.4, fold 5 (Top-1 94.64 %): TOP-1 confusion matrix

[!WARNING] These figures were measured on a 5,449-page evaluation set, most of whose pages are training pages (its selection script missed zero-padded page numbers and ids with a letter). They chose each base model's fold, and they are not held-out accuracy. The stored tables do not all reproduce them either: v4.3 gives 98.92 % there, not 99.16 %.

Base modelRevisionmax_catBest_Prec (%)Best_Acc (%)Fold
google/vit-base-patch16-224v2.314,00098.7998.795
google/vit-base-patch16-384v3.314,00098.9298.922
google/vit-large-patch16-384v5.314,00099.1299.122
microsoft/dit-base-finetuned-rvlcdipv9.314,00098.7198.723
microsoft/dit-large-finetuned-rvlcdipv10.314,00098.6698.663
microsoft/dit-largev11.314,00098.5398.532
timm/regnety_120.sw_in12k_ft_in1kv12.314,00098.2998.293
timm/regnety_160.swag_ft_in1kv4.314,00099.1799.161
timm/regnety_640.seev6.314,00098.7998.795
timm/tf_efficientnetv2_l.in21k_ft_in1kv8.314,00098.6298.625
timm/tf_efficientnetv2_m.in21k_ft_in1kv1.314,00098.8398.831
timm/tf_efficientnetv2_s.in21kv7.314,00097.9097.871

Scored on the v2.2 evaluation set (1,583–1,586 pages), whose overlap with their training data was never checked: read the figures as examples, not as held-out accuracy.

RevisionTop-1, %Top-3, %
v1.297.7399.87
v2.297.5499.94
v3.297.4199.94
v4.297.8699.87
v5.297.7399.87

The result tables are listed in the repository's README 1.

Limits

  • One collection. The models were trained and tested on Czech archaeological archives of 1920–2020. On another collection, check a sample by hand first.
  • Page-level, single-fold results. Each model was tested on one fold, split by page; the unseen-documents column is the closest measure of documents the model has not seen. It is not five-fold cross-validation.
  • Neighbouring categories are the hard cases, TEXT and TEXT_T above all. A page that mixes several kinds of content gets the category of what dominates.
  • Scores are not calibrated confidence. They are the model's probabilities; the code renormalises them over the N categories it keeps. A low top score with a close second marks a page worth a look, and so does a page on which the five models disagree.

Citation

@misc{lutsai2026vithistoricalpage,
  author       = {Lutsai, Kateryna and K\v{r}iv\'ankov\'a, Dana and Nov\'ak, David and Stra\v{n}\'ak, Pavel},
  title        = {Page classification of historical archive scans},
  howpublished = {Hugging Face Hub},
  year         = {2026},
  note         = {Model licence: CC BY-NC 4.0},
  url          = {https://huggingface.co/ufal/vit-historical-page}
}

@misc{lutsai2026pageclassifier,
  author        = {Lutsai, Kateryna and K\v{r}iv\'ankov\'a, Dana and Stra\v{n}\'ak, Pavel and Nov\'ak, David},
  title         = {Page image classifier fine-tuned on century-spanning archives of scanned documents for further content-specific processing},
  year          = {2026},
  eprint        = {2606.07558},
  archivePrefix = {arXiv},
  doi           = {10.48550/arXiv.2606.07558}
}

@misc{lutsai2025pageclassification,
  author        = {Lutsai, Kateryna and Stra\v{n}\'ak, Pavel},
  title         = {Page image classification for content-specific data processing},
  year          = {2025},
  eprint        = {2507.21114},
  archivePrefix = {arXiv},
  doi           = {10.48550/arXiv.2507.21114}
}

@dataset{lutsai2026dataset,
  author    = {Lutsai, Kateryna and K\v{r}iv\'ankov\'a, Dana},
  title     = {Content-specific classification of historical page images - annotated dataset},
  publisher = {LINDAT/CLARIAH-CZ},
  year      = {2026},
  url       = {http://hdl.handle.net/20.500.12800/1-6184}
}

The first paper compares the vision-only models with CLIP on 649,508 unlabelled archive pages; the second covers the data, the benchmark of image-classification approaches (Random Forest, EfficientNetV2, RegNetY, DiT, ViT and CLIP) and the system. The code has its own CITATION.cff 1.

Acknowledgements

Developed by UFAL 12 and funded by ATRIUM 13 (Horizon Europe, grant agreement 101132163); shared by ATRIUM and UFAL. Contact: lutsai.k@gmail.com.

© 2022 UFAL & ATRIUM

Footnotes

  1. https://github.com/ufal/atrium-page-classification ↩ ↩2 ↩3 ↩4 ↩5

  2. http://hdl.handle.net/20.500.12800/1-6184 ↩ ↩2 ↩3

  3. http://hdl.handle.net/20.500.12800/1-5959 ↩ ↩2

  4. https://huggingface.co/timm/regnety_160.swag_ft_in1k ↩ ↩2 ↩3

  5. https://huggingface.co/timm/tf_efficientnetv2_s.in21k ↩ ↩2

  6. https://huggingface.co/timm/tf_efficientnetv2_l.in21k_ft_in1k ↩ ↩2

  7. https://huggingface.co/timm/tf_efficientnetv2_m.in21k_ft_in1k ↩ ↩2

  8. https://huggingface.co/google/vit-base-patch16-224 ↩ ↩2

  9. https://huggingface.co/google/vit-base-patch16-384 ↩ ↩2

  10. https://huggingface.co/google/vit-large-patch16-384 ↩ ↩2

  11. https://huggingface.co/ufal/vit-historical-page ↩

  12. https://ufal.mff.cuni.cz/home-page ↩

  13. https://atrium-research.eu/ ↩

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

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

GPU в ailist

Универсальный рантайм · transformers · image-classification

Можно запустить

Подбираем GPU…

Класс архитектуры
TimmWrapperForImageClassification
Ревизия весов
38ce8b1

0 моделей