From de95605a39c68ea425b64408d87d2cfbda8b6eb0 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Wed, 12 Jun 2024 18:41:01 +0300 Subject: [PATCH] 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. --- cvat-core/src/core-types.ts | 1 - cvat-core/src/ml-model.ts | 4 ---- cvat/apps/lambda_manager/tests/test_lambda.py | 6 +----- cvat/apps/lambda_manager/views.py | 15 --------------- .../WongKinYiu/yolov7/nuclio/function-gpu.yaml | 1 - .../onnx/WongKinYiu/yolov7/nuclio/function.yaml | 1 - serverless/openvino/dextr/nuclio/function.yaml | 1 - .../face-detection-0205/nuclio/function.yaml | 1 - .../nuclio/function.yaml | 1 - .../nuclio/function.yaml | 1 - .../text-detection-0004/nuclio/function.yaml | 1 - .../nuclio/function.yaml | 1 - .../nuclio/function.yaml | 1 - .../omz/public/yolo-v3-tf/nuclio/function.yaml | 1 - .../dschoerk/transt/nuclio/function-gpu.yaml | 1 - .../pytorch/dschoerk/transt/nuclio/function.yaml | 1 - .../retinanet_r101/nuclio/function-gpu.yaml | 1 - .../retinanet_r101/nuclio/function.yaml | 1 - .../facebookresearch/sam/nuclio/function-gpu.yaml | 1 - .../facebookresearch/sam/nuclio/function.yaml | 1 - .../foolwood/siammask/nuclio/function-gpu.yaml | 1 - .../foolwood/siammask/nuclio/function.yaml | 1 - .../pytorch/mmpose/hrnet32/nuclio/function.yaml | 1 - .../pytorch/saic-vul/fbrs/nuclio/function.yaml | 1 - .../saic-vul/hrnet/nuclio/function-gpu.yaml | 1 - .../pytorch/saic-vul/hrnet/nuclio/function.yaml | 1 - .../pytorch/shiyinzhang/iog/nuclio/function.yaml | 1 - .../nuclio/function-gpu.yaml | 1 - .../nuclio/function.yaml | 1 - .../docs/manual/advanced/serverless-tutorial.md | 1 - 30 files changed, 1 insertion(+), 51 deletions(-) diff --git a/cvat-core/src/core-types.ts b/cvat-core/src/core-types.ts index c80d03b2bc7e..0edb2dce84cf 100644 --- a/cvat-core/src/core-types.ts +++ b/cvat-core/src/core-types.ts @@ -37,7 +37,6 @@ export interface SerializedModel { name?: string; labels_v2?: MLModelLabel[]; version?: number; - framework?: string; description?: string; kind?: ModelKind; type?: string; diff --git a/cvat-core/src/ml-model.ts b/cvat-core/src/ml-model.ts index dd7aa2732992..a504986c038d 100644 --- a/cvat-core/src/ml-model.ts +++ b/cvat-core/src/ml-model.ts @@ -35,10 +35,6 @@ export default class MLModel { return this.serialized.version; } - public get framework(): string { - return this.serialized.framework; - } - public get description(): string { return this.serialized.description; } diff --git a/cvat/apps/lambda_manager/tests/test_lambda.py b/cvat/apps/lambda_manager/tests/test_lambda.py index 6515a048fe61..e360ab1996d8 100644 --- a/cvat/apps/lambda_manager/tests/test_lambda.py +++ b/cvat/apps/lambda_manager/tests/test_lambda.py @@ -36,9 +36,8 @@ id_function_state_building = "test-model-has-state-building" id_function_state_error = "test-model-has-state-error" -expected_keys_in_response_all_functions = ["id", "kind", "labels", "description", "framework", "name"] +expected_keys_in_response_all_functions = ["id", "kind", "labels_v2", "description", "name"] expected_keys_in_response_function_interactor = expected_keys_in_response_all_functions + ["min_pos_points", "startswith_box"] -expected_keys_in_response_function_tracker = expected_keys_in_response_all_functions + ["state"] expected_keys_in_response_requests = ["id", "function", "status", "progress", "enqueued", "started", "ended", "exc_info"] path = os.path.join(os.path.dirname(__file__), 'assets', 'tasks.json') @@ -247,9 +246,6 @@ def _check_expected_keys_in_response_function(self, data): if kind == "interactor": for key in expected_keys_in_response_function_interactor: self.assertIn(key, data) - elif kind == "tracker": - for key in expected_keys_in_response_function_tracker: - self.assertIn(key, data) else: for key in expected_keys_in_response_all_functions: self.assertIn(key, data) diff --git a/cvat/apps/lambda_manager/views.py b/cvat/apps/lambda_manager/views.py index 36f48f99a619..a6e37933f325 100644 --- a/cvat/apps/lambda_manager/views.py +++ b/cvat/apps/lambda_manager/views.py @@ -185,14 +185,10 @@ def parse_attributes(attrs_spec): raise ValidationError( "`{}` lambda function has non-unique attributes for label {}".format(self.id, label), code=status.HTTP_404_NOT_FOUND) - # state of the function - self.state = data['status']['state'] # description of the function self.description = data['spec']['description'] # http port to access the serverless function self.port = data["status"].get("httpPort") - # framework which is used for the function (e.g. tensorflow, openvino) - self.framework = meta_anno.get('framework') # display name for the function self.name = meta_anno.get('name', self.id) self.min_pos_points = int(meta_anno.get('min_pos_points', 1)) @@ -207,10 +203,8 @@ def to_dict(self): response = { 'id': self.id, 'kind': str(self.kind), - 'labels': [label['name'] for label in self.labels], 'labels_v2': self.labels, 'description': self.description, - 'framework': self.framework, 'name': self.name, 'version': self.version } @@ -224,15 +218,6 @@ def to_dict(self): 'animated_gif': self.animated_gif }) - if self.kind is LambdaType.TRACKER: - response.update({ - 'state': self.state - }) - if self.kind is LambdaType.DETECTOR: - response.update({ - 'attributes': self.func_attributes - }) - return response def invoke( diff --git a/serverless/onnx/WongKinYiu/yolov7/nuclio/function-gpu.yaml b/serverless/onnx/WongKinYiu/yolov7/nuclio/function-gpu.yaml index d14cb7e68a42..d9235c458155 100644 --- a/serverless/onnx/WongKinYiu/yolov7/nuclio/function-gpu.yaml +++ b/serverless/onnx/WongKinYiu/yolov7/nuclio/function-gpu.yaml @@ -4,7 +4,6 @@ metadata: annotations: name: YOLO v7 type: detector - framework: onnx spec: | [ { "id": 0, "name": "person", "type": "rectangle" }, diff --git a/serverless/onnx/WongKinYiu/yolov7/nuclio/function.yaml b/serverless/onnx/WongKinYiu/yolov7/nuclio/function.yaml index 075fe42ed049..b1ff8463a03a 100644 --- a/serverless/onnx/WongKinYiu/yolov7/nuclio/function.yaml +++ b/serverless/onnx/WongKinYiu/yolov7/nuclio/function.yaml @@ -4,7 +4,6 @@ metadata: annotations: name: YOLO v7 type: detector - framework: onnx spec: | [ { "id": 0, "name": "person", "type": "rectangle" }, diff --git a/serverless/openvino/dextr/nuclio/function.yaml b/serverless/openvino/dextr/nuclio/function.yaml index 3a1df59ad310..15a0c9ae1088 100644 --- a/serverless/openvino/dextr/nuclio/function.yaml +++ b/serverless/openvino/dextr/nuclio/function.yaml @@ -6,7 +6,6 @@ metadata: version: 2 type: interactor spec: - framework: openvino min_pos_points: 4 animated_gif: https://raw.githubusercontent.com/opencv/cvat/0fbb19ae3846a017853d52e187f0ce149adced7d/site/content/en/images/dextr_example.gif 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 diff --git a/serverless/openvino/omz/intel/face-detection-0205/nuclio/function.yaml b/serverless/openvino/omz/intel/face-detection-0205/nuclio/function.yaml index f0d41ee5ffad..e14799113c7e 100644 --- a/serverless/openvino/omz/intel/face-detection-0205/nuclio/function.yaml +++ b/serverless/openvino/omz/intel/face-detection-0205/nuclio/function.yaml @@ -4,7 +4,6 @@ metadata: annotations: name: Attributed face detection type: detector - framework: openvino spec: | [ { "id": 0, "name": "face", "type": "rectangle", "attributes": [ diff --git a/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/function.yaml b/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/function.yaml index f3dbfa00300a..39b4e981957f 100644 --- a/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/function.yaml +++ b/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/function.yaml @@ -4,7 +4,6 @@ metadata: annotations: name: Person reidentification type: reid - framework: openvino spec: spec: diff --git a/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/function.yaml b/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/function.yaml index 60960cf36c9f..1fdc514fbde0 100644 --- a/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/function.yaml +++ b/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/function.yaml @@ -4,7 +4,6 @@ metadata: annotations: name: Semantic segmentation for ADAS type: detector - framework: openvino spec: | [ { "id": 0, "name": "road", "type": "mask" }, diff --git a/serverless/openvino/omz/intel/text-detection-0004/nuclio/function.yaml b/serverless/openvino/omz/intel/text-detection-0004/nuclio/function.yaml index d65e5c87bafb..1da18b533e42 100644 --- a/serverless/openvino/omz/intel/text-detection-0004/nuclio/function.yaml +++ b/serverless/openvino/omz/intel/text-detection-0004/nuclio/function.yaml @@ -4,7 +4,6 @@ metadata: annotations: name: Text detection v4 type: detector - framework: openvino spec: | [ { "id": 1, "name": "text", "type": "mask" } diff --git a/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml b/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml index c331526729cd..1da0f1a8194b 100644 --- a/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml +++ b/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml @@ -4,7 +4,6 @@ metadata: annotations: name: Faster RCNN type: detector - framework: openvino spec: | [ { "id": 1, "name": "person", "type": "rectangle" }, diff --git a/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml b/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml index 050569d5606d..b93974e4167d 100644 --- a/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml +++ b/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml @@ -7,7 +7,6 @@ metadata: annotations: name: Mask RCNN type: detector - framework: openvino spec: | [ { "id": 1, "name": "person", "type": "mask" }, diff --git a/serverless/openvino/omz/public/yolo-v3-tf/nuclio/function.yaml b/serverless/openvino/omz/public/yolo-v3-tf/nuclio/function.yaml index 60265c636af0..f2bc28a36809 100644 --- a/serverless/openvino/omz/public/yolo-v3-tf/nuclio/function.yaml +++ b/serverless/openvino/omz/public/yolo-v3-tf/nuclio/function.yaml @@ -4,7 +4,6 @@ metadata: annotations: name: YOLO v3 type: detector - framework: openvino spec: | [ { "id": 0, "name": "person", "type": "rectangle" }, diff --git a/serverless/pytorch/dschoerk/transt/nuclio/function-gpu.yaml b/serverless/pytorch/dschoerk/transt/nuclio/function-gpu.yaml index a051a0036e3d..3eebab004fbb 100644 --- a/serverless/pytorch/dschoerk/transt/nuclio/function-gpu.yaml +++ b/serverless/pytorch/dschoerk/transt/nuclio/function-gpu.yaml @@ -5,7 +5,6 @@ metadata: name: TransT type: tracker spec: - framework: pytorch spec: description: Fast Online Object Tracking and Segmentation diff --git a/serverless/pytorch/dschoerk/transt/nuclio/function.yaml b/serverless/pytorch/dschoerk/transt/nuclio/function.yaml index 718eb383e87c..34ff90cfb8d9 100644 --- a/serverless/pytorch/dschoerk/transt/nuclio/function.yaml +++ b/serverless/pytorch/dschoerk/transt/nuclio/function.yaml @@ -5,7 +5,6 @@ metadata: name: TransT type: tracker spec: - framework: pytorch spec: description: Fast Online Object Tracking and Segmentation diff --git a/serverless/pytorch/facebookresearch/detectron2/retinanet_r101/nuclio/function-gpu.yaml b/serverless/pytorch/facebookresearch/detectron2/retinanet_r101/nuclio/function-gpu.yaml index 707a1552820f..545f70ce1ebc 100644 --- a/serverless/pytorch/facebookresearch/detectron2/retinanet_r101/nuclio/function-gpu.yaml +++ b/serverless/pytorch/facebookresearch/detectron2/retinanet_r101/nuclio/function-gpu.yaml @@ -4,7 +4,6 @@ metadata: annotations: name: RetinaNet R101 type: detector - framework: pytorch spec: | [ { "id": 1, "name": "person", "type": "rectangle" }, diff --git a/serverless/pytorch/facebookresearch/detectron2/retinanet_r101/nuclio/function.yaml b/serverless/pytorch/facebookresearch/detectron2/retinanet_r101/nuclio/function.yaml index 0c659781ff5f..7e8088a38a50 100644 --- a/serverless/pytorch/facebookresearch/detectron2/retinanet_r101/nuclio/function.yaml +++ b/serverless/pytorch/facebookresearch/detectron2/retinanet_r101/nuclio/function.yaml @@ -4,7 +4,6 @@ metadata: annotations: name: RetinaNet R101 type: detector - framework: pytorch spec: | [ { "id": 1, "name": "person", "type": "rectangle" }, diff --git a/serverless/pytorch/facebookresearch/sam/nuclio/function-gpu.yaml b/serverless/pytorch/facebookresearch/sam/nuclio/function-gpu.yaml index 3cfaf702b304..814f014c19cc 100644 --- a/serverless/pytorch/facebookresearch/sam/nuclio/function-gpu.yaml +++ b/serverless/pytorch/facebookresearch/sam/nuclio/function-gpu.yaml @@ -10,7 +10,6 @@ metadata: version: 2 type: interactor spec: - framework: pytorch min_pos_points: 1 min_neg_points: 0 animated_gif: https://raw.githubusercontent.com/cvat-ai/cvat/develop/site/content/en/images/hrnet_example.gif diff --git a/serverless/pytorch/facebookresearch/sam/nuclio/function.yaml b/serverless/pytorch/facebookresearch/sam/nuclio/function.yaml index 125092901fc9..ba0d91189f19 100644 --- a/serverless/pytorch/facebookresearch/sam/nuclio/function.yaml +++ b/serverless/pytorch/facebookresearch/sam/nuclio/function.yaml @@ -10,7 +10,6 @@ metadata: version: 2 type: interactor spec: - framework: pytorch min_pos_points: 1 min_neg_points: 0 animated_gif: https://raw.githubusercontent.com/cvat-ai/cvat/develop/site/content/en/images/hrnet_example.gif diff --git a/serverless/pytorch/foolwood/siammask/nuclio/function-gpu.yaml b/serverless/pytorch/foolwood/siammask/nuclio/function-gpu.yaml index 3ee8b43640bb..7deaa32c8cec 100644 --- a/serverless/pytorch/foolwood/siammask/nuclio/function-gpu.yaml +++ b/serverless/pytorch/foolwood/siammask/nuclio/function-gpu.yaml @@ -5,7 +5,6 @@ metadata: name: SiamMask type: tracker spec: - framework: pytorch spec: description: Fast Online Object Tracking and Segmentation diff --git a/serverless/pytorch/foolwood/siammask/nuclio/function.yaml b/serverless/pytorch/foolwood/siammask/nuclio/function.yaml index d36e00d3e969..cf74e906c702 100644 --- a/serverless/pytorch/foolwood/siammask/nuclio/function.yaml +++ b/serverless/pytorch/foolwood/siammask/nuclio/function.yaml @@ -5,7 +5,6 @@ metadata: name: SiamMask type: tracker spec: - framework: pytorch spec: description: Fast Online Object Tracking and Segmentation diff --git a/serverless/pytorch/mmpose/hrnet32/nuclio/function.yaml b/serverless/pytorch/mmpose/hrnet32/nuclio/function.yaml index 8087151ccdcd..7f19ac24b871 100644 --- a/serverless/pytorch/mmpose/hrnet32/nuclio/function.yaml +++ b/serverless/pytorch/mmpose/hrnet32/nuclio/function.yaml @@ -4,7 +4,6 @@ metadata: annotations: name: Human pose estimation type: detector - framework: pytorch spec: | [ { diff --git a/serverless/pytorch/saic-vul/fbrs/nuclio/function.yaml b/serverless/pytorch/saic-vul/fbrs/nuclio/function.yaml index 9e8bfb6f4d6a..276adc70995e 100644 --- a/serverless/pytorch/saic-vul/fbrs/nuclio/function.yaml +++ b/serverless/pytorch/saic-vul/fbrs/nuclio/function.yaml @@ -6,7 +6,6 @@ metadata: version: 2 type: interactor spec: - framework: pytorch min_pos_points: 1 min_neg_points: 0 animated_gif: https://raw.githubusercontent.com/cvat-ai/cvat/0fbb19ae3846a017853d52e187f0ce149adced7d/site/content/en/images/fbrs_example.gif diff --git a/serverless/pytorch/saic-vul/hrnet/nuclio/function-gpu.yaml b/serverless/pytorch/saic-vul/hrnet/nuclio/function-gpu.yaml index d34420de905f..b2d0e743818b 100644 --- a/serverless/pytorch/saic-vul/hrnet/nuclio/function-gpu.yaml +++ b/serverless/pytorch/saic-vul/hrnet/nuclio/function-gpu.yaml @@ -6,7 +6,6 @@ metadata: version: 2 type: interactor spec: - framework: pytorch min_pos_points: 1 min_neg_points: 0 animated_gif: https://raw.githubusercontent.com/cvat-ai/cvat/develop/site/content/en/images/hrnet_example.gif diff --git a/serverless/pytorch/saic-vul/hrnet/nuclio/function.yaml b/serverless/pytorch/saic-vul/hrnet/nuclio/function.yaml index 76d7be0d64af..848834fd7ca8 100644 --- a/serverless/pytorch/saic-vul/hrnet/nuclio/function.yaml +++ b/serverless/pytorch/saic-vul/hrnet/nuclio/function.yaml @@ -6,7 +6,6 @@ metadata: version: 2 type: interactor spec: - framework: pytorch min_pos_points: 1 min_neg_points: 0 animated_gif: https://raw.githubusercontent.com/cvat-ai/cvat/develop/site/content/en/images/hrnet_example.gif diff --git a/serverless/pytorch/shiyinzhang/iog/nuclio/function.yaml b/serverless/pytorch/shiyinzhang/iog/nuclio/function.yaml index d9b52fdda2f3..e582b5c0711f 100644 --- a/serverless/pytorch/shiyinzhang/iog/nuclio/function.yaml +++ b/serverless/pytorch/shiyinzhang/iog/nuclio/function.yaml @@ -6,7 +6,6 @@ metadata: version: 2 type: interactor spec: - framework: pytorch min_pos_points: 1 min_neg_points: 0 startswith_box: true diff --git a/serverless/tensorflow/faster_rcnn_inception_v2_coco/nuclio/function-gpu.yaml b/serverless/tensorflow/faster_rcnn_inception_v2_coco/nuclio/function-gpu.yaml index 3fa0f8b0a421..062bbd08ad20 100644 --- a/serverless/tensorflow/faster_rcnn_inception_v2_coco/nuclio/function-gpu.yaml +++ b/serverless/tensorflow/faster_rcnn_inception_v2_coco/nuclio/function-gpu.yaml @@ -4,7 +4,6 @@ metadata: annotations: name: Faster RCNN via Tensorflow type: detector - framework: tensorflow spec: | [ { "id": 1, "name": "person", "type": "rectangle" }, diff --git a/serverless/tensorflow/faster_rcnn_inception_v2_coco/nuclio/function.yaml b/serverless/tensorflow/faster_rcnn_inception_v2_coco/nuclio/function.yaml index 656d4a6c8a20..bbc2a8394112 100644 --- a/serverless/tensorflow/faster_rcnn_inception_v2_coco/nuclio/function.yaml +++ b/serverless/tensorflow/faster_rcnn_inception_v2_coco/nuclio/function.yaml @@ -4,7 +4,6 @@ metadata: annotations: name: Faster RCNN via Tensorflow type: detector - framework: tensorflow spec: | [ { "id": 1, "name": "person", "type": "rectangle" }, diff --git a/site/content/en/docs/manual/advanced/serverless-tutorial.md b/site/content/en/docs/manual/advanced/serverless-tutorial.md index bb83acf9cd04..7355d22d982e 100644 --- a/site/content/en/docs/manual/advanced/serverless-tutorial.md +++ b/site/content/en/docs/manual/advanced/serverless-tutorial.md @@ -440,7 +440,6 @@ metadata: annotations: name: RetinaNet R101 type: detector - framework: pytorch spec: | [ { "id": 1, "name": "person" },