延寿水库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

2.5 KiB

水库智能算法云服务接口文档

服务概述

基于 FastAPI 构建的水库智能算法云服务,提供视频流分析和图像识别功能,支持多种 YOLO 模型场景检测。

服务地址: http://33.36.139.134.254:18005


接口列表

1. 视频流异步分析接口

接口路径: POST /v1/task/stream

描述: 将 RTSP 视频流任务派发给 Celery worker 异步处理

请求体:

{
    "source_url": "rtsp://摄像头地址",
    "webhook_url": "回调地址",
    "scene_type": "floating_trash | fishing | swimming",
    "roi": [[x1, y1], [x2, y2], ...]
}

参数说明:

参数 类型 必填 说明
source_url string 摄像头 RTSP 流地址
webhook_url string 业务系统回调地址
scene_type string 场景类型
roi array 电子围栏坐标点集

响应示例:

{
    "code": 200,
    "msg": "任务已下发至计算集群",
    "task_type": "floating_trash"
}

2. 指定模型图像预测接口

接口路径: POST /{model_type}/predict/image

描述: 使用指定模型对上传的图片进行目标检测

路径参数:

参数 说明
model_type 模型类型

支持的模型类型:

model_type 模型文件 说明
default yolov8n.pt 默认预训练模型
bati model/Bati/best.pt 坝体检测模型
buildings model/buildings/best.pt 建筑物检测模型
disaster model/disaster/best.pt 灾害检测模型
fire-smoke model/fire-smoke/best.pt 烟火检测模型
Floating model/Floating/best.pt 漂浮物检测模型
ship model/ship/best.pt 船只检测模型

请求表单:

  • file: 图片文件 (支持 jpg, png 等格式)

响应示例:

{
    "results": [
        {
            "boxes": {
                "xyxy": [[x1, y1, x2, y2]],
                "conf": [0.95],
                "cls": [0]
            },
            "names": { "0": "目标类别" }
        }
    ]
}

3. 默认模型图像预测接口

接口路径: POST /v1/predict/image

描述: 使用默认 YOLOv8n 模型对图片进行预测

请求表单:

  • file: 图片文件

响应示例: 同接口2


启动参数:

  • Host: 0.0.0.0
  • Port: 8000

错误处理

HTTP 状态码 说明
400 请求参数错误
500 服务器内部错误