- Added `resize_mode` option to `preprocess_node` for handling image resizing strategies: stretch, keep ratio, and letterbox. - Implemented `BuildLetterbox` function to create letterbox resized frames while maintaining aspect ratio. - Introduced `FrameTransformMeta` structure to store transformation metadata for frames, including scaling and padding information. - Updated detection coordinate calculations in `ai_yolo_node` to utilize transformation metadata for accurate bounding box adjustments. - Enhanced bounding box mapping in `osd_node` to account for potential discrepancies between detection and frame sizes. - Refactored image processing logic to support new resizing modes and ensure compatibility with existing formats.
137 lines
3.3 KiB
JSON
137 lines
3.3 KiB
JSON
{
|
|
"global": {
|
|
"metrics_port": 9001,
|
|
"web_root": "web"
|
|
},
|
|
"queue": {
|
|
"size": 8,
|
|
"strategy": "drop_oldest"
|
|
},
|
|
"graphs": [
|
|
{
|
|
"name": "cam_ppe11_yolo_debug",
|
|
"nodes": [
|
|
{
|
|
"id": "in_cam1",
|
|
"type": "input_rtsp",
|
|
"role": "source",
|
|
"enable": true,
|
|
"url": "rtsp://10.0.0.49:8554/cam",
|
|
"fps": 30,
|
|
"width": 1280,
|
|
"height": 720,
|
|
"use_mpp": true,
|
|
"use_ffmpeg": false,
|
|
"force_tcp": true,
|
|
"reconnect_sec": 5,
|
|
"reconnect_backoff_max_sec": 30
|
|
},
|
|
{
|
|
"id": "pre_cam1",
|
|
"type": "preprocess",
|
|
"role": "filter",
|
|
"enable": true,
|
|
"dst_w": 768,
|
|
"dst_h": 768,
|
|
"dst_format": "rgb",
|
|
"dst_packed": true,
|
|
"resize_mode": "letterbox",
|
|
"keep_ratio": false,
|
|
"rga_gate": "cam_ppe11_yolo_debug",
|
|
"use_rga": true
|
|
},
|
|
{
|
|
"id": "yolo_cam1",
|
|
"type": "ai_yolo",
|
|
"role": "filter",
|
|
"enable": true,
|
|
"model_path": "./models/best-768.rknn",
|
|
"model_version": "v8",
|
|
"model_w": 768,
|
|
"model_h": 768,
|
|
"num_classes": 11,
|
|
"v8_box_format": "cxcywh",
|
|
"v8_cls_activation": "auto",
|
|
"conf": 0.25,
|
|
"nms": 0.45,
|
|
"class_filter": [],
|
|
"debug": {
|
|
"stats": true,
|
|
"stats_interval": 30,
|
|
"detections": true
|
|
}
|
|
},
|
|
{
|
|
"id": "osd_cam1",
|
|
"type": "osd",
|
|
"role": "filter",
|
|
"enable": true,
|
|
"draw_bbox": true,
|
|
"draw_text": true,
|
|
"draw_face_det": false,
|
|
"draw_face_bbox": false,
|
|
"line_width": 2,
|
|
"font_scale": 1,
|
|
"use_rga_bbox": false,
|
|
"labels": [
|
|
"helmet",
|
|
"gloves",
|
|
"vest",
|
|
"boots",
|
|
"goggles",
|
|
"none",
|
|
"Person",
|
|
"no_helmet",
|
|
"no_goggle",
|
|
"no_gloves",
|
|
"no_boots"
|
|
]
|
|
},
|
|
{
|
|
"id": "post_cam1",
|
|
"type": "preprocess",
|
|
"role": "filter",
|
|
"enable": true,
|
|
"dst_w": 1280,
|
|
"dst_h": 720,
|
|
"dst_format": "nv12",
|
|
"keep_ratio": false,
|
|
"rga_gate": "cam_ppe11_yolo_debug",
|
|
"use_rga": true
|
|
},
|
|
{
|
|
"id": "pub_cam1",
|
|
"type": "publish",
|
|
"role": "sink",
|
|
"enable": true,
|
|
"codec": "h264",
|
|
"fps": 30,
|
|
"gop": 60,
|
|
"bitrate_kbps": 2000,
|
|
"use_mpp": true,
|
|
"use_ffmpeg_mux": true,
|
|
"outputs": [
|
|
{
|
|
"proto": "hls",
|
|
"path": "./web/hls/cam1_debug/index.m3u8",
|
|
"segment_sec": 2
|
|
},
|
|
{
|
|
"proto": "rtsp_server",
|
|
"port": 8556,
|
|
"path": "/live/cam1_debug"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"edges": [
|
|
["in_cam1", "pre_cam1"],
|
|
["pre_cam1", "yolo_cam1"],
|
|
["yolo_cam1", "osd_cam1"],
|
|
["osd_cam1", "post_cam1"],
|
|
["post_cam1", "pub_cam1"]
|
|
]
|
|
}
|
|
]
|
|
}
|