From a8c5de0aa665c7ff51936a365ffff7add429c3a0 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Sun, 25 Jan 2026 22:10:10 +0800 Subject: [PATCH] =?UTF-8?q?feat(db):=20=E6=B7=BB=E5=8A=A0=E5=9B=BE?= =?UTF-8?q?=E5=83=8F=E5=88=86=E7=B1=BB=E6=A0=87=E6=B3=A8=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=88=B0=E6=95=B0=E6=8D=AE=E5=BA=93=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增图像分类标注模板配置,支持内容审核、安全检测等场景 - 集成 ResNet、EfficientNet、Vision Transformer 关联模型 - 添加 Choices 标签配置,包含 Adult content、Weapons、Violence 选项 - 设置 Image 对象类型用于图像展示和标注 - 配置水平布局样式和计算机视觉类别属性 --- .../app/module/annotation/service/editor.py | 4 ++- scripts/db/data-annotation-init.sql | 34 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) 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) -- =============================================