火灾检测模型由基于YOLOv10的火灾烟雾检测模型改为复合模型[基于YOLOv8的火灾检测模型(单火焰检测)+YOLOv10-M,专用火灾烟雾模型]

This commit is contained in:
2026-06-10 14:18:43 +08:00
parent 30ea6eb0fb
commit 0e011dacfd
6 changed files with 206 additions and 21 deletions

View File

@@ -20,7 +20,8 @@ async def detect_image(
model_id: str = Query("fire_detection"),
confidence: float = Query(0.5),
iou: float = Query(0.45),
algorithm_config: Optional[str] = Query(None, description="算法配置JSON字符串")
algorithm_config: Optional[str] = Query(None, description="算法配置JSON字符串"),
composite: bool = Query(False, description="是否启用复合检测(火灾检测时同时检测火焰和烟雾)")
):
"""
图片检测接口
@@ -61,9 +62,15 @@ async def detect_image(
data={}
)
result = await detection_service.detect_image(
frame, model_id, confidence, iou, algorithm_config=algo_config
)
# 判断是否启用复合火灾检测
if composite and model_id == 'fire_detection':
result = await detection_service.detect_fire_composite(
frame, confidence, iou
)
else:
result = await detection_service.detect_image(
frame, model_id, confidence, iou, algorithm_config=algo_config
)
if result['success']:
annotated_frame = detection_service.draw_detections(