Downloads · 30 days
0
santhoshkammari/tablet-split-model
tablet-split-model is a image classification model from santhoshkammari. Use it when you need a label for an image. It is set up for pytorch. The card lists the license as mit.
This repository contains the Split Model implementation from the paper TABLET: Learning From Instructions For Tabular Data, trained for detecting row and column splits in table images.
Downloads · 30 days
0
Access
Public
Updated Oct 12, 2025
Repo size
128 MB
Likes
2
Public
Click a slice to open those files.
.pth128 MB · 100%
From the Hugging Face model README
This repository contains the Split Model implementation from the paper TABLET: Learning From Instructions For Tabular Data, trained for detecting row and column splits in table images.
The Split Model is a deep learning architecture designed to detect horizontal and vertical splits in table images, enabling accurate table structure recognition. The model processes a table image and predicts the positions of row and column boundaries.
The model consists of three main components:
Modified ResNet-18 Backbone
Feature Pyramid Network (FPN)
Dual Transformer Branches
pip install torch torchvision pillow numpy
import torch
from PIL import Image
import torchvision.transforms as transforms
from split_model import SplitModel
# Load model
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = SplitModel().to(device)
# Load checkpoint
checkpoint = torch.load('split_model.pth', map_location=device)
model.load_state_dict(checkpoint['model_state_dict'])
model.eval()
# Prepare image
transform = transforms.Compose([
transforms.Resize((960, 960)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
image = Image.open('table_image.png').convert('RGB')
image_tensor = transform(image).unsqueeze(0).to(device)
# Predict
with torch.no_grad():
h_pred, v_pred = model(image_tensor) # Returns [1, 480] predictions
# Upsample to 960 for visualization
h_pred = h_pred.repeat_interleave(2, dim=1) # [1, 960]
v_pred = v_pred.repeat_interleave(2, dim=1) # [1, 960]
# Apply threshold
h_splits = (h_pred > 0.5).float()
v_splits = (v_pred > 0.5).float()
# Count rows and columns
num_rows = h_splits.sum().item() + 1
num_cols = v_splits.sum().item() + 1
print(f"Detected {num_rows} rows and {num_cols} columns")
Use the included visualization script to test on your images:
python test_split_by_images_folder.py \
--image-folder /path/to/images \
--output-folder predictions_output \
--model-path split_model.pth \
--threshold 0.5
The model was trained on combined FinTabNet and PubTabNet datasets:
split_model.py - Model architecture and dataset classestrain_split_fixed.py - Training scripttest_split_by_images_folder.py - Inference and visualization scriptsplit_model.pth - Trained model weightsIf you use this model, please cite the original TABLET paper:
@article{tablet2025,
title={TABLET: Learning From Instructions For Tabular Data},
author={[Authors from paper]},
journal={arXiv preprint arXiv:2506.07015},
year={2025}
}
This implementation is based on the Split Model described in Section 3.2 of: TABLET: Learning From Instructions For Tabular Data
This model is released for research purposes. Please refer to the original paper for more details.