Skip to content

Commit de95605

Browse files
authored
Remove unnecessary fields from the /api/lambda/functions response (#8004)
Remove several fields that haven't been used for one reason or another: * `labels` and `attributes` have been replaced by `labels_v2`. Keeping them around nearly triples the response length. * `framework` hasn't been used by the UI since #5635, and IMO was never useful to begin with. There are no decisions that the UI can take based on this field, so it's essentially just a freeform text field, and we already have a freeform text field - `description`. (Which... the UI doesn't display either. But it could!) Remove the `framework` field from the function descriptions as well, since it has no other purpose. * `state` has, as far I could determine, never been used by the UI. I could see a field like this potentially being useful (e.g. the UI could still display a function, but prevent it from being used if it's unavailable), but since none of that is implemented right now, I see no reason to have this field in the API.
1 parent 14b65ac commit de95605

File tree

30 files changed

+1
-51
lines changed

30 files changed

+1
-51
lines changed

cvat-core/src/core-types.ts

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export interface SerializedModel {
3737
name?: string;
3838
labels_v2?: MLModelLabel[];
3939
version?: number;
40-
framework?: string;
4140
description?: string;
4241
kind?: ModelKind;
4342
type?: string;

cvat-core/src/ml-model.ts

-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ export default class MLModel {
3535
return this.serialized.version;
3636
}
3737

38-
public get framework(): string {
39-
return this.serialized.framework;
40-
}
41-
4238
public get description(): string {
4339
return this.serialized.description;
4440
}

cvat/apps/lambda_manager/tests/test_lambda.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@
3636
id_function_state_building = "test-model-has-state-building"
3737
id_function_state_error = "test-model-has-state-error"
3838

39-
expected_keys_in_response_all_functions = ["id", "kind", "labels", "description", "framework", "name"]
39+
expected_keys_in_response_all_functions = ["id", "kind", "labels_v2", "description", "name"]
4040
expected_keys_in_response_function_interactor = expected_keys_in_response_all_functions + ["min_pos_points", "startswith_box"]
41-
expected_keys_in_response_function_tracker = expected_keys_in_response_all_functions + ["state"]
4241
expected_keys_in_response_requests = ["id", "function", "status", "progress", "enqueued", "started", "ended", "exc_info"]
4342

4443
path = os.path.join(os.path.dirname(__file__), 'assets', 'tasks.json')
@@ -247,9 +246,6 @@ def _check_expected_keys_in_response_function(self, data):
247246
if kind == "interactor":
248247
for key in expected_keys_in_response_function_interactor:
249248
self.assertIn(key, data)
250-
elif kind == "tracker":
251-
for key in expected_keys_in_response_function_tracker:
252-
self.assertIn(key, data)
253249
else:
254250
for key in expected_keys_in_response_all_functions:
255251
self.assertIn(key, data)

cvat/apps/lambda_manager/views.py

-15
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,10 @@ def parse_attributes(attrs_spec):
185185
raise ValidationError(
186186
"`{}` lambda function has non-unique attributes for label {}".format(self.id, label),
187187
code=status.HTTP_404_NOT_FOUND)
188-
# state of the function
189-
self.state = data['status']['state']
190188
# description of the function
191189
self.description = data['spec']['description']
192190
# http port to access the serverless function
193191
self.port = data["status"].get("httpPort")
194-
# framework which is used for the function (e.g. tensorflow, openvino)
195-
self.framework = meta_anno.get('framework')
196192
# display name for the function
197193
self.name = meta_anno.get('name', self.id)
198194
self.min_pos_points = int(meta_anno.get('min_pos_points', 1))
@@ -207,10 +203,8 @@ def to_dict(self):
207203
response = {
208204
'id': self.id,
209205
'kind': str(self.kind),
210-
'labels': [label['name'] for label in self.labels],
211206
'labels_v2': self.labels,
212207
'description': self.description,
213-
'framework': self.framework,
214208
'name': self.name,
215209
'version': self.version
216210
}
@@ -224,15 +218,6 @@ def to_dict(self):
224218
'animated_gif': self.animated_gif
225219
})
226220

227-
if self.kind is LambdaType.TRACKER:
228-
response.update({
229-
'state': self.state
230-
})
231-
if self.kind is LambdaType.DETECTOR:
232-
response.update({
233-
'attributes': self.func_attributes
234-
})
235-
236221
return response
237222

238223
def invoke(

serverless/onnx/WongKinYiu/yolov7/nuclio/function-gpu.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ metadata:
44
annotations:
55
name: YOLO v7
66
type: detector
7-
framework: onnx
87
spec: |
98
[
109
{ "id": 0, "name": "person", "type": "rectangle" },

serverless/onnx/WongKinYiu/yolov7/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ metadata:
44
annotations:
55
name: YOLO v7
66
type: detector
7-
framework: onnx
87
spec: |
98
[
109
{ "id": 0, "name": "person", "type": "rectangle" },

serverless/openvino/dextr/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ metadata:
66
version: 2
77
type: interactor
88
spec:
9-
framework: openvino
109
min_pos_points: 4
1110
animated_gif: https://raw.githubusercontent.com/opencv/cvat/0fbb19ae3846a017853d52e187f0ce149adced7d/site/content/en/images/dextr_example.gif
1211
help_message: The interactor allows to get a mask of an object using its extreme points (more or equal than 4). You can add a point left-clicking the image

serverless/openvino/omz/intel/face-detection-0205/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ metadata:
44
annotations:
55
name: Attributed face detection
66
type: detector
7-
framework: openvino
87
spec: |
98
[
109
{ "id": 0, "name": "face", "type": "rectangle", "attributes": [

serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ metadata:
44
annotations:
55
name: Person reidentification
66
type: reid
7-
framework: openvino
87
spec:
98

109
spec:

serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ metadata:
44
annotations:
55
name: Semantic segmentation for ADAS
66
type: detector
7-
framework: openvino
87
spec: |
98
[
109
{ "id": 0, "name": "road", "type": "mask" },

serverless/openvino/omz/intel/text-detection-0004/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ metadata:
44
annotations:
55
name: Text detection v4
66
type: detector
7-
framework: openvino
87
spec: |
98
[
109
{ "id": 1, "name": "text", "type": "mask" }

serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ metadata:
44
annotations:
55
name: Faster RCNN
66
type: detector
7-
framework: openvino
87
spec: |
98
[
109
{ "id": 1, "name": "person", "type": "rectangle" },

serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ metadata:
77
annotations:
88
name: Mask RCNN
99
type: detector
10-
framework: openvino
1110
spec: |
1211
[
1312
{ "id": 1, "name": "person", "type": "mask" },

serverless/openvino/omz/public/yolo-v3-tf/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ metadata:
44
annotations:
55
name: YOLO v3
66
type: detector
7-
framework: openvino
87
spec: |
98
[
109
{ "id": 0, "name": "person", "type": "rectangle" },

serverless/pytorch/dschoerk/transt/nuclio/function-gpu.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ metadata:
55
name: TransT
66
type: tracker
77
spec:
8-
framework: pytorch
98

109
spec:
1110
description: Fast Online Object Tracking and Segmentation

serverless/pytorch/dschoerk/transt/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ metadata:
55
name: TransT
66
type: tracker
77
spec:
8-
framework: pytorch
98

109
spec:
1110
description: Fast Online Object Tracking and Segmentation

serverless/pytorch/facebookresearch/detectron2/retinanet_r101/nuclio/function-gpu.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ metadata:
44
annotations:
55
name: RetinaNet R101
66
type: detector
7-
framework: pytorch
87
spec: |
98
[
109
{ "id": 1, "name": "person", "type": "rectangle" },

serverless/pytorch/facebookresearch/detectron2/retinanet_r101/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ metadata:
44
annotations:
55
name: RetinaNet R101
66
type: detector
7-
framework: pytorch
87
spec: |
98
[
109
{ "id": 1, "name": "person", "type": "rectangle" },

serverless/pytorch/facebookresearch/sam/nuclio/function-gpu.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ metadata:
1010
version: 2
1111
type: interactor
1212
spec:
13-
framework: pytorch
1413
min_pos_points: 1
1514
min_neg_points: 0
1615
animated_gif: https://raw.githubusercontent.com/cvat-ai/cvat/develop/site/content/en/images/hrnet_example.gif

serverless/pytorch/facebookresearch/sam/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ metadata:
1010
version: 2
1111
type: interactor
1212
spec:
13-
framework: pytorch
1413
min_pos_points: 1
1514
min_neg_points: 0
1615
animated_gif: https://raw.githubusercontent.com/cvat-ai/cvat/develop/site/content/en/images/hrnet_example.gif

serverless/pytorch/foolwood/siammask/nuclio/function-gpu.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ metadata:
55
name: SiamMask
66
type: tracker
77
spec:
8-
framework: pytorch
98

109
spec:
1110
description: Fast Online Object Tracking and Segmentation

serverless/pytorch/foolwood/siammask/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ metadata:
55
name: SiamMask
66
type: tracker
77
spec:
8-
framework: pytorch
98

109
spec:
1110
description: Fast Online Object Tracking and Segmentation

serverless/pytorch/mmpose/hrnet32/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ metadata:
44
annotations:
55
name: Human pose estimation
66
type: detector
7-
framework: pytorch
87
spec: |
98
[
109
{

serverless/pytorch/saic-vul/fbrs/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ metadata:
66
version: 2
77
type: interactor
88
spec:
9-
framework: pytorch
109
min_pos_points: 1
1110
min_neg_points: 0
1211
animated_gif: https://raw.githubusercontent.com/cvat-ai/cvat/0fbb19ae3846a017853d52e187f0ce149adced7d/site/content/en/images/fbrs_example.gif

serverless/pytorch/saic-vul/hrnet/nuclio/function-gpu.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ metadata:
66
version: 2
77
type: interactor
88
spec:
9-
framework: pytorch
109
min_pos_points: 1
1110
min_neg_points: 0
1211
animated_gif: https://raw.githubusercontent.com/cvat-ai/cvat/develop/site/content/en/images/hrnet_example.gif

serverless/pytorch/saic-vul/hrnet/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ metadata:
66
version: 2
77
type: interactor
88
spec:
9-
framework: pytorch
109
min_pos_points: 1
1110
min_neg_points: 0
1211
animated_gif: https://raw.githubusercontent.com/cvat-ai/cvat/develop/site/content/en/images/hrnet_example.gif

serverless/pytorch/shiyinzhang/iog/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ metadata:
66
version: 2
77
type: interactor
88
spec:
9-
framework: pytorch
109
min_pos_points: 1
1110
min_neg_points: 0
1211
startswith_box: true

serverless/tensorflow/faster_rcnn_inception_v2_coco/nuclio/function-gpu.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ metadata:
44
annotations:
55
name: Faster RCNN via Tensorflow
66
type: detector
7-
framework: tensorflow
87
spec: |
98
[
109
{ "id": 1, "name": "person", "type": "rectangle" },

serverless/tensorflow/faster_rcnn_inception_v2_coco/nuclio/function.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ metadata:
44
annotations:
55
name: Faster RCNN via Tensorflow
66
type: detector
7-
framework: tensorflow
87
spec: |
98
[
109
{ "id": 1, "name": "person", "type": "rectangle" },

site/content/en/docs/manual/advanced/serverless-tutorial.md

-1
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,6 @@ metadata:
440440
annotations:
441441
name: RetinaNet R101
442442
type: detector
443-
framework: pytorch
444443
spec: |
445444
[
446445
{ "id": 1, "name": "person" },

0 commit comments

Comments
 (0)