File size: 939 Bytes
00312f8
 
 
 
 
 
c9211cb
a3e4b9a
c9211cb
 
 
 
 
 
 
 
 
b794013
c9211cb
b794013
c9211cb
 
b794013
c9211cb
 
b794013
d60c294
 
 
c9211cb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
---
tags:
- object-detection
---


## Model description
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)

## Training data
The model was trained on ICDAR2019 Table Dataset

### How to use

```python
from transformers import DetrFeatureExtractor, DetrForObjectDetection
from PIL import Image

image = Image.open("Image path")

feature_extractor = DetrFeatureExtractor.from_pretrained('TahaDouaji/detr-doc-table-detection')
model = DetrForObjectDetection.from_pretrained('TahaDouaji/detr-doc-table-detection')

inputs = feature_extractor(images=image, return_tensors="pt")
outputs = model(**inputs)

# convert outputs (bounding boxes and class logits) to COCO API
target_sizes = torch.tensor([image.size[::-1]])
results = feature_extractor.post_process(outputs, target_sizes=target_sizes)[0]
```