Instructions to use microsoft/OmniParser-v2.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/OmniParser-v2.0 with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("microsoft/OmniParser-v2.0", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Config.json is failing validation
#32
by intellionix - opened
- README.md +2 -84
- icon_detect_v3/LICENSE +0 -21
- icon_detect_v3/model.pt +0 -3
README.md
CHANGED
|
@@ -11,7 +11,7 @@ tags:
|
|
| 11 |
OmniParser is a general screen parsing tool, which interprets/converts UI screenshot to structured format, to improve existing LLM based UI agent.
|
| 12 |
Training Datasets include: 1) an interactable icon detection dataset, which was curated from popular web pages and automatically annotated to highlight clickable and actionable regions, and 2) an icon description dataset, designed to associate each UI element with its corresponding function.
|
| 13 |
|
| 14 |
-
This model hub includes a finetuned version of YOLOv8 and a finetuned Florence-2 base model on the above dataset respectively.
|
| 15 |
|
| 16 |
# What's new in V2?
|
| 17 |
- Larger and cleaner set of icon caption + grounding dataset
|
|
@@ -20,80 +20,6 @@ This model hub includes a finetuned version of YOLOv8 and a finetuned Florence-2
|
|
| 20 |
- Your agent only need one tool: OmniTool. Control a Windows 11 VM with OmniParser + your vision model of choice. OmniTool supports out of the box the following large language models - OpenAI (4o/o1/o3-mini), DeepSeek (R1), Qwen (2.5VL) or Anthropic Computer Use. Check out our github repo for details.
|
| 21 |
|
| 22 |
|
| 23 |
-
# New: MIT licensed detector weights (`icon_detect_v3`)
|
| 24 |
-
The original `icon_detect` weights are finetuned from YOLOv8 and are therefore distributed under the AGPL-3.0 license, which is a blocker for many downstream users. We now additionally release `icon_detect_v3/model.pt`, an interactable region detector finetuned from YOLOv9-E on the same detection data and released under the **MIT license** (see `icon_detect_v3/LICENSE`).
|
| 25 |
-
|
| 26 |
-
The model is finetuned from YOLOv9-E using the [MultimediaTechLab/YOLO](https://github.com/MultimediaTechLab/YOLO) implementation, which is MIT licensed. This is what makes the permissive relicensing possible: unlike the Ultralytics YOLOv8 codebase behind `icon_detect`, neither the training code nor the resulting weights carry AGPL-3.0 obligations.
|
| 27 |
-
|
| 28 |
-
Pairing `icon_detect_v3` with `icon_caption` gives a fully MIT licensed OmniParser pipeline. `icon_detect` is still available and unchanged for users who are fine with AGPL-3.0.
|
| 29 |
-
|
| 30 |
-
The weights are shipped as a self-contained TorchScript module, so inference only requires `torch` (no `ultralytics` and no AGPL licensed code at runtime):
|
| 31 |
-
|
| 32 |
-
```python
|
| 33 |
-
import numpy as np
|
| 34 |
-
import torch
|
| 35 |
-
from PIL import Image
|
| 36 |
-
from torchvision.ops import nms
|
| 37 |
-
|
| 38 |
-
IMGSZ = 1280
|
| 39 |
-
STRIDES = (8, 16, 32)
|
| 40 |
-
CONF_THRESHOLD = 0.05
|
| 41 |
-
IOU_THRESHOLD = 0.45
|
| 42 |
-
|
| 43 |
-
model = torch.jit.load("icon_detect_v3/model.pt", map_location="cpu").eval()
|
| 44 |
-
|
| 45 |
-
# Letterbox the screenshot into a square IMGSZ canvas, keeping the aspect ratio.
|
| 46 |
-
image = Image.open("screenshot.png").convert("RGB")
|
| 47 |
-
width, height = image.size
|
| 48 |
-
scale = min(IMGSZ / width, IMGSZ / height)
|
| 49 |
-
resized = image.resize((round(width * scale), round(height * scale)), Image.BILINEAR)
|
| 50 |
-
canvas = Image.new("RGB", (IMGSZ, IMGSZ), (114, 114, 114))
|
| 51 |
-
canvas.paste(resized, (0, 0))
|
| 52 |
-
x = torch.from_numpy(np.array(canvas)).permute(2, 0, 1).float()[None] / 255.0
|
| 53 |
-
|
| 54 |
-
with torch.no_grad():
|
| 55 |
-
outputs = model(x) # (cls_logits, box_ltrb) per stride, in that order
|
| 56 |
-
|
| 57 |
-
# Decode the raw heads: class logits need a sigmoid, and the 4 box channels are
|
| 58 |
-
# left/top/right/bottom distances from each grid cell center, in grid units.
|
| 59 |
-
boxes, scores = [], []
|
| 60 |
-
for i, stride in enumerate(STRIDES):
|
| 61 |
-
cls = outputs[2 * i].sigmoid()[0, 0]
|
| 62 |
-
ltrb = outputs[2 * i + 1][0]
|
| 63 |
-
grid = cls.shape[-1]
|
| 64 |
-
gy, gx = torch.meshgrid(
|
| 65 |
-
torch.arange(grid, dtype=torch.float32),
|
| 66 |
-
torch.arange(grid, dtype=torch.float32),
|
| 67 |
-
indexing="ij",
|
| 68 |
-
)
|
| 69 |
-
cx, cy = gx + 0.5, gy + 0.5
|
| 70 |
-
left, top, right, bottom = ltrb
|
| 71 |
-
boxes.append(
|
| 72 |
-
torch.stack(
|
| 73 |
-
[(cx - left) * stride, (cy - top) * stride,
|
| 74 |
-
(cx + right) * stride, (cy + bottom) * stride], dim=-1
|
| 75 |
-
).reshape(-1, 4)
|
| 76 |
-
)
|
| 77 |
-
scores.append(cls.reshape(-1))
|
| 78 |
-
|
| 79 |
-
boxes, scores = torch.cat(boxes), torch.cat(scores)
|
| 80 |
-
keep = scores > CONF_THRESHOLD
|
| 81 |
-
boxes, scores = boxes[keep], scores[keep]
|
| 82 |
-
keep = nms(boxes, scores, IOU_THRESHOLD)
|
| 83 |
-
boxes, scores = boxes[keep], scores[keep]
|
| 84 |
-
|
| 85 |
-
# Map the boxes from the letterboxed canvas back to original image coordinates.
|
| 86 |
-
boxes = boxes / scale
|
| 87 |
-
boxes[:, 0::2] = boxes[:, 0::2].clamp(0, width)
|
| 88 |
-
boxes[:, 1::2] = boxes[:, 1::2].clamp(0, height)
|
| 89 |
-
# boxes: (N, 4) xyxy in original pixels, scores: (N,) confidence
|
| 90 |
-
```
|
| 91 |
-
|
| 92 |
-
Notes:
|
| 93 |
-
- The model is single class (interactable region), so `cls` has one channel per scale.
|
| 94 |
-
- `CONF_THRESHOLD` defaults to `0.05` to match the `box_threshold` that OmniParser uses with `icon_detect`. The detector is deliberately low confidence on small UI elements, so raising this much above `0.1` starts dropping real elements (icons, toolbar buttons, footer links) rather than just filtering noise. Tune `CONF_THRESHOLD` / `IOU_THRESHOLD` for your screenshots the same way you would tune `box_threshold` / `iou_threshold` for `icon_detect`.
|
| 95 |
-
- The letterbox padding above is top-left anchored, which keeps the coordinate mapping to a single `scale` division. If you center the padding instead, subtract the pad offsets before dividing.
|
| 96 |
-
|
| 97 |
# Responsible AI Considerations
|
| 98 |
## Intended Use
|
| 99 |
- OmniParser is designed to be able to convert unstructured screenshot image into structured list of elements including interactable regions location and captions of icons on its potential functionality.
|
|
@@ -104,12 +30,4 @@ Notes:
|
|
| 104 |
- While OmniParser only converts screenshot image into texts, it can be used to construct an GUI agent based on LLMs that is actionable. When developing and operating the agent using OmniParser, the developers need to be responsible and follow common safety standard.
|
| 105 |
|
| 106 |
# License
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
| Folder | Model | License |
|
| 110 |
-
| --- | --- | --- |
|
| 111 |
-
| `icon_detect` | YOLOv8 based interactable region detector ([Ultralytics](https://github.com/ultralytics/ultralytics)) | AGPL-3.0 |
|
| 112 |
-
| `icon_detect_v3` | YOLOv9-E based interactable region detector ([MultimediaTechLab/YOLO](https://github.com/MultimediaTechLab/YOLO), MIT) | MIT |
|
| 113 |
-
| `icon_caption` | Florence-2 based icon captioner | MIT |
|
| 114 |
-
|
| 115 |
-
Using `icon_detect_v3` together with `icon_caption` yields an OmniParser pipeline that is entirely MIT licensed.
|
|
|
|
| 11 |
OmniParser is a general screen parsing tool, which interprets/converts UI screenshot to structured format, to improve existing LLM based UI agent.
|
| 12 |
Training Datasets include: 1) an interactable icon detection dataset, which was curated from popular web pages and automatically annotated to highlight clickable and actionable regions, and 2) an icon description dataset, designed to associate each UI element with its corresponding function.
|
| 13 |
|
| 14 |
+
This model hub includes a finetuned version of YOLOv8 and a finetuned Florence-2 base model on the above dataset respectively. For more details of the models used and finetuning, please refer to the [paper](https://arxiv.org/abs/2408.00203).
|
| 15 |
|
| 16 |
# What's new in V2?
|
| 17 |
- Larger and cleaner set of icon caption + grounding dataset
|
|
|
|
| 20 |
- Your agent only need one tool: OmniTool. Control a Windows 11 VM with OmniParser + your vision model of choice. OmniTool supports out of the box the following large language models - OpenAI (4o/o1/o3-mini), DeepSeek (R1), Qwen (2.5VL) or Anthropic Computer Use. Check out our github repo for details.
|
| 21 |
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
# Responsible AI Considerations
|
| 24 |
## Intended Use
|
| 25 |
- OmniParser is designed to be able to convert unstructured screenshot image into structured list of elements including interactable regions location and captions of icons on its potential functionality.
|
|
|
|
| 30 |
- While OmniParser only converts screenshot image into texts, it can be used to construct an GUI agent based on LLMs that is actionable. When developing and operating the agent using OmniParser, the developers need to be responsible and follow common safety standard.
|
| 31 |
|
| 32 |
# License
|
| 33 |
+
Please note that icon_detect model is under AGPL license, and icon_caption is under MIT license. Please refer to the LICENSE file in the folder of each model.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
icon_detect_v3/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
| 1 |
-
MIT License
|
| 2 |
-
|
| 3 |
-
Copyright (c) Microsoft Corporation.
|
| 4 |
-
|
| 5 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
-
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
-
in the Software without restriction, including without limitation the rights
|
| 8 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
-
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
-
furnished to do so, subject to the following conditions:
|
| 11 |
-
|
| 12 |
-
The above copyright notice and this permission notice shall be included in all
|
| 13 |
-
copies or substantial portions of the Software.
|
| 14 |
-
|
| 15 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
-
SOFTWARE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
icon_detect_v3/model.pt
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:11c6cbb77f22569fab22d86c76407a83ec81ab89dbfe28279854822d6e3fb00c
|
| 3 |
-
size 281182680
|
|
|
|
|
|
|
|
|
|
|
|