Views
No views yet
| Model | Size | Open Source | ScreenSpot-V2 | ScreenSpotPro | OSWORLD-G |
|---|---|---|---|---|---|
| OpenAI CUA | — | ❌ | 87.9 | 23.4 | — |
| Claude 3.7 | — | ❌ | 87.6 | 27.7 | — |
| JEDI-7B | 7B | ✅ | 91.7 | 39.5 | 54.1 |
| SE-GUI | 7B | ✅ | 90.3 | 47.0 | — |
| UI-TARS | 7B | ✅ | 91.6 | 35.7 | 47.5 |
| UI-TARS-1.5* | 7B | ✅ | 89.7* | 42.0* | 64.2* |
| UGround-v1-7B | 7B | ✅ | — | 31.1 | 36.4 |
| Qwen2.5-VL-32B-Instruct | 32B | ✅ | 91.9* | 48.0 | 59.6* |
| UGround-v1-72B | 72B | ✅ | — | 34.5 | — |
| Qwen2.5-VL-72B-Instruct | 72B | ✅ | 94.00* | 53.3 | 62.2* |
| UI-TARS | 72B | ✅ | 90.3 | 38.1 | — |
| GTA1 (Ours) | 7B | ✅ | 92.4 (∆ +2.7) | 50.1(∆ +8.1) | 67.7 (∆ +3.5) |
| GTA1 (Ours) | 32B | ✅ | 93.2 (∆ +1.3) | 53.6 (∆ +5.6) | 61.9(∆ +2.3) |
| GTA1 (Ours) | 72B | ✅ | 94.8(∆ +0.8) | 58.4 (∆ +5.1) | 66.7(∆ +4.5) |
Note:
- Model size is indicated in billions (B) of parameters.
- A dash (—) denotes results that are currently unavailable.
- A superscript asterisk (﹡) denotes our evaluated result.
- UI-TARS-1.5 7B, Qwen2.5-VL-32B-Instruct, and Qwen2.5-VL-72B-Instruct are applied as our baseline models.
- ∆ indicates the performance improvement (∆) of our model compared to its baseline.
1from PIL import Image
2from qwen_vl_utils import process_vision_info, smart_resize
3from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
4import torch
5import re
6
7SYSTEM_PROMPT = '''
8You are an expert UI element locator. Given a GUI image and a user's element description, provide the coordinates of the specified element as a single (x,y) point. The image resolution is height {height} and width {width}. For elements with area, return the center point.
9
10Output the coordinate pair exactly:
11(x,y)
12'''
13SYSTEM_PROMPT=SYSTEM_PROMPT.strip()
14
15# Function to extract coordinates from model output
16def extract_coordinates(raw_string):
17 try:
18 matches = re.findall(r"\((-?\d*\.?\d+),\s*(-?\d*\.?\d+)\)", raw_string)
19 return [tuple(map(int, match)) for match in matches][0]
20 except:
21 return 0,0
22
23# Load model and processor
24model_path = "HelloKKMe/GTA1-72B"
25max_new_tokens = 32
26
27model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
28 model_path,
29 torch_dtype=torch.bfloat16,
30 attn_implementation="flash_attention_2",
31 device_map="auto"
32)
33processor = AutoProcessor.from_pretrained(
34 model_path,
35 min_pixels=3136,
36 max_pixels= 4096 * 2160
37)
38
39# Load and resize image
40image = Image.open("file path")
41instruction = "description" # Instruction for grounding
42width, height = image.width, image.height
43
44resized_height, resized_width = smart_resize(
45 image.height,
46 image.width,
47 factor=processor.image_processor.patch_size * processor.image_processor.merge_size,
48 min_pixels=processor.image_processor.min_pixels,
49 max_pixels=processor.image_processor.max_pixels,
50)
51resized_image = image.resize((resized_width, resized_height))
52scale_x, scale_y = width / resized_width, height / resized_height
53
54# Prepare system and user messages
55system_message = {
56 "role": "system",
57 "content": SYSTEM_PROMPT.format(height=resized_height,width=resized_width)
58}
59
60user_message = {
61 "role": "user",
62 "content": [
63 {"type": "image", "image": resized_image},
64 {"type": "text", "text": instruction}
65 ]
66}
67
68# Tokenize and prepare inputs
69image_inputs, video_inputs = process_vision_info([system_message, user_message])
70text = processor.apply_chat_template([system_message, user_message], tokenize=False, add_generation_prompt=True)
71inputs = processor(text=[text], images=image_inputs, videos=video_inputs, padding=True, return_tensors="pt")
72inputs = inputs.to(model.device)
73
74# Generate prediction
75output_ids = model.generate(**inputs, max_new_tokens=max_new_tokens, do_sample=False, temperature=1.0, use_cache=True)
76generated_ids = [output_ids[len(input_ids):] for input_ids, output_ids in zip(inputs.input_ids, output_ids)]
77output_text = processor.batch_decode(generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=True)[0]
78
79# Extract and rescale coordinates
80pred_x, pred_y = extract_coordinates(output_text)
81pred_x*=scale_x
82pred_y*=scale_y
83print(pred_x,pred_y)