Skip to content

Commit 2ac8565

Browse files
committed
Fixed VQA evaluator bugs -- wrong path to screenshots and missing import.
1 parent e1e54a4 commit 2ac8565

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/evaluators.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from termcolor import colored
2020

2121
import os
22+
from .validation_agent.validator import validate_task_vqa
2223

2324
class Evaluator:
2425
"""Base class for evaluation strategies.
@@ -423,16 +424,17 @@ async def __call__(
423424

424425
# Get path to screenshots for the given task
425426
test_folder = list_items_in_folder(f"{os. getcwd()}/test/logs/")[-1] # Get the most recent log folder, this may take look for the wrong folder TODO: fix to take correct folder
426-
path_to_screenshots = f"{os. getcwd()}/test/logs/{test_folder}/log_for_task_{task_id}/snapshots"
427-
screenshot_path_list = list_items_in_folder(path_to_screenshots) # type: ignore
428-
427+
path_to_screenshots = f"{os. getcwd()}/test/logs/{test_folder}/logs_for_task_{task_id}/snapshots"
428+
screenshot_names = list_items_in_folder(path_to_screenshots) # type: ignore
429+
429430
# Load and compress screenshots
430-
for screenshot_path in screenshot_path_list:
431+
for screenshot_name in screenshot_names:
432+
screenshot_path = f"{path_to_screenshots}/{screenshot_name}"
431433
compress_png(screenshot_path)
432-
state_seq.append({"id":task_id, "path_to_screenshot": screenshot_path})
434+
state_seq.append({"id":task_id, "path_to_screenshot": f"{path_to_screenshots}/{screenshot_name}"})
433435

434436
#Calculate VQA Score
435-
score_dict = validator.validate_task_vqa(state_seq, task) # type: ignore
437+
score_dict = validate_task_vqa(state_seq, task) # type: ignore
436438
score = score_dict["pred_task_completed"]
437439

438440
print(f"VQA score is {score}")

0 commit comments

Comments
 (0)