docs: model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: onnxruntime
|
| 3 |
+
pipeline_tag: object-detection
|
| 4 |
+
license: agpl-3.0
|
| 5 |
+
base_model: juliozhao/DocLayout-YOLO-DocStructBench
|
| 6 |
+
tags:
|
| 7 |
+
- yolo
|
| 8 |
+
- doclayout-yolo
|
| 9 |
+
- object-detection
|
| 10 |
+
- document-layout-analysis
|
| 11 |
+
- onnx
|
| 12 |
+
- dynamic-axes
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# DocLayout-YOLO — ONNX with dynamic axes
|
| 16 |
+
|
| 17 |
+
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.
|
| 18 |
+
|
| 19 |
+
## Why dynamic axes?
|
| 20 |
+
|
| 21 |
+
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.
|
| 22 |
+
|
| 23 |
+
## Variants
|
| 24 |
+
|
| 25 |
+
| Subdir | Source | Use case |
|
| 26 |
+
|---|---|---|
|
| 27 |
+
| `doclayout_yolo_onnx_dynamic/` | DocStructBench (academic + business mix) | Primary — used by ScanIndex `layout_analyzer` |
|
| 28 |
+
| `doclayout_yolo_doclaynet_onnx_dynamic/` | DocLayNet (annotated diverse docs) | Auxiliary for non-table region routing |
|
| 29 |
+
|
| 30 |
+
Each subdir contains the `.onnx` + `.onnx.data` (external weights) + a `.names.json` for class id → label mapping.
|
| 31 |
+
|
| 32 |
+
## Loading
|
| 33 |
+
|
| 34 |
+
```python
|
| 35 |
+
import onnxruntime as ort
|
| 36 |
+
from huggingface_hub import snapshot_download
|
| 37 |
+
local = snapshot_download("welcomyou/doclayout-yolo-onnx-dynamic", local_dir="models")
|
| 38 |
+
sess = ort.InferenceSession(f"{local}/doclayout_yolo_onnx_dynamic/doclayout_yolo_docstructbench_imgsz1024_dynamic.onnx")
|
| 39 |
+
# input "images": (N, 3, H, W) where H, W must be multiples of 32
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
## Re-export reproduction
|
| 43 |
+
|
| 44 |
+
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).
|
| 45 |
+
|
| 46 |
+
## License
|
| 47 |
+
|
| 48 |
+
**AGPL-3.0**, inherited from upstream DocLayout-YOLO. Commercial use requires complying with AGPL terms or obtaining an alternative license from the authors.
|