🚀 UDOP模型
UDOP模型是一个用于通用文档处理的模型,它统一了视觉、文本和布局信息,可应用于文档图像分类、解析和视觉问答等任务。
🚀 快速开始
UDOP模型由Zineng Tang、Ziyi Yang、Guoxin Wang、Yuwei Fang、Yang Liu、Chenguang Zhu、Michael Zeng、Cha Zhang和Mohit Bansal等人在论文Unifying Vision, Text, and Layout for Universal Document Processing中提出。
✨ 主要特性
UDOP采用基于T5的编码器 - 解码器Transformer架构,可用于文档AI任务,如文档图像分类、文档解析和文档视觉问答。
📦 安装指南
文档中未提及具体安装步骤,故跳过此章节。
💻 使用示例
基础用法
from transformers import AutoProcessor, UdopForConditionalGeneration
from datasets import load_dataset
processor = AutoProcessor.from_pretrained("microsoft/udop-large", apply_ocr=False)
model = UdopForConditionalGeneration.from_pretrained("microsoft/udop-large")
dataset = load_dataset("nielsr/funsd-layoutlmv3", split="train")
example = dataset[0]
image = example["image"]
words = example["tokens"]
boxes = example["bboxes"]
question = "Question answering. What is the date on the form?"
encoding = processor(image, question, words, boxes=boxes, return_tensors="pt")
predicted_ids = model.generate(**encoding)
print(processor.batch_decode(predicted_ids, skip_special_tokens=True)[0])
9/30/92
参考演示笔记本进行微调/推理。
📚 详细文档
预期用途和限制
你可以使用该模型进行文档图像分类、文档解析和文档视觉问答(DocVQA)。
BibTeX引用和引用信息
@misc{tang2023unifying,
title={Unifying Vision, Text, and Layout for Universal Document Processing},
author={Zineng Tang and Ziyi Yang and Guoxin Wang and Yuwei Fang and Yang Liu and Chenguang Zhu and Michael Zeng and Cha Zhang and Mohit Bansal},
year={2023},
eprint={2212.02623},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
📄 许可证
本项目采用MIT许可证。