From b1c26898a7223ba895711b1fc11f51b6b00016c3 Mon Sep 17 00:00:00 2001 From: Brandon Davis Date: Mon, 6 Dec 2021 22:42:55 -0500 Subject: [PATCH] Support automatic tag annotation (#3896) --- CHANGELOG.md | 1 + cvat/apps/lambda_manager/views.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f1b8f92..6025f2d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add project tasks paginations () - Add remove issue button () - Options to change font size & position of text labels on the canvas () +- Add "tag" return type for automatic annotation in Nuclio () ### Changed - TDB diff --git a/cvat/apps/lambda_manager/views.py b/cvat/apps/lambda_manager/views.py index eb759e4d..071aa4ab 100644 --- a/cvat/apps/lambda_manager/views.py +++ b/cvat/apps/lambda_manager/views.py @@ -353,6 +353,9 @@ class LambdaJob: def append_shape(self, shape): self.data["shapes"].append(shape) + def append_tag(self, tag): + self.data["tags"].append(tag) + def submit(self): if not self.is_empty(): serializer = LabeledDataSerializer(data=self.data) @@ -380,7 +383,17 @@ class LambdaJob: for anno in annotations: label_id = labels.get(anno["label"]) - if label_id is not None: + if label_id is None: + continue # Invalid label provided + if anno["type"].lower() == "tag": + results.append_tag({ + "frame": frame, + "label_id": label_id, + "source": "auto", + "attributes": [], + "group": None, + }) + else: results.append_shape({ "frame": frame, "label_id": label_id,