SciTsr-Logical / README.md
saeed11b95's picture
Update README.md
0c45032 verified
metadata
license: mit
language:
  - en
tags:
  - table-structure-recognition
  - ocr
  - document-ai
  - scitsr

SciTSR-Logical: A Line-Level OCR Conversion of the SciTSR Dataset

Dataset Description

This dataset is a converted and enhanced version of the SciTSR (Scientific Table Structure Recognition) dataset, reformatted for line-level OCR and Table Structure Recognition (TSR) tasks.

While SciTSR provides excellent logical structure information, this version focuses on creating a direct link between low-level OCR output and that structure. For each table, the dataset includes:

  1. A high-resolution cropped PNG image of the table (rendered at 144 DPI).
  2. A detailed JSON file that maps each detected text line's physical bounding box to its logical grid coordinates ([row_start, row_end, col_start, col_end]).

This format is ideal for training and evaluating Document AI models that perform OCR and TSR in a unified manner.

How to Use

You can load an example by pairing the images from the cropped_images directory with the JSON annotations in the logical_gt directory.

import json
from PIL import Image
from pathlib import Path

# Assume dataset is loaded or cloned locally
base_path = Path("./") # Path to the dataset directory

# Get a list of all examples
gt_files = list((base_path / "logical_gt").glob("*.json"))
example_file = gt_files[0]

# Load the annotation data
with open(example_file, 'r') as f:
    annotations = json.load(f)

# Load the corresponding image
image_path = base_path / "cropped_images" / (example_file.stem + ".png")
image = Image.open(image_path)

# Display the first annotation
first_line = annotations[0]
print(f"Text: {first_line['text']}")
print(f"Bounding Box: {first_line['box']}")
print(f"Logical Coordinates: {first_line['logical_coords']}")

# image.show()