HashNuke's picture
Clarify IndicOCR usage and stage loading
3ca5518 verified
|
Raw History Blame Contribute Delete
1.67 kB
metadata
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): 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.

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). The source weights are from bodhan-ai/indic-ocr under the Indic Open Model License v1.0.