diff --git a/test/dataset/formats/test_pascal_voc.py b/test/dataset/formats/test_pascal_voc.py index fa3f1124..bfd56854 100644 --- a/test/dataset/formats/test_pascal_voc.py +++ b/test/dataset/formats/test_pascal_voc.py @@ -13,7 +13,7 @@ from supervision.dataset.formats.pascal_voc import ( ) -def are_xml_elements_equal(elem1, elem2): +def are_xml_elements_equal_with_offset(elem1, elem2): if ( elem1.tag != elem2.tag or elem1.attrib != elem2.attrib @@ -23,7 +23,7 @@ def are_xml_elements_equal(elem1, elem2): return False for child1, child2 in zip(elem1, elem2): - if not are_xml_elements_equal(child1, child2): + if not are_xml_elements_equal_with_offset(child1, child2): return False return True @@ -33,20 +33,20 @@ def are_xml_elements_equal(elem1, elem2): "xyxy, name, polygon, expected_result, exception", [ ( - [0, 0, 10, 10], + np.array([0, 0, 10, 10]), "test", None, ET.fromstring( - """test001010""" + """test111111""" ), DoesNotRaise(), ), ( - [0, 0, 10, 10], + np.array([0, 0, 10, 10]), "test", - [[0, 0], [10, 0], [10, 10], [0, 10]], + np.array([[0, 0], [10, 0], [10, 10], [0, 10]]), ET.fromstring( - """test001010001001010010""" + """test111111111111111111""" ), DoesNotRaise(), ), @@ -61,7 +61,7 @@ def test_object_to_pascal_voc( ): with exception: result = object_to_pascal_voc(xyxy=xyxy, name=name, polygon=polygon) - assert are_xml_elements_equal(result, expected_result) + assert are_xml_elements_equal_with_offset(result, expected_result) @pytest.mark.parametrize( @@ -86,13 +86,13 @@ def test_parse_polygon_points( assert result == expected_result -ONE_CLASS_N_BBOX = """test001010test10102020""" +ONE_CLASS_N_BBOX = """test111111test11112121""" -ONE_CLASS_ONE_BBOX = """test001010""" +ONE_CLASS_ONE_BBOX = """test111111""" -N_CLASS_N_BBOX = """test001010test20303040test210102020""" +N_CLASS_N_BBOX = """test111111test21313141test211112121""" NO_DETECTIONS = """""" @@ -138,7 +138,7 @@ NO_DETECTIONS = """""" ), ], ) -def test_detections_from_xml_obj( +def test_detections_from_xml_obj_with_offset( xml_string, classes, resolution_wh, force_masks, expected_result, exception ): with exception: