diff --git a/runtime/datamate-python/app/module/annotation/service/editor.py b/runtime/datamate-python/app/module/annotation/service/editor.py index be7f4b9..be7dd1f 100644 --- a/runtime/datamate-python/app/module/annotation/service/editor.py +++ b/runtime/datamate-python/app/module/annotation/service/editor.py @@ -735,7 +735,9 @@ class AnnotationEditorService: annotation_payload = dict(request.annotation or {}) result = annotation_payload.get("result") - if not isinstance(result, list): + if result is None: + annotation_payload["result"] = [] + elif not isinstance(result, list): raise HTTPException(status_code=400, detail="annotation.result 必须为数组") ls_task_id = self._make_ls_task_id(project_id, file_id) diff --git a/scripts/db/data-annotation-init.sql b/scripts/db/data-annotation-init.sql index 10bd2e1..ae857ec 100644 --- a/scripts/db/data-annotation-init.sql +++ b/scripts/db/data-annotation-init.sql @@ -762,6 +762,40 @@ INSERT INTO t_dm_annotation_templates ( ); */ +-- ============================================= +-- 3.x 计算机视觉(已启用) +-- ============================================= + +-- 3.2 图像分类 +INSERT INTO t_dm_annotation_templates ( + id, name, description, data_type, labeling_type, + configuration, label_config, style, category, built_in, version +) VALUES ( + 'tpl-image-classification-001', + '图像分类', + '对图像进行分类,适用于内容审核、安全检测、社交媒体审核等场景。关联模型:ResNet、EfficientNet、Vision Transformer', + 'image', + 'image-classification', + JSON_OBJECT( + 'labels', JSON_ARRAY( + JSON_OBJECT('fromName', 'choice', 'toName', 'image', 'type', 'Choices', 'options', JSON_ARRAY('Adult content', 'Weapons', 'Violence'), 'required', true) + ), + 'objects', JSON_ARRAY(JSON_OBJECT('name', 'image', 'type', 'Image', 'value', '$image')) + ), + ' + + + + + + +', + 'horizontal', + 'computer-vision', + 1, + '1.0.0' +); + -- ============================================= -- 4. 自然语言处理 (NLP) -- =============================================