🚀 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)。關於微調/推理的詳細內容,請參考 演示筆記本。
🔧 技術細節
文檔中未提及詳細技術實現細節,故跳過此章節。
📄 許可證
該模型使用MIT許可證。
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}
}