From 4b15595146e591731ba174d513c56b7e14ade51f Mon Sep 17 00:00:00 2001 From: BlankCheng <913501223@qq.com> Date: Tue, 12 Mar 2024 00:17:46 +0800 Subject: [PATCH] Update fix --- desktop_env/evaluators/metrics/gimp.py | 78 ++++++++++--------- .../3c8f201a-009d-4bbe-8b65-a6f8b35bb57f.json | 2 +- .../42f4d1c7-4521-4161-b646-0a8934e36081.json | 2 +- .../91190194-f406-4cd6-b3f9-c43fac942b22.json | 8 +- .../98e8e339-5f91-4ed2-b2b2-12647cb134f4.json | 2 +- .../d68204bf-11c1-4b13-b48b-d303c73d4bf6.json | 8 +- 6 files changed, 48 insertions(+), 52 deletions(-) diff --git a/desktop_env/evaluators/metrics/gimp.py b/desktop_env/evaluators/metrics/gimp.py index e46f5d5..6b555ad 100644 --- a/desktop_env/evaluators/metrics/gimp.py +++ b/desktop_env/evaluators/metrics/gimp.py @@ -199,7 +199,7 @@ def structure_check_by_mse(img1, img2, threshold=0.03): def structure_check_by_ssim(img1, img2, threshold=0.9): """Check if two images are approximately the same by SSIM""" - similarity = ssim(np.array(img1), np.array(img2), multichannel=True) + similarity = ssim(np.array(img1), np.array(img2), multichannel=True, channel_axis=-1) print("SSIM: ", similarity) return similarity >= threshold @@ -571,40 +571,44 @@ def check_image_file_size(src_path, rule): if __name__ == "__main__": - actual_config_path = "../../../cache/sessionrc_test" - rule = { - "key": "hide-docks", - "value": "no" - } - print(check_config_status(actual_config_path, rule)) + # actual_config_path = "../../../cache/sessionrc_test" + # rule = { + # "key": "hide-docks", + # "value": "no" + # } + # print(check_config_status(actual_config_path, rule)) + # + # actual_config_path = "../../../cache/action-history_test" + # rule = { + # "key": ["history-item", "\"filters-vignette\""], + # "value": "1" + # } + # print(check_config_status(actual_config_path, rule)) + # + # actual_config_path = "../../../cache/gimprc_test" + # rule = { + # "key": "undo-levels", + # "value": "100" + # } + # print(check_config_status(actual_config_path, rule)) + # + # src_path = "../../../cache/734d6579-c07d-47a8-9ae2-13339795476b/green_background_with_object.png" + # tgt_path = "../../../cache/734d6579-c07d-47a8-9ae2-13339795476b/white_background_with_object.png" + # print(check_green_background(src_path, tgt_path)) + # + # tgt_path = "../../../cache/f4aec372-4fb0-4df5-a52b-79e0e2a5d6ce/Triangle_In_The_Middle.png" + # print(check_triangle_position(tgt_path)) + # + # src_path = "../../../cache/bb7db4c2-30b5-4be7-8dd7-b8c4ec7d3108/anmi_sharper.png" + # tgt_path = "../../../cache/bb7db4c2-30b5-4be7-8dd7-b8c4ec7d3108/anmi.png" + # print(check_sharper(src_path, tgt_path)) + # + # src_path = "../../../cache/3c8f201a-009d-4bbe-8b65-a6f8b35bb57f/compressed.jpeg" + # rule = { + # "max_size": 500000 + # } + # print(check_image_file_size(src_path, rule)) - actual_config_path = "../../../cache/action-history_test" - rule = { - "key": ["history-item", "\"filters-vignette\""], - "value": "1" - } - print(check_config_status(actual_config_path, rule)) - - actual_config_path = "../../../cache/gimprc_test" - rule = { - "key": "undo-levels", - "value": "100" - } - print(check_config_status(actual_config_path, rule)) - - src_path = "../../../cache/734d6579-c07d-47a8-9ae2-13339795476b/green_background_with_object.png" - tgt_path = "../../../cache/734d6579-c07d-47a8-9ae2-13339795476b/white_background_with_object.png" - print(check_green_background(src_path, tgt_path)) - - tgt_path = "../../../cache/f4aec372-4fb0-4df5-a52b-79e0e2a5d6ce/Triangle_In_The_Middle.png" - print(check_triangle_position(tgt_path)) - - src_path = "../../../cache/bb7db4c2-30b5-4be7-8dd7-b8c4ec7d3108/anmi_sharper.png" - tgt_path = "../../../cache/bb7db4c2-30b5-4be7-8dd7-b8c4ec7d3108/anmi.png" - print(check_sharper(src_path, tgt_path)) - - src_path = "../../../cache/3c8f201a-009d-4bbe-8b65-a6f8b35bb57f/compressed.jpeg" - rule = { - "max_size": 500000 - } - print(check_image_file_size(src_path, rule)) \ No newline at end of file + src_path = "../../../cache/d68204bf-11c1-4b13-b48b-d303c73d4bf6/12ad623d-7f35-550e-9c44-6830386b20a0_rearranged_gold.png" + tgt_path = "../../../cache/d68204bf-11c1-4b13-b48b-d303c73d4bf6/d1c7c561-6e76-5d7b-9c10-4af0332dfa50_tilearray.png" + print(check_structure_sim(src_path, tgt_path)) diff --git a/evaluation_examples/examples/multi_apps/3c8f201a-009d-4bbe-8b65-a6f8b35bb57f.json b/evaluation_examples/examples/multi_apps/3c8f201a-009d-4bbe-8b65-a6f8b35bb57f.json index 309f370..283a3ad 100644 --- a/evaluation_examples/examples/multi_apps/3c8f201a-009d-4bbe-8b65-a6f8b35bb57f.json +++ b/evaluation_examples/examples/multi_apps/3c8f201a-009d-4bbe-8b65-a6f8b35bb57f.json @@ -1,7 +1,7 @@ { "id": "3c8f201a-009d-4bbe-8b65-a6f8b35bb57f", "snapshot": "gimp", - "instruction": "Use `gdown` to download the image from \"https://drive.google.com/uc?export=download&id=1i8j5dGS57sA07jEuPNAlQW-sn5uqUnuK\", and then use GIMP to compress it to under 600KB. Resize if needed.", + "instruction": "Download the image from \"https://drive.google.com/uc?export=download&id=1i8j5dGS57sA07jEuPNAlQW-sn5uqUnuK\", and then use GIMP to compress it to under 600KB. Resize if needed.", "source": "", "config": [ { diff --git a/evaluation_examples/examples/multi_apps/42f4d1c7-4521-4161-b646-0a8934e36081.json b/evaluation_examples/examples/multi_apps/42f4d1c7-4521-4161-b646-0a8934e36081.json index a6adb54..0369148 100644 --- a/evaluation_examples/examples/multi_apps/42f4d1c7-4521-4161-b646-0a8934e36081.json +++ b/evaluation_examples/examples/multi_apps/42f4d1c7-4521-4161-b646-0a8934e36081.json @@ -1,7 +1,7 @@ { "id": "42f4d1c7-4521-4161-b646-0a8934e36081", "snapshot": "gimp", - "instruction": "Configure VS Code to edit GIMP script-fu scripts effectively by installing lisp extension. Test by writing code to resizing the image as 128 * 128 as \"resized.png\"", + "instruction": "Configure VS Code to edit GIMP script-fu scripts effectively by installing lisp extension. Test by writing code to resize the image \"character.png\" to 128 * 128 as \"resized.png\".", "source": "", "config": [ { diff --git a/evaluation_examples/examples/multi_apps/91190194-f406-4cd6-b3f9-c43fac942b22.json b/evaluation_examples/examples/multi_apps/91190194-f406-4cd6-b3f9-c43fac942b22.json index ba554e0..2d40c93 100644 --- a/evaluation_examples/examples/multi_apps/91190194-f406-4cd6-b3f9-c43fac942b22.json +++ b/evaluation_examples/examples/multi_apps/91190194-f406-4cd6-b3f9-c43fac942b22.json @@ -11,10 +11,6 @@ { "url": "https://drive.google.com/uc?export=download&id=1bmSRNNh4JkF6izrKrmynUHarf0pFES50", "path": "/home/user/Desktop/cola.png" - }, - { - "url": "https://drive.google.com/uc?export=download&id=1MayrIPJWRK7cMEVe3TxYmgkAbVMrYcQA", - "path": "/home/user/Desktop/cropped_gold.png" } ] } @@ -43,8 +39,8 @@ "dest": "cropped.png" }, "expected": { - "type": "vm_file", - "path": "/home/user/Desktop/cropped_gold.png", + "type": "cloud_file", + "path": "https://drive.google.com/uc?export=download&id=1MayrIPJWRK7cMEVe3TxYmgkAbVMrYcQA", "dest": "cropped_gold.png" } } diff --git a/evaluation_examples/examples/multi_apps/98e8e339-5f91-4ed2-b2b2-12647cb134f4.json b/evaluation_examples/examples/multi_apps/98e8e339-5f91-4ed2-b2b2-12647cb134f4.json index 3d08199..c7b01f9 100644 --- a/evaluation_examples/examples/multi_apps/98e8e339-5f91-4ed2-b2b2-12647cb134f4.json +++ b/evaluation_examples/examples/multi_apps/98e8e339-5f91-4ed2-b2b2-12647cb134f4.json @@ -1,7 +1,7 @@ { "id": "98e8e339-5f91-4ed2-b2b2-12647cb134f4", "snapshot": "vs_code", - "instruction": "Merge the contents of all .txt files from your vscode project into a single document in Writer. No merging separator is needed. Ensure to set the overall font size of the document to 10.", + "instruction": "Merge the contents of all .txt files from your vscode project into a single document \"concat.docx\" on Desktop with libreoffice writer. No merging separator is needed. Ensure to set the overall font size of the document to 10.", "source": "", "config": [ { diff --git a/evaluation_examples/examples/multi_apps/d68204bf-11c1-4b13-b48b-d303c73d4bf6.json b/evaluation_examples/examples/multi_apps/d68204bf-11c1-4b13-b48b-d303c73d4bf6.json index 55af9af..29573aa 100644 --- a/evaluation_examples/examples/multi_apps/d68204bf-11c1-4b13-b48b-d303c73d4bf6.json +++ b/evaluation_examples/examples/multi_apps/d68204bf-11c1-4b13-b48b-d303c73d4bf6.json @@ -11,10 +11,6 @@ { "url": "https://drive.google.com/uc?export=download&id=1CPGW_OZsfSWDdTU7CFrTjpzSAASyLy4w", "path": "/home/user/Desktop/tilearray.png" - }, - { - "url": "https://drive.google.com/uc?export=download&id=1aHwmnxL2CKEh_FhVpevY452-BQH2t5rG", - "path": "/home/user/Desktop/rearranged_gold.png" } ] } @@ -43,8 +39,8 @@ "dest": "rearranged.png" }, "expected": { - "type": "vm_file", - "path": "/home/user/Desktop/rearranged_gold.png", + "type": "cloud_file", + "path": "https://drive.google.com/uc?export=download&id=1aHwmnxL2CKEh_FhVpevY452-BQH2t5rG", "dest": "rearranged_gold.png" } }