README.md
3.9 KB · 131 lines · markdown Raw
1 ---
2 tags:
3 - object-detection
4 - '- vision'
5 - onnx
6 license: apache-2.0
7 base_model: facebook/detr-resnet-50
8 datasets:
9 - MohamedExperio/ICDAR2019
10 ---
11
12 # Model Card for detr-doc-table-detection
13
14 # Model Details
15
16 detr-doc-table-detection is a model trained to detect both **Bordered** and **Borderless** tables in documents, based on [facebook/detr-resnet-50](https://huggingface.co/facebook/detr-resnet-50).
17
18 - **Developed by:** Taha Douaji
19 - **Shared by [Optional]:** Taha Douaji
20 - **Model type:** Object Detection
21 - **Language(s) (NLP):** More information needed
22 - **License:** More information needed
23 - **Parent Model:** [facebook/detr-resnet-50](https://huggingface.co/facebook/detr-resnet-50)
24 - **Resources for more information:**
25 - [Model Demo Space](https://huggingface.co/spaces/trevbeers/pdf-table-extraction)
26 - [Associated Paper](https://arxiv.org/abs/2005.12872)
27
28
29
30 # Uses
31
32
33 ## Direct Use
34 This model can be used for the task of object detection.
35
36 ## Out-of-Scope Use
37
38 The model should not be used to intentionally create hostile or alienating environments for people.
39
40 # Bias, Risks, and Limitations
41
42
43 Significant research has explored bias and fairness issues with language models (see, e.g., [Sheng et al. (2021)](https://aclanthology.org/2021.acl-long.330.pdf) and [Bender et al. (2021)](https://dl.acm.org/doi/pdf/10.1145/3442188.3445922)). Predictions generated by the model may include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups.
44
45
46
47 ## Recommendations
48
49
50 Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
51
52 # Training Details
53
54 ## Training Data
55
56 The model was trained on ICDAR2019 Table Dataset
57
58
59 # Environmental Impact
60
61 Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
62
63
64 # Citation
65
66
67 **BibTeX:**
68
69
70 ```bibtex
71 @article{DBLP:journals/corr/abs-2005-12872,
72 author = {Nicolas Carion and
73 Francisco Massa and
74 Gabriel Synnaeve and
75 Nicolas Usunier and
76 Alexander Kirillov and
77 Sergey Zagoruyko},
78 title = {End-to-End Object Detection with Transformers},
79 journal = {CoRR},
80 volume = {abs/2005.12872},
81 year = {2020},
82 url = {https://arxiv.org/abs/2005.12872},
83 archivePrefix = {arXiv},
84 eprint = {2005.12872},
85 timestamp = {Thu, 28 May 2020 17:38:09 +0200},
86 biburl = {https://dblp.org/rec/journals/corr/abs-2005-12872.bib},
87 bibsource = {dblp computer science bibliography, https://dblp.org}
88 }
89 ```
90
91
92 # Model Card Authors [optional]
93
94 Taha Douaji in collaboration with Ezi Ozoani and the Hugging Face team
95
96
97 # Model Card Contact
98
99 More information needed
100
101 # How to Get Started with the Model
102
103 Use the code below to get started with the model.
104
105
106 ```python
107 from transformers import DetrImageProcessor, DetrForObjectDetection
108 import torch
109 from PIL import Image
110 import requests
111
112 image = Image.open("IMAGE_PATH")
113
114 processor = DetrImageProcessor.from_pretrained("TahaDouaji/detr-doc-table-detection")
115 model = DetrForObjectDetection.from_pretrained("TahaDouaji/detr-doc-table-detection")
116
117 inputs = processor(images=image, return_tensors="pt")
118 outputs = model(**inputs)
119
120 # convert outputs (bounding boxes and class logits) to COCO API
121 # let's only keep detections with score > 0.9
122 target_sizes = torch.tensor([image.size[::-1]])
123 results = processor.post_process_object_detection(outputs, target_sizes=target_sizes, threshold=0.9)[0]
124
125 for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
126 box = [round(i, 2) for i in box.tolist()]
127 print(
128 f"Detected {model.config.id2label[label.item()]} with confidence "
129 f"{round(score.item(), 3)} at location {box}"
130 )
131 ```