Skip to main content
Glama
npu-vision-fallback

npu-vision-fallback

by Byte-Naut

🔋 npu-vision-fallback

⚠️ Archived experiment — no longer actively developed

An Intel NPU screen-vision + MCP integration experiment. Backend routing and Windows-native OCR integration worked; the NPU-first product hypothesis did not find a stable user need. Code preserved for reference.

PyPI License: MIT Python 3.11+

English | 中文


🗄️ Why This Is Archived

This project tested whether desktop AI agents would benefit from running low-level screen perception — "find the button", "read this region" — locally on an Intel NPU, exposed as an MCP server. That was a hypothesis, not a verified need; it never crystallized into stable demand, so development stopped.

Two things the experiment did prove:

  • Backend routing with graceful fallback — NPU → CPU → system OCR → cross-platform OCR, driven by a power policy, with heavy dependencies kept optional.

  • Windows-native OCR over MCP — WinRT OCR wired into the same tool surface as the OpenVINO NPU UI detector.

What I still use it for: batch OCR of long screenshots. Note that the implementation has no complete tiling guarantee for very long images — it may drop content on extreme captures. Treat the code as a reference, not a maintained dependency.


Related MCP server: openowl

🧱 Original Design

Three constraints that shaped the project:

  1. Cheapest path first. OS-native OCR, then a local detector. A cloud multimodal model was the last resort — for reasoning, not for finding buttons.

  2. Isolate compute. Inference on the NPU so the GPU stays free for the app the agent is watching. The service requests NPU or CPU only — never any GPU.

  3. Local, period. Screenshots stay in memory and are never written to disk; OCR text is never logged; nothing leaves the machine.

Pipeline: mcp_server.py → core/orchestrator.py → core/backend_selector.py → selected backend → screen-space remap. Full detail: docs/ARCHITECTURE.md.


📋 Reference

MCP Tools

Tool

Purpose

Key Arguments

health_check

Server status

—

list_backends

Available backends

—

ocr_region

Extract text from region

region=[x1,y1,x2,y2]

detect_ui

Find UI elements

region=[x1,y1,x2,y2]

analyze_screen

Combined OCR + detection

region=[x1,y1,x2,y2]

analyze_image_file

Analyze an image file

path, mode=ocr|ui|all

analyze_image_directory

Batch-analyze images in a directory

input_dir, output_dir, mode, recursive, overwrite, max_workers

analyze_screen fuses detection + OCR into spatially-sorted elements with text annotations. analyze_image_file and analyze_image_directory reuse the same pipeline on image files.

CLI

# Single image
uv run npu-vision-fallback-cli analyze-image path/to/image.png --mode all

# Directory batch
uv run npu-vision-fallback-cli analyze-dir path/to/dir --output-dir out/ --recursive
pip install "npu-vision-fallback[ocr-win,detect]"
python scripts/download_ui_model.py  # one-time model export to OpenVINO IR

Further extras are listed in pyproject.toml.

Supported Backends

Backend

Type

Device

Platform

Status

winocr

System OCR

CPU/NPU

Windows

✅ Primary

openvino_npu

UI Detection

NPU

Win/Linux + Intel NPU

✅ Primary

openvino_cpu

UI Detection

CPU

Win/Linux/macOS

✅ Fallback

rapid_ocr

OCR

CPU

All

✅ Cross-platform

pytesseract

OCR

CPU

All

✅ Last-resort

vision

System OCR

ANE

macOS

🚧 Never implemented

Measured Performance

Intel Core Ultra 9 275HX, 2560×1600, on battery:

Task

Backend

Latency

Energy

Notes

OCR

WinOCR

~1100ms

2.5J

Native Windows API

OCR

RapidOCR

~6300ms

14.5J

Cross-platform ONNX CPU

UI Detection

OpenVINO NPU

~80ms

0.3J

YOLOv8n on Intel AI Boost

UI Detection

OpenVINO CPU

~120ms

—

No-NPU fallback

Full details: outputs/power_report.md

Examples

Example

Description

basic_ocr.py

OCR a screen region

agent_ui_navigation.py

Find and click UI elements

desktop_remote_vnc.py

Vision fallback in remote desktop

uv run python examples/basic_ocr.py --region 0 0 1280 800

Docs


📄 License

MIT © npu-vision-fallback contributors

🙏 Acknowledgments

Built with MCP (Anthropic), OpenVINO, Ultralytics YOLO, RapidOCR, Tesseract, and python-mss.

Development assisted by Claude Code (Anthropic).

Available Tools

5 tools
analyze_screenA

Capture a screen region, run NPU YOLO UI detection and system OCR in parallel, then spatially fuse the results. Returns an ordered list of interactive elements (buttons, fields, headings, …) each annotated with the visible text inside them — ideal for agents that need to understand and act on the current screen. region=[x1,y1,x2,y2] in screen coords; omit for full screen.

Inputs: region, min_confidence.

detect_uiA

Detect objects / UI elements in a screen region using YOLOv8n on OpenVINO (NPU or CPU). Returns bounding boxes with labels and confidence scores. region=[x1,y1,x2,y2] in screen coords; omit for full screen.

Inputs: region, backend.

health_checkA

Check server health

Inputs: no named parameters.

list_backendsA

List available vision backends

Inputs: no named parameters.

ocr_regionB

OCR a screen region. region=[x1,y1,x2,y2] in screen coords; omit for full screen.

Inputs: region, backend.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a distinct purpose: analyze_screen combines detection and OCR, detect_ui does detection only, ocr_region does OCR only, while health_check and list_backends are utility tools. No overlap or ambiguity.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun snake_case pattern (analyze_screen, detect_ui, ocr_region, list_backends, health_check), making them predictable and easy to understand.

    Tool Count5/5

    Five tools is well-scoped for a vision fallback server: core detection, OCR, combined analysis, health check, and backend listing. Each tool earns its place without being overwhelming or insufficient.

    Completeness4/5

    The tool surface covers the main vision operations (detection, OCR, combined) plus utility. A minor gap might be adjustable OCR language or detection parameters, but overall the set is functional and avoids dead ends.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      GUI automation MCP server that enables AI agents to see and control the Windows desktop using a local Vision LLM (Ollama), supporting screenshot analysis, mouse/keyboard actions, and autonomous task execution.
      5
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      An MCP server that gives any AI assistant eyes and hands on your desktop — screenshots, clicking, typing, OCR, window management, accessibility-tree queries, workflow recording.
      5
      Apache 2.0