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
Preprocessing for better results
Hi,
Can we do any preprocessing to obtain better detection results? In my case, I got full-page tables with alternating color rows (i.e. background for the first row is white, the second row is light yellow, the third is white again, and so on.
The table transformer detector is not able to detect these tables. It works beautifully on regular tables that are homogenous in terms of background and are not full-page.
I've tried padding the corners of my images, but that doesn't work.
Convert the image to grayscale, add some binary + otsu thresholding and if needs be use some dilations and it should be a lot better
you may share pinned versions + a <20-line repro, that usually separates env skew from a real regression.
Related reading: Preprocess image for better barcode read results; OpenCV preprocess image for better thresholding results.
If those checks don't match what you're seeing, paste the exact versions + traceback lines.
βA