Skip to content

Commit be10ff0

Browse files
committed
merge
2 parents 5ccbacf + a984031 commit be10ff0

File tree

49 files changed

+202
-153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+202
-153
lines changed

src/superannotate/lib/core/usecases.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3177,12 +3177,6 @@ def execute(self):
31773177
),
31783178
)
31793179
)
3180-
image_names = [
3181-
annotation_path.replace(constances.PIXEL_ANNOTATION_POSTFIX, "").replace(
3182-
constances.VECTOR_ANNOTATION_POSTFIX, ""
3183-
)
3184-
for annotation_path in annotation_paths
3185-
]
31863180
images_data = self._backend_service.get_bulk_images(
31873181
images=[image.name for image in images_detail],
31883182
folder_id=self._folder.uuid,
@@ -3200,7 +3194,7 @@ def execute(self):
32003194
annotations_to_upload = list(
32013195
filter(lambda detail: detail.id is not None, images_detail)
32023196
)
3203-
if len(images_data) < (len(image_names)):
3197+
if missing_annotations:
32043198
self._response.errors = AppException(
32053199
f"Couldn't find image {','.join(map(lambda x: x.path, missing_annotations))} for annotation upload."
32063200
)
@@ -4206,7 +4200,6 @@ def execute(self):
42064200
yield
42074201

42084202
uploaded = []
4209-
# duplicates = []
42104203
for i in range(0, len(uploaded_images), 500):
42114204
response = AttachFileUrlsUseCase(
42124205
project=self._project,

tests/convertors/test_consensus.py

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,17 @@ def export_path(self):
2626
return os.path.join(dirname(dirname(__file__)), self.TEST_EXPORT_ROOT)
2727

2828
def test_consensus(self):
29-
annot_types = ['polygon', 'bbox', 'point']
30-
folder_names = ['consensus_1', 'consensus_2', 'consensus_3']
29+
annot_types = ["polygon", "bbox", "point"]
30+
folder_names = ["consensus_1", "consensus_2", "consensus_3"]
3131
df_column_names = [
32-
'creatorEmail', 'imageName', 'instanceId', 'area', 'className',
33-
'attributes', 'folderName', 'score'
32+
"creatorEmail",
33+
"imageName",
34+
"instanceId",
35+
"area",
36+
"className",
37+
"attributes",
38+
"folderName",
39+
"score",
3440
]
3541
export_path = self.export_path
3642
for i in range(1, 4):
@@ -39,47 +45,53 @@ def test_consensus(self):
3945
self.PROJECT_NAME, self.export_path + "/classes/classes.json"
4046
)
4147
sa.upload_images_from_folder_to_project(
42-
self.PROJECT_NAME, self.export_path + "/images", annotation_status="Completed"
48+
self.PROJECT_NAME,
49+
self.export_path + "/images",
50+
annotation_status="Completed",
4351
)
4452
for i in range(1, 4):
4553
sa.upload_images_from_folder_to_project(
46-
self.PROJECT_NAME + f'/{self.CONSENSUS_PREFIX}' + str(i),
54+
self.PROJECT_NAME + f"/{self.CONSENSUS_PREFIX}" + str(i),
4755
self.export_path + "/images",
48-
annotation_status="Completed"
56+
annotation_status="Completed",
4957
)
5058
time.sleep(2)
51-
sa.upload_annotations_from_folder_to_project(self.PROJECT_NAME, self.export_path)
59+
sa.upload_annotations_from_folder_to_project(
60+
self.PROJECT_NAME, self.export_path
61+
)
5262
for i in range(1, 4):
5363
sa.upload_annotations_from_folder_to_project(
54-
self.PROJECT_NAME + f'/{self.CONSENSUS_PREFIX}' + str(i),
55-
self.export_path + f'/{self.CONSENSUS_PREFIX}' + str(i)
64+
self.PROJECT_NAME + f"/{self.CONSENSUS_PREFIX}" + str(i),
65+
self.export_path + f"/{self.CONSENSUS_PREFIX}" + str(i),
5666
)
5767

5868
for annot_type in annot_types:
59-
res_df = sa.consensus(self.PROJECT_NAME, folder_names, annot_type=annot_type)
60-
#test content of projectName column
61-
assert sorted(res_df['folderName'].unique()) == folder_names
69+
res_df = sa.consensus(
70+
self.PROJECT_NAME, folder_names, annot_type=annot_type
71+
)
72+
# test content of projectName column
73+
assert sorted(res_df["folderName"].unique()) == folder_names
6274

63-
#test structure of resulting DataFrame
75+
# test structure of resulting DataFrame
6476
assert sorted(res_df.columns) == sorted(df_column_names)
6577

66-
#test lower bound of the score
67-
assert (res_df['score'] >= 0).all()
78+
# test lower bound of the score
79+
assert (res_df["score"] >= 0).all()
6880

69-
#test upper bound of the score
70-
assert (res_df['score'] <= 1).all()
81+
# test upper bound of the score
82+
assert (res_df["score"] <= 1).all()
7183

7284
image_names = [
73-
'bonn_000000_000019_leftImg8bit.png',
74-
'bielefeld_000000_000321_leftImg8bit.png'
85+
"bonn_000000_000019_leftImg8bit.png",
86+
"bielefeld_000000_000321_leftImg8bit.png",
7587
]
7688

77-
#test filtering images with given image names list
89+
# test filtering images with given image names list
7890
res_images = sa.consensus(
7991
self.PROJECT_NAME,
8092
folder_names,
8193
export_root=export_path,
82-
image_list=image_names
94+
image_list=image_names,
8395
)
8496

85-
assert sorted(res_images['imageName'].unique()) == sorted(image_names)
97+
assert sorted(res_images["imageName"].unique()) == sorted(image_names)

tests/convertors/test_dataloop.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from pathlib import Path
2-
import pytest
32

3+
import pytest
44
import superannotate as sa
55

66

@@ -20,6 +20,7 @@ def test_dataloop_convert_vector(tmpdir):
2020
ptype = "Vector"
2121
# upload_project(out_dir, project_name, description, ptype)
2222

23+
2324
@pytest.mark.skip(reason="Need to adjust")
2425
def test_dataloop_convert_object(tmpdir):
2526
project_name = "dataloop2sa_vector_object"

tests/convertors/test_googlecloud.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from pathlib import Path
22

3+
import pytest
34
import superannotate as sa
45

5-
import pytest
66

77
@pytest.mark.skip(reason="Need to adjust")
88
def test_googlecloud_convert_web(tmpdir):

tests/convertors/test_labelbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from pathlib import Path
22

3+
import pytest
34
import superannotate as sa
45

5-
import pytest
66

77
@pytest.mark.skip(reason="Need to adjust")
88
def test_labelbox_convert_vector(tmpdir):

tests/convertors/test_sagemaker.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from pathlib import Path
22

3-
import superannotate as sa
4-
53
import pytest
4+
import superannotate as sa
65

76

87
@pytest.mark.skip(reason="Need to adjust")

tests/convertors/test_supervisely.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from pathlib import Path
22

3-
import superannotate as sa
4-
53
import pytest
4+
import superannotate as sa
65

76

87
@pytest.mark.skip(reason="Need to adjust")
@@ -90,8 +89,11 @@ def test_supervisely_convert_keypoint(tmpdir):
9089
description = "supervisely keypoint"
9190
ptype = "Vector"
9291
# upload_project(out_dir, project_name, description, ptype)
92+
93+
9394
#
9495

96+
9597
@pytest.mark.skip(reason="Need to adjust")
9698
def test_supervisely_convert_instance_pixel(tmpdir):
9799
project_name = "supervisely_test_instance_pixel"

tests/convertors/test_vgg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from pathlib import Path
22

3+
import pytest
34
import superannotate as sa
45

5-
import pytest
66

77
@pytest.mark.skip(reason="Need to adjust")
88
def test_vgg_convert_object(tmpdir):

tests/convertors/test_voc.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from pathlib import Path
22

3-
import superannotate as sa
4-
53
import pytest
4+
import superannotate as sa
65

76

87
@pytest.mark.skip(reason="Need to adjust")

tests/convertors/test_vott.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from pathlib import Path
22

3-
import superannotate as sa
4-
53
import pytest
4+
import superannotate as sa
65

76

87
@pytest.mark.skip(reason="Need to adjust")

0 commit comments

Comments
 (0)