feat:新增基于YOLOv8的打架斗殴模型,支持上传视频识别以及摄像头识别

This commit is contained in:
2026-06-10 14:24:59 +08:00
parent ed5079a9dd
commit 77bd437fdb
4 changed files with 315 additions and 4 deletions

View File

@@ -110,6 +110,16 @@ class ModelService:
'description': '基于PaddlePaddle PP-YOLOE-l的违停检测模型支持车牌识别',
'name': '违停检测 (Paddle)'
},
'fight_detection': {
'path': os.path.join(base_dir, 'models', 'fight_detection', 'yolov8n.pt'),
'type': 'yolov8',
'classes': ['violence', 'non_violence'],
'labels': {'violence': '暴力行为', 'non_violence': '正常'},
'size': '22MB',
'description': '基于YOLOv8的打架斗殴检测模型',
'name': '打架斗殴检测(YOLO)',
'supports_video': True
},
'action_detection': {
'path': 'docker_api',
'type': 'docker_api',
@@ -142,7 +152,7 @@ class ModelService:
model_exists = os.path.exists(model_path)
if model_exists:
available_models.append({
model_info = {
'id': model_id,
'name': config['name'],
'description': config['description'],
@@ -150,7 +160,11 @@ class ModelService:
'labels': config['labels'],
'size': config['size'],
'type': config['type']
})
}
# 支持 video 的模型增加标记
if config.get('supports_video'):
model_info['supports_video'] = True
available_models.append(model_info)
else:
logger.warning(f"模型文件不存在: {model_path}")
return available_models