许可证: mit
许可证链接: https://huggingface.co/microsoft/Florence-2-base-ft/resolve/main/LICENSE
管道标签: 图像文本到文本
标签:
- 视觉
- 光学字符识别
- 分割
数据集:
- yifeihu/TF-ID-arxiv-papers
TF-ID: 学术论文表格/图表识别器
模型概述
TF-ID(表格/图表识别器)是由Yifei Hu开发的一系列目标检测模型,专门用于提取学术论文中的表格和图表。共有四个版本:
模型 |
模型大小 |
模型描述 |
TF-ID基础版[HF] |
0.23B |
提取表格/图表及其标题文本 |
TF-ID大型版[HF](推荐) |
0.77B |
提取表格/图表及其标题文本 |
TF-ID基础无标题版[HF] |
0.23B |
提取表格/图表但不包含标题文本 |
TF-ID大型无标题版[HF](推荐) |
0.77B |
提取表格/图表但不包含标题文本 |
所有TF-ID模型均基于microsoft/Florence-2检查点微调而成。 |
|
|
- 模型使用Hugging Face每日论文数据进行微调。所有边界框均由人工手动标注并检查。
- TF-ID模型以单页论文图像作为输入,返回该页中所有表格和图表的边界框。
- TF-ID基础版和大型版会为表格/图表及其标题文本绘制边界框。
- TF-ID基础无标题版和大型无标题版仅围绕表格/图表绘制边界框,不包含标题文本。
强烈推荐使用大型模型!

目标检测结果格式:
{'<OD>': {'bboxes': [[x1, y1, x2, y2], ...],
'labels': ['label1', 'label2', ...]} }
训练代码与数据集
性能基准
我们在训练数据集之外的论文页面上测试了模型性能。测试论文为Hugging Face每日论文的子集。
正确输出标准:模型为给定页面中的每个表格/图表绘制正确的边界框。
模型 |
总图像数 |
正确输出数 |
成功率 |
TF-ID基础版[HF] |
258 |
251 |
97.29% |
TF-ID大型版[HF] |
258 |
253 |
98.06% |
模型 |
总图像数 |
正确输出数 |
成功率 |
TF-ID基础无标题版[HF] |
261 |
253 |
96.93% |
TF-ID大型无标题版[HF] |
261 |
254 |
97.32% |
根据使用场景,某些"错误"输出可能完全可用。例如,模型为一个包含两个子组件的图表绘制了两个边界框。
快速开始
使用以下代码快速体验模型功能。
import requests
from PIL import Image
from transformers import AutoProcessor, AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("yifeihu/TF-ID-base", trust_remote_code=True)
processor = AutoProcessor.from_pretrained("yifeihu/TF-ID-base", trust_remote_code=True)
prompt = "<OD>"
url = "https://huggingface.co/yifeihu/TF-ID-base/resolve/main/arxiv_2305_10853_5.png?download=true"
image = Image.open(requests.get(url, stream=True).raw)
inputs = processor(text=prompt, images=image, return_tensors="pt")
generated_ids = model.generate(
input_ids=inputs["input_ids"],
pixel_values=inputs["pixel_values"],
max_new_tokens=1024,
do_sample=False,
num_beams=3
)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=False)[0]
parsed_answer = processor.post_process_generation(generated_text, task="<OD>", image_size=(image.width, image.height))
print(parsed_answer)
如需可视化结果,请参阅本教程笔记本获取更多细节。
引用信息
@misc{TF-ID,
author = {Yifei Hu},
title = {TF-ID: Table/Figure IDentifier for academic papers},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/ai8hyf/TF-ID}},
}