Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/source/api_reference/api_client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ Contents
api_subset
api_image
api_team
api_neural_network
8 changes: 0 additions & 8 deletions docs/source/api_reference/api_neural_network.rst

This file was deleted.

107 changes: 0 additions & 107 deletions src/superannotate/lib/app/interface/sdk_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
from lib.core.enums import ProjectType
from lib.core.enums import ClassTypeEnum
from lib.core.exceptions import AppException
from lib.core.types import MLModel
from lib.core.types import PriorityScoreEntity
from lib.core.types import Project
from lib.core.pydantic_v1 import ValidationError
Expand Down Expand Up @@ -1923,27 +1922,6 @@ def upload_image_annotations(
if response.errors and not response.errors == constants.INVALID_JSON_MESSAGE:
raise AppException(response.errors)

def download_model(self, model: MLModel, output_dir: Union[str, Path]):
"""Downloads the neural network and related files
which are the <model_name>.pth/pkl. <model_name>.json, <model_name>.yaml, classes_mapper.json

:param model: the model that needs to be downloaded
:type model: dict

:param output_dir: the directory in which the files will be saved
:type output_dir: str

:return: the metadata of the model
:rtype: dict
"""
res = self.controller.models.download(
model_data=model.dict(), download_path=output_dir
)
if res.errors:
logger.error("\n".join([str(error) for error in res.errors]))
else:
return BaseSerializer(res.data).serialize()

def consensus(
self,
project: NotEmptyStr,
Expand Down Expand Up @@ -1983,48 +1961,6 @@ def consensus(
raise AppException(response.errors)
return response.data

def run_prediction(
self,
project: Union[NotEmptyStr, dict],
images_list: List[NotEmptyStr],
model: Union[NotEmptyStr, dict],
):
"""This function runs smart prediction on given list of images from a given project
using the neural network of your choice

:param project: the project in which the target images are uploaded.
:type project: str or dict

:param images_list: the list of image names on which smart prediction has to be run
:type images_list: list of str

:param model: the name of the model that should be used for running smart prediction
:type model: str or dict

:return: tuple of two lists, list of images on which the prediction has succeeded and failed respectively
:rtype: tuple
"""
project_name = None
folder_name = None
if isinstance(project, dict):
project_name = project["name"]
if isinstance(project, str):
project_name, folder_name = extract_project_folder(project)

model_name = model
if isinstance(model, dict):
model_name = model["name"]
project, folder = self.controller.get_project_folder(project_name, folder_name)
response = self.controller.models.run_prediction(
project=project,
folder=folder,
items_list=images_list,
model_name=model_name,
)
if response.errors:
raise AppException(response.errors)
return response.data

def upload_image_to_project(
self,
project: NotEmptyStr,
Expand Down Expand Up @@ -2073,49 +2009,6 @@ def upload_image_to_project(
if response.errors:
raise AppException(response.errors)

def search_models(
self,
name: Optional[NotEmptyStr] = None,
type_: Optional[NotEmptyStr] = None, # noqa
project_id: Optional[int] = None,
task: Optional[NotEmptyStr] = None,
include_global: Optional[bool] = True,
):
r"""Search for ML models.

:param name: search string
:type name: str

:param type\_: ml model type string
:type type\_: str

:param project_id: project id
:type project_id: int

:param task: training task
:type task: str

:param include_global: include global ml models
:type include_global: bool

:return: ml model metadata
:rtype: list of dicts
"""
condition = EmptyCondition()
if name:
condition &= Condition("name", name, EQ)
if type_:
condition &= Condition("type", type_, EQ)
if project_id:
condition &= Condition("project_id", project_id, EQ)
if task:
condition &= Condition("task", task, EQ)
if include_global:
condition &= Condition("include_global", include_global, EQ)

res = self.controller.models.list(condition)
return res.data

def upload_images_to_project(
self,
project: NotEmptyStr,
Expand Down
2 changes: 0 additions & 2 deletions src/superannotate/lib/core/entities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from lib.core.entities.items import VideoEntity
from lib.core.entities.project import AttachmentEntity
from lib.core.entities.project import ContributorEntity
from lib.core.entities.project import MLModelEntity
from lib.core.entities.project import ProjectEntity
from lib.core.entities.project import SettingEntity
from lib.core.entities.project import TeamEntity
Expand Down Expand Up @@ -47,6 +46,5 @@
"AnnotationClassEntity",
"TeamEntity",
"UserEntity",
"MLModelEntity",
"IntegrationEntity",
]
23 changes: 0 additions & 23 deletions src/superannotate/lib/core/entities/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,29 +142,6 @@ def __eq__(self, other):
return self.id == other.id


class MLModelEntity(TimedBaseModel):
id: Optional[int]
team_id: Optional[int]
name: Optional[str]
path: Optional[str]
config_path: Optional[str]
model_type: Optional[int]
description: Optional[str]
output_path: Optional[str]
task: Optional[str]
base_model_id: Optional[int]
image_count: Optional[int]
training_status: Optional[int]
test_folder_ids: Optional[List[int]]
train_folder_ids: Optional[List[int]]
is_trainable: Optional[bool]
is_global: Optional[bool]
hyper_parameters: Optional[dict]

class Config:
extra = Extra.ignore


class UserEntity(BaseModel):
id: Optional[str]
first_name: Optional[str]
Expand Down
28 changes: 0 additions & 28 deletions src/superannotate/lib/core/service_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,30 +52,6 @@ def __init__(self, **data):
super().__init__(**data)


class DownloadMLModelAuthData(BaseModel):
access_key: str
secret_key: str
session_token: str
region: str
bucket: str
paths: List[str]

class Config:
extra = Extra.allow
fields = {
"access_key": "accessKeyId",
"secret_key": "secretAccessKey",
"session_token": "sessionToken",
"region": "region",
}

def __init__(self, **data):
credentials = data["tokens"]
data.update(credentials)
del data["tokens"]
super().__init__(**data)


class UploadAnnotations(BaseModel):
class Resource(BaseModel):
classes: List[str] = Field([], alias="class")
Expand Down Expand Up @@ -202,10 +178,6 @@ class SubsetResponse(ServiceResponse):
res_data: entities.SubSetEntity = None


class DownloadMLModelAuthDataResponse(ServiceResponse):
res_data: DownloadMLModelAuthData = None


class UploadAnnotationsResponse(ServiceResponse):
res_data: Optional[UploadAnnotations] = None

Expand Down
33 changes: 0 additions & 33 deletions src/superannotate/lib/core/serviceproviders.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
from lib.core.conditions import Condition
from lib.core.reporter import Reporter
from lib.core.service_types import AnnotationClassListResponse
from lib.core.service_types import DownloadMLModelAuthDataResponse
from lib.core.service_types import FolderListResponse
from lib.core.service_types import FolderResponse
from lib.core.service_types import IntegrationListResponse
from lib.core.service_types import ItemListResponse
from lib.core.service_types import ModelListResponse
from lib.core.service_types import ProjectListResponse
from lib.core.service_types import ProjectResponse
from lib.core.service_types import ServiceResponse
Expand Down Expand Up @@ -469,20 +467,6 @@ def add_items(
raise NotImplementedError


class BaseModelsService(SuperannotateServiceProvider):
@abstractmethod
def delete(self, model_id: int) -> ServiceResponse:
raise NotImplementedError

@abstractmethod
def start_training(self, model_id: int) -> ServiceResponse:
raise NotImplementedError

@abstractmethod
def list(self, condition: Condition = None) -> ModelListResponse:
raise NotImplementedError


class BaseIntegrationService(SuperannotateServiceProvider):
@abstractmethod
def list(self) -> IntegrationListResponse:
Expand All @@ -507,7 +491,6 @@ class BaseServiceProvider:
custom_fields: BaseCustomFieldService
annotation_classes: BaseAnnotationClassService
subsets: BaseSubsetService
models: BaseModelsService
integrations: BaseIntegrationService

@abstractmethod
Expand Down Expand Up @@ -579,28 +562,12 @@ def prepare_export(
def get_exports(self, project: entities.ProjectEntity) -> ServiceResponse:
raise NotImplementedError

@abstractmethod
def get_model_metrics(self, model_id: int) -> ServiceResponse:
raise NotImplementedError

@abstractmethod
def get_export(
self, project: entities.ProjectEntity, export_id: int
) -> ServiceResponse:
raise NotImplementedError

@abstractmethod
def get_ml_model_download_tokens(
self, model_id: int
) -> DownloadMLModelAuthDataResponse:
raise NotImplementedError

@abstractmethod
def run_prediction(
self, project: entities.ProjectEntity, ml_model_id: int, image_ids: list
) -> ServiceResponse:
raise NotImplementedError

@abstractmethod
def get_project_images_count(
self, project: entities.ProjectEntity
Expand Down
11 changes: 0 additions & 11 deletions src/superannotate/lib/core/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,6 @@ class Config:
extra = Extra.allow


class MLModel(BaseModel):
name: NotEmptyStr
id: Optional[int]
path: NotEmptyStr
config_path: NotEmptyStr
team_id: Optional[int]

class Config:
extra = Extra.allow


class PriorityScoreEntity(BaseModel):
name: NotEmptyStr
priority: float
Expand Down
Loading