Skip to main content

Add your description here

Project description

RF-DETR For Document Layout Analysis

This is a repository for RF-DETR For Document Layout Analysis training with DocLayNet dataset.

This repository is based on rf-detr-onnx.

Original Image Result Image
academic academic_result
textbook textbook_result

Installation

pip install rfdetr-doclayout

Quick Start

from rfdetr_doclayout.rfdetr import RfDetrDoclayout
import time

# Initialize the model
model = RfDetrDoclayout()

# Run inference and get detections
_, labels, boxes, masks = model.predict("path/to/image.jpg")
model.save_detections("path/to/image.jpg", boxes, labels, masks, "path/to/output.jpg")

Training

git clone https://github.com/neka-nat/rfdetr-doclayout.git
cd rfdetr-doclayout
uv sync --extra train

Download Dataset

wget https://codait-cos-dax.s3.us.cloud-object-storage.appdomain.cloud/dax-doclaynet/1.0.0/DocLayNet_core.zip
unzip DocLayNet_core.zip -d DocLayNet_core

Convert dataset to RF-DETR format.

uv run scripts/convert_dataset.py --src DocLayNet_core --dst dataset

Training Locally

uv run scripts/doclaynet_train.py --dataset_dir dataset --output_dir models/rfdetr-doclayout

Training on AWS SageMaker

aws s3 sync dataset/  s3://<your-bucket-name>/dataset
touch .env
echo "AWS_BUCKET_NAME=<your-bucket-name>" >> .env
echo "AWS_SAGEMAKER_ROLE_NAME=<your-role-name>" >> .env
uv run scripts/deploy_train.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rfdetr_doclayout-0.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rfdetr_doclayout-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file rfdetr_doclayout-0.1.0.tar.gz.

File metadata

  • Download URL: rfdetr_doclayout-0.1.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.15

File hashes

Hashes for rfdetr_doclayout-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8f6fff0272a72b2711f8f5f36451cdcf0b4aecc0360bbe61a5282f03c8632174
MD5 5c4ca05d046c27b3b5dff1a0806fef0b
BLAKE2b-256 4ecdf984dad52919c8f5f9037edbcd63adb0654b12ca5b03a4f409d9c827bcd1

See more details on using hashes here.

File details

Details for the file rfdetr_doclayout-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rfdetr_doclayout-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 492eda78bd10a1f29c8acec37813529949f3cc641ca8ffffe07c2af28063b587
MD5 9470058d787139f77744257ff9bbba8f
BLAKE2b-256 454b221c500165c1dacf58db63a4bd9dc495239dbe7e466a7b177b99b642b6ac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page