superb-ai-onprem 0.9.1__py3-none-any.whl → 0.10.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of superb-ai-onprem might be problematic. Click here for more details.
- spb_onprem/__init__.py +39 -4
- spb_onprem/_version.py +2 -2
- spb_onprem/data/entities/__init__.py +2 -0
- spb_onprem/data/entities/data.py +2 -0
- spb_onprem/data/entities/data_annotation_stats.py +8 -0
- spb_onprem/data/params/data_list.py +7 -2
- spb_onprem/data/params/update_data.py +11 -0
- spb_onprem/data/params/update_data_slice.py +14 -2
- spb_onprem/data/queries.py +12 -1
- spb_onprem/data/service.py +9 -0
- spb_onprem/entities.py +24 -2
- spb_onprem/models/__init__.py +8 -3
- spb_onprem/models/entities/__init__.py +9 -0
- spb_onprem/models/entities/model.py +32 -0
- spb_onprem/models/entities/model_page_info.py +14 -0
- spb_onprem/models/entities/model_train_class.py +15 -0
- spb_onprem/models/params/__init__.py +16 -4
- spb_onprem/models/params/create_model.py +70 -0
- spb_onprem/models/params/delete_model.py +11 -8
- spb_onprem/models/params/model.py +17 -0
- spb_onprem/models/params/models.py +60 -0
- spb_onprem/models/params/pin_model.py +17 -0
- spb_onprem/models/params/unpin_model.py +17 -0
- spb_onprem/models/params/update_model.py +61 -0
- spb_onprem/models/queries.py +224 -19
- spb_onprem/models/service.py +251 -30
- spb_onprem/reports/__init__.py +25 -0
- spb_onprem/reports/entities/__init__.py +10 -0
- spb_onprem/reports/entities/analytics_report.py +22 -0
- spb_onprem/reports/entities/analytics_report_item.py +30 -0
- spb_onprem/reports/entities/analytics_report_page_info.py +14 -0
- spb_onprem/reports/params/__init__.py +29 -0
- spb_onprem/reports/params/analytics_report.py +17 -0
- spb_onprem/reports/params/analytics_reports.py +87 -0
- spb_onprem/reports/params/create_analytics_report.py +35 -0
- spb_onprem/reports/params/create_analytics_report_item.py +47 -0
- spb_onprem/reports/params/delete_analytics_report.py +17 -0
- spb_onprem/reports/params/delete_analytics_report_item.py +20 -0
- spb_onprem/reports/params/update_analytics_report.py +38 -0
- spb_onprem/reports/params/update_analytics_report_item.py +46 -0
- spb_onprem/reports/queries.py +239 -0
- spb_onprem/reports/service.py +328 -0
- spb_onprem/searches.py +18 -0
- {superb_ai_onprem-0.9.1.dist-info → superb_ai_onprem-0.10.0.dist-info}/METADATA +53 -9
- {superb_ai_onprem-0.9.1.dist-info → superb_ai_onprem-0.10.0.dist-info}/RECORD +48 -38
- spb_onprem/models/entities.py +0 -9
- spb_onprem/models/params/get_models.py +0 -29
- spb_onprem/predictions/__init__.py +0 -7
- spb_onprem/predictions/entities.py +0 -11
- spb_onprem/predictions/params/__init__.py +0 -15
- spb_onprem/predictions/params/create_prediction_set.py +0 -44
- spb_onprem/predictions/params/delete_prediction_from_data.py +0 -20
- spb_onprem/predictions/params/delete_prediction_set.py +0 -14
- spb_onprem/predictions/params/get_prediction_set.py +0 -14
- spb_onprem/predictions/params/get_prediction_sets.py +0 -29
- spb_onprem/predictions/params/update_prediction_set_data_info.py +0 -28
- spb_onprem/predictions/queries.py +0 -110
- spb_onprem/predictions/service.py +0 -225
- tests/models/__init__.py +0 -1
- tests/models/test_model_service.py +0 -249
- tests/predictions/__init__.py +0 -1
- tests/predictions/test_prediction_service.py +0 -359
- {superb_ai_onprem-0.9.1.dist-info → superb_ai_onprem-0.10.0.dist-info}/WHEEL +0 -0
- {superb_ai_onprem-0.9.1.dist-info → superb_ai_onprem-0.10.0.dist-info}/licenses/LICENSE +0 -0
- {superb_ai_onprem-0.9.1.dist-info → superb_ai_onprem-0.10.0.dist-info}/top_level.txt +0 -0
spb_onprem/__init__.py
CHANGED
|
@@ -11,7 +11,7 @@ from .activities.service import ActivityService
|
|
|
11
11
|
from .exports.service import ExportService
|
|
12
12
|
from .contents.service import ContentService
|
|
13
13
|
from .models.service import ModelService
|
|
14
|
-
from .
|
|
14
|
+
from .reports.service import ReportService
|
|
15
15
|
|
|
16
16
|
# Core Entities and Enums
|
|
17
17
|
from .entities import (
|
|
@@ -29,9 +29,9 @@ from .entities import (
|
|
|
29
29
|
Export,
|
|
30
30
|
Content,
|
|
31
31
|
Frame,
|
|
32
|
-
Model,
|
|
33
32
|
Comment,
|
|
34
33
|
Reply,
|
|
34
|
+
DataAnnotationStat,
|
|
35
35
|
|
|
36
36
|
# Enums
|
|
37
37
|
DataType,
|
|
@@ -45,6 +45,24 @@ from .entities import (
|
|
|
45
45
|
CommentStatus,
|
|
46
46
|
)
|
|
47
47
|
|
|
48
|
+
# Models and Reports Entities
|
|
49
|
+
from .models import (
|
|
50
|
+
Model,
|
|
51
|
+
ModelTrainClass,
|
|
52
|
+
ModelPageInfo,
|
|
53
|
+
ModelsFilter,
|
|
54
|
+
ModelsFilterOptions,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
from .reports import (
|
|
58
|
+
AnalyticsReport,
|
|
59
|
+
AnalyticsReportItem,
|
|
60
|
+
AnalyticsReportItemType,
|
|
61
|
+
AnalyticsReportPageInfo,
|
|
62
|
+
AnalyticsReportsFilter,
|
|
63
|
+
AnalyticsReportsFilterOptions,
|
|
64
|
+
)
|
|
65
|
+
|
|
48
66
|
# Filters
|
|
49
67
|
from .searches import (
|
|
50
68
|
DateTimeRangeFilterOption,
|
|
@@ -78,6 +96,7 @@ from .searches import (
|
|
|
78
96
|
ActivitiesFilterOptions,
|
|
79
97
|
ExportFilter,
|
|
80
98
|
ExportFilterOptions,
|
|
99
|
+
AnnotationCountsFilter
|
|
81
100
|
)
|
|
82
101
|
|
|
83
102
|
__all__ = (
|
|
@@ -89,7 +108,7 @@ __all__ = (
|
|
|
89
108
|
"ExportService",
|
|
90
109
|
"ContentService",
|
|
91
110
|
"ModelService",
|
|
92
|
-
"
|
|
111
|
+
"ReportService",
|
|
93
112
|
|
|
94
113
|
# Core Entities
|
|
95
114
|
"Data",
|
|
@@ -105,9 +124,24 @@ __all__ = (
|
|
|
105
124
|
"Export",
|
|
106
125
|
"Content",
|
|
107
126
|
"Frame",
|
|
108
|
-
"Model",
|
|
109
127
|
"Comment",
|
|
110
128
|
"Reply",
|
|
129
|
+
"DataAnnotationStat",
|
|
130
|
+
|
|
131
|
+
# Models Entities
|
|
132
|
+
"Model",
|
|
133
|
+
"ModelTrainClass",
|
|
134
|
+
"ModelPageInfo",
|
|
135
|
+
"ModelsFilter",
|
|
136
|
+
"ModelsFilterOptions",
|
|
137
|
+
|
|
138
|
+
# Reports Entities
|
|
139
|
+
"AnalyticsReport",
|
|
140
|
+
"AnalyticsReportItem",
|
|
141
|
+
"AnalyticsReportItemType",
|
|
142
|
+
"AnalyticsReportPageInfo",
|
|
143
|
+
"AnalyticsReportsFilter",
|
|
144
|
+
"AnalyticsReportsFilterOptions",
|
|
111
145
|
|
|
112
146
|
# Enums
|
|
113
147
|
"DataType",
|
|
@@ -152,4 +186,5 @@ __all__ = (
|
|
|
152
186
|
"ActivitiesFilterOptions",
|
|
153
187
|
"ExportFilter",
|
|
154
188
|
"ExportFilterOptions",
|
|
189
|
+
"AnnotationCountsFilter",
|
|
155
190
|
)
|
spb_onprem/_version.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.
|
|
32
|
-
__version_tuple__ = version_tuple = (0,
|
|
31
|
+
__version__ = version = '0.10.0'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 10, 0)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -5,6 +5,7 @@ from .data import Data
|
|
|
5
5
|
from .scene import Scene
|
|
6
6
|
from .data_slice import DataSlice
|
|
7
7
|
from .frame import Frame
|
|
8
|
+
from .data_annotation_stats import DataAnnotationStat
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
__all__ = (
|
|
@@ -17,4 +18,5 @@ __all__ = (
|
|
|
17
18
|
"Reply",
|
|
18
19
|
"DataMeta",
|
|
19
20
|
"DataSlice",
|
|
21
|
+
"DataAnnotationStat",
|
|
20
22
|
)
|
spb_onprem/data/entities/data.py
CHANGED
|
@@ -7,6 +7,7 @@ from .data_meta import DataMeta
|
|
|
7
7
|
from .data_slice import DataSlice
|
|
8
8
|
from .frame import Frame
|
|
9
9
|
from spb_onprem.contents.entities import BaseContent
|
|
10
|
+
from .data_annotation_stats import DataAnnotationStat
|
|
10
11
|
|
|
11
12
|
class Data(CustomBaseModel):
|
|
12
13
|
"""
|
|
@@ -28,6 +29,7 @@ class Data(CustomBaseModel):
|
|
|
28
29
|
|
|
29
30
|
# 어노테이션 및 예측
|
|
30
31
|
annotation: Optional[Annotation] = Field(None, description="어노테이션 데이터")
|
|
32
|
+
annotation_stats: Optional[List[AnnotationStat]] = Field(None, alias="annotationStats", description="어노테이션 통계 정보")
|
|
31
33
|
|
|
32
34
|
# 메타데이터
|
|
33
35
|
meta: Optional[List[DataMeta]] = Field(None, description="커스텀 메타데이터 목록")
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
class DataAnnotationStat(CustomBaseModel):
|
|
4
|
+
type: Optional[str] = Field(None, description="어노테이션 타입")
|
|
5
|
+
group: Optional[str] = Field(None, description="어노테이션 그룹")
|
|
6
|
+
annotation_class: Optional[str] = Field(None, alias="annotationClass", description="어노테이션 클래스")
|
|
7
|
+
sub_class: Optional[str] = Field(None, alias="subClass", description="어노테이션 서브 클래스")
|
|
8
|
+
count: Optional[int] = Field(None, description="어노테이션 개수")
|
|
@@ -173,10 +173,14 @@ class DistanceCountFilter(CustomBaseModel):
|
|
|
173
173
|
distance_range: NumericRangeFilter = Field(..., alias="distanceRange")
|
|
174
174
|
count_range: NumericRangeFilter = Field(..., alias="countRange")
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
|
|
177
|
+
class AnnotationCountsFilter(CustomBaseModel):
|
|
177
178
|
annotation_class: Optional[List[CountFilter]] = Field(None, alias="class")
|
|
178
179
|
group: Optional[List[CountFilter]] = None
|
|
179
180
|
sub_class: Optional[List[CountFilter]] = Field(None, alias="subClass")
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
class FrameCountsFilter(AnnotationCountsFilter):
|
|
180
184
|
distance: Optional[List[DistanceCountFilter]] = None
|
|
181
185
|
|
|
182
186
|
# === Frame 필터 ===
|
|
@@ -227,6 +231,7 @@ class DataFilterOptions(CustomBaseModel):
|
|
|
227
231
|
# 메타데이터 및 기타
|
|
228
232
|
meta: Optional[MetaFilter] = Field(None, description="커스텀 메타데이터 필터")
|
|
229
233
|
assigned_to_user: Optional[str] = Field(None, alias="assignedToUser", description="할당된 사용자")
|
|
234
|
+
annotation_counts: Optional[AnnotationCountsFilter] = Field(None, alias="annotationCounts", description="어노테이션 개수 필터")
|
|
230
235
|
|
|
231
236
|
class DataSliceStatusFilterOption(CustomBaseModel):
|
|
232
237
|
status_in: Optional[List[str]] = Field(None, alias="in")
|
|
@@ -261,6 +266,7 @@ class DataSlicePropertiesFilter(CustomBaseModel):
|
|
|
261
266
|
comments: Optional[DataSliceCommentFilterOption] = None
|
|
262
267
|
meta: Optional[MetaFilter] = None
|
|
263
268
|
assigned_to_user: Optional[str] = Field(None, alias="assignedToUser")
|
|
269
|
+
annotation_counts: Optional[AnnotationCountsFilter] = Field(None, alias="annotationCounts")
|
|
264
270
|
|
|
265
271
|
class DataSliceFilter(CustomBaseModel):
|
|
266
272
|
id: str
|
|
@@ -270,7 +276,6 @@ class DataSliceFilter(CustomBaseModel):
|
|
|
270
276
|
|
|
271
277
|
class FrameFilter(CustomBaseModel):
|
|
272
278
|
conditions: Optional[FrameFilterOptions] = None
|
|
273
|
-
mode: Optional[Union[str, Literal["INDIVIDUAL_FRAMES", "DATA_SUMMARY"]]] = "INDIVIDUAL_FRAMES"
|
|
274
279
|
matching_frame_count: Optional[NumericRangeFilter] = Field(None, alias="matchingFrameCount")
|
|
275
280
|
|
|
276
281
|
|
|
@@ -9,6 +9,7 @@ from spb_onprem.base_types import (
|
|
|
9
9
|
)
|
|
10
10
|
from spb_onprem.data.entities import (
|
|
11
11
|
DataMeta,
|
|
12
|
+
DataAnnotationStat,
|
|
12
13
|
)
|
|
13
14
|
|
|
14
15
|
|
|
@@ -23,6 +24,10 @@ def update_params(
|
|
|
23
24
|
Optional[List[DataMeta]],
|
|
24
25
|
UndefinedType
|
|
25
26
|
] = Undefined,
|
|
27
|
+
annotation_stats: Union[
|
|
28
|
+
Optional[List[DataAnnotationStat]],
|
|
29
|
+
UndefinedType
|
|
30
|
+
] = Undefined
|
|
26
31
|
):
|
|
27
32
|
"""Make the variables for the updateData query.
|
|
28
33
|
|
|
@@ -31,6 +36,7 @@ def update_params(
|
|
|
31
36
|
data_id (str): The ID of the data.
|
|
32
37
|
key (str): The key of the data.
|
|
33
38
|
meta (List[DataMeta]): The meta of the data.
|
|
39
|
+
annotation_stats (List[DataAnnotationStat]): The annotation stats of the data.
|
|
34
40
|
"""
|
|
35
41
|
variables = {
|
|
36
42
|
"datasetId": dataset_id,
|
|
@@ -52,4 +58,9 @@ def update_params(
|
|
|
52
58
|
for meta_item in meta
|
|
53
59
|
] if meta is not None else None
|
|
54
60
|
|
|
61
|
+
if annotation_stats is not Undefined:
|
|
62
|
+
variables["annotation_stats"] = [
|
|
63
|
+
stat.model_dump(by_alias=True, exclude_unset=True) for stat in annotation_stats
|
|
64
|
+
] if annotation_stats is not None else None
|
|
65
|
+
|
|
55
66
|
return variables
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
from typing import Any, Optional, Union
|
|
1
|
+
from typing import Any, Optional, Union, List
|
|
2
2
|
from spb_onprem.base_types import (
|
|
3
3
|
Undefined,
|
|
4
4
|
UndefinedType,
|
|
5
5
|
)
|
|
6
|
+
from spb_onprem.data.entities import (
|
|
7
|
+
DataAnnotationStat,
|
|
8
|
+
)
|
|
6
9
|
|
|
7
10
|
|
|
8
11
|
def update_data_slice_params(
|
|
@@ -13,6 +16,10 @@ def update_data_slice_params(
|
|
|
13
16
|
Optional[dict],
|
|
14
17
|
UndefinedType
|
|
15
18
|
] = Undefined,
|
|
19
|
+
annotation_stats: Union[
|
|
20
|
+
Optional[List[DataAnnotationStat]],
|
|
21
|
+
UndefinedType
|
|
22
|
+
] = Undefined
|
|
16
23
|
):
|
|
17
24
|
"""Make the variables for the updateDataSlice query.
|
|
18
25
|
|
|
@@ -27,7 +34,12 @@ def update_data_slice_params(
|
|
|
27
34
|
"data_id": data_id,
|
|
28
35
|
"slice_id": slice_id,
|
|
29
36
|
}
|
|
30
|
-
|
|
37
|
+
|
|
38
|
+
if annotation_stats is not Undefined:
|
|
39
|
+
params["annotation_stats"] = [
|
|
40
|
+
stat.model_dump(by_alias=True, exclude_unset=True) for stat in annotation_stats
|
|
41
|
+
] if annotation_stats is not None else None
|
|
42
|
+
|
|
31
43
|
if meta is not Undefined:
|
|
32
44
|
params["meta"] = meta
|
|
33
45
|
|
spb_onprem/data/queries.py
CHANGED
|
@@ -71,6 +71,13 @@ class Schemas:
|
|
|
71
71
|
meta
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
+
annotationStats {
|
|
75
|
+
type
|
|
76
|
+
group
|
|
77
|
+
annotationClass
|
|
78
|
+
subClass
|
|
79
|
+
count
|
|
80
|
+
}
|
|
74
81
|
meta {
|
|
75
82
|
key
|
|
76
83
|
type
|
|
@@ -172,12 +179,14 @@ class Queries():
|
|
|
172
179
|
$data_id: ID!,
|
|
173
180
|
$key: String,
|
|
174
181
|
$meta: [DataMetaInput!]
|
|
182
|
+
$annotation_stats: [DataAnnotationStatInput!]
|
|
175
183
|
) {{
|
|
176
184
|
updateData(
|
|
177
185
|
datasetId: $dataset_id,
|
|
178
186
|
id: $data_id,
|
|
179
187
|
key: $key,
|
|
180
|
-
meta: $meta
|
|
188
|
+
meta: $meta,
|
|
189
|
+
annotationStats: $annotation_stats,
|
|
181
190
|
)
|
|
182
191
|
{{
|
|
183
192
|
{Schemas.DATA}
|
|
@@ -541,12 +550,14 @@ class Queries():
|
|
|
541
550
|
$data_id: ID!,
|
|
542
551
|
$slice_id: ID!,
|
|
543
552
|
$meta: JSONObject!,
|
|
553
|
+
$annotation_stats: [DataAnnotationStatInput!],
|
|
544
554
|
) {{
|
|
545
555
|
updateDataSlice(
|
|
546
556
|
datasetId: $dataset_id,
|
|
547
557
|
dataId: $data_id,
|
|
548
558
|
sliceId: $slice_id,
|
|
549
559
|
meta: $meta,
|
|
560
|
+
annotationStats: $annotation_stats,
|
|
550
561
|
) {{
|
|
551
562
|
{Schemas.DATA}
|
|
552
563
|
}}
|
spb_onprem/data/service.py
CHANGED
|
@@ -198,6 +198,10 @@ class DataService(BaseService):
|
|
|
198
198
|
List[DataMeta],
|
|
199
199
|
UndefinedType,
|
|
200
200
|
] = Undefined,
|
|
201
|
+
annotation_stats: Union[
|
|
202
|
+
Optional[List[DataAnnotationStat]],
|
|
203
|
+
UndefinedType,
|
|
204
|
+
] = Undefined,
|
|
201
205
|
):
|
|
202
206
|
"""Update a data.
|
|
203
207
|
|
|
@@ -217,6 +221,7 @@ class DataService(BaseService):
|
|
|
217
221
|
data_id=data_id,
|
|
218
222
|
key=key,
|
|
219
223
|
meta=meta,
|
|
224
|
+
annotation_stats=annotation_stats,
|
|
220
225
|
)
|
|
221
226
|
)
|
|
222
227
|
data = Data.model_validate(response)
|
|
@@ -665,6 +670,10 @@ class DataService(BaseService):
|
|
|
665
670
|
Optional[dict],
|
|
666
671
|
UndefinedType
|
|
667
672
|
] = Undefined,
|
|
673
|
+
annotation_stats: Union]
|
|
674
|
+
Optional[List[DataAnnotationStat]],
|
|
675
|
+
UndefinedType
|
|
676
|
+
] = Undefined,
|
|
668
677
|
):
|
|
669
678
|
"""Update the metadata of a data slice.
|
|
670
679
|
|
spb_onprem/entities.py
CHANGED
|
@@ -8,6 +8,7 @@ from .data.entities import (
|
|
|
8
8
|
Frame,
|
|
9
9
|
Comment,
|
|
10
10
|
Reply,
|
|
11
|
+
DataAnnotationStat,
|
|
11
12
|
)
|
|
12
13
|
from .data.entities.comment import CommentStatus
|
|
13
14
|
from .datasets.entities import Dataset
|
|
@@ -28,7 +29,17 @@ from .activities.entities import (
|
|
|
28
29
|
)
|
|
29
30
|
from .exports.entities import Export
|
|
30
31
|
from .contents.entities import Content
|
|
31
|
-
from .models.entities import
|
|
32
|
+
from .models.entities import (
|
|
33
|
+
Model,
|
|
34
|
+
ModelTrainClass,
|
|
35
|
+
ModelPageInfo,
|
|
36
|
+
)
|
|
37
|
+
from .reports.entities import (
|
|
38
|
+
AnalyticsReport,
|
|
39
|
+
AnalyticsReportItem,
|
|
40
|
+
AnalyticsReportItemType,
|
|
41
|
+
AnalyticsReportPageInfo,
|
|
42
|
+
)
|
|
32
43
|
|
|
33
44
|
__all__ = [
|
|
34
45
|
# Core Entities
|
|
@@ -45,9 +56,20 @@ __all__ = [
|
|
|
45
56
|
"Export",
|
|
46
57
|
"Content",
|
|
47
58
|
"Frame",
|
|
48
|
-
"Model",
|
|
49
59
|
"Comment",
|
|
50
60
|
"Reply",
|
|
61
|
+
"DataAnnotationStat",
|
|
62
|
+
|
|
63
|
+
# Models Entities
|
|
64
|
+
"Model",
|
|
65
|
+
"ModelTrainClass",
|
|
66
|
+
"ModelPageInfo",
|
|
67
|
+
|
|
68
|
+
# Reports Entities
|
|
69
|
+
"AnalyticsReport",
|
|
70
|
+
"AnalyticsReportItem",
|
|
71
|
+
"AnalyticsReportItemType",
|
|
72
|
+
"AnalyticsReportPageInfo",
|
|
51
73
|
|
|
52
74
|
# Enums
|
|
53
75
|
"DataType",
|
spb_onprem/models/__init__.py
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
from .service import ModelService
|
|
2
|
-
from .entities import Model
|
|
2
|
+
from .entities import Model, ModelTrainClass, ModelPageInfo
|
|
3
|
+
from .params import ModelsFilter, ModelsFilterOptions
|
|
3
4
|
|
|
4
|
-
__all__ =
|
|
5
|
+
__all__ = (
|
|
5
6
|
"ModelService",
|
|
6
7
|
"Model",
|
|
7
|
-
|
|
8
|
+
"ModelTrainClass",
|
|
9
|
+
"ModelPageInfo",
|
|
10
|
+
"ModelsFilter",
|
|
11
|
+
"ModelsFilterOptions",
|
|
12
|
+
)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from typing import Optional, List, Any
|
|
2
|
+
from spb_onprem.base_model import CustomBaseModel, Field
|
|
3
|
+
from spb_onprem.contents.entities.base_content import BaseContent
|
|
4
|
+
from spb_onprem.slices.entities.slice import Slice
|
|
5
|
+
from .model_train_class import ModelTrainClass
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Model(CustomBaseModel):
|
|
9
|
+
"""
|
|
10
|
+
모델 엔터티
|
|
11
|
+
|
|
12
|
+
머신러닝 모델의 정보와 학습 상태, 성능 지표를 포함합니다.
|
|
13
|
+
"""
|
|
14
|
+
id: Optional[str] = Field(None, description="모델 고유 식별자")
|
|
15
|
+
dataset_id: Optional[str] = Field(None, alias="datasetId", description="이 모델이 속한 데이터셋 ID")
|
|
16
|
+
baseline_model: Optional[str] = Field(None, alias="baselineModel", description="사용된 베이스라인 모델")
|
|
17
|
+
name: Optional[str] = Field(None, description="모델 이름")
|
|
18
|
+
description: Optional[str] = Field(None, description="모델 설명")
|
|
19
|
+
training_classes: Optional[List[ModelTrainClass]] = Field(None, alias="trainingClasses", description="모델의 학습 클래스")
|
|
20
|
+
training_data_count: Optional[int] = Field(None, alias="trainingDataCount", description="학습용 데이터 수")
|
|
21
|
+
validation_data_count: Optional[int] = Field(None, alias="validationDataCount", description="검증용 데이터 수")
|
|
22
|
+
is_pinned: Optional[bool] = Field(None, alias="isPinned", description="모델 즐겨찾기 고정 여부")
|
|
23
|
+
is_trained: Optional[bool] = Field(None, alias="isTrained", description="모델 학습 완료 여부")
|
|
24
|
+
trained_at: Optional[str] = Field(None, alias="trainedAt", description="모델 학습 완료 일시 (ISO 8601)")
|
|
25
|
+
model_content: Optional[BaseContent] = Field(None, alias="modelContent", description="모델 컨텐츠 베이스")
|
|
26
|
+
created_by: Optional[str] = Field(None, alias="createdBy", description="생성자")
|
|
27
|
+
created_at: Optional[str] = Field(None, alias="createdAt", description="생성일시 (ISO 8601)")
|
|
28
|
+
updated_by: Optional[str] = Field(None, alias="updatedBy", description="수정자")
|
|
29
|
+
updated_at: Optional[str] = Field(None, alias="updatedAt", description="수정일시 (ISO 8601)")
|
|
30
|
+
meta: Optional[Any] = Field(None, description="추가 메타데이터 (JSONObject)")
|
|
31
|
+
training_slices: Optional[List[Slice]] = Field(None, alias="trainingSlices", description="모델의 학습용 슬라이스")
|
|
32
|
+
validation_slices: Optional[List[Slice]] = Field(None, alias="validationSlices", description="모델의 검증용 슬라이스")
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from typing import Optional, List
|
|
2
|
+
from spb_onprem.base_model import CustomBaseModel, Field
|
|
3
|
+
from .model import Model
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ModelPageInfo(CustomBaseModel):
|
|
7
|
+
"""
|
|
8
|
+
모델 페이지 정보 엔터티
|
|
9
|
+
|
|
10
|
+
모델 목록 조회 시 페이지네이션 정보를 포함합니다.
|
|
11
|
+
"""
|
|
12
|
+
models: Optional[List[Model]] = Field(None, description="쿼리와 일치하는 모델 목록")
|
|
13
|
+
next: Optional[str] = Field(None, description="페이지네이션에 사용할 커서")
|
|
14
|
+
total_count: Optional[int] = Field(None, alias="totalCount", description="쿼리와 일치하는 모델의 총 개수")
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
from spb_onprem.base_model import CustomBaseModel, Field
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ModelTrainClass(CustomBaseModel):
|
|
6
|
+
"""
|
|
7
|
+
모델 학습 클래스 엔터티
|
|
8
|
+
|
|
9
|
+
모델 학습에 사용되는 클래스별 정보와 성능 지표를 포함합니다.
|
|
10
|
+
"""
|
|
11
|
+
class_name: Optional[str] = Field(None, alias="class", description="모델 학습 클래스 이름")
|
|
12
|
+
annotation_type: Optional[str] = Field(None, alias="annotationType", description="어노테이션 타입")
|
|
13
|
+
ap: Optional[float] = Field(None, description="AP (Average Precision) 점수")
|
|
14
|
+
training_annotations_count: Optional[int] = Field(None, alias="trainingAnnotationsCount", description="학습용 어노테이션 수")
|
|
15
|
+
validation_annotations_count: Optional[int] = Field(None, alias="validationAnnotationsCount", description="검증용 어노테이션 수")
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
from .
|
|
1
|
+
from .models import models_params, ModelsFilter, ModelsFilterOptions
|
|
2
|
+
from .model import model_params
|
|
3
|
+
from .create_model import create_model_params
|
|
4
|
+
from .update_model import update_model_params
|
|
5
|
+
from .pin_model import pin_model_params
|
|
6
|
+
from .unpin_model import unpin_model_params
|
|
2
7
|
from .delete_model import delete_model_params
|
|
3
8
|
|
|
4
|
-
__all__ =
|
|
5
|
-
"
|
|
9
|
+
__all__ = (
|
|
10
|
+
"models_params",
|
|
11
|
+
"model_params",
|
|
12
|
+
"create_model_params",
|
|
13
|
+
"update_model_params",
|
|
14
|
+
"pin_model_params",
|
|
15
|
+
"unpin_model_params",
|
|
6
16
|
"delete_model_params",
|
|
7
|
-
|
|
17
|
+
"ModelsFilter",
|
|
18
|
+
"ModelsFilterOptions",
|
|
19
|
+
)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
from typing import List, Union, Any, Optional
|
|
2
|
+
from spb_onprem.base_types import Undefined, UndefinedType
|
|
3
|
+
from spb_onprem.models.entities.model_train_class import ModelTrainClass
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def create_model_params(
|
|
7
|
+
dataset_id: str,
|
|
8
|
+
name: str,
|
|
9
|
+
baseline_model: str,
|
|
10
|
+
training_slice_ids: List[str],
|
|
11
|
+
validation_slice_ids: List[str],
|
|
12
|
+
description: Union[str, UndefinedType] = Undefined,
|
|
13
|
+
training_classes: Union[List[ModelTrainClass], UndefinedType] = Undefined,
|
|
14
|
+
model_content_id: Union[str, UndefinedType] = Undefined,
|
|
15
|
+
is_trained: Union[bool, UndefinedType] = Undefined,
|
|
16
|
+
trained_at: Union[str, UndefinedType] = Undefined,
|
|
17
|
+
is_pinned: Union[bool, UndefinedType] = Undefined,
|
|
18
|
+
meta: Union[Any, UndefinedType] = Undefined,
|
|
19
|
+
):
|
|
20
|
+
"""Get parameters for creating a model.
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
dataset_id: The dataset ID
|
|
24
|
+
name: The model name
|
|
25
|
+
baseline_model: The baseline model used
|
|
26
|
+
training_slice_ids: The IDs of the training slices
|
|
27
|
+
validation_slice_ids: The IDs of the validation slices
|
|
28
|
+
description: Optional model description
|
|
29
|
+
training_classes: Optional training classes
|
|
30
|
+
model_content_id: Optional model content ID
|
|
31
|
+
is_trained: Optional trained status
|
|
32
|
+
trained_at: Optional trained timestamp
|
|
33
|
+
is_pinned: Optional pinned status
|
|
34
|
+
meta: Optional metadata
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
dict: Parameters for creating a model
|
|
38
|
+
"""
|
|
39
|
+
params = {
|
|
40
|
+
"datasetId": dataset_id,
|
|
41
|
+
"name": name,
|
|
42
|
+
"baselineModel": baseline_model,
|
|
43
|
+
"trainingSliceIds": training_slice_ids,
|
|
44
|
+
"validationSliceIds": validation_slice_ids,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if not isinstance(description, UndefinedType):
|
|
48
|
+
params["description"] = description
|
|
49
|
+
|
|
50
|
+
if not isinstance(training_classes, UndefinedType):
|
|
51
|
+
params["trainingClasses"] = [
|
|
52
|
+
tc.model_dump(by_alias=True, exclude_unset=True) for tc in training_classes
|
|
53
|
+
] if training_classes is not None else None
|
|
54
|
+
|
|
55
|
+
if not isinstance(model_content_id, UndefinedType):
|
|
56
|
+
params["modelContentId"] = model_content_id
|
|
57
|
+
|
|
58
|
+
if not isinstance(is_trained, UndefinedType):
|
|
59
|
+
params["isTrained"] = is_trained
|
|
60
|
+
|
|
61
|
+
if not isinstance(trained_at, UndefinedType):
|
|
62
|
+
params["trainedAt"] = trained_at
|
|
63
|
+
|
|
64
|
+
if not isinstance(is_pinned, UndefinedType):
|
|
65
|
+
params["isPinned"] = is_pinned
|
|
66
|
+
|
|
67
|
+
if not isinstance(meta, UndefinedType):
|
|
68
|
+
params["meta"] = meta
|
|
69
|
+
|
|
70
|
+
return params
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
def delete_model_params(
|
|
2
|
-
|
|
1
|
+
def delete_model_params(
|
|
2
|
+
dataset_id: str,
|
|
3
|
+
model_id: str,
|
|
4
|
+
):
|
|
5
|
+
"""Get parameters for deleting a model.
|
|
3
6
|
|
|
4
7
|
Args:
|
|
5
|
-
dataset_id
|
|
6
|
-
model_id
|
|
8
|
+
dataset_id: The dataset ID
|
|
9
|
+
model_id: The model ID
|
|
7
10
|
|
|
8
11
|
Returns:
|
|
9
|
-
dict:
|
|
12
|
+
dict: Parameters for deleting a model
|
|
10
13
|
"""
|
|
11
14
|
return {
|
|
12
|
-
"
|
|
13
|
-
"id": model_id
|
|
14
|
-
}
|
|
15
|
+
"datasetId": dataset_id,
|
|
16
|
+
"id": model_id,
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
def model_params(
|
|
2
|
+
dataset_id: str,
|
|
3
|
+
model_id: str,
|
|
4
|
+
):
|
|
5
|
+
"""Get parameters for retrieving a single model.
|
|
6
|
+
|
|
7
|
+
Args:
|
|
8
|
+
dataset_id: The dataset ID
|
|
9
|
+
model_id: The model ID
|
|
10
|
+
|
|
11
|
+
Returns:
|
|
12
|
+
dict: Parameters for retrieving a model
|
|
13
|
+
"""
|
|
14
|
+
return {
|
|
15
|
+
"datasetId": dataset_id,
|
|
16
|
+
"modelId": model_id,
|
|
17
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from typing import Optional, List, Union
|
|
2
|
+
|
|
3
|
+
from spb_onprem.base_model import CustomBaseModel, Field
|
|
4
|
+
from spb_onprem.base_types import Undefined, UndefinedType
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ModelsFilterOptions(CustomBaseModel):
|
|
8
|
+
"""Options for filtering models.
|
|
9
|
+
|
|
10
|
+
Attributes:
|
|
11
|
+
name_contains: Filter models by name containing this string
|
|
12
|
+
id_in: Filter models by list of IDs
|
|
13
|
+
is_pinned: Filter models by pinned status
|
|
14
|
+
is_trained: Filter models by trained status
|
|
15
|
+
"""
|
|
16
|
+
name_contains: Optional[str] = Field(None, alias="nameContains")
|
|
17
|
+
id_in: Optional[List[str]] = Field(None, alias="idIn")
|
|
18
|
+
is_pinned: Optional[bool] = Field(None, alias="isPinned")
|
|
19
|
+
is_trained: Optional[bool] = Field(None, alias="isTrained")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ModelsFilter(CustomBaseModel):
|
|
23
|
+
"""Filter criteria for model queries.
|
|
24
|
+
|
|
25
|
+
Attributes:
|
|
26
|
+
must_filter: Conditions that must be met
|
|
27
|
+
not_filter: Conditions that must not be met
|
|
28
|
+
"""
|
|
29
|
+
must_filter: Optional[ModelsFilterOptions] = Field(None, alias="must")
|
|
30
|
+
not_filter: Optional[ModelsFilterOptions] = Field(None, alias="not")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def models_params(
|
|
34
|
+
dataset_id: str,
|
|
35
|
+
models_filter: Union[
|
|
36
|
+
ModelsFilter,
|
|
37
|
+
UndefinedType
|
|
38
|
+
] = Undefined,
|
|
39
|
+
cursor: Optional[str] = None,
|
|
40
|
+
length: Optional[int] = 10
|
|
41
|
+
):
|
|
42
|
+
"""Get parameters for listing models.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
dataset_id: Required dataset ID
|
|
46
|
+
models_filter: Optional filter criteria for models
|
|
47
|
+
cursor: Optional cursor for pagination
|
|
48
|
+
length: Optional number of items per page (default: 10)
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
dict: Parameters for listing models
|
|
52
|
+
"""
|
|
53
|
+
return {
|
|
54
|
+
"datasetId": dataset_id,
|
|
55
|
+
"filter": models_filter.model_dump(
|
|
56
|
+
by_alias=True, exclude_unset=True
|
|
57
|
+
) if models_filter and not isinstance(models_filter, UndefinedType) else None,
|
|
58
|
+
"cursor": cursor,
|
|
59
|
+
"length": length
|
|
60
|
+
}
|