Instructions to use microsoft/table-transformer-detection with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/table-transformer-detection with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("object-detection", model="microsoft/table-transformer-detection")# Load model directly from transformers import AutoImageProcessor, AutoModelForObjectDetection processor = AutoImageProcessor.from_pretrained("microsoft/table-transformer-detection") model = AutoModelForObjectDetection.from_pretrained("microsoft/table-transformer-detection", device_map="auto") - Notebooks
- Google Colab
- Kaggle
docs: rename WinML CLI example path to microsoft_table-transformer-detection
Browse files
README.md
CHANGED
|
@@ -1,35 +1,35 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
widget:
|
| 4 |
-
- src: https://www.invoicesimple.com/wp-content/uploads/2018/06/Sample-Invoice-printable.png
|
| 5 |
-
example_title: Invoice
|
| 6 |
-
---
|
| 7 |
-
|
| 8 |
-
# Table Transformer (fine-tuned for Table Detection)
|
| 9 |
-
|
| 10 |
-
Table Transformer (DETR) model trained on PubTables1M. It was introduced in the paper [PubTables-1M: Towards Comprehensive Table Extraction From Unstructured Documents](https://arxiv.org/abs/2110.00061) by Smock et al. and first released in [this repository](https://github.com/microsoft/table-transformer).
|
| 11 |
-
|
| 12 |
-
Disclaimer: The team releasing Table Transformer did not write a model card for this model so this model card has been written by the Hugging Face team.
|
| 13 |
-
|
| 14 |
-
## Model description
|
| 15 |
-
|
| 16 |
-
The Table Transformer is equivalent to [DETR](https://huggingface.co/docs/transformers/model_doc/detr), a Transformer-based object detection model. Note that the authors decided to use the "normalize before" setting of DETR, which means that layernorm is applied before self- and cross-attention.
|
| 17 |
-
|
| 18 |
-
## Usage
|
| 19 |
-
|
| 20 |
-
You can use the raw model for detecting tables in documents. See the [documentation](https://huggingface.co/docs/transformers/main/en/model_doc/table-transformer) for more info.
|
| 21 |
-
|
| 22 |
-
### Run as ONNX (CPU / NPU / GPU)
|
| 23 |
-
|
| 24 |
-
Detect tables ~14× faster on a Windows NPU at half the model size, with mAP within 1% of the original PyTorch checkpoint — by exporting this model to ONNX. You can also export to ONNX to run on CPU or GPU.
|
| 25 |
-
|
| 26 |
-
Benchmarked on an Intel Core Ultra 7 258V (PubTables-1M validation, 1000 samples):
|
| 27 |
-
|
| 28 |
-
| Model | Device | Precision | mAP | mean latency (ms) | p50 latency (ms) | Size (MB) |
|
| 29 |
-
|---------|--------------|-------------|--------|-------------------|------------------|-----------|
|
| 30 |
-
| PyTorch | CPU | fp32 | 0.9887 | 620.9 | 600.3 | 115 |
|
| 31 |
-
| ONNX | OpenVINO NPU | w8a16 (QDQ) | 0.9822 | 44.1 | 41.6 | 58 |
|
| 32 |
-
|
| 33 |
-
- **How to convert** — Export and quantize with [Microsoft's WinML CLI](https://github.com/microsoft/winml-cli). The NPU build is QDQ-quantized to w8a16; fp32 builds for CPU and GPU are also supported. End-to-end build, evaluation, and a Python inference example: [examples/
|
| 34 |
-
- **How to run on Windows** — Use [Windows ML](https://learn.microsoft.com/en-us/windows/ai/new-windows-ml/overview), which manages execution providers for NPU / GPU / CPU and routes ONNX inference to the right backend automatically.
|
| 35 |
-
- **How to run on other platforms** — Use [ONNX Runtime](https://onnxruntime.ai/docs/) with the execution provider of your choice (OpenVINO, QNN, DirectML, CUDA, CPU, etc.).
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
widget:
|
| 4 |
+
- src: https://www.invoicesimple.com/wp-content/uploads/2018/06/Sample-Invoice-printable.png
|
| 5 |
+
example_title: Invoice
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
# Table Transformer (fine-tuned for Table Detection)
|
| 9 |
+
|
| 10 |
+
Table Transformer (DETR) model trained on PubTables1M. It was introduced in the paper [PubTables-1M: Towards Comprehensive Table Extraction From Unstructured Documents](https://arxiv.org/abs/2110.00061) by Smock et al. and first released in [this repository](https://github.com/microsoft/table-transformer).
|
| 11 |
+
|
| 12 |
+
Disclaimer: The team releasing Table Transformer did not write a model card for this model so this model card has been written by the Hugging Face team.
|
| 13 |
+
|
| 14 |
+
## Model description
|
| 15 |
+
|
| 16 |
+
The Table Transformer is equivalent to [DETR](https://huggingface.co/docs/transformers/model_doc/detr), a Transformer-based object detection model. Note that the authors decided to use the "normalize before" setting of DETR, which means that layernorm is applied before self- and cross-attention.
|
| 17 |
+
|
| 18 |
+
## Usage
|
| 19 |
+
|
| 20 |
+
You can use the raw model for detecting tables in documents. See the [documentation](https://huggingface.co/docs/transformers/main/en/model_doc/table-transformer) for more info.
|
| 21 |
+
|
| 22 |
+
### Run as ONNX (CPU / NPU / GPU)
|
| 23 |
+
|
| 24 |
+
Detect tables ~14× faster on a Windows NPU at half the model size, with mAP within 1% of the original PyTorch checkpoint — by exporting this model to ONNX. You can also export to ONNX to run on CPU or GPU.
|
| 25 |
+
|
| 26 |
+
Benchmarked on an Intel Core Ultra 7 258V (PubTables-1M validation, 1000 samples):
|
| 27 |
+
|
| 28 |
+
| Model | Device | Precision | mAP | mean latency (ms) | p50 latency (ms) | Size (MB) |
|
| 29 |
+
|---------|--------------|-------------|--------|-------------------|------------------|-----------|
|
| 30 |
+
| PyTorch | CPU | fp32 | 0.9887 | 620.9 | 600.3 | 115 |
|
| 31 |
+
| ONNX | OpenVINO NPU | w8a16 (QDQ) | 0.9822 | 44.1 | 41.6 | 58 |
|
| 32 |
+
|
| 33 |
+
- **How to convert** — Export and quantize with [Microsoft's WinML CLI](https://github.com/microsoft/winml-cli). The NPU build is QDQ-quantized to w8a16; fp32 builds for CPU and GPU are also supported. End-to-end build, evaluation, and a Python inference example: [examples/microsoft_table-transformer-detection](https://github.com/microsoft/winml-cli/blob/main/examples/microsoft_table-transformer-detection/README.md).
|
| 34 |
+
- **How to run on Windows** — Use [Windows ML](https://learn.microsoft.com/en-us/windows/ai/new-windows-ml/overview), which manages execution providers for NPU / GPU / CPU and routes ONNX inference to the right backend automatically.
|
| 35 |
+
- **How to run on other platforms** — Use [ONNX Runtime](https://onnxruntime.ai/docs/) with the execution provider of your choice (OpenVINO, QNN, DirectML, CUDA, CPU, etc.).
|