MCPcopy Create free account
hub / github.com/OpenBMB/AgentCPM-GUI / verify

Function verify

eval/grounding_eval/code/UI-TARS/text2bbox_eval_uitars.py:89–114  ·  view source on GitHub ↗

接受模型的字符串输入,判断是否正确

(response, ground_truth, w, h)

Source from the content-addressed store, hash-verified

87 return response.strip("\n").replace(" ","")
88
89async def verify(response, ground_truth, w, h):
90 """
91 接受模型的字符串输入,判断是否正确
92 """
93 pattern = r'(\d+,\d+)'
94 matches = re.findall(pattern, response)
95 # 将输入字符串转换为整数列表
96 if matches:
97 match = matches[0]
98 try:
99 x, y = map(int, match.split(','))
100 x = x/1000*w
101 y = y/1000*h
102 gt_bbox = list(map(int, ground_truth.strip('<>').split(',')))
103
104 gt_x_min = gt_bbox[0]
105 gt_x_max = gt_bbox[2]
106 gt_y_min = gt_bbox[1]
107 gt_y_max = gt_bbox[3]
108 if gt_x_min<=x<=gt_x_max and gt_y_min<=y<=gt_y_max:
109 return 1
110 except:
111 return 0
112 else:
113 print("wrong response: {}".format(response))
114 return 0
115
116async def process_item_async(item, client, model_name, semaphore):
117 async with semaphore:

Callers 1

process_item_asyncFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected