welcomyou's picture
docs: model card
06f3652 verified
---
library_name: onnxruntime
pipeline_tag: object-detection
license: agpl-3.0
base_model: juliozhao/DocLayout-YOLO-DocStructBench
tags:
- yolo
- doclayout-yolo
- object-detection
- document-layout-analysis
- onnx
- dynamic-axes
---
# DocLayout-YOLO — ONNX with dynamic axes
Re-export of [`juliozhao/DocLayout-YOLO-DocStructBench`](https://huggingface.co/juliozhao/DocLayout-YOLO-DocStructBench) and the DocLayNet-pretrained variant to **ONNX with dynamic batch + spatial dimensions**, which the upstream releases do not provide.
## Why dynamic axes?
The official DocLayout-YOLO ONNX exports use fixed input shapes (e.g. 1024×1024). Dynamic axes let downstream tools batch arbitrary page sizes without re-exporting per resolution — convenient for desktop OCR pipelines that hit pages of mixed DPI.
## Variants
| Subdir | Source | Use case |
|---|---|---|
| `doclayout_yolo_onnx_dynamic/` | DocStructBench (academic + business mix) | Primary — used by ScanIndex `layout_analyzer` |
| `doclayout_yolo_doclaynet_onnx_dynamic/` | DocLayNet (annotated diverse docs) | Auxiliary for non-table region routing |
Each subdir contains the `.onnx` + `.onnx.data` (external weights) + a `.names.json` for class id → label mapping.
## Loading
```python
import onnxruntime as ort
from huggingface_hub import snapshot_download
local = snapshot_download("welcomyou/doclayout-yolo-onnx-dynamic", local_dir="models")
sess = ort.InferenceSession(f"{local}/doclayout_yolo_onnx_dynamic/doclayout_yolo_docstructbench_imgsz1024_dynamic.onnx")
# input "images": (N, 3, H, W) where H, W must be multiples of 32
```
## Re-export reproduction
See [train-convert/doclayoutyolo/convert/export_doclayout_yolo_to_onnx.py](https://github.com/welcomyou/scanindex/blob/main/train-convert/doclayoutyolo/convert/export_doclayout_yolo_to_onnx.py).
## License
**AGPL-3.0**, inherited from upstream DocLayout-YOLO. Commercial use requires complying with AGPL terms or obtaining an alternative license from the authors.