YOLO模型调用API
通过restful接口,使用YOLO模型的能力
YOLO模型调用
接口功能:使用yolo模型识别
请求方式:POST
请求地址:http://{IP地址}:{端口}/detect
- 请求参数
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
image_base64 | form-data | string | 是 | 图片base64编码 |
conf_thres | form-data | double | 是 | 置信度阈值,允许为空,默认0.25 |
iou_thres | form-data | double | 是 | 交并比,允许为空,默认0.45 |
- 请求示例
shell
curl --location --request POST 'http://ip:port/detect' \
--form 'image_base64="/9j/4AAQSkZJxxxxx"' \
--form 'conf_thres="0.25"' \
--form 'iou_thres="0.45"'
- 响应参数
名称 | 类型 | 说明 |
---|---|---|
success | boolean | 调用结果,true成功false失败 |
detections | object | 识别结果,详情见detection |
annotated_base64 | string | 结果图片base编码 |
detection
名称 | 类型 | 说明 |
---|---|---|
label | string | 识别标签,如fire、smoke |
confidence | object | 识别结果 |
- 响应示例
json
{
"success": true,
"detections": [
{
"label": "fire",
"confidence": 0.9047
},
{
"label": "smoke",
"confidence": 0.8467
}
],
"annotated_base64": "/9j/4AAQSkZJRgABAQAAAQAxxxxxxxxxx"
}