Skip to content

Commit be6e92a

Browse files
authored
Merge pull request #707 from superannotateai/develop
Develop
2 parents 115161a + 377ba56 commit be6e92a

File tree

14 files changed

+13
-480
lines changed

14 files changed

+13
-480
lines changed

CHANGELOG.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,24 @@ History
66

77
All release highlights of this project will be documented in this file.
88

9+
4.4.24 - July 2, 2024
10+
_______________________
11+
12+
13+
**Removed**
14+
15+
- ``SAClient.download_model()``
16+
- ``SAClient.run_prediction()``
17+
- ``SAClient.search_models()``
18+
19+
920
4.4.23 - July 4, 2024
1021
_______________________
1122

1223

1324
**Updated**
1425

15-
- ``SAClient.prepare_export`` added the ability to export GenAI project data to a CSV file..
26+
- ``SAClient.prepare_export`` added the ability to export GenAI project data to a CSV file.
1627

1728
**Fixed**
1829

docs/source/api_reference/api_client.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,3 @@ Contents
1818
api_subset
1919
api_image
2020
api_team
21-
api_neural_network

docs/source/api_reference/api_neural_network.rst

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/superannotate/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44

55

6-
__version__ = "4.4.23"
6+
__version__ = "4.4.24"
77

88
sys.path.append(os.path.split(os.path.realpath(__file__))[0])
99

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

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
from lib.core.enums import ProjectType
5656
from lib.core.enums import ClassTypeEnum
5757
from lib.core.exceptions import AppException
58-
from lib.core.types import MLModel
5958
from lib.core.types import PriorityScoreEntity
6059
from lib.core.types import Project
6160
from lib.core.pydantic_v1 import ValidationError
@@ -1923,27 +1922,6 @@ def upload_image_annotations(
19231922
if response.errors and not response.errors == constants.INVALID_JSON_MESSAGE:
19241923
raise AppException(response.errors)
19251924

1926-
def download_model(self, model: MLModel, output_dir: Union[str, Path]):
1927-
"""Downloads the neural network and related files
1928-
which are the <model_name>.pth/pkl. <model_name>.json, <model_name>.yaml, classes_mapper.json
1929-
1930-
:param model: the model that needs to be downloaded
1931-
:type model: dict
1932-
1933-
:param output_dir: the directory in which the files will be saved
1934-
:type output_dir: str
1935-
1936-
:return: the metadata of the model
1937-
:rtype: dict
1938-
"""
1939-
res = self.controller.models.download(
1940-
model_data=model.dict(), download_path=output_dir
1941-
)
1942-
if res.errors:
1943-
logger.error("\n".join([str(error) for error in res.errors]))
1944-
else:
1945-
return BaseSerializer(res.data).serialize()
1946-
19471925
def consensus(
19481926
self,
19491927
project: NotEmptyStr,
@@ -1983,48 +1961,6 @@ def consensus(
19831961
raise AppException(response.errors)
19841962
return response.data
19851963

1986-
def run_prediction(
1987-
self,
1988-
project: Union[NotEmptyStr, dict],
1989-
images_list: List[NotEmptyStr],
1990-
model: Union[NotEmptyStr, dict],
1991-
):
1992-
"""This function runs smart prediction on given list of images from a given project
1993-
using the neural network of your choice
1994-
1995-
:param project: the project in which the target images are uploaded.
1996-
:type project: str or dict
1997-
1998-
:param images_list: the list of image names on which smart prediction has to be run
1999-
:type images_list: list of str
2000-
2001-
:param model: the name of the model that should be used for running smart prediction
2002-
:type model: str or dict
2003-
2004-
:return: tuple of two lists, list of images on which the prediction has succeeded and failed respectively
2005-
:rtype: tuple
2006-
"""
2007-
project_name = None
2008-
folder_name = None
2009-
if isinstance(project, dict):
2010-
project_name = project["name"]
2011-
if isinstance(project, str):
2012-
project_name, folder_name = extract_project_folder(project)
2013-
2014-
model_name = model
2015-
if isinstance(model, dict):
2016-
model_name = model["name"]
2017-
project, folder = self.controller.get_project_folder(project_name, folder_name)
2018-
response = self.controller.models.run_prediction(
2019-
project=project,
2020-
folder=folder,
2021-
items_list=images_list,
2022-
model_name=model_name,
2023-
)
2024-
if response.errors:
2025-
raise AppException(response.errors)
2026-
return response.data
2027-
20281964
def upload_image_to_project(
20291965
self,
20301966
project: NotEmptyStr,
@@ -2073,49 +2009,6 @@ def upload_image_to_project(
20732009
if response.errors:
20742010
raise AppException(response.errors)
20752011

2076-
def search_models(
2077-
self,
2078-
name: Optional[NotEmptyStr] = None,
2079-
type_: Optional[NotEmptyStr] = None, # noqa
2080-
project_id: Optional[int] = None,
2081-
task: Optional[NotEmptyStr] = None,
2082-
include_global: Optional[bool] = True,
2083-
):
2084-
r"""Search for ML models.
2085-
2086-
:param name: search string
2087-
:type name: str
2088-
2089-
:param type\_: ml model type string
2090-
:type type\_: str
2091-
2092-
:param project_id: project id
2093-
:type project_id: int
2094-
2095-
:param task: training task
2096-
:type task: str
2097-
2098-
:param include_global: include global ml models
2099-
:type include_global: bool
2100-
2101-
:return: ml model metadata
2102-
:rtype: list of dicts
2103-
"""
2104-
condition = EmptyCondition()
2105-
if name:
2106-
condition &= Condition("name", name, EQ)
2107-
if type_:
2108-
condition &= Condition("type", type_, EQ)
2109-
if project_id:
2110-
condition &= Condition("project_id", project_id, EQ)
2111-
if task:
2112-
condition &= Condition("task", task, EQ)
2113-
if include_global:
2114-
condition &= Condition("include_global", include_global, EQ)
2115-
2116-
res = self.controller.models.list(condition)
2117-
return res.data
2118-
21192012
def upload_images_to_project(
21202013
self,
21212014
project: NotEmptyStr,

src/superannotate/lib/core/entities/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from lib.core.entities.items import VideoEntity
1313
from lib.core.entities.project import AttachmentEntity
1414
from lib.core.entities.project import ContributorEntity
15-
from lib.core.entities.project import MLModelEntity
1615
from lib.core.entities.project import ProjectEntity
1716
from lib.core.entities.project import SettingEntity
1817
from lib.core.entities.project import TeamEntity
@@ -47,6 +46,5 @@
4746
"AnnotationClassEntity",
4847
"TeamEntity",
4948
"UserEntity",
50-
"MLModelEntity",
5149
"IntegrationEntity",
5250
]

src/superannotate/lib/core/entities/project.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -142,29 +142,6 @@ def __eq__(self, other):
142142
return self.id == other.id
143143

144144

145-
class MLModelEntity(TimedBaseModel):
146-
id: Optional[int]
147-
team_id: Optional[int]
148-
name: Optional[str]
149-
path: Optional[str]
150-
config_path: Optional[str]
151-
model_type: Optional[int]
152-
description: Optional[str]
153-
output_path: Optional[str]
154-
task: Optional[str]
155-
base_model_id: Optional[int]
156-
image_count: Optional[int]
157-
training_status: Optional[int]
158-
test_folder_ids: Optional[List[int]]
159-
train_folder_ids: Optional[List[int]]
160-
is_trainable: Optional[bool]
161-
is_global: Optional[bool]
162-
hyper_parameters: Optional[dict]
163-
164-
class Config:
165-
extra = Extra.ignore
166-
167-
168145
class UserEntity(BaseModel):
169146
id: Optional[str]
170147
first_name: Optional[str]

src/superannotate/lib/core/service_types.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -52,30 +52,6 @@ def __init__(self, **data):
5252
super().__init__(**data)
5353

5454

55-
class DownloadMLModelAuthData(BaseModel):
56-
access_key: str
57-
secret_key: str
58-
session_token: str
59-
region: str
60-
bucket: str
61-
paths: List[str]
62-
63-
class Config:
64-
extra = Extra.allow
65-
fields = {
66-
"access_key": "accessKeyId",
67-
"secret_key": "secretAccessKey",
68-
"session_token": "sessionToken",
69-
"region": "region",
70-
}
71-
72-
def __init__(self, **data):
73-
credentials = data["tokens"]
74-
data.update(credentials)
75-
del data["tokens"]
76-
super().__init__(**data)
77-
78-
7955
class UploadAnnotations(BaseModel):
8056
class Resource(BaseModel):
8157
classes: List[str] = Field([], alias="class")
@@ -202,10 +178,6 @@ class SubsetResponse(ServiceResponse):
202178
res_data: entities.SubSetEntity = None
203179

204180

205-
class DownloadMLModelAuthDataResponse(ServiceResponse):
206-
res_data: DownloadMLModelAuthData = None
207-
208-
209181
class UploadAnnotationsResponse(ServiceResponse):
210182
res_data: Optional[UploadAnnotations] = None
211183

src/superannotate/lib/core/serviceproviders.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
from lib.core.conditions import Condition
1111
from lib.core.reporter import Reporter
1212
from lib.core.service_types import AnnotationClassListResponse
13-
from lib.core.service_types import DownloadMLModelAuthDataResponse
1413
from lib.core.service_types import FolderListResponse
1514
from lib.core.service_types import FolderResponse
1615
from lib.core.service_types import IntegrationListResponse
1716
from lib.core.service_types import ItemListResponse
18-
from lib.core.service_types import ModelListResponse
1917
from lib.core.service_types import ProjectListResponse
2018
from lib.core.service_types import ProjectResponse
2119
from lib.core.service_types import ServiceResponse
@@ -469,20 +467,6 @@ def add_items(
469467
raise NotImplementedError
470468

471469

472-
class BaseModelsService(SuperannotateServiceProvider):
473-
@abstractmethod
474-
def delete(self, model_id: int) -> ServiceResponse:
475-
raise NotImplementedError
476-
477-
@abstractmethod
478-
def start_training(self, model_id: int) -> ServiceResponse:
479-
raise NotImplementedError
480-
481-
@abstractmethod
482-
def list(self, condition: Condition = None) -> ModelListResponse:
483-
raise NotImplementedError
484-
485-
486470
class BaseIntegrationService(SuperannotateServiceProvider):
487471
@abstractmethod
488472
def list(self) -> IntegrationListResponse:
@@ -507,7 +491,6 @@ class BaseServiceProvider:
507491
custom_fields: BaseCustomFieldService
508492
annotation_classes: BaseAnnotationClassService
509493
subsets: BaseSubsetService
510-
models: BaseModelsService
511494
integrations: BaseIntegrationService
512495

513496
@abstractmethod
@@ -579,28 +562,12 @@ def prepare_export(
579562
def get_exports(self, project: entities.ProjectEntity) -> ServiceResponse:
580563
raise NotImplementedError
581564

582-
@abstractmethod
583-
def get_model_metrics(self, model_id: int) -> ServiceResponse:
584-
raise NotImplementedError
585-
586565
@abstractmethod
587566
def get_export(
588567
self, project: entities.ProjectEntity, export_id: int
589568
) -> ServiceResponse:
590569
raise NotImplementedError
591570

592-
@abstractmethod
593-
def get_ml_model_download_tokens(
594-
self, model_id: int
595-
) -> DownloadMLModelAuthDataResponse:
596-
raise NotImplementedError
597-
598-
@abstractmethod
599-
def run_prediction(
600-
self, project: entities.ProjectEntity, ml_model_id: int, image_ids: list
601-
) -> ServiceResponse:
602-
raise NotImplementedError
603-
604571
@abstractmethod
605572
def get_project_images_count(
606573
self, project: entities.ProjectEntity

src/superannotate/lib/core/types.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,6 @@ class Config:
1414
extra = Extra.allow
1515

1616

17-
class MLModel(BaseModel):
18-
name: NotEmptyStr
19-
id: Optional[int]
20-
path: NotEmptyStr
21-
config_path: NotEmptyStr
22-
team_id: Optional[int]
23-
24-
class Config:
25-
extra = Extra.allow
26-
27-
2817
class PriorityScoreEntity(BaseModel):
2918
name: NotEmptyStr
3019
priority: float

0 commit comments

Comments
 (0)