模型:
TahaDouaji/detr-doc-table-detection
detr-doc-table-detection是一个基于 facebook/detr-resnet-50 进行训练的模型,用于检测文档中的有边框和无边框表格。
该模型可用于目标检测任务。
不应将该模型用于故意创建对人们敌对或疏远的环境。
大量研究探讨了语言模型的偏见和公平性问题(参见 Sheng et al. (2021) 和 Bender et al. (2021) )。模型生成的预测可能包含关于受保护类别、身份特征以及敏感的社会和职业群体的令人不安和有害的刻板印象。
用户(直接和下游用户)应了解模型的风险、偏见和限制。进一步的建议需要更多信息。
该模型是在ICDAR2019表格数据集上训练的。
可以使用 Machine Learning Impact calculator 中提出的方法来估计碳排放量。
BibTeX:
@article{DBLP:journals/corr/abs-2005-12872,
author = {Nicolas Carion and
Francisco Massa and
Gabriel Synnaeve and
Nicolas Usunier and
Alexander Kirillov and
Sergey Zagoruyko},
title = {End-to-End Object Detection with Transformers},
journal = {CoRR},
volume = {abs/2005.12872},
year = {2020},
url = {https://arxiv.org/abs/2005.12872},
archivePrefix = {arXiv},
eprint = {2005.12872},
timestamp = {Thu, 28 May 2020 17:38:09 +0200},
biburl = {https://dblp.org/rec/journals/corr/abs-2005-12872.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
Taha Douaji与Ezi Ozoani以及Hugging Face团队合作
需要更多信息
使用下面的代码开始使用模型。
from transformers import DetrImageProcessor, DetrForObjectDetection
import torch
from PIL import Image
import requests
image = Image.open("IMAGE_PATH")
processor = DetrImageProcessor.from_pretrained("TahaDouaji/detr-doc-table-detection")
model = DetrForObjectDetection.from_pretrained("TahaDouaji/detr-doc-table-detection")
inputs = processor(images=image, return_tensors="pt")
outputs = model(**inputs)
# convert outputs (bounding boxes and class logits) to COCO API
# let's only keep detections with score > 0.9
target_sizes = torch.tensor([image.size[::-1]])
results = processor.post_process_object_detection(outputs, target_sizes=target_sizes, threshold=0.9)[0]
for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
box = [round(i, 2) for i in box.tolist()]
print(
f"Detected {model.config.id2label[label.item()]} with confidence "
f"{round(score.item(), 3)} at location {box}"
)