Repository navigation
OCR_HOST
Status: Implemented
Last Updated: 2026-11-13
Audience: Developers and coding agents
Last verified: 2026-11-13 against b1688a8de
Code: src/Martlet.Core/Reading/, src/Martlet.Gateway.Ocr/, workers/ocr/host/, deploy/host/roles/ocr/
The ocr host role lets a paired Martlet desktop read text from a screen image.
It has two engines, one at a time:
-
rapidocr: RapidOCR 1.4.4 with PaddleOCR's PP-OCRv4 models, on the processor. It is the smallest. -
ppocrv5: RapidOCR 3.10.0 with PaddleOCR's PP-OCRv5 models. It is the most accurate. Theppocrv5-mobilemodel runs on the processor. Theppocrv5-servermodel is for an NVIDIA graphics card only.
The rapidocr engine and the mobile model do not need a graphics card.
The role is for the Reading feature.
Install it with the normal host flow:
martlet-host add ocrThe role reads the engine (MARTLET_OCR_ENGINE) and the model (OCR_MODEL). For
ppocrv5, it also asks for the accelerator (cpu or gpu). Companion ›
Reading answers these questions for you. To change the model later, choose it
on that page and select Switch to, or run martlet-host add ocr again.
Hosts that installed the role before it had engines run rapidocr.
The role requires Docker.
It builds an image locally.
The images use python:3.12.10-slim-bookworm and hash-pinned PyPI wheels.
They set ORT_DISABLE_TELEMETRY=1, so ONNX Runtime sends no usage data.
The rapidocr image (workers/ocr/host/Dockerfile) installs these main
components:
- RapidOCR
1.4.4throughrapidocr_onnxruntime. - PaddleOCR PP-OCRv4 ONNX models that are inside that package.
- ONNX Runtime
1.30.0. - OpenCV Python headless
5.0.0.93. - NumPy
2.5.3.
The ppocrv5 image (workers/ocr/host/Dockerfile.ppocrv5) installs these main
components:
- RapidOCR
3.10.0. - PaddleOCR PP-OCRv5 mobile and server ONNX models (about 190 MB). The build downloads them from RapidOCR's ModelScope release v3.10.0, or from an identical Hugging Face copy, and checks each SHA-256. Both models are in the image, so a model change only restarts the service.
- ONNX Runtime
1.31.0. With thegpuaccelerator (compose.gpu.yaml), it is ONNX Runtime's CUDA 13 build with NVIDIA's CUDA and cuDNN libraries from PyPI (about 2 GB more). That needs NVIDIA driver 580 or newer. - OpenCV Python headless
5.0.0.93and NumPy2.5.3.
The CPU image is about 685 MB. The CUDA image is about 3.1 GB. Each build reads a generated test image with both models before it finishes.
- Route ID:
martlet.gateway.ocr.v1 - Path:
/martlet/v1/inference/ocr - Contract:
martlet.ocr-relayversion1.0 - Role:
GatewayRole.Voice - Model IDs:
rapidocr-ppocrv4(the default),ppocrv5-mobileandppocrv5-server, each pinned with its model's SHA-256 - Port:
127.0.0.1:50087
Each request has one operation.
status returns the engine state.
read sends one PNG or JPEG image.
The image limit is 4 MiB.
Martlet sends the full-size screenshot as a JPEG at quality 90.
When that is more than 4 MiB, Martlet tries quality 75, then quality 60.
The result limit is 256 KiB.
A status result has this form:
{"state":"ready","engine":"ppocrv5","engine_version":"3.10.0","model":"ppocrv5-mobile","accelerator":"cpu","threads":4,"providers":["CPUExecutionProvider"]}The rapidocr engine reports "engine":"rapidocr" and
"model":"rapidocr-ppocrv4". When accelerator is gpu and ONNX Runtime
cannot use the card, the state is failed.
A read result has this form:
{"lines":[{"text":"Score","score":0.99,"box":[1,2,30,10]}],"width":100,"height":50,"milliseconds":12}The box values are x, y, width and height.
The service returns at most 256 lines.
Each line has at most 512 characters.
The role listens only on loopback. The Martlet gateway is the only LAN entry point. Paired desktops send screenshots while Martlet watches the screen. The worker decodes and reads each image in memory. It does not write screenshots or OCR text to disk.
Using the role means accepting these licenses:
- RapidOCR: Apache-2.0.
- PaddleOCR PP-OCRv4 and PP-OCRv5 models: Apache-2.0.
- With the
gpuaccelerator: NVIDIA CUDA and cuDNN libraries, NVIDIA's license. - omegaconf and antlr4-python3-runtime (PP-OCRv5 image): BSD-3-Clause.
- ONNX Runtime: MIT.
- OpenCV: Apache-2.0.
- NumPy: BSD-3-Clause.
- pyclipper: MIT.
- Shapely: BSD-3-Clause.
- Pillow: MIT-CMU and HPND.
- PyYAML: MIT.
- six: MIT.
- tqdm: MPL-2.0 and MIT.
Martlet: download · repository · changelog · issues
These pages come from docs/wiki in the repository. To suggest a change, open an issue or a pull request there.
- Home
- Accounts and households
- Accounts and Household
- Android phones and tablets: what it takes, and the plan
- Martlet's API for other apps and scripts
- App Guides
- App Settings and Updates
- App guides: game and app knowledge from the web
- Architecture
- Bounded PCM playback
- Audio dependency inventory and notices
- Avatar guide: Live2D, VRM and speech animation
- V01a explicit microphone capture
- Chatterbox voice engines
- Cleaning up disk space
- One Martlet on all your computers
- Companion controls and behavior requirements
- Components, jobs and placement (design)
- Live conversation
- Creations
- Decision map: which file owns each decision
- Deep research: web search and long research jobs
- The desktop app: updates, notification area, exiting and appearance
- Linux and macOS desktop companion: research, decision and plan
- Developer Guide
- Dia voice engine
- Diagnostics
- Discord
- Architecture and provider contracts
- Discord
- Memory (P03a/P03b/P03c)
- Singing
- Desktop troubleshooting and local support
- Recognizing people by voice, and Parakeet
- Echo cancellation
- ElevenLabs voice: your cloned voice with tones
- F5 worker and reference-voice foundation
- FAQ
- First Steps
- Game state plan: implementation history
- Glossary: one name for each concept
- GPT-SoVITS voice
- Hosted Thinking: cloud models when Thinking can't run on this PC
- Installation and support
- Installing Martlet
- iOS and iPadOS: what it takes, and the plan
- Repository instructions for coding agents
- Repository knowledge base
- Knowledge base maintenance
- GitHub Wiki mirror
- Linux and Mac
- Listening and Voice ID
- Local model apps
- Lorebooks
- macOS: what it takes, and the plan
- Martlet MCP Server
- MCP in Martlet
- MCP: The app's window
- MCP: Apps, home and memory
- MCP: Characters
- MCP: Diagnostics and logs
- MCP: Computers, network and accounts
- MCP: Other
- MCP: Tool permissions
- MCP pages
- MCP: Server and protocol internals
- MCP: Settings
- MCP: Start here
- MCP: Thinking and models
- MCP: Voice and listening
- Memory
- Messaging apps
- Model catalog: sources, conflicts and design
- Motion host role
- Multiple Computers
- Your Martlet network
- OCR host role
- Share your language models: the OpenAI-compatible endpoint
- Packaging
- Perception worker contracts
- Personality and Characters
- Picture making
- Pictures and Creations
- Picture making host role
- Platforms: what each device can do
- Prerequisites: what Martlet bundles, installs for you, or needs from you
- Privacy and Safety
- Reading the text on your screen
- Wiki source
- Recommendation design: ask three questions, plan for three situations
- Recommended setups: one machine to unlimited budget
- Releasing
- Repository Layout
- Research and provenance ledger
- Resource footprints
- Roadmap
- Watch my screen: screen-aware commentary
- Search engine
- Image and audio models: who sees, who hears, who answers
- Setting Up a Host
- Setup, Windows credentials and local audio
- Sharing with Friends
- Singing
- Smart Home
- Smart home and cameras
- Source Projects
- Talking to Martlet
- Telegram and WhatsApp
- The Character
- Thinking
- Tools and MCP
- Troubleshooting
- Martlet desktop UI design
- User stories and target flows
- Voice activity detection
- Validating changes
- Validation and Testing
- Vision
- Voice latency: from you stopping talking to Martlet's voice
- Voice recognition host role
- Multi-engine voice setup and comparison
- Voices
- The welcome wizard
- XTTS-v2 voice engine