ver Mar15th
fixed bugs about infeasible task evaluation
This commit is contained in:
@@ -69,11 +69,11 @@ def judge_node(node: ET, platform="ubuntu", check_image=False) -> bool:
|
|||||||
keeps = keeps and coordinates[0]>0 and coordinates[1]>0 and sizes[0]>0 and sizes[1]>0
|
keeps = keeps and coordinates[0]>0 and coordinates[1]>0 and sizes[0]>0 and sizes[1]>0
|
||||||
return keeps
|
return keeps
|
||||||
|
|
||||||
def filter_nodes(root: ET, platform="ubuntu"):
|
def filter_nodes(root: ET, platform="ubuntu", check_image=False):
|
||||||
filtered_nodes = []
|
filtered_nodes = []
|
||||||
|
|
||||||
for node in root.iter():
|
for node in root.iter():
|
||||||
if judge_node(node, platform):
|
if judge_node(node, platform, check_image):
|
||||||
filtered_nodes.append(node)
|
filtered_nodes.append(node)
|
||||||
#print(ET.tostring(node, encoding="unicode"))
|
#print(ET.tostring(node, encoding="unicode"))
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ def tag_screenshot(screenshot, accessibility_tree):
|
|||||||
os.makedirs("tmp/images", exist_ok=True)
|
os.makedirs("tmp/images", exist_ok=True)
|
||||||
tagged_screenshot_file_path = os.path.join("tmp/images", uuid_str + ".png")
|
tagged_screenshot_file_path = os.path.join("tmp/images", uuid_str + ".png")
|
||||||
# nodes = filter_nodes(find_leaf_nodes(accessibility_tree))
|
# nodes = filter_nodes(find_leaf_nodes(accessibility_tree))
|
||||||
nodes = filter_nodes(ET.fromstring(accessibility_tree))
|
nodes = filter_nodes(ET.fromstring(accessibility_tree), check_image=True)
|
||||||
# Make tag screenshot
|
# Make tag screenshot
|
||||||
marks, drew_nodes = draw_bounding_boxes(nodes, screenshot, tagged_screenshot_file_path)
|
marks, drew_nodes = draw_bounding_boxes(nodes, screenshot, tagged_screenshot_file_path)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user