From fa8e48af481f3d3ed14e8fdf731dff89be962b7a Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 27 Sep 2023 16:23:59 -0600 Subject: [PATCH] Update and move tests based on Eric's feedback --- client/unit-tests/test_client.py | 95 -------------------------------- 1 file changed, 95 deletions(-) diff --git a/client/unit-tests/test_client.py b/client/unit-tests/test_client.py index 223e29b24..ac0ace3a0 100644 --- a/client/unit-tests/test_client.py +++ b/client/unit-tests/test_client.py @@ -1,98 +1,3 @@ -from velour.enums import TaskType -from velour.integrations.coco import _merge_annotations -from velour.schemas import Label -from copy import deepcopy - - -def test__merge_annotations(): - """Check that we get the correct annotation set after merging semantic segmentions""" - - initial_annotations = [ - dict( - task_type=TaskType.SEMANTIC_SEGMENTATION, - labels=set([Label(key="k1", value="v1"), Label(key="k2", value="v2")]), - mask=[True, False, False, False], - ), - dict( - task_type=TaskType.SEMANTIC_SEGMENTATION, - labels=set([Label(key="k1", value="v1"), Label(key="k3", value="v3")]), - mask=[False, False, True, False], - ), - dict( - task_type=TaskType.SEMANTIC_SEGMENTATION, - labels=set( - [ - Label(key="k1", value="v1"), - Label(key="k2", value="v2"), - Label(key="k4", value="v4"), - ] - ), - mask=[False, False, False, True], - ), - dict( - task_type=TaskType.INSTANCE_SEGMENTATION, - labels=set([Label(key="k1", value="v1"), Label(key="k3", value="v3")]), - mask=[False, True, False, False], - ), - ] - - expected = [ - dict( - task_type=TaskType.SEMANTIC_SEGMENTATION, - labels=set([Label(key="k3", value="v3")]), - mask=[False, False, True, False], - ), - dict( - task_type=TaskType.SEMANTIC_SEGMENTATION, - labels=set([Label(key="k4", value="v4")]), - mask=[False, False, False, True], - ), - dict( - task_type=TaskType.INSTANCE_SEGMENTATION, - labels=set( - [ - Label(key="k1", value="v1"), - Label(key="k3", value="v3"), - ] - ), - mask=[False, True, False, False], - ), - dict( - task_type=TaskType.SEMANTIC_SEGMENTATION, - labels=set([Label(key="k1", value="v1")]), - mask=[True, False, True, True], - ), - dict( - task_type=TaskType.SEMANTIC_SEGMENTATION, - labels=set([Label(key="k2", value="v2")]), - mask=[True, False, False, True], - ), - ] - - label_map = { - Label(key="k1", value="v1"): [0, 1, 2], - Label(key="k2", value="v2"): [0, 2], - Label(key="k3", value="v3"): [1], - Label(key="k4", value="v4"): [2], - } - - merged_annotations = _merge_annotations( - annotation_list=initial_annotations.copy(), label_map=label_map - ) - - for i, v in enumerate(merged_annotations): - assert ( - merged_annotations[i]["labels"] == expected[i]["labels"] - ), "Labels didn't merge as expected" - assert sum(merged_annotations[i]["mask"]) == sum( - expected[i]["mask"] - ), "Masks didn't merge as expected" - - -if __name__ == "__main__": - test__merge_annotations() - - # NOTE: Will probably reimplemnt in the future under `velour.client.Evaluation` # from velour.client import Model