TahaDouaji/detr-doc-table-detection is a forked repo from huggingface. License: None
Go to file
Niels Rogge d60c294e85 Improve code snippet 2022-08-05 13:31:07 +00:00
.gitattributes initial commit 2022-03-11 15:55:14 +00:00
README.md Improve code snippet 2022-08-05 13:31:07 +00:00
config.json Update config.json 2022-03-11 22:43:07 +00:00
preprocessor_config.json Update preprocessor_config.json 2022-03-12 11:59:43 +00:00
pytorch_model.bin add model 2022-03-11 16:03:02 +00:00

README.md

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

Training data

The model was trained on ICDAR2019 Table Dataset

How to use

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]