
OmniParser-微軟的開源螢幕解析工具
繼之前提到的 Ahthropic Computer Use ,那時候超級驚豔的,馬上就看到MS也有推出自己的版本,雖然沒有自動執行功能,但可以配合 pyautogui 達成,雖然不支援中文,但可以透過中文OCR 或是 tesseract 處理

安裝到本地端
先建立一個虛擬環境起來
conda create -n omni python=3.12 -y conda activate omni
選項:有GPU的,先把CUDA安裝起來
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
整個安裝也很簡單,就五個步驟
git clone https://github.com/microsoft/OmniParser.git && cd OmniParser pip install -r requirements.txt huggingface-cli download --repo-type model microsoft/OmniParser --local-dir weights --include "icon_detect/*" "icon_caption_blip2/*" "icon_caption_florence/*" python /home/Ubuntu/OmniParser/weights/convert_safetensor_to_pt.py python gradio_demo.py
OmniParser 2.0 更新
OmniParser V2 的主要改進與優勢
1. 更大、更乾淨的訓練資料集
OmniParser V2 採用了規模更大且模型已經清洗良好的「icon caption + grounding」資料集,涵蓋更豐富的 UI 標記與功能描述,進而提升模型對互動區域的識別能力。
2. 顯著降低推理延遲
V2 在推理速度上較 V1 快了 60%,平均延遲為每畫面 0.6 秒(A100 GPU)或 0.8 秒(RTX 4090),適合即時 GUI 解讀與互動場景。
3. Grounding 準確度大幅提升
在「ScreenSpot Pro」這項標註小型 UI 元素的基準上,搭配 GPT-4o,V2 的平均精準度達到 39.6%,遠高於 GPT-4o 原本只有 0.8% 的表現。
4. 整合 OmniTool,打造完整 AI GUI Agent 流程
V2 支援搭配 OmniTool,形成一個即插即用的環境,可控制 Windows 11 VM 並搭配各家大型語言模型,如 OpenAI (4o, o1, o3-mini)、DeepSeek R1、Qwen 2.5VL 甚至 Anthropic,使建構 GUI Agent 更簡單。
5. 擴大使用場景與穩定性
除了支援 PC 與手機螢幕截圖外,V2 的架構更穩定、更泛用,適合建構可解讀 GUI 的多種應用。
V1 vs V2 功能比較表
特性 | OmniParser V1 | OmniParser V2 |
---|---|---|
訓練資料集 | 標準 icon caption+grounding 少量 | 更大、更乾淨的訓練資料集 |
推理速度 | 較慢 | 快了約 60%,平均延遲 0.6s–0.8s |
Grounding 準確度 | 基準低,難以處理小 UI 元素 | 搭配 GPT-4o 平均達 39.6% 準確率 |
操作流程整合性 | 需手動整合模型與 LLM | 支援 OmniTool,快速與多款 LLM 串接 |
適用場景廣度 | 較狹窄 | 更廣泛,包含各種 GUI 互動與截圖輸入 |
下載新的模型
for f in icon_detect/{train_args.yaml,model.pt,model.yaml} icon_caption/{config.json,generation_config.json,model.safetensors}; do huggingface-cli download microsoft/OmniParser-v2.0 "$f" --local-dir weights; done mv weights/icon_caption weights/icon_caption_florence
如果你是 Windows 可以去 Hugginface 下載模型後,並且在目錄下建立 weights\icon_caption_florence ,把下載來的模型放在目錄中即可
https://huggingface.co/microsoft/OmniParser-v2.0/tree/main
OmniParser 1.5 更新
先下載模型
python weights/convert_safetensor_to_pt.py For v1.5: download 'model_v1_5.pt' from https://huggingface.co/microsoft/OmniParser/tree/main/icon_detect_v1_5, make a new dir: weights/icon_detect_v1_5, and put it inside the folder. No weight conversion is needed.
執行指令要改成 1.5 版本
python gradio_demo.py --icon_detect_model weights/icon_detect_v1_5/model_v1_5.pt --icon_caption_model florence2
支援其他的語言
舉例來說,要改成中文,請找到專案下的 utils.py ,將 en 改成 ch
reader = easyocr.Reader(['en']) paddle_ocr = PaddleOCR( # lang='en', # other lang also available lang='ch', # other lang also available use_angle_cls=False, use_gpu=False, # using cuda will conflict with pytorch in the same process show_log=False, max_batch_size=1024, use_dilation=True, # improves accuracy det_db_score_mode='slow', # improves accuracy rec_batch_num=1024)
在介面中選取使用 PaddleOCR

相關資源
https://blog.stoeng.site/20241030.html
近期留言