Skip to main content

Tables Model

Overview

The Tables Model is designed to detect table outlines in documents using the cutting-edge DETR (DEtection TRansformer) architecture. DETR is a revolutionary approach to object detection that leverages transformers to deliver high accuracy and performance. By integrating DETR, our model can effectively identify and outline tables within various document formats, making it an invaluable tool for data extraction and document processing.

Project Structure

The project has the following structure:

├── README.md
├── data
│ ├── preprocessed_data
│ │ ├── <smapshot_id>_<objective>
│ │ │ ├── VOCdevkit
│ │ │ │ ├── VOC2012
│ │ │ │ │ ├── Annotations
│ │ │ │ │ ├── ImageSets
│ │ │ │ │ └── JPEGImages
│ │ │ ├── train_coco.json
│ │ │ └── val_coco.json
│ │ ├── test_docs.json
│ │ ├── train_docs.json
│ │ └── val_docs.json
├── logs
├── results
├── src
│ ├── preprocessing
│ ├── training
│ │ ├── run_train_detection_pipeline.py
│ │ └── run_train_structure_pipeline.py
│ ├── genie_model.py
│ └── run_evaluation.py
├── trained_models
├── requirements.txt
└── .gitignore

Key Highlights

  • Advanced Detection : Utilizes the powerful DETR architecture to accurately detect table boundaries in complex documents.
  • Robust Structure Recognition : Capable of recognizing and understanding the internal structure of tables, including rows and columns.
  • Versatile Applications : Suitable for a wide range of applications, from financial document analysis to academic research and beyond.
  • Seamless Integration : Easily integrates with other data processing pipelines and tools, enhancing your document workflow.

How It Works

The model processes documents by analyzing their visual and textual content. Using the DETR architecture, it transforms this content into a format where table outlines can be detected with high precision. The detected tables are then processed to extract their structure, which can be used for various downstream tasks such as data extraction, analysis, and visualization.

Features

  • Table Detection: Train a model to detect table outlines using the DETR architecture.
  • Structure Recognition: Train a model to recognize the structure within detected tables.
  • Evaluation: Evaluate model performance and export results to a spreadsheet.
  • Inference: Perform inference to detect tables in new images.

Training

Training Table Detection

Run python src/training/run_train_detection_pipeline.py

Training Table Structure Recognition

Run python src/training/run_train_structure_pipeline.py

Evaluation

  1. Specify snapshot in src/run_evaluation.py
  2. Specify output file name in src/run_evaluation.py
  3. Run python src/run_evaluation.py

Inference

Running the Model

  1. Specify snapshot path in src/genie_model.py .
  2. Specify document from snapshot in src/genie_model.py.
  3. Run python src/genie_model.py to get the table structure for the document.

Use the following command to run the inference: Run model = TablesModel() pred_doc = model.predict(document)

Evaluation

  1. Specify snapshot in src/run_evaluation.py
  2. Specify output file name in src/run_evaluation.py
  3. Run python src/run_evaluation.py

More detailed documentation on architecture, training and evaluation results

https://cognaize.atlassian.net/wiki/spaces/CD/pages/48955393/DETR+Table+Detection https://cognaize.atlassian.net/wiki/spaces/CD/pages/69075000/DETR+Table+Structure+Recognition+Model