|
6 | 6 | # COCO to SA |
7 | 7 | # test panoptic-segmentation |
8 | 8 | def panoptic_segmentation_coco2sa(tmpdir): |
9 | | - out_path = tmpdir / "toSuperAnnotate/panoptic_test" |
10 | | - try: |
11 | | - sa.import_annotation_format( |
12 | | - "tests/converter_test/COCO/input/toSuperAnnotate/panoptic_segmentation", |
13 | | - str(out_path), "COCO", "panoptic_test", "Pixel", |
14 | | - "panoptic_segmentation" |
15 | | - ) |
16 | | - except Exception as e: |
17 | | - return 1 |
18 | | - return 0 |
| 9 | + out_path = tmpdir / "toSuperAnnotate" / "panoptic_test" |
| 10 | + sa.import_annotation_format( |
| 11 | + "tests/converter_test/COCO/input/toSuperAnnotate/panoptic_segmentation", |
| 12 | + str(out_path), "COCO", "panoptic_test", "Pixel", "panoptic_segmentation" |
| 13 | + ) |
19 | 14 |
|
20 | 15 |
|
21 | 16 | # test keypoint-detection |
22 | 17 | def keypoint_detection_coco2sa(tmpdir): |
23 | | - out_path = tmpdir / "toSuperAnnotate/keypoint_test" |
24 | | - try: |
25 | | - sa.import_annotation_format( |
26 | | - "tests/converter_test/COCO/input/toSuperAnnotate/keypoint_detection", |
27 | | - str(out_path), "COCO", "person_keypoints_test", "Vector", |
28 | | - "keypoint_detection" |
29 | | - ) |
30 | | - except Exception as e: |
31 | | - return 1 |
32 | | - return 0 |
| 18 | + out_path = tmpdir / "toSuperAnnotate" / "keypoint_test" |
| 19 | + sa.import_annotation_format( |
| 20 | + "tests/converter_test/COCO/input/toSuperAnnotate/keypoint_detection", |
| 21 | + str(out_path), "COCO", "person_keypoints_test", "Vector", |
| 22 | + "keypoint_detection" |
| 23 | + ) |
33 | 24 |
|
34 | 25 |
|
35 | 26 | # test instance segmentation |
36 | 27 | def instance_segmentation_coco2sa(tmpdir): |
37 | | - out_path = tmpdir / "toSuperAnnotate/instances_test" |
38 | | - try: |
39 | | - sa.import_annotation_format( |
40 | | - "tests/converter_test/COCO/input/toSuperAnnotate/instance_segmentation", |
41 | | - str(out_path), "COCO", "instances_test", "Vector", |
42 | | - "instance_segmentation" |
43 | | - ) |
44 | | - except Exception as e: |
45 | | - return 1 |
46 | | - return 0 |
| 28 | + out_path = tmpdir / "toSuperAnnotate" / "instances_test" |
| 29 | + sa.import_annotation_format( |
| 30 | + "tests/converter_test/COCO/input/toSuperAnnotate/instance_segmentation", |
| 31 | + str(out_path), "COCO", "instances_test", "Vector", |
| 32 | + "instance_segmentation" |
| 33 | + ) |
47 | 34 |
|
48 | 35 |
|
49 | 36 | # SA to COCO |
50 | 37 | # test panoptic segmentation |
51 | 38 | def panoptic_segmentation_sa2coco(tmpdir): |
52 | | - out_path = tmpdir / "fromSuperAnnotate/panoptic_test" |
53 | | - try: |
54 | | - sa.export_annotation_format( |
55 | | - "tests/converter_test/COCO/input/fromSuperAnnotate/cats_dogs_panoptic_segm", |
56 | | - str(out_path), "COCO", "panoptic_test", "Pixel", |
57 | | - "panoptic_segmentation" |
58 | | - ) |
59 | | - except Exception as e: |
60 | | - return 1 |
61 | | - return 0 |
| 39 | + out_path = tmpdir / "fromSuperAnnotate" / "panoptic_test" |
| 40 | + sa.export_annotation_format( |
| 41 | + "tests/converter_test/COCO/input/fromSuperAnnotate/cats_dogs_panoptic_segm", |
| 42 | + str(out_path), "COCO", "panoptic_test", "Pixel", "panoptic_segmentation" |
| 43 | + ) |
62 | 44 |
|
63 | 45 |
|
64 | 46 | def keypoint_detection_sa2coco(tmpdir): |
65 | | - out_path = tmpdir / "fromSuperAnnotate/keypoint_test_vector" |
66 | | - try: |
67 | | - sa.export_annotation_format( |
68 | | - "tests/converter_test/COCO/input/fromSuperAnnotate/cats_dogs_vector_keypoint_det", |
69 | | - str(out_path), "COCO", "keypoint_test_vector", "Vector", |
70 | | - "keypoint_detection" |
71 | | - ) |
72 | | - except Exception as e: |
73 | | - return 1 |
74 | | - return 0 |
| 47 | + out_path = tmpdir / "fromSuperAnnotate" / "keypoint_test_vector" |
| 48 | + sa.export_annotation_format( |
| 49 | + "tests/converter_test/COCO/input/fromSuperAnnotate/cats_dogs_vector_keypoint_det", |
| 50 | + str(out_path), "COCO", "keypoint_test_vector", "Vector", |
| 51 | + "keypoint_detection" |
| 52 | + ) |
75 | 53 |
|
76 | 54 |
|
77 | 55 | def instance_segmentation_sa2coco_pixel(tmpdir): |
78 | | - out_path = tmpdir / "fromSuperAnnotate/instance_test_pixel" |
79 | | - try: |
80 | | - sa.export_annotation_format( |
81 | | - "tests/converter_test/COCO/input/fromSuperAnnotate/cats_dogs_pixel_instance_segm", |
82 | | - str(out_path), "COCO", "instance_test_pixel", "Pixel", |
83 | | - "instance_segmentation" |
84 | | - ) |
85 | | - except Exception as e: |
86 | | - return 1 |
87 | | - return 0 |
| 56 | + out_path = tmpdir / "fromSuperAnnotate" / "instance_test_pixel" |
| 57 | + sa.export_annotation_format( |
| 58 | + "tests/converter_test/COCO/input/fromSuperAnnotate/cats_dogs_pixel_instance_segm", |
| 59 | + str(out_path), "COCO", "instance_test_pixel", "Pixel", |
| 60 | + "instance_segmentation" |
| 61 | + ) |
88 | 62 |
|
89 | 63 |
|
90 | 64 | def instance_segmentation_sa2coco_vector(tmpdir): |
91 | | - out_path = tmpdir / "fromSuperAnnotate/instance_test_vector" |
92 | | - try: |
93 | | - sa.export_annotation_format( |
94 | | - "tests/converter_test/COCO/input/fromSuperAnnotate/cats_dogs_vector_instance_segm", |
95 | | - str(out_path), "COCO", "instance_test_vector", "Vector", |
96 | | - "instance_segmentation" |
97 | | - ) |
98 | | - except Exception as e: |
99 | | - return 1 |
100 | | - return 0 |
| 65 | + out_path = tmpdir / "fromSuperAnnotate" / "instance_test_vector" |
| 66 | + sa.export_annotation_format( |
| 67 | + "tests/converter_test/COCO/input/fromSuperAnnotate/cats_dogs_vector_instance_segm", |
| 68 | + str(out_path), "COCO", "instance_test_vector", "Vector", |
| 69 | + "instance_segmentation" |
| 70 | + ) |
101 | 71 |
|
102 | 72 |
|
103 | 73 | def test_coco2sa(tmpdir): |
104 | | - assert panoptic_segmentation_coco2sa(tmpdir) == 0 |
105 | | - assert keypoint_detection_coco2sa(tmpdir) == 0 |
106 | | - assert instance_segmentation_coco2sa(tmpdir) == 0 |
| 74 | + panoptic_segmentation_coco2sa(tmpdir) |
| 75 | + keypoint_detection_coco2sa(tmpdir) |
| 76 | + instance_segmentation_coco2sa(tmpdir) |
107 | 77 |
|
108 | 78 |
|
109 | 79 | def test_sa2coco(tmpdir): |
110 | | - assert panoptic_segmentation_sa2coco(tmpdir) == 0 |
111 | | - assert keypoint_detection_sa2coco(tmpdir) == 0 |
112 | | - assert instance_segmentation_sa2coco_pixel(tmpdir) == 0 |
113 | | - assert instance_segmentation_sa2coco_vector(tmpdir) == 0 |
| 80 | + panoptic_segmentation_sa2coco(tmpdir) |
| 81 | + keypoint_detection_sa2coco(tmpdir) |
| 82 | + instance_segmentation_sa2coco_pixel(tmpdir) |
| 83 | + instance_segmentation_sa2coco_vector(tmpdir) |
0 commit comments