Skip to content

Commit 3f89ae0

Browse files
committed
Fix seg-pred-add logs
1 parent 09ec2fa commit 3f89ae0

File tree

4 files changed

+28
-7
lines changed

4 files changed

+28
-7
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
@@ -4075,12 +4075,14 @@ def execute(self):
40754075
image_ids = [image["id"] for image in images]
40764076
image_names = [image["name"] for image in images]
40774077

4078-
self._service.run_segmentation(
4078+
res = self._service.run_segmentation(
40794079
self._project.team_id,
40804080
self._project.uuid,
40814081
model_name=self._ml_model_name,
40824082
image_ids=image_ids,
40834083
)
4084+
if not res.ok:
4085+
return self._response
40844086

40854087
succeded_imgs = []
40864088
failed_imgs = []
@@ -4156,12 +4158,14 @@ def execute(self):
41564158
if model.name == self._ml_model_name:
41574159
ml_model = model
41584160

4159-
self._service.run_prediction(
4161+
res = self._service.run_prediction(
41604162
team_id=self._project.team_id,
41614163
project_id=self._project.uuid,
41624164
ml_model_id=ml_model.uuid,
41634165
image_ids=image_ids,
41644166
)
4167+
if not res.ok:
4168+
return self._response
41654169

41664170
success_images = []
41674171
failed_images = []

src/superannotate/lib/infrastructure/controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(self, logger, config_path=constances.CONFIG_FILE_LOCATION):
6262
api_url=self.configs.get_one("main_endpoint").value,
6363
auth_token=ConfigRepository().get_one("token").value,
6464
logger=logger,
65-
verify_ssl=verify_ssl
65+
verify_ssl=verify_ssl,
6666
)
6767
self._s3_upload_auth_data = None
6868
self._projects = None

src/superannotate/lib/infrastructure/services.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
from contextlib import contextmanager
32
from datetime import datetime
43
from typing import Dict
@@ -27,7 +26,9 @@ class BaseBackendService(SuerannotateServiceProvider):
2726
Base service class
2827
"""
2928

30-
def __init__(self, api_url: str, auth_token: str, logger, paginate_by=None, verify_ssl=True):
29+
def __init__(
30+
self, api_url: str, auth_token: str, logger, paginate_by=None, verify_ssl=True
31+
):
3132
self.api_url = api_url
3233
self._auth_token = auth_token
3334
self.logger = logger
@@ -932,7 +933,7 @@ def run_segmentation(
932933
params={"team_id": team_id, "project_id": project_id},
933934
data={"model_name": model_name, "image_ids": image_ids},
934935
)
935-
return res.json()
936+
return res
936937

937938
def run_prediction(
938939
self, team_id: int, project_id: int, ml_model_id: int, image_ids: list
@@ -948,7 +949,7 @@ def run_prediction(
948949
"image_ids": image_ids,
949950
},
950951
)
951-
return res.json()
952+
return res
952953

953954
def delete_image_annotations(
954955
self,

0 commit comments

Comments
 (0)