---
title: multi-modal_convnext-roberta-base_vldoc-embedding
canonical_url: "https://www.modelscope.cn/models/damo/multi-modal_convnext-roberta-base_vldoc-embedding"
md_url: "https://www.modelscope.cn/models/damo/multi-modal_convnext-roberta-base_vldoc-embedding.md"
repository: damo/multi-modal_convnext-roberta-base_vldoc-embedding
chinese_name: "读光-文档理解-文档理解多模态预训练模型"
last_updated: 2025-06-13
license: "Apache License 2.0"
pipeline_tag: document-understanding
tasks:
  - document-understanding
model_type:
  - "two stream roberta-convnext"
architectures:
  - LayoutRobertaModel
library_name:
  - pytorch
frameworks:
  - pytorch
language:
  - en
  - zh
domain:
  - multi-modal
downloads: 10133
stars: 94
tags:
  - OCR
  - document-understanding
  - multi-modal
  - layoutlm
  - "读光"
---

# multi-modal_convnext-roberta-base_vldoc-embedding

> multi-modal_convnext-roberta-base_vldoc-embedding - damo 在 ModelScope 开源的模型。文档理解，即给定一个视觉富文档(visually-rich document)，对其自动地分析与处理，包括文档信息抽取、文档版面分析、文档分类与文档VQA等等。

damo/multi-modal_convnext-roberta-base_vldoc-embedding 是 ModelScope 魔搭社区上的document-understanding模型，采用 Apache License 2.0 许可。

- **Repository**: damo/multi-modal_convnext-roberta-base_vldoc-embedding
- **License**: Apache License 2.0
- **Tasks**: document-understanding
- **Tags**: OCR, document-understanding, multi-modal, layoutlm, 读光
- **Downloads**: 10133
- **Stars**: 94
- **Last updated**: 2025-06-13

Source: https://www.modelscope.cn/models/damo/multi-modal_convnext-roberta-base_vldoc-embedding

---

# VLDoc文档理解多模态预训练模型介绍

文档理解，即给定一个视觉富文档(visually-rich document)，对其自动地分析与处理，包括文档信息抽取、文档版面分析、文档分类与文档VQA等等。

VLDoc是用于文档理解的多模态预训练模型基座，包含文本、视觉、版式(Layout)三种文档模态信息，采用针对文档特性的预训练任务，使模型能充分建模文档，提高文档理解任务效果。

## 模型描述

模型采用双塔结构(如下图)，主要包括三个主要部分，Image backbone用于提取文档的图像信息，Text-layout backbone用于对文档的文本、版式信息进行建模，最后进行多模态特征融合，连接相关的预训练任务进行优化。

![model](./model.jpg)

### 预训练任务

- 采用Masked Vision Language Modeling (MVLM)预训练任务
- 采用Bi-VLDoc的Text Image Position Awareness(TIPA)预训练任务
- 采用geometric pre-training tasks (from the GeoLayoutLM)

## 期望模型使用方式以及适用范围

本预训练模型主要作为一个多模态特征抽取backbone，用于文档多模态表征或文档理解相关下游任务微调。用户可以基于自有数据进行调用。具体调用方式请参考代码示例。

### 如何使用
由于模型的输入包含相关文件`data/*`，以下示例需要克隆本仓库之后，在本文件夹运行。
#### 代码范例

```python
import os
from modelscope.pipelines import pipeline
from modelscope import snapshot_download

model_path = snapshot_download('iic/multi-modal_convnext-roberta-base_vldoc-embedding', revision='master')
doc_VL_emb_pipeline = pipeline(task='document-vl-embedding', model=model_path)

inp = {
    'images': [os.path.join(model_path, 'data/demo.png')], 
    'ocr_info_paths': [os.path.join(model_path, 'data/demo.json')]
}
result = doc_VL_emb_pipeline(inp)

print('Results of VLDoc: ')
for k, v in result.items():
    print(f'{k}: {v.size()}')
# Expected output:
# img_embedding: torch.Size([1, 151, 768]), 151 = 1 global img feature + 150 segment features
# text_embedding: torch.Size([1, 512, 768])
```
The example in the `data` folder is from [FUNSD](https://guillaumejaume.github.io/FUNSD/).
<!-- 
```python
from modelscope.metainfo import Preprocessors
from modelscope.msdatasets import MsDataset
from modelscope.trainers import build_trainer
from modelscope.utils.constant import Tasks
``` -->

### 模型局限性以及可能的偏差

基于收集的数据进行训练，模型训练数据有限，效果可能存在一定偏差。

## 训练数据介绍
### 预训练数据
- VLDoc模型训练数据集由网络收集的文档数据和部分IIT-CDIP文档数据构成，总训练文档数据数量约11M。
- 文档OCR结果，由[读光OCR](https://duguang.aliyun.com/)提供。

### 下游数据集
- 文档信息抽取：[FUNSD](https://guillaumejaume.github.io/FUNSD/), [CORD](https://huggingface.co/datasets/katanaml/cord), [XFUND](https://github.com/doc-analysis/XFUND/releases/tag/v1.0).
- 文档分类：[RVL-CDIP](https://huggingface.co/datasets/rvl_cdip).

## 模型训练流程

本文档多模态预训练模型，视觉backbone由ConvNeXt参数进行初始化，文本+Layout的backbone由InfoXLM-base参数进行初始化。模型输入图像尺度为768x768，最大处理文本长度为512，超过部分被截断。在训练数据集上进行自监督预训练1个epoch

## 数据评估及结果

| 模型          | FUNSD.SER | FUNSD.RE | XFUND.zh.SER | XFUND.zh.RE |
| --------------- | --------- | -------- | ------------ | ----------- |
| LayoutLMv3-base | 0.9029    | 0.6684   | --           | --          |
| LayoutXLM-base  | 0.7940    | 0.5483   | 0.8924       | 0.7073      |
| VLDoc-XLM-base  | 0.9031    | 0.8259   | 0.9122       | 0.8811      |

### 相关论文以及引用信息

如果我们的模型对您有帮助，请您引用我们的文章：

```BibTex
@article{luo2022bi,
  title={Bi-VLDoc: Bidirectional Vision-Language Modeling for Visually-Rich Document Understanding},
  author={Luo, Chuwei* and Tang, Guozhi* and Zheng, Qi and Yao, Cong and Jin, Lianwen and Li, Chenliang and Xue, Yang and Si, Luo},
  journal={arXiv preprint arXiv:2206.13155},
  year={2022}
}

@article{cvpr2023geolayoutlm,
  title={GeoLayoutLM: Geometric Pre-training for Visual Information Extraction},
  author={Chuwei Luo* and Changxu Cheng* and Qi Zheng and Cong Yao},
  journal={2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
  year={2023}
}
```
