From 8f7709d2c975beb774e4fa1fefc40fad79420211 Mon Sep 17 00:00:00 2001 From: John Wilkie Date: Fri, 25 Oct 2024 14:31:37 +0100 Subject: [PATCH] E2E tests for converting annotations --- .gitignore | 1 - e2e_tests/cli/{convert => }/test_convert.py | 57 +- .../coco/from/base_annotation.json | 0 .../data/{ => convert}/coco/to/output.json | 0 .../data/convert/cvat/from/000000021295.json | 67 ++ e2e_tests/data/convert/cvat/to/output.xml | 1 + .../instance_mask/from/000000021295.json | 155 +++ .../to/masks/000000021295_00000.png | Bin 0 -> 1163 bytes .../to/masks/000000021295_00001.png | Bin 0 -> 940 bytes .../to/masks/000000021295_00002.png | Bin 0 -> 1198 bytes .../hippocampus_001_mpr_1_test_hippo.nii.json | 945 ++++++++++++++++++ ..._mpr_1_test_hippo_test_mask_basic_m.nii.gz | Bin 0 -> 1022 bytes ...mpr_1_test_hippo_test_polygon_basic.nii.gz | Bin 0 -> 974 bytes .../convert/pascalvoc/from/000000021295.json | 81 ++ .../convert/pascalvoc/to/000000021295.xml | 1 + .../semantic_mask/from/221b-2.json | 0 .../semantic_mask/to/class_mapping.csv | 0 .../test_input_with_bboxes_and_polys.json | 0 .../data/{ => convert}/yolo/to/darknet.labels | 0 .../test_input_with_bboxes_and_polys.json | 0 .../{ => convert}/yolov8/to/darknet.labels | 0 .../to/test_input_with_bboxes_and_polys.txt | 5 - .../to/test_input_with_bboxes_and_polys.txt | 5 - 23 files changed, 1300 insertions(+), 18 deletions(-) rename e2e_tests/cli/{convert => }/test_convert.py (65%) rename e2e_tests/data/{ => convert}/coco/from/base_annotation.json (100%) rename e2e_tests/data/{ => convert}/coco/to/output.json (100%) create mode 100644 e2e_tests/data/convert/cvat/from/000000021295.json create mode 100644 e2e_tests/data/convert/cvat/to/output.xml create mode 100644 e2e_tests/data/convert/instance_mask/from/000000021295.json create mode 100644 e2e_tests/data/convert/instance_mask/to/masks/000000021295_00000.png create mode 100644 e2e_tests/data/convert/instance_mask/to/masks/000000021295_00001.png create mode 100644 e2e_tests/data/convert/instance_mask/to/masks/000000021295_00002.png create mode 100644 e2e_tests/data/convert/nifti/from/hippocampus_001_mpr_1_test_hippo.nii.json create mode 100644 e2e_tests/data/convert/nifti/to/hippocampus_001_mpr_1_test_hippo_test_mask_basic_m.nii.gz create mode 100644 e2e_tests/data/convert/nifti/to/hippocampus_001_mpr_1_test_hippo_test_polygon_basic.nii.gz create mode 100644 e2e_tests/data/convert/pascalvoc/from/000000021295.json create mode 100644 e2e_tests/data/convert/pascalvoc/to/000000021295.xml rename e2e_tests/data/{ => convert}/semantic_mask/from/221b-2.json (100%) rename e2e_tests/data/{ => convert}/semantic_mask/to/class_mapping.csv (100%) rename e2e_tests/data/{ => convert}/yolo/from/test_input_with_bboxes_and_polys.json (100%) rename e2e_tests/data/{ => convert}/yolo/to/darknet.labels (100%) rename e2e_tests/data/{ => convert}/yolov8/from/test_input_with_bboxes_and_polys.json (100%) rename e2e_tests/data/{ => convert}/yolov8/to/darknet.labels (100%) delete mode 100644 e2e_tests/data/yolo/to/test_input_with_bboxes_and_polys.txt delete mode 100644 e2e_tests/data/yolov8/to/test_input_with_bboxes_and_polys.txt diff --git a/.gitignore b/.gitignore index 5d4b4611b..54f37a022 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ data/ !tests/darwin/data darwin_py.egg-info/PKG-INFO -*.png *.jpeg *.jpg *.bpm diff --git a/e2e_tests/cli/convert/test_convert.py b/e2e_tests/cli/test_convert.py similarity index 65% rename from e2e_tests/cli/convert/test_convert.py rename to e2e_tests/cli/test_convert.py index 188d93635..aadbc1612 100644 --- a/e2e_tests/cli/convert/test_convert.py +++ b/e2e_tests/cli/test_convert.py @@ -4,13 +4,14 @@ import orjson as json import pytest +import xml.etree.ElementTree as ET from e2e_tests.helpers import assert_cli, run_cli_command class TestExportCli: this_file_path = Path(dirname(__file__)).absolute() - data_path = (this_file_path / ".." / ".." / "data").resolve() + data_path = (this_file_path / ".." / "data" / "convert").resolve() @pytest.fixture(autouse=True) def config(self) -> None: @@ -33,10 +34,10 @@ def compare_directories(self, path: Path, expected_path: Path) -> None: continue # Compare files - with file.open("r") as f: + with file.open("rb") as f: content = f.read() - with Path(expected_path / file.name).open() as f: + with Path(expected_path / file.name).open("rb") as f: expected_content = f.read() if content != expected_content: @@ -52,6 +53,14 @@ def compare_directories(self, path: Path, expected_path: Path) -> None: [ ("yolo_segmented", data_path / "yolov8/from", data_path / "yolov8/to"), ("yolo", data_path / "yolo/from", data_path / "yolo/to"), + ("cvat", data_path / "cvat/from", data_path / "cvat/to"), + ("pascalvoc", data_path / "pascalvoc/from", data_path / "pascalvoc/to"), + ("nifti", data_path / "nifti/from", data_path / "nifti/to"), + ( + "instance_mask", + data_path / "instance_mask/from", + data_path / "instance_mask/to", + ), pytest.param( "coco", data_path / "coco/from", @@ -87,23 +96,34 @@ def test_darwin_convert( result = run_cli_command( f"darwin convert {format} {str(input_path)} {str(tmp_path)}" ) - if format == "coco": - self.patch_coco(tmp_path / "output.json") + self.patch_format(format, tmp_path) assert_cli(result, 0) self.compare_directories(expectation_path, tmp_path) + def patch_format(self, format: str, path: Path) -> None: + """ + Patch files based on format to match the expected output. + """ + patch_methods = { + "coco": self.patch_coco, + "cvat": self.patch_cvat, + } + patch_method = patch_methods.get(format) + if patch_method: + patch_method(path) + def patch_coco(self, path: Path) -> None: """ Patch coco file to match the expected output, includes changes to year and date_created, wrapped in try except so that format errors are still caught later with correct error messages """ try: - with open(path, "r") as f: + with open(path / "output.json", "r") as f: contents = f.read() temp = json.loads(contents) temp["info"]["year"] = 2023 temp["info"]["date_created"] = "2023/12/05" - with open(path, "w") as f: + with open(path / "output.json", "w") as f: op = json.dumps( temp, option=json.OPT_INDENT_2 | json.OPT_SERIALIZE_NUMPY ).decode("utf-8") @@ -111,6 +131,29 @@ def patch_coco(self, path: Path) -> None: except Exception: print(f"Error patching {path}") + def patch_cvat(self, path: Path) -> None: + """ + Patch cvat file to match the expected output. + """ + try: + tree = ET.parse(path / "output.xml") + root = tree.getroot() + # Adjust the required fields + dumped_elem = root.find(".//meta/dumped") + if dumped_elem is not None: + dumped_elem.text = "2024-10-25 10:33:01.789498+00:00" + created_elem = root.find(".//meta/task/created") + if created_elem is not None: + created_elem.text = "2024-10-25 10:33:01.789603+00:00" + updated_elem = root.find(".//meta/task/updated") + if updated_elem is not None: + updated_elem.text = "2024-10-25 10:33:01.789608+00:00" + tree.write(path / "output.xml") + except ET.ParseError: + print(f"Error parsing XML in {path}") + except Exception as e: + print(f"Error patching {path}: {e}") + if __name__ == "__main__": pytest.main(["-vv", "-s", __file__]) diff --git a/e2e_tests/data/coco/from/base_annotation.json b/e2e_tests/data/convert/coco/from/base_annotation.json similarity index 100% rename from e2e_tests/data/coco/from/base_annotation.json rename to e2e_tests/data/convert/coco/from/base_annotation.json diff --git a/e2e_tests/data/coco/to/output.json b/e2e_tests/data/convert/coco/to/output.json similarity index 100% rename from e2e_tests/data/coco/to/output.json rename to e2e_tests/data/convert/coco/to/output.json diff --git a/e2e_tests/data/convert/cvat/from/000000021295.json b/e2e_tests/data/convert/cvat/from/000000021295.json new file mode 100644 index 000000000..5e428560d --- /dev/null +++ b/e2e_tests/data/convert/cvat/from/000000021295.json @@ -0,0 +1,67 @@ +{ + "version": "2.0", + "schema_ref": "https://darwin-public.s3.eu-west-1.amazonaws.com/darwin_json/2.0/schema.json", + "item": { + "name": "000000021295.jpg", + "path": "/", + "source_info": { + "item_id": "0192c338-2dc8-bb9f-8dde-9c4a8714c957", + "dataset": { + "name": "tmp", + "slug": "tmp", + "dataset_management_url": "https://staging.v7labs.com/datasets/426200/dataset-management" + }, + "team": { + "name": "E2E Testing", + "slug": "e2e-testing" + }, + "workview_url": "https://staging.v7labs.com/workview?dataset=426200&item=0192c338-2dc8-bb9f-8dde-9c4a8714c957" + }, + "slots": [ + { + "type": "image", + "slot_name": "0", + "width": 640, + "height": 427, + "thumbnail_url": "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/6c554c31-8bf6-4fc7-9f31-394fd775b2a6/thumbnail", + "source_files": [ + { + "file_name": "000000021295.jpg", + "url": "https://staging.v7labs.com/api/v2/teams/e2e-testing/uploads/ade5f1e3-a165-4a07-989f-86ee342499c9" + } + ] + } + ] + }, + "annotations": [ + { + "bounding_box": { + "h": 43.7181, + "w": 71.2665, + "x": 166.0884, + "y": 113.1879 + }, + "id": "46b33c9c-7453-4722-8b43-91bbb3fc247f", + "name": "test_bounding_box_basic", + "properties": [], + "slot_names": [ + "0" + ] + }, + { + "bounding_box": { + "h": 31.7405, + "w": 58.0912, + "x": 360.1248, + "y": 259.913 + }, + "id": "2b7c85ed-74b3-4111-a5d6-073da56d0072", + "name": "test_bounding_box_basic", + "properties": [], + "slot_names": [ + "0" + ] + } + ], + "properties": [] +} \ No newline at end of file diff --git a/e2e_tests/data/convert/cvat/to/output.xml b/e2e_tests/data/convert/cvat/to/output.xml new file mode 100644 index 000000000..66a9982e1 --- /dev/null +++ b/e2e_tests/data/convert/cvat/to/output.xml @@ -0,0 +1 @@ +1.12024-10-25 10:33:01.789498+00:001exported_task_from_darwin1annotation0NoneFalse2024-10-25 10:33:01.789603+00:002024-10-25 10:33:01.789608+00:00111not applicableexample_usernameuser@example.com \ No newline at end of file diff --git a/e2e_tests/data/convert/instance_mask/from/000000021295.json b/e2e_tests/data/convert/instance_mask/from/000000021295.json new file mode 100644 index 000000000..34cac389b --- /dev/null +++ b/e2e_tests/data/convert/instance_mask/from/000000021295.json @@ -0,0 +1,155 @@ +{ + "version": "2.0", + "schema_ref": "https://darwin-public.s3.eu-west-1.amazonaws.com/darwin_json/2.0/schema.json", + "item": { + "name": "000000021295.jpg", + "path": "/", + "source_info": { + "item_id": "0192c338-2dc8-bb9f-8dde-9c4a8714c957", + "team": { + "name": "E2E Testing", + "slug": "e2e-testing" + }, + "dataset": { + "name": "tmp", + "slug": "tmp", + "dataset_management_url": "https://staging.v7labs.com/datasets/426200/dataset-management" + }, + "workview_url": "https://staging.v7labs.com/workview?dataset=426200&item=0192c338-2dc8-bb9f-8dde-9c4a8714c957" + }, + "slots": [ + { + "type": "image", + "slot_name": "0", + "width": 640, + "height": 427, + "thumbnail_url": "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/6c554c31-8bf6-4fc7-9f31-394fd775b2a6/thumbnail", + "source_files": [ + { + "file_name": "000000021295.jpg", + "url": "https://staging.v7labs.com/api/v2/teams/e2e-testing/uploads/ade5f1e3-a165-4a07-989f-86ee342499c9" + } + ] + } + ] + }, + "annotations": [ + { + "bounding_box": { + "h": 123.8166, + "w": 147.2414, + "x": 105.8307, + "y": 63.5815 + }, + "id": "4f23f7d2-2f83-45bc-927a-d03b9f642619", + "name": "test_polygon_basic", + "polygon": { + "paths": [ + [ + { + "x": 189.4906, + "y": 63.5815 + }, + { + "x": 105.8307, + "y": 182.0439 + }, + { + "x": 249.0564, + "y": 187.3981 + }, + { + "x": 196.1834, + "y": 105.0768 + }, + { + "x": 253.0721, + "y": 99.7226 + } + ] + ] + }, + "properties": [], + "slot_names": [ + "0" + ] + }, + { + "bounding_box": { + "h": 99.05329999999998, + "w": 155.2727, + "x": 201.5376, + "y": 287.1207 + }, + "id": "b4248df6-5390-488a-9190-edfa397458a6", + "name": "test_polygon_basic", + "polygon": { + "paths": [ + [ + { + "x": 247.0486, + "y": 287.1207 + }, + { + "x": 201.5376, + "y": 386.174 + }, + { + "x": 293.8981, + "y": 386.174 + }, + { + "x": 356.8103, + "y": 384.1661 + }, + { + "x": 356.8103, + "y": 329.9545 + }, + { + "x": 319.3307, + "y": 316.569 + } + ] + ] + }, + "properties": [], + "slot_names": [ + "0" + ] + }, + { + "bounding_box": { + "h": 163.3041, + "w": 171.33550000000002, + "x": 338.0705, + "y": 50.1959 + }, + "id": "5092f929-ec75-4eb9-8b56-e6bbc472e272", + "name": "test_polygon_basic", + "polygon": { + "paths": [ + [ + { + "x": 429.7618, + "y": 50.1959 + }, + { + "x": 338.0705, + "y": 212.8307 + }, + { + "x": 509.406, + "y": 213.5 + } + ] + ] + }, + "properties": [], + "slot_names": [ + "0" + ] + } + ], + "properties": [] +} \ No newline at end of file diff --git a/e2e_tests/data/convert/instance_mask/to/masks/000000021295_00000.png b/e2e_tests/data/convert/instance_mask/to/masks/000000021295_00000.png new file mode 100644 index 0000000000000000000000000000000000000000..32060673fbd4b2f2e2def785bc6cd4b6148be0f6 GIT binary patch literal 1163 zcmeAS@N?(olHy`uVBq!ia0y~yU}|7sU|h`s6ksS-t(?xlz!K!?;uumf=k1--lZ3+s zTrVCv`2T-V^@TQvvS!t*kLLyNyw($_{W#BvwfUYINE;Dg!R_O(_z%S0536smwcGZI z@y5TXzl`60ZD3t(sy|`=OH+Qs*pIjW?)uerTw>jKmij;6_(fjwewetvX=zseb@78& z&lyF&UR=BPL)3D~H+t$nCR@iWFG>HiZ_A~|W3Ot~+vn{%H*wjn>zwztowe`S9kQ^pTS~vNA z{7Fu`UwOL@YkD!+%vs;0Xq9)-a%;(%x?<7(f?L~G&G>h3*}Mn-?>-dqT0fZLBgHm< z!2{X8*Xt8*6z*I9k70Rm?3O>zE3+A&^&egSV|vxT{XYVKIQ?4v(^kgZ{P+IE2tAtv z>HHi1U&x*+``~k|=7x~6hC6X34eQsKYHtWGYFKZ&^nlk%Mk9xUhV|=Av^NCiHB?C{ znjJ9zH92SD4Tk#*57@0_%*yPzz;OSK|F%*m=9=kDw^P_wEH+ePzH@PY$!Qg~9okB) zWu80}9GRH!>^!{YfL0~rJ3fy_-%m^_Q+6=?)%p~9iOEJqj`f=d_k_elOg0(ik&ULC zm_*K51TxB9pFb(ug|$L~b(#lPfC)1zYei0d);j@_2M0wW6xAIL_J{~S`1n_Im!nUE zdO$+s6o#WlAs!9Szbt=MBgr@~w2SF+D$9uoLB@I8SFAZu!pXQQWkUU%O9Y)crE{j9H#zlHU~cc4oKK^m2p+_j-!lmm*$^nUVE=$dO*Uut&Cd9dzLcB zU7LR)x!2+#*O{$G4xt;24tW0-u3k~f7&oVd$(Z*ipU0|H#<+bG*BtOz%`}Di_O@QD zgR}g%XdF;A)G)X(i(%;jd$zd=ch#eW9&8d2kw|xKFnX|@m2ur0|KFKzwd{99B%c3b zP(7fp$6rudzq;P8f7#pw*0!Bi4(HD|cQgCE(0^$B;qV^eH3u}Vv%PrvbGkRP&rAKM z#Ra(y_vZee@k91Pe5-;u+l()-Jm;rw%RgQB=@#3yvuB&nwC_+jcjn-8&6@V+S2}b4 z^u7DWbN+he_LJVeRc*&D)P4Dg$cuDWa{Y(2?dOnyxw)@LETK@4-3m?3eHh7{(FA+^qGeQl@|Yhbf@>sLzamL>;E3q zH|lyT6kK2N(Ss*>`-kWc?(dGgX5IJ2ev6L5#JM^T($fl79{B#(oRzyLb@HAi^_B&d z2j4v8s5{`f$L&t{zvXd9mu{ZN`lnBFj^10@`bB}6f@@P5>r>d$xvKZhe;X9x!`-S{ zoqXodq$pMGYt`+UVPV}VtyRA-$Arab?`Zkc$$c^-aQ&AV-&|bHVnb#fex|Lpb?2l- zGL4ph)aYAB=cc{7%FAu{N2H`w2fKOPt}{B_@x8C3W!t|L>4_gcD?PgT*PdBW(Oy$= z_T9g`jgsp6>W?RBv!<+WV3I3f`W)cEXc_sRN$SAjulfq^+3^m{72CeCKFPVuox#9= zeQ$%zx=Kdg2QO!dPq?h95dBqef$)!tz1$~0Mu}fwn76)^(K7xyP&1R2_yi^?pitO_ z9StEDwl}bCXxYcQgav5LHr5iR>ld~)T)D6nDB7`(bxFrER+ENM6J3SSFFFetbrz>H zYA#M?R+x52Je^Q4qlnz4$KkWyP1N# zw*#$B+9f(6No2y>S)vy>V|+I=1^KQAiWXIgPAG~Jy})qo@~Va_msbLzopr0JVul>Hq)$ literal 0 HcmV?d00001 diff --git a/e2e_tests/data/convert/instance_mask/to/masks/000000021295_00002.png b/e2e_tests/data/convert/instance_mask/to/masks/000000021295_00002.png new file mode 100644 index 0000000000000000000000000000000000000000..bc1cb483b1e7a50d8d37b8ba8757a5fe6a9d4bbf GIT binary patch literal 1198 zcmeAS@N?(olHy`uVBq!ia0y~yU}|7sU|h`s6ksS-t(?xlz*6ez;uumf=k1l#dD`v* zE{?bU|3Clfnbd}b;+nqYsoz}IteDF6!uV$eNDCfNz@2}YJ?7o}m&_FhEB|tCI8(^U zwc$kJS6h~d=UX^fZ#>@eO|HM4;kV4Rg$&s;VfW;jaz1{0cU+L=ga+fZir*j7?HP@{ z8f5R;{arkVK~nVqSAP7zn?4OaLJ7^~-R0+4xHcTH+__i%fZuTw%>y;Zk9-qkoMyGu zi}9GX>ehbF4ObOoxeV?qF06HHcxd1&SPhV{<5@~mvP?Gb;*or zE4ZI)G4&M0*5|5n1KsUY@HA(tFW3x*>wRI@!Pd_y|C$mC5iGpUA9k6As~{>^mz(2* zi)$cvK}4XoHwRGboUIuQ)n%bTmp@pM>K$s_$TTNp@<}Tun-K5YOfpx5PI@ufgnHg( zniD+fL==-vnEQPunahGFvY2ebT^};d37UAkib-bE;{9#MK%O~w!`P2iSOe(8f+OoP zPt6B=Uicet@E@S<4mG0EoF58aZsac5|3z(^(1VwUip3w4J#@`cJMcJ_UH`z{P1QI2 z8fNo;5udvU6ft`jUC(G@$XD1|#h5pB&LJMgdyWO)neJ#>v}iKzX}$A_bw^+xTQSRy z^C|Tk--5#7PFh(@5I7nh=v@{z`TO5q5#*G~KN)B3f1u2CNBQ$tW{wYbO7={Qd4fN` z39?iucg}BQDEFxODZsR6@&SIw25FXk)jW*r#IM9((5wdqP>fzy>7u?$8qNiZsbtv^l2jjQ&I!_?nVs`bv~()S3$2TmJ+q(m zPDo)f%MQOw7yiUwNM(vqdoi_{^TV_vJ3hvBlRh82$Wq~NIKQ1iytDFQ0n?t9Q}|sP zvX|`1w_&^&dO}_4fT~m6_6COV6)*H3dw^0ncS_Fb?MmlFfM!-VMBCAi@?fc}c^U3CC?xgB;{CluehkO_?Ipd_6|xr}~RqY32tE znJ1;*J%1^(?c+Iv51;d1SlRK#x4q||U*0dDdvW>0c-_b2|i{(S!LmsQcVyEpT1 zjy``~Zu;?$A7^Yg6ni|~bGrWieRbOERV*BPtQvnrns58vXQlY-=aLmUw`2UGqvxj< zz1p>{-p}jU&b{^3*Y?law$66)rK%%0ql;hOKmXy&A7Qbjw#urL4bSP8udhyDl45)< zY_odus?NJ_`~y527#NvYI0O_5TomRVUvxIz_356os%KZ9uB`W48Tsv;=gWHW-7$`~ zmv+zEm3DJ~+Nn?PzMe1*-}LofMwI`1uXA2E&%KO4X|eg*n%_I8e4UeX%;f(Gt#5Y& zMIoj-G%z$qbI8$T>|jlLyo_D{+`zw}Re%U9X&eQiGP z|E#SHK6mZvy^sGjQ-$8e{`|J5(4P++S|EQ-7w=HN{ntNURk5l%Om^$iv&*O4+BN;` z%53ldrpu?4JO2J|{BD1UyZ&mS&x`B+m&dAPauV&Y#xR9C@Aa~0=eRm;nR&~|eAQyz z@L$z|(cAxCHQc#Q*>R literal 0 HcmV?d00001 diff --git a/e2e_tests/data/convert/nifti/to/hippocampus_001_mpr_1_test_hippo_test_polygon_basic.nii.gz b/e2e_tests/data/convert/nifti/to/hippocampus_001_mpr_1_test_hippo_test_polygon_basic.nii.gz new file mode 100644 index 0000000000000000000000000000000000000000..dcf741bcabe4784b528e5377fc6666999eb22a14 GIT binary patch literal 974 zcmb2|=3oE;mj7>WUCh00AmR|X^d!UGh4X)MSvlD4a!Y@~Bde*rY?F7ul6hGlJsr8f zYj`AIytK7KVac+I@A)sUdt3O+sP^yIzaM_DwtboTt48w2Pb=U0UvM!a`7$BvLa=$?%l9AoY~s}bwzFo+0m=7j>$JO*!z04gfBNO#iMyP$*X#C)mtT6% zTy^QacrGk?%jVS7IS>~rI5aRc*2gMrUzV9(8XLJKd2w}VsZmv$?LM;TeTu*LuU|LnR?5tdTr2ZZNBgH= z^vv%@w|7l?=`z(v-I)0~LYIPpR>8U5U*Bjg*?Vi#tPFSe?_N)DoXL9Xksf)n{MM;G z({Ek_YFU+HHB-`}9m%1Az~Ee)9a?pa)>ga1wT`ESX}epU_S$zj?AhKk+t#I6 j1*%>?dFFs6F!bS$9AymB&}jVc{Xn)Q_R7Svmy8Smwp2Bf literal 0 HcmV?d00001 diff --git a/e2e_tests/data/convert/pascalvoc/from/000000021295.json b/e2e_tests/data/convert/pascalvoc/from/000000021295.json new file mode 100644 index 000000000..dc8e22aae --- /dev/null +++ b/e2e_tests/data/convert/pascalvoc/from/000000021295.json @@ -0,0 +1,81 @@ +{ + "version": "2.0", + "schema_ref": "https://darwin-public.s3.eu-west-1.amazonaws.com/darwin_json/2.0/schema.json", + "item": { + "name": "000000021295.jpg", + "path": "/", + "source_info": { + "item_id": "0192c338-2dc8-bb9f-8dde-9c4a8714c957", + "dataset": { + "name": "tmp", + "slug": "tmp", + "dataset_management_url": "https://staging.v7labs.com/datasets/426200/dataset-management" + }, + "team": { + "name": "E2E Testing", + "slug": "e2e-testing" + }, + "workview_url": "https://staging.v7labs.com/workview?dataset=426200&item=0192c338-2dc8-bb9f-8dde-9c4a8714c957" + }, + "slots": [ + { + "type": "image", + "slot_name": "0", + "width": 640, + "height": 427, + "thumbnail_url": "https://staging.v7labs.com/api/v2/teams/e2e-testing/files/6c554c31-8bf6-4fc7-9f31-394fd775b2a6/thumbnail", + "source_files": [ + { + "file_name": "000000021295.jpg", + "url": "https://staging.v7labs.com/api/v2/teams/e2e-testing/uploads/ade5f1e3-a165-4a07-989f-86ee342499c9" + } + ] + } + ] + }, + "annotations": [ + { + "bounding_box": { + "h": 23.3562, + "w": 87.4362, + "x": 103.2062, + "y": 55.6957 + }, + "id": "754f5f2c-71aa-433c-99dd-e7aae940651c", + "name": "test_bounding_box_basic", + "properties": [], + "slot_names": [ + "0" + ] + }, + { + "bounding_box": { + "h": 76.6564, + "w": 72.4642, + "x": 401.4474, + "y": 128.7588 + }, + "id": "fbcdffcc-d053-46db-b336-4c7e2179cf15", + "name": "test_bounding_box_basic", + "properties": [], + "slot_names": [ + "0" + ] + }, + { + "bounding_box": { + "h": 21.5596, + "w": 117.979, + "x": 187.0491, + "y": 262.9074 + }, + "id": "3325b3b5-add0-47ed-9d71-ccc655e3f3e2", + "name": "test_bounding_box_basic", + "properties": [], + "slot_names": [ + "0" + ] + } + ], + "properties": [] +} \ No newline at end of file diff --git a/e2e_tests/data/convert/pascalvoc/to/000000021295.xml b/e2e_tests/data/convert/pascalvoc/to/000000021295.xml new file mode 100644 index 000000000..d1bb2a6d6 --- /dev/null +++ b/e2e_tests/data/convert/pascalvoc/to/000000021295.xml @@ -0,0 +1 @@ +images000000021295.jpgimages/000000021295.jpgdarwin64042730test_bounding_box_basicUnspecified001035619179test_bounding_box_basicUnspecified00401129474205test_bounding_box_basicUnspecified00187263305284 \ No newline at end of file diff --git a/e2e_tests/data/semantic_mask/from/221b-2.json b/e2e_tests/data/convert/semantic_mask/from/221b-2.json similarity index 100% rename from e2e_tests/data/semantic_mask/from/221b-2.json rename to e2e_tests/data/convert/semantic_mask/from/221b-2.json diff --git a/e2e_tests/data/semantic_mask/to/class_mapping.csv b/e2e_tests/data/convert/semantic_mask/to/class_mapping.csv similarity index 100% rename from e2e_tests/data/semantic_mask/to/class_mapping.csv rename to e2e_tests/data/convert/semantic_mask/to/class_mapping.csv diff --git a/e2e_tests/data/yolo/from/test_input_with_bboxes_and_polys.json b/e2e_tests/data/convert/yolo/from/test_input_with_bboxes_and_polys.json similarity index 100% rename from e2e_tests/data/yolo/from/test_input_with_bboxes_and_polys.json rename to e2e_tests/data/convert/yolo/from/test_input_with_bboxes_and_polys.json diff --git a/e2e_tests/data/yolo/to/darknet.labels b/e2e_tests/data/convert/yolo/to/darknet.labels similarity index 100% rename from e2e_tests/data/yolo/to/darknet.labels rename to e2e_tests/data/convert/yolo/to/darknet.labels diff --git a/e2e_tests/data/yolov8/from/test_input_with_bboxes_and_polys.json b/e2e_tests/data/convert/yolov8/from/test_input_with_bboxes_and_polys.json similarity index 100% rename from e2e_tests/data/yolov8/from/test_input_with_bboxes_and_polys.json rename to e2e_tests/data/convert/yolov8/from/test_input_with_bboxes_and_polys.json diff --git a/e2e_tests/data/yolov8/to/darknet.labels b/e2e_tests/data/convert/yolov8/to/darknet.labels similarity index 100% rename from e2e_tests/data/yolov8/to/darknet.labels rename to e2e_tests/data/convert/yolov8/to/darknet.labels diff --git a/e2e_tests/data/yolo/to/test_input_with_bboxes_and_polys.txt b/e2e_tests/data/yolo/to/test_input_with_bboxes_and_polys.txt deleted file mode 100644 index 93acf7c2f..000000000 --- a/e2e_tests/data/yolo/to/test_input_with_bboxes_and_polys.txt +++ /dev/null @@ -1,5 +0,0 @@ -1 0.37675 0.41677 0.39357999999999993 0.34274 -0 0.74999 0.21733 0.31066000000000005 0.21066 -0 0.7666700000000001 0.60467 0.29866000000000004 0.18266 -0 0.432 0.7526700000000001 0.104 0.09466 -1 0.12866999999999998 0.142 0.12749999999999997 0.10883999999999999 \ No newline at end of file diff --git a/e2e_tests/data/yolov8/to/test_input_with_bboxes_and_polys.txt b/e2e_tests/data/yolov8/to/test_input_with_bboxes_and_polys.txt deleted file mode 100644 index a9bdc66ca..000000000 --- a/e2e_tests/data/yolov8/to/test_input_with_bboxes_and_polys.txt +++ /dev/null @@ -1,5 +0,0 @@ -1 0.30963999999999997 0.49563999999999997 0.29192 0.5335599999999999 0.27406 0.51644 0.31636000000000003 0.48402 0.39442 0.26954 0.39304 0.26539999999999997 0.38148000000000004 0.26539999999999997 0.36394 0.26872 0.32583999999999996 0.28058 0.30169999999999997 0.29202 0.28518 0.30345999999999995 0.27614 0.3125 0.25072 0.34554 0.24181999999999998 0.35952 0.2253 0.39254 0.21259999999999998 0.42432 0.20118 0.45964 0.19996 0.50318 0.20124 0.51842 0.20965999999999999 0.5351 0.22019999999999998 0.53424 0.24525999999999998 0.51428 0.24102 0.50944 0.23086 0.48784 0.22824 0.47776 0.22952 0.43710000000000004 0.24609999999999999 0.38127999999999995 0.26389999999999997 0.3457 0.28042 0.32156 0.30568 0.29884 0.32474000000000003 0.28614 0.33872 0.27978 0.37166000000000005 0.26954 0.39552 0.28954 0.37332 0.28954 0.34872000000000003 0.29710000000000003 0.32838 0.30726 0.31060000000000004 0.31995999999999997 0.29610000000000003 0.33358 0.28122 0.3557 0.26342000000000004 0.39127999999999996 0.25058 0.43178 0.24824000000000002 0.45108 0.24824000000000002 0.47776 0.26058 0.50202 0.36092 0.42338 0.38706 0.35608 0.39216 0.33672 0.3947 0.31512 0.5535399999999999 0.4803 0.5535399999999999 0.45616 0.55216 0.45064 0.53962 0.42557999999999996 0.52946 0.40906 0.51706 0.39336 0.50408 0.38364 0.49492 0.37976 0.46442 0.37848000000000004 0.45033999999999996 0.38224 0.41731999999999997 0.40256000000000003 0.38289999999999996 0.43088 0.38668 0.43592000000000003 0.39056 0.44980000000000003 0.39564 0.47522000000000003 0.3943 0.48022000000000004 0.39064 0.48388 0.38564 0.48522000000000004 0.38064 0.48388 0.37698000000000004 0.48022000000000004 0.37066000000000004 0.4505 0.33586 0.52216 0.31956 0.5511 0.3372 0.55738 0.35662 0.56196 0.39454 0.56688 0.46442 0.56814 0.48663999999999996 0.5638 0.50516 0.5555 0.53708 0.5261399999999999 0.54852 0.50708 0.55226 0.48919999999999997 0.5735399999999999 0.4803 0.5735399999999999 0.45616 0.571 0.446 0.5569400000000001 0.41558 0.5467799999999999 0.39906 0.5327999999999999 0.38127999999999995 0.5139 0.36618 0.49492 0.35975999999999997 0.46442 0.35848 0.44036000000000003 0.36492 0.43019999999999997 0.37 0.39280000000000004 0.39672 0.40446 0.36586 0.41216 0.33672 0.4147 0.31512 0.41554 0.28902 0.4186 0.2882 0.42225999999999997 0.28454 0.42360000000000003 0.27954 0.42225999999999997 0.27454 0.4186 0.27088 0.4148 0.26986 0.40954 0.25294 0.40588 0.24928 0.3958 0.2454 0.38056 0.2454 0.3615 0.24922 0.31583999999999995 0.26326 0.2917 0.2747 0.27518 0.28614 0.24609999999999999 0.31774 0.2245 0.34952 0.20163999999999999 0.3978 0.18124 0.4587 0.17996 0.4803 0.18124 0.51842 0.18384 0.5285 0.19274000000000002 0.5463 0.19894 0.5525 0.20648 0.5551 0.21918 0.5551 0.22926 0.5525 0.25858 0.52828 0.2845 0.55274 0.28416 0.5730599999999999 0.2855 0.5780599999999999 0.28916000000000003 0.58172 0.29416000000000003 0.5830599999999999 0.29916000000000004 0.58172 0.30922000000000005 0.56824 0.32854 0.57536 0.35514 0.5818 0.39454 0.58688 0.46442 0.58814 0.50246 0.5791799999999999 0.51516 0.57282 0.52152 0.56774 0.5544 0.53614 0.56584 0.5170800000000001 0.57226 0.48919999999999997 -0 0.59466 0.112 0.9053199999999999 0.112 0.9053199999999999 0.32265999999999995 0.59466 0.32265999999999995 -0 0.61734 0.51334 0.916 0.51334 0.916 0.696 0.61734 0.696 -0 0.38 0.7053400000000001 0.484 0.7053400000000001 0.484 0.8 0.38 0.8 -1 0.19241999999999998 0.12534 0.19094 0.1118 0.18688 0.10773999999999999 0.18134 0.10624 0.17492 0.10726000000000001 0.1736 0.10112 0.16688 0.09440000000000001 0.15734 0.09292 0.14912 0.09573999999999999 0.146 0.09886 0.1362 0.08906 0.13066 0.08758 0.1118 0.09306 0.09876 0.10526 0.09445999999999999 0.10640000000000001 0.08774 0.11312 0.07174 0.14112 0.06492 0.16666 0.06492 0.184 0.0664 0.18954 0.07046 0.1936 0.07866 0.19641999999999998 0.09354000000000001 0.1936 0.09934 0.18913999999999997 0.10646 0.19494 0.112 0.19641999999999998 0.11754 0.19494 0.12294 0.18954 0.12984 0.17432 0.13312000000000002 0.1776 0.13866 0.17908000000000002 0.1482 0.1776 0.15134 0.17448 0.15734 0.17642 0.16288 0.17493999999999998 0.1736 0.16419999999999998 0.1856 0.1482 0.19241999999999998 0.12534