Loading repository data…
Loading repository data…
microsoft / repository
Table Transformer (TATR) is a deep learning model for extracting tables from unstructured documents (PDFs and images). This is also the official repository for the PubTables-1M dataset and GriTS evaluation metric.
A deep learning model based on object detection for extracting tables from PDFs and images.
First proposed in "PubTables-1M: Towards comprehensive table extraction from unstructured documents".

This repository also contains the official code for these papers:
Note: If you are looking to use Table Transformer to extract your own tables, here are some helpful things to know:
Additional information about this project for both users and researchers, including data, training, evaluation, and inference code is provided below.
08/22/2023: We have released 3 new pre-trained models for TATR-v1.1 (trained on 1. PubTables-1M, 2. FinTabNet.c, and 3. both datasets combined) according to the details in our paper.
04/19/2023: Our latest papers (link and link) have been accepted at ICDAR 2023.
03/09/2023: We have added more image cropping to the official training script (like we do in our most recent paper) and updated the code and environment.yml to use Python 3.10.9, PyTorch 1.13.1, and Torchvision 0.14.1, among others.
03/07/2023: We have released a new simple inference pipeline for TATR. Now you can easily detect and recognize tables from images and convert them to HTML or CSV.
03/07/2023: We have released a collection of scripts to create training data for TATR and to canonicalize pre-existing datasets, such as FinTabNet and SciTSR.
03/01/2023: New paper "Aligning benchmark datasets for table structure recognition" is now available on arXiv.
11/25/2022: We have made the full PubTables-1M dataset alternatively available for download from Hugging Face.
05/05/2022: We have released the pre-trained weights for the table structure recognition model trained on PubTables-1M.
03/23/2022: Our paper "GriTS: Grid table similarity metric for table structure recognition" is now available on arXiv
03/04/2022: We have released the pre-trained weights for the table detection model trained on PubTables-1M.
03/03/2022: "PubTables-1M: Towards comprehensive table extraction from unstructured documents" has been accepted at CVPR 2022.
11/21/2021: Our updated paper "PubTables-1M: Towards comprehensive table extraction from unstructured documents" is available on arXiv.
10/21/2021: The full PubTables-1M dataset has been officially released on .
: Initial version of the Table Transformer (TATR) project is released.
The goal of PubTables-1M is to create a large, detailed, high-quality dataset for training and evaluating a wide variety of models for the tasks of table detection, table structure recognition, and functional analysis.
It contains:
Additionally, cells in the headers are canonicalized and we implement multiple quality control steps to ensure the annotations are as free of noise as possible. For more details, please see our paper.
We provide different pre-trained models for table detection and table structure recognition.
Table Detection:
Table Structure Recognition:
Table Detection:
Table Structure Recognition:
PubTables-1M is available for download from Microsoft Research Open Data.
We have also uploaded the full set of archives to Hugging Face.
The dataset on Microsoft Research Open Data comes in 5 tar.gz files:
/images: 575,305 JPG files; one file for each page image/train: 460,589 XML files containing bounding boxes in PASCAL VOC format/test: 57,125 XML files containing bounding boxes in PASCAL VOC format/val: 57,591 XML files containing bounding boxes in PASCAL VOC format/images: 947,642 JPG files; one file for each page image/train: 758,849 XML files containing bounding boxes in PASCAL VOC format/test: 93,834 XML files containing bounding boxes in PASCAL VOC format/val: 94,959 XML files containing bounding boxes in PASCAL VOC formatTo download from the command line:
https://msropendataset01.blob.core.windows.net/pubtables1m?[SAS_TOKEN_HERE].azcopy copy "https://msropendataset01.blob.core.windows.net/pubtables1m?[SAS_TOKEN_HERE]" "/path/to/your/download/folder/" --recursive
Then unzip each of the archives from the command line using:
tar -xzvf yourfile.tar.gz
Create a conda environment from the yml file and activate it as follows
conda env create -f environment.yml
conda activate tables-detr
The code trains models for 2 different sets of table extraction tasks:
For a detailed description of these tasks and the models, please refer to the paper.
To train, you need to cd to the src directory and specify: 1. the path to the dataset, 2. the task (detection or structure), and 3. the path to the config file, which contains the hyperparameters for the architecture and training.
To train the detection model:
python main.py --data_type detection --config_file detection_config.json --data_root_dir /path/to/detection_data
06/08/2021