diff --git a/tests/python/shared/assets/projects.json b/tests/python/shared/assets/projects.json index 19d345ee4e30..f9131f466a0e 100644 --- a/tests/python/shared/assets/projects.json +++ b/tests/python/shared/assets/projects.json @@ -125,8 +125,8 @@ "location": "local" }, "task_subsets": [ - "Train", - "Validation" + "Validation", + "Train" ], "tasks": { "count": 2, @@ -618,4 +618,4 @@ "url": "http://localhost:8080/api/projects/1" } ] -} +} \ No newline at end of file diff --git a/tests/python/shared/assets/quality_settings.json b/tests/python/shared/assets/quality_settings.json index dc56352fc1ef..2d84cac5d168 100644 --- a/tests/python/shared/assets/quality_settings.json +++ b/tests/python/shared/assets/quality_settings.json @@ -8,13 +8,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 1, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -29,13 +29,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 2, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -50,13 +50,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 3, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -71,13 +71,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 4, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -92,13 +92,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 5, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -113,13 +113,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 6, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -134,13 +134,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 7, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -155,13 +155,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 8, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -176,13 +176,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 9, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -197,13 +197,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 10, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -218,13 +218,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 11, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -239,13 +239,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 12, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -260,13 +260,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 13, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -281,13 +281,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 14, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -302,13 +302,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 15, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -323,13 +323,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 16, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -344,13 +344,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 17, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -365,13 +365,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 18, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -386,13 +386,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 19, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -407,13 +407,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 20, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -428,13 +428,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 21, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -449,13 +449,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 22, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -470,13 +470,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 23, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, @@ -491,13 +491,13 @@ "compare_attributes": true, "compare_groups": true, "compare_line_orientation": true, + "empty_is_annotated": false, "group_match_threshold": 0.5, "id": 24, "iou_threshold": 0.4, "line_orientation_threshold": 0.1, "line_thickness": 0.01, "low_overlap_threshold": 0.8, - "empty_is_annotated": false, "max_validations_per_job": 0, "object_visibility_threshold": 0.05, "oks_sigma": 0.09, diff --git a/tests/python/shared/assets/users.json b/tests/python/shared/assets/users.json index 9c4dce1e4fdf..6d6fadb41332 100644 --- a/tests/python/shared/assets/users.json +++ b/tests/python/shared/assets/users.json @@ -353,4 +353,4 @@ "username": "admin1" } ] -} +} \ No newline at end of file diff --git a/tests/python/shared/utils/dump_objects.py b/tests/python/shared/utils/dump_objects.py index ecab740f0ec1..99f7f96e14cd 100644 --- a/tests/python/shared/utils/dump_objects.py +++ b/tests/python/shared/utils/dump_objects.py @@ -1,11 +1,38 @@ -# Copyright (C) 2022 CVAT.ai Corporation +# Copyright (C) 2022-2025 CVAT.ai Corporation # # SPDX-License-Identifier: MIT import json +from datetime import timezone from http import HTTPStatus +from typing import Any from config import ASSETS_DIR, get_method +from dateutil.parser import ParserError, parse + + +def clean_list_response(data: dict[str, Any]) -> dict[str, Any]: + # truncate milliseconds to 3 digit precision to align with data.json + # "2023-03-30T09:37:31.615123Z" -> + # "2023-03-30T09:37:31.615000Z" + + for result in data["results"]: + for k, v in result.items(): + if not isinstance(v, str): + continue + + try: + parsed_date = parse(v) + except ParserError: + continue + + parsed_date = parsed_date.replace( + microsecond=parsed_date.microsecond - (parsed_date.microsecond % 1000) + ) + result[k] = parsed_date.astimezone(timezone.utc).isoformat().replace("+00:00", "Z") + + return data + if __name__ == "__main__": annotations = {} @@ -31,7 +58,7 @@ filename = f"{obj}s.json".replace("/", "_") with open(ASSETS_DIR / filename, "w") as f: - json.dump(response.json(), f, indent=2, sort_keys=True) + f.write(json.dumps(clean_list_response(response.json()), indent=2, sort_keys=True)) if obj in ["job", "task"]: annotations[obj] = {}