safesight/plugins/ai_shoe_det/README.md

96 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ai_shoe_det - 鞋子检测节点
专门针对鞋子检测优化的节点,支持滑动窗口提高小目标检测率。
## 特性
- **滑动窗口支持**:可配置多窗口覆盖全图,提高小鞋子检测精度
- **单类优化**:专门针对 shoe 单类检测优化
- **自动 NMS**:多窗口结果自动合并去重
- **轻量快速**:基于 RK3588 NPU 加速
## 配置参数
```json
{
"id": "shoe_det",
"type": "ai_shoe_det",
"model_path": "./models/shoe_detector.rknn",
"model_w": 640,
"model_h": 640,
"conf": 0.25,
"nms": 0.45,
"windows": [
{"x": 0, "y": 0, "w": 960, "h": 1080},
{"x": 960, "y": 0, "w": 960, "h": 1080}
]
}
```
### 参数说明
| 参数 | 类型 | 默认值 | 说明 |
|------|------|--------|------|
| `model_path` | string | - | RKNN 模型路径 |
| `model_w` | int | 640 | 模型输入宽度 |
| `model_h` | int | 640 | 模型输入高度 |
| `conf` | float | 0.25 | 置信度阈值 |
| `nms` | float | 0.45 | NMS IoU 阈值 |
| `windows` | array | - | 滑动窗口配置,不配置则使用全图单窗口 |
### 窗口配置
- **单窗口(全图)**:不配置 `windows` 或配置 `[{"x":0,"y":0,"w":0,"h":0}]`
- **双窗口(推荐)**:左右各 960x1080
```json
"windows": [
{"x": 0, "y": 0, "w": 960, "h": 1080},
{"x": 960, "y": 0, "w": 960, "h": 1080}
]
```
## Pipeline 示例
```json
{
"nodes": [
{"id": "in", "type": "input_rtsp", "url": "rtsp://..."},
{"id": "pre", "type": "preprocess", "dst_w": 1920, "dst_h": 1080, "dst_format": "rgb"},
{
"id": "shoe_det",
"type": "ai_shoe_det",
"model_path": "./models/shoe_detector_openimages_ppe_v1.rknn",
"model_w": 640,
"model_h": 640,
"conf": 0.25,
"windows": [
{"x": 0, "y": 0, "w": 960, "h": 1080},
{"x": 960, "y": 0, "w": 960, "h": 1080}
]
},
{"id": "osd", "type": "osd"},
{"id": "pub", "type": "publish"}
],
"edges": [
["in", "pre"],
["pre", "shoe_det"],
["shoe_det", "osd"],
["osd", "pub"]
]
}
```
## 编译
```bash
cd build
cmake ..
make ai_shoe_det -j4
```
## 注意事项
1. 模型必须是单类shoeYOLOv8 格式
2. 多窗口会增加 NPU 负载2窗口 = 2倍推理时间
3. 窗口之间有重叠时NMS 会自动去重