--- tags: - ocr - multilingual - onnx - scriptmoe --- # openocr-mlt ONNX Models FP32 inference models for multilingual OCR with the `openocr-mlt` Python package. The bundle combines ScriptMoE autoregressive recognition with PP-OCRv6 medium text detection and provides whole-page OCR, text detection, and cropped text recognition. ## Model details | Property | Value | |---|---| | Recognition | ScriptMoE ONNX Prefill/Decode with KV caching | | Detection | PP-OCRv6 medium ONNX | | Precision | FP32 | | Effective batch size | 1 | | Maximum recognition length | 100 decoding steps | The archive includes recognition graphs, shared weights, the character dictionary, the model manifest, and the detector. ## Installation and use Use Linux x86_64 with Python 3.10. Create a virtual environment and install the package. ~~~bash python3.10 -m venv .venv-ocr source .venv-ocr/bin/activate python -m pip install openocr-mlt ~~~ The same installation supports CPU and NVIDIA CUDA on Linux x86_64. CUDA requires a compatible NVIDIA driver. The Python task API defaults to `device="auto"`. Set `device="cpu"` or `device="cuda:0"` to select a device explicitly. ~~~python from openocr_mlt import OpenOCRMLT with OpenOCRMLT(task="ocr") as ocr: result = ocr(image_path="page.jpg") print(result.text) print(ocr.info["device"]) with OpenOCRMLT(task="det", device="cpu") as detector: boxes = detector(image_path="page.jpg") print([box.points for box in boxes]) with OpenOCRMLT(task="rec", device="cpu") as recognizer: lines = recognizer(image_path="crop.jpg") print([(line.text, line.score) for line in lines]) ~~~ Replace the image paths with existing files. Use `image=` for a PIL image or a uint8 NumPy array. NumPy arrays use BGR by default. Specify `color_order="RGB"` for RGB arrays. The first task call downloads and verifies the registered model bundle. ModelScope is the primary source, with Hugging Face and hf-mirror as fallbacks. The default model cache is `$XDG_CACHE_HOME/openocr-mlt` or `~/.cache/openocr-mlt`. First GPU use may require about 1.32 GB of additional CUDA 12 and cuDNN 9 libraries. The library preparation process displays download and verification progress. Compatible local libraries and verified caches can be reused. PyTorch is optional. ## Model archive | Property | Value | |---|---| | File | `scriptmoe-medium-fp32-20261101-v1.tar.gz` | | Size | 213,794,128 bytes | | SHA256 | `ee43e7358066ddf1286f61983024dc407808e350b1dd57eb986523eaf9417ad3` | For offline use, copy the archive to the target machine and import it with the installed package. ~~~bash python -m openocr_mlt fetch-models \ --source ./scriptmoe-medium-fp32-20261101-v1.tar.gz \ --cache-dir ./models --offline ~~~ The command verifies the archive and model files before installing them in the cache. In the Python API, set `cache_dir="./models", offline=True` to use this model cache offline. CUDA use also requires compatible local runtime libraries or a previously prepared CUDA cache. Offline package installation requires local copies of the package dependencies. ## Sources and licensing Recognition derives from [ScriptMoE](https://github.com/YesianRohn/ScriptMoE), upstream revision `5dde99867aaee6b4af3e75a3020b225eab17ac53`. Detection uses `PP-OCRv6_medium_det_onnx.tar` from Paddle's official model storage. Component attribution and licensing details are provided in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). Package installation and API documentation are available on [PyPI](https://pypi.org/project/openocr-mlt/).