/ Модель

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

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

vit-historical-page

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

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

2 392скачиваний за 30 дней4лайкавеса обновлены23 июл 2026

Бенчмарки

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

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

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

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

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

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

ufal/vit-historical-page — модель компьютерного зрения, разработанная UFAL для сортировки изображений страниц архивных документов по категориям перед последующей обработкой содержимого. Она основана на Vision Transformer Google и обучена на размеченных изображениях архивных страниц; в репозитории представлены варианты на нескольких базовых моделях ViT. Модель классифицирует страницы, включая рисунки и схемы, рукописные записи в таблицах и другие типы страниц; поддерживает вывод наиболее вероятных категорий и сводных результатов в табличном виде.

Для актуальной версии vX.3 README указывает 38 625 обучающих и 4 823 оценочных изображений. Для варианта ViT base с разрешением 224 пикселя указано 87 млн параметров; доступны также варианты с другими размерами и разрешениями. Данные охватывают архивные документы 1920–2020 годов. Модель принимает изображения и выдаёт метки классов с оценками вероятности. Лицензия модели — MIT.

Качество зависит от представительности категорий и разметки: README отмечает дисбаланс классов и наличие более ранних версий с ошибками аннотации. Указанные высокие метрики относятся к конкретным наборам и разбиениям данных и не гарантируют аналогичных результатов на иных коллекциях архивов.

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

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

Ограничения

Классы в данных распределены неравномерно, а README отмечает ошибки аннотации в ранних версиях. Метрики получены на описанных наборах и могут не переноситься на другие архивные коллекции.

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

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

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

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

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

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

Открыть на Hugging Face

Image classification using fine-tuned ViT - for historical :bowtie: documents sorting

Goal: solve a task of archive page images sorting (for their further content-based processing)

Scope: Processing of images, training and evaluation of ViT model, input file/directory processing, class 🏷️ (category) results of top N predictions output, predictions summarizing into a tabular format, HF 😊 hub support for the model

Versions 🏁

There are currently 2 version of the model available for download, both of them have the same set of categories, but different data annotations. The latest v4.3 is considered to be default and can be found in the main branch of HF 😊 hub 1 🔗

VersionBasePagesPDFsDescription
v2.0vit-base-patch16-224100733896annotations with mistakes, more heterogenous data
v2.1vit-base-patch16-224119405002main: more diverse pages in each category, less annotation mistakes
v2.2vit-base-patch16-224158555730same data as v2.1 + some restored pages from v2.0
v3.2vit-base-patch16-384158555730same data as v2.2, but a bit larger model base with higher resolution
v5.2vit-large-patch16-384158555730same data as v2.2, but the largest model base with higher resolution
v1.2efficientnetv2_s.in21k158555730same data as v2.2, but the smallest model base (CNN)
v4.2efficientnetv2_l.in21k_ft_in1k158555730same data as v2.2, CNN base model smaller than the largest, may be more accurate
v2.3vit-base-patch16-2243862537328new data annotation phase data, more single-page documents used, transformer model
v3.3vit-base-patch16-3843862537328same data as v2.3, but a bit larger model base with higher resolution
v5.3vit-large-patch16-3843862537328same data as v2.3, but the largest model base with higher resolution
v1.3efficientnetv2_m.in21k_ft_in1k3862537328same data as v2.3, but the smallest model base (CNN)
v4.3regnety_160.swag_ft_in1k3862537328same data as v2.3, CNN base model bigger than the smallest, may be more accurate
v2.4vit-base-patch16-2243830737316only cc-by nc 4 licensed dats samples were kept in vX.4 versions data
v3.4vit-base-patch16-3843830737316same data as v2.4, but a bit larger model base with higher resolution
v5.4vit-large-patch16-3843830737316same data as v2.4, but the largest model base with higher resolution
v1.4efficientnetv2_m.in21k_ft_in1k3830737316same data as v2.4, but the smallest model base (CNN)
v4.4regnety_160.swag_ft_in1k3830737316same data as v2.4, CNN base model bigger than the smallest, may be more accurate
VersionParameters (M)Resolution (px)Revision
efficientnetv2_s.in21k48300v1.X
efficientnetv2_m.in21k_ft_in1k54384v1.3
vit-base-patch16-22487224v2.X
vit-base-patch16-38487384v3.X
regnety_160.swag_ft_in1k84224v4.3
vit-large-patch16-384305384v5.X
regnety_640.seer281384v6.3
Base ModelRevisionmax_catBest_Prec (%)Best_Acc (%)FoldNote
google/vit-base-patch16-224v2.314,00098.7998.795OK & Small
google/vit-base-patch16-384v3.314,00098.9298.922Good & Small
google/vit-large-patch16-384v5.314,00099.1299.122Best & Large
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.161Best & Small
timm/regnety_640.seev6.314,00098.7998.795OK & Large
timm/tf_efficientnetv2_l.in21k_ft_in1kv8.314,00098.6298.625
timm/tf_efficientnetv2_m.in21k_ft_in1kv1.314,00098.8398.831Good & Small
timm/tf_efficientnetv2_s.in21kv7.314,00097.9097.871
Ensemble (Best 5 Models)--14,000N/AN/A--Combined

Model description 📇

architecture.png

🔲 Fine-tuned model repository: vit-historical-page 1 🔗

🔳 Base model repository:

  • Google's vit-base-patch16-224, vit-base-patch16-384, and vit-large-patch16-284 2 3 4 🔗
  • timm's regnety_160.swag_ft_in1k, efficientnetv2_s.in21k, efficientnetv2_m.in21k_ft_in1k, and efficientnetv2_l.in21k_ft_in1k 5 6 7 8 🔗

Data 📜

The dataset is provided under Public Domain license, and consists of 48,499 PNG images of pages from 37,328 archival documents. The source image files and their annotation can be found in the LINDAT repository 9 🔗.

Manual ✍️ annotation was performed beforehand and took some time ⌛, the categories 🪧 tabulated below were formed from different sources of the archival documents originated in the 1920-2020 years span.

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 table above shows category distribution for different model versions, where the last column (Dataset 3) corresponds to the latest vX.3 models data, which actually used 14,000 pages of TEXT category, while other columns cover all the used samples - specifically 80% as training 💪, and 10% each as development and test 🏆 sets. The early model version used 90% of the data as training 💪 and the remaining 10% as both development and test 🏆 set due to the lack of annotated (manually classified) pages.

[!NOTE] Disproportion of the categories 🪧 in both training and evaluation data is NOT intentional, but rather a result of the source data nature.

Training set of the model: 8950 images for v2.0

Training set of the model: 10745 images for v2.1

Training set of the model: 14565 images for v2.X

Training set of the model: 38625 images for vX.3

Plus, the test sets:

Evaluation set: 1586 images (taken from v2.2 annotations)

Evaluation set: 4823 images (for vX.3 models)

Categories 🏷️

Label️Description
DRAW📈 - drawings, maps, paintings, schematics, or graphics, potentially containing some text labels or captions
DRAW_L📈📏 - drawings, etc but presented within a table-like layout or includes a legend formatted as a table
LINE_HW✏️📏 - handwritten text organized in a tabular or form-like structure
LINE_P📏 - printed text organized in a tabular or form-like structure
LINE_T📏 - machine-typed text organized in a tabular or form-like structure
PHOTO🌄 - photographs or photographic cutouts, potentially with text captions
PHOTO_L🌄📏 - photos presented within a table-like layout or accompanied by tabular annotations
TEXT📰 - mixtures of printed, handwritten, and/or typed text, potentially with minor graphical elements
TEXT_HW✏️📄 - only handwritten text in paragraph or block form (non-tabular)
TEXT_P📄 - only printed text in paragraph or block form (non-tabular)
TEXT_T📄 - only machine-typed text in paragraph or block form (non-tabular)

dataset_timeline.png

Data preprocessing

During training the following transforms were applied randomly with a 50% chance:

  • transforms.ColorJitter(brightness 0.5)
  • transforms.ColorJitter(contrast 0.5)
  • transforms.ColorJitter(saturation 0.5)
  • transforms.ColorJitter(hue 0.5)
  • transforms.Lambda(lambda img: ImageEnhance.Sharpness(img).enhance(random.uniform(0.5, 1.5)))
  • transforms.Lambda(lambda img: img.filter(ImageFilter.GaussianBlur(radius=random.uniform(0, 2))))

Training Hyperparameters

  • eval_strategy "epoch"
  • save_strategy "epoch"
  • learning_rate 5e-5
  • per_device_train_batch_size 8
  • per_device_eval_batch_size 8
  • num_train_epochs 3
  • warmup_ratio 0.1
  • logging_steps 10
  • load_best_model_at_end True
  • metric_for_best_model "accuracy"

Results 📊

RevisionTop-1Top-3
v1.297.7399.87
v2.297.5499.94
v3.296.4999.94
v4.297.7399.87
v5.297.8699.87
v1.396.8199.78
v2.398.7999.96
v3.398.9299.98
v4.398.92100.0
v5.399.1299.94
v6.398.7999.94

v2.2 Evaluation set's accuracy (Top-1): 97.54% TOP-1 confusion matrix - trained ViT

v3.2 Evaluation set's accuracy (Top-1): 96.49% TOP-1 confusion matrix - trained ViT

v5.2 Evaluation set's accuracy (Top-1): 97.73% TOP-1 confusion matrix - trained ViT

v1.2 Evaluation set's accuracy (Top-1): 97.73% TOP-1 confusion matrix - trained ViT

v4.2 Evaluation set's accuracy (Top-1): 97.86% TOP-1 confusion matrix - trained ViT

v1.3 Evaluation set's accuracy (Top-1): 98.83% TOP-1 confusion matrix

v2.3 Evaluation set's accuracy (Top-1): 98.79% TOP-1 confusion matrix

v3.3 Evaluation set's accuracy (Top-1): 98.92% TOP-1 confusion matrix

v4.3 Evaluation set's accuracy (Top-1): 98.16% TOP-1 confusion matrix

v5.3 Evaluation set's accuracy (Top-1): 99.12% TOP-1 confusion matrix

v6.3 Evaluation set's accuracy (Top-1): 98.79% TOP-1 confusion matrix

Result tables

Contacts 📧

For support write to 📧 lutsai.k@gmail.com 📧

Official repository: UFAL 10

Preprint 📖

For the full research background, check out our paper on arXiv: Page image classification for content-specific data processing

It covers everything from raw data exploration and dataset construction 🗂️, through benchmarking of multiple image classification approaches (Random Forest, EfficientNetV2, RegNetY, DiT, ViT, and CLIP), to system architecture and real-world results on historical collections from Prague ⛪ and Brno 🏛️.

Acknowledgements 🙏

  • Developed by UFAL 11 👥
  • Funded by ATRIUM 12 💰
  • Shared by ATRIUM 12 & UFAL 11
  • Model type:
    • fine-tuned ViT with a 224x224 2 🔗 or 384x384 3 4 🔗 resolution size
    • fine-tuned EffNetV2 with a 300x300 6 🔗 or 384x384 8 🔗 resolution size

©️ 2022 UFAL & ATRIUM

Footnotes

  1. https://huggingface.co/k4tel/vit-historical-page ↩ ↩2

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

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

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

  5. https://huggingface.co/timm/tf_efficientnetv2_m.in21k_ft_in1k ↩

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

  7. https://huggingface.co/timm/regnety_160.swag_ft_in1k ↩

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

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

  10. https://github.com/ufal/atrium-page-classification ↩

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

  12. https://atrium-research.eu/ ↩ ↩2

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

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

GPU в ailist

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

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

Подбираем GPU…

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

0 моделей