How to Extract Tables from Document Images Using Multi-Type-TD-TSR

Jan 13, 2024 | Data Science

In the fast-paced world, where data-driven industries reign supreme, converting digital images of scanned documents into machine-readable information has never been more important. Enter Multi-Type-TD-TSR, a multi-stage pipeline adept at extracting tables from documents. This guide is your roadmap to harnessing the power of this innovative table extraction solution.

What is Multi-Type-TD-TSR?

Multi-Type-TD-TSR stands for Multi-Type Table Detection and Table Structure Recognition. It’s an end-to-end solution crafted to tackle the challenge of table extraction from documents, even when faced with obstacles like rotated images or noise. It accomplishes this through two core tasks:

  • Table Detection: Locating the tables within the document images.
  • Table Structure Recognition: Understanding the layout and structure of these tables.

Why Use Multi-Type-TD-TSR?

Employing deep learning methods, specifically designed to recognize three different types of tables based on their borders, Multi-Type-TD-TSR is a versatile tool that can extract semantics smoothly. With its state-of-the-art performance, it shines in various conditions.

Step-by-Step Usage Instructions

To get started with Multi-Type-TD-TSR, follow these simple steps:

1. Configure Your Environment

Ensure you have the necessary library dependencies installed:

  • PyTorch: 1.7.0
  • Torchvision: 0.8.1
  • CUDA: 10.1
  • PyYAML: 5.1

2. Image Alignment Pre-Processing

For initial image processing, use the script deskew.py to adjust image alignment. Execute the following command:

python3 deskew.py --folder path_to_images --output path_to_output

3. Table Structure Recognition (TSR)

Apply the table structure recognition algorithm by running:

python3 tsr.py --folder path_to_images --type [bordered, unbordered, partially, partially_color_inv] --img_output path_to_processed_images --xml_output path_to_xml_files

4. Table Detection and Structure Recognition (TD-TSR)

If you want to perform both detection and recognition, utilize:

python3 tdtsr.py --folder path_to_images --type [bordered, unbordered, partially, partially_color_inv] --tsr_img_output path_to_tsr_images --td_img_output path_to_table_cutouts --xml_output path_to_xml_files --config path_to_detectron2_config --yaml path_to_detectron2_yaml --weights path_to_detectron2_weights

5. Evaluation

To evaluate the recognition quality, use the evaluate.py script:

python3 evaluate.py --dataset path_to_dataset_folder

Troubleshooting

If you encounter issues during the installation or execution, consider the following tips:

  • Check your environment setup to ensure all dependencies are correctly installed.
  • Verify the paths you provide in the scripts are correct and accessible.
  • Refer to the documentation for Detectron2 installation to resolve any potential errors during setup.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Conclusion

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox