johnlockejrr/regnetx-8gf-polyline-baseline-stage0
regnetx-8gf-polyline-baseline-stage0
Stage-0 multiscript pretrained weights for `regnetx-det` — RegNetX-8GF + D-FINE HybridEncoder + PolylineTransformer, predicting text-line baselines as polylines (B-spline control points), not boxes.
Hub repo: `johnlockejrr/regnetx-8gf-polyline-baseline-stage0` Primary file:best_cbad_f1.safetensors(~208 MB) Paper (Zenodo preprint): doi:10.5281/zenodo.22059333 Recommended operating confidence: `0.40` (CLI--conf 0.4).0.50is a close alternative.
This checkpoint is a generic baseline pretrain for downstream fine-tunes (Hebrew/Samaritan, ICDAR cBAD Stage-1, other PAGE/ALTO corpora). It improves on the D-FINE Stage-0 teacher on the same multiscript Arrow validation split.
Sibling checkpoints:
- D-FINE Stage-0 teacher: `johnlockejrr/dfine-det-large-baseline-stage0` (
cbad_f1_max≈ 0.893) - Hebrew/Samaritan domain fine-tune (older warm-start): `johnlockejrr/regnetx-8gf-polyline-hebrew-samaritan` (
cbad_f1_max≈ 0.942 on internal val)
Model summary
Detection is set prediction of scored polylines. Polygonal line environments (BLLA) are applied only at PAGE/ALTO serialize time.
Intended use
Use for
- Starting point for Stage-1 / domain fine-tuning on a target script or corpus
- Zero-shot probing of baselines on heterogeneous manuscripts (expect domain gap)
- Research comparing RegNetX + HybridEncoder vs D-FINE / ConvNeXt polyline siblings
Not for
- Claiming official ICDAR cBAD 2019 test numbers from these Stage-0 val scores
- Production OCR transcription (lines only; no text recognition)
- Layout region detection (paragraphs, tables, illustrations)
- Treating
cbad_f1@ conf 0.1 as the quality number (see operating point below)
Training data (Stage-0)
Same multiscript PAGE-XML / ALTO baseline Arrow as `dfine-det` Stage-0: HTR-United–style open corpora + private packs, compiled with adaptive simplify → uniform cubic B-spline \(K=8\).
Corpus mix matches the D-FINE Stage-0 card (29 corpora, multilingual historical scripts). See the dfine-det Stage-0 model card for the full corpus table.
Important: ICDAR cBAD pages appear inside this pretrain mixture. Stage-0 validation F1 is an internal multiscript holdout, not a fair official cBAD 2019 test score. For apples-to-apples cBAD bake-offs, use a separate Stage-1-cBAD fine-tune and the official test split.
Training recipe
Config reference: configs/baseline_pretrain_stage0_droplet.yaml in the regnetx-det repo.
Hardware: AMD Instinct MI300X on AMD Developer Cloud (ROCm 7.14, PyTorch HIP).
Evaluation (Stage-0 val)
Metric: cBAD-style line F1 — Hungarian matching of densified polylines with mean bidirectional Chamfer cost; TP if cost ≤ 20 px.
Released checkpoint
Compared to the D-FINE Stage-0 teacher on the same val split: +0.036 absolute cbad_f1_max (0.893 → 0.929).
Fixed conf 0.1 F1 (cbad_f1 on the progress bar) is substantially lower than cbad_f1_max — always sweep (or use ~0.4 for this checkpoint) before comparing systems.
How to use
Install
git clone <regnetx-det-repo>
cd regnetx-det
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"Use this project's .venv (not a sibling detector repo).
Download weights
huggingface-cli download johnlockejrr/regnetx-8gf-polyline-baseline-stage0 \
best_cbad_f1.safetensors \
--local-dir PRETRAIN/regnetx_stage0Inference (PAGE XML) — preferred path
regnetx-det infer-page \
-m PRETRAIN/regnetx_stage0/best_cbad_f1.safetensors \
-d cuda:0 \
--format page \
--conf 0.4 \
--text-direction horizontal-rl \
page.jpgSingle-image export with extra NMS/polygon knobs:
regnetx-det infer \
-w PRETRAIN/regnetx_stage0/best_cbad_f1.safetensors \
--image page.jpg \
-o page.xml \
--format page \
--conf 0.4 \
--reading-order rtlFine-tune (Stage-1 / domain)
train:
load: PRETRAIN/regnetx_stage0/best_cbad_f1.safetensors
backbone: regnetx_080.tv2_in1k
pretrained_backbone: false
lr: 3.0e-5
backbone_lr_mult: 0.2
monitor: cbad_f1_maxregnetx-det --config configs/hebrew_samaritan_regnetx_stage0_finetune_balanced.yaml -d cuda:0 trainHebrew/Samaritan and cBAD Stage-1 YAML templates ship in the regnetx-det repo.
Files in this release
Limitations
- Val F1 is not official cBAD 2019 test performance.
- Pretrain includes cBAD pages → do not treat Stage-0 zero-shot cBAD scores as an external bake-off.
- \(K=8\) control points underfit strongly curved / torn lines.
- EMA is used during training; released safetensors are the monitored best snapshot.
- Some listed corpora may have missing sidecars at compile time; Arrow compile skips unresolved pages.
Citation & credits
Paper (prefer this)
Preprint: regnetx-det: Set-Prediction Polyline Baselines for Historical Documents with HybridEncoder Transfer (Zenodo, Aug 2026).
@misc{bors2026regnetxdet,
author = {Bors, Teodor},
title = {regnetx-det: Set-Prediction Polyline Baselines for Historical Documents with HybridEncoder Transfer},
year = {2026},
month = aug,
publisher = {Zenodo},
version = {v1},
doi = {10.5281/zenodo.22059333},
url = {https://doi.org/10.5281/zenodo.22059333}
}D-FINE (HybridEncoder / decoder init)
@inproceedings{peng2025dfine,
title = {D-FINE: Redefine Regression Task in DETRs as Fine-grained Distribution Refinement},
author = {Peng, Yansong and Li, Hebei and Wu, Peixi and Zhang, Yueyi and Sun, Xiaoyan and Wu, Feng},
booktitle = {The Thirteenth International Conference on Learning Representations},
year = {2025},
url = {https://arxiv.org/abs/2410.13842}
}- Code: github.com/Peterande/D-FINE
- Stage-0 teacher: johnlockejrr/dfine-det-large-baseline-stage0
This Stage-0 checkpoint (weights)
@software{regnetx_det_stage0_8gf,
title = {regnetx-det Stage-0: RegNetX-8GF Multiscript Polyline Baseline Pretrain},
author = {Bors, Teodor},
year = {2026},
note = {RegNetX-8GF + HybridEncoder + PolylineTransformer; see Zenodo preprint doi:10.5281/zenodo.22059333},
url = {https://huggingface.co/johnlockejrr/regnetx-8gf-polyline-baseline-stage0}
}Acknowledgements
Compute for Stage-0 pretraining was provided via complimentary credits on the AMD Developer Cloud (AMD Instinct™ MI300X) through the AMD AI Developer Program.
Additional notices
- Vendored D-FINE modules: see
THIRD_PARTY_NOTICES.mdin the repo (Apache-2.0). - PAGE polygonalization helpers derive from Kraken/BLLA (Apache-2.0) — used at export, not in the pretrain loss.
- Training corpora: respect each dataset's original license. Private packs are not redistributed with this card; only model weights trained with them are released where license allows.
License
Apache License 2.0 for the regnetx-det code and these weights. Downstream users must comply with licenses of any datasets used in further fine-tuning.
