feat(db): 添加图像分类标注模板到数据库初始化脚本

- 新增图像分类标注模板配置,支持内容审核、安全检测等场景
- 集成 ResNet、EfficientNet、Vision Transformer 关联模型
- 添加 Choices 标签配置,包含 Adult content、Weapons、Violence 选项
- 设置 Image 对象类型用于图像展示和标注
- 配置水平布局样式和计算机视觉类别属性
This commit is contained in:
2026-01-25 22:10:10 +08:00
parent c5aa052451
commit a8c5de0aa6
2 changed files with 37 additions and 1 deletions

View File

@@ -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)

View File

@@ -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'))
),
'<View>
<Image name="image" value="$image"/>
<Choices name="choice" toName="image">
<Choice value="Adult content"/>
<Choice value="Weapons" />
<Choice value="Violence" />
</Choices>
</View>',
'horizontal',
'computer-vision',
1,
'1.0.0'
);
-- =============================================
-- 4. 自然语言处理 (NLP)
-- =============================================