Skip to content

Commit 7cd414d

Browse files
Vaghinak BasentsyanVaghinak Basentsyan
authored andcommitted
Merge branch 're-design-sdk' of https://github.com/superannotateai/superannotate-python-sdk into re-design-sdk
� Conflicts: � src/superannotate/lib/infrastructure/controller.py � src/superannotate/lib/infrastructure/services.py
2 parents d2ad859 + 865a020 commit 7cd414d

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

src/superannotate/lib/app/interface/sdk_interface.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2599,9 +2599,25 @@ def upload_preannotations_from_folder_to_project(
25992599
"The function does not support projects containing videos attached with URLs"
26002600
)
26012601

2602+
if recursive_subfolders:
2603+
logger.info(
2604+
"When using recursive subfolder parsing same name annotations in different subfolders will overwrite each other.",
2605+
)
2606+
2607+
logger.info(
2608+
"The JSON files should follow specific naming convention. For Vector projects they should be named '<image_name>___objects.json', for Pixel projects JSON file should be names '<image_name>___pixel.json' and also second mask image file should be present with the name '<image_name>___save.png'. In both cases image with <image_name> should be already present on the platform."
2609+
)
2610+
logger.info("Existing annotations will be overwritten.",)
2611+
logger.info(
2612+
"Uploading all annotations from %s to project %s.", folder_path, project_name
2613+
)
2614+
26022615
annotation_paths = get_annotation_paths(
26032616
folder_path, from_s3_bucket, recursive_subfolders
26042617
)
2618+
logger.info(
2619+
"Uploading %s annotations to project %s.", len(annotation_paths), project_name
2620+
)
26052621
uploaded_annotations = []
26062622
failed_annotations = []
26072623
missing_annotations = []

src/superannotate/lib/core/usecases.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4077,12 +4077,14 @@ def execute(self):
40774077
image_ids = [image["id"] for image in images]
40784078
image_names = [image["name"] for image in images]
40794079

4080-
self._service.run_segmentation(
4080+
res = self._service.run_segmentation(
40814081
self._project.team_id,
40824082
self._project.uuid,
40834083
model_name=self._ml_model_name,
40844084
image_ids=image_ids,
40854085
)
4086+
if not res.ok:
4087+
return self._response
40864088

40874089
succeded_imgs = []
40884090
failed_imgs = []
@@ -4158,12 +4160,14 @@ def execute(self):
41584160
if model.name == self._ml_model_name:
41594161
ml_model = model
41604162

4161-
self._service.run_prediction(
4163+
res = self._service.run_prediction(
41624164
team_id=self._project.team_id,
41634165
project_id=self._project.uuid,
41644166
ml_model_id=ml_model.uuid,
41654167
image_ids=image_ids,
41664168
)
4169+
if not res.ok:
4170+
return self._response
41674171

41684172
success_images = []
41694173
failed_images = []

src/superannotate/lib/infrastructure/controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ def search_annotation_classes(self, project_name: str, name_prefix: str = None):
726726
classes=AnnotationClassRepository(
727727
service=self._backend_client, project=project_entity
728728
),
729-
condition=condition,
729+
condition=condition
730730
)
731731
return use_case.execute()
732732

src/superannotate/lib/infrastructure/services.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
from contextlib import contextmanager
23
from datetime import datetime
34
from typing import Dict
@@ -26,10 +27,7 @@ class BaseBackendService(SuerannotateServiceProvider):
2627
Base service class
2728
"""
2829

29-
@classmethod
30-
def __init__(
31-
self, api_url: str, auth_token: str, logger, paginate_by=None, verify_ssl=True
32-
):
30+
def __init__(self, api_url: str, auth_token: str, logger, paginate_by=None, verify_ssl=True):
3331
self.api_url = api_url
3432
self._auth_token = auth_token
3533
self.logger = logger
@@ -934,7 +932,7 @@ def run_segmentation(
934932
params={"team_id": team_id, "project_id": project_id},
935933
data={"model_name": model_name, "image_ids": image_ids},
936934
)
937-
return res.json()
935+
return res
938936

939937
def run_prediction(
940938
self, team_id: int, project_id: int, ml_model_id: int, image_ids: list
@@ -950,7 +948,7 @@ def run_prediction(
950948
"image_ids": image_ids,
951949
},
952950
)
953-
return res.json()
951+
return res
954952

955953
def delete_image_annotations(
956954
self,

0 commit comments

Comments
 (0)