Skip to main content

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

Metadata

Release files for rfdetr-doclayout 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rfdetr-doclayout 0.1.0
File Size Uploaded Provenance
rfdetr_doclayout-0.1.0.tar.gz 4.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for rfdetr-doclayout 0.1.0
File Interpreter ABI Platform
rfdetr_doclayout-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / rfdetr_doclayout-0.1.0.tar.gz

Download URL rfdetr_doclayout-0.1.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8f6fff0272a72b2711f8f5f36451cdcf0b4aecc0360bbe61a5282f03c8632174
BLAKE2b-256 checksum
How to use checksums
4ecdf984dad52919c8f5f9037edbcd63adb0654b12ca5b03a4f409d9c827bcd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.15

Release files / rfdetr_doclayout-0.1.0-py3-none-any.whl

Download URL rfdetr_doclayout-0.1.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
492eda78bd10a1f29c8acec37813529949f3cc641ca8ffffe07c2af28063b587
BLAKE2b-256 checksum
How to use checksums
454b221c500165c1dacf58db63a4bd9dc495239dbe7e466a7b177b99b642b6ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.15

Security for rfdetr-doclayout 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page