File size: 1,668 Bytes
6a0d82c
 
 
 
 
3ca5518
6a0d82c
3ca5518
 
 
 
6a0d82c
 
3ca5518
6a0d82c
3ca5518
 
 
 
 
 
 
 
6a0d82c
 
 
3ca5518
 
6a0d82c
3ca5518
 
 
 
 
6a0d82c
3ca5518
 
 
6a0d82c
 
3ca5518
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
tags:
- mlx
- object-detection
- document-layout
- reading-order
library_name: mlx-vlm
license: other
license_name: indic-open-model-license-1.0
license_link: https://huggingface.co/HashNuke/indic-ocr-mlx/blob/main/LICENSE.md
base_model: bodhan-ai/indic-ocr
---

# IndicDocLayout (MLX)

Built with IndicDocLayout from Bodhan AI / AI4Bharat.

The layout stage of [IndicOCR (MLX)](https://huggingface.co/HashNuke/indic-ocr-mlx):
a 37-class PP-DocLayoutV3 fine-tune that predicts document regions and reading
order. The weights are float32, about 33M parameters (133 MB).

Use an mlx-vlm checkout with `pp_doclayout_v3` support. This example downloads
only the layout stage; it does not load the OCR model.

```python
from pathlib import Path

from huggingface_hub import snapshot_download
from mlx_vlm.utils import load_model

root = Path(snapshot_download(
    "HashNuke/indic-ocr-mlx", allow_patterns=["weights/layout/*"]
))
model = load_model(root / "weights/layout")
model.eval()
records = model.detect("page.png", conf=0.5)
for record in sorted(records, key=lambda item: item["reading_order"]):
    print(record)
```

Replace `page.png` with an image path. Records contain `bbox` in
`[y0, x0, y1, x1]` order, normalized to 0–1000, plus `label`, one-based
`reading_order`, and `score`. The detector does not transcribe text.

This fine-tune is distinct from the stock 25-class
[PP-DocLayout V3 (MLX)](https://huggingface.co/HashNuke/pp-doclayout-v3-mlx).
The source weights are from [bodhan-ai/indic-ocr](https://huggingface.co/bodhan-ai/indic-ocr)
under the [Indic Open Model License v1.0](https://huggingface.co/HashNuke/indic-ocr-mlx/blob/main/LICENSE.md).