diff --git a/configs/stress_5ch_face_recog.json b/configs/stress_5ch_face_recog.json index 098ab74..e1be259 100644 --- a/configs/stress_5ch_face_recog.json +++ b/configs/stress_5ch_face_recog.json @@ -30,11 +30,11 @@ "type": "preprocess", "role": "filter", "enable": true, - "dst_w": 640, - "dst_h": 640, + "dst_w": 768, + "dst_h": 768, "dst_format": "rgb", "dst_packed": true, - "keep_ratio": false, + "resize_mode": "letterbox", "rga_gate": "${name}", "use_rga": true }, @@ -44,12 +44,14 @@ "role": "filter", "enable": true, "infer_fps": 10, - "model_path": "./models/best-640.rknn", + "model_path": "./models/best-768.rknn", "model_version": "v8", - "num_classes": 3, + "model_w": 768, + "model_h": 768, + "num_classes": 11, "conf": 0.35, "nms": 0.45, - "class_filter": [] + "class_filter": [3, 6] }, { "id": "face_det", @@ -94,7 +96,7 @@ "mode": "bytetrack_lite", "per_class": true, "state_key": "${name}", - "track_classes": [0, 1, 2], + "track_classes": [3, 6], "ignore_classes": [], "allowed_models": ["yolov5", "yolov8"], "high_th": 0.5, @@ -134,7 +136,7 @@ "dst_w": "${src_w}", "dst_h": "${src_h}", "dst_format": "nv12", - "keep_ratio": false, + "resize_mode": "keep_ratio", "rga_gate": "${name}", "use_rga": true }, @@ -147,8 +149,8 @@ "labels": [], "rules": [ { - "name": "object_in_view", - "class_ids": [0, 1, 2], + "name": "ppe_violation", + "class_ids": [3, 6], "roi": {"x": 0.0, "y": 0.0, "w": 1.0, "h": 1.0}, "min_score": 0.4, "min_box_area_ratio": 0.02, diff --git a/docs/requirements/guide.md b/docs/requirements/guide.md index 987e79b..89c650f 100644 --- a/docs/requirements/guide.md +++ b/docs/requirements/guide.md @@ -57,8 +57,11 @@ watch -n 1 'grep -E "fps_calc|RKVENC" /proc/mpp_service/sessions-summary | head ~/apps/OrangePi3588Media/scripts/monitor_hw.sh -- 运行media-server - ./build/media-server -c configs/sample_cam4_best.json +- 标准单路全流程测试: + ./build/media-server -c configs/sample_cam_ppe11.json + +- 5路全流程压力测试 + ./build/media-server --config configs/stress_5ch_face_recog.json - PT模型转RKNN diff --git a/docs/stress_test_5ch_face_recog.md b/docs/stress_test_5ch_face_recog.md index 5010ace..40aae6f 100644 --- a/docs/stress_test_5ch_face_recog.md +++ b/docs/stress_test_5ch_face_recog.md @@ -158,9 +158,9 @@ mc mb myminio/myminio | 节点 | 类型 | 作用 | 关键参数 | |------|------|------|----------| | `input_rtsp` | source | 拉取 RTSP 流 | 1280×720@30fps, use_mpp=true | -| `preprocess` | filter | 图像预处理 | 720p → 640×640 RGB, use_rga=true | -| `ai_yolo` | filter | 目标检测 | best-640.rknn, v8, conf=0.35, nms=0.45, infer_fps=10, num_classes=3 | -| `tracker` | filter | 目标跟踪 | bytetrack_lite, max_age_ms=1500, track_classes=[0,1,2] | +| `preprocess` | filter | 图像预处理 | 720p → 768×768 RGB, resize_mode=letterbox, use_rga=true | +| `ai_yolo` | filter | 目标检测 | best-768.rknn, v8, conf=0.35, nms=0.45, infer_fps=10, num_classes=11, class_filter=[3,6] | +| `tracker` | filter | 目标跟踪 | bytetrack_lite, max_age_ms=1500, track_classes=[3,6] | | `face_det` | filter | 人脸检测 | RetinaFace_mobile320.rknn, conf=0.7, max_faces=10 | | `face_recog` | filter | 人脸识别 | mobilefacenet_arcface.rknn, align=true, max_faces=10, threshold.accept=0.45 | | `osd` | filter | 屏幕显示 | draw_bbox=true, draw_text=true, draw_face_det=true, draw_face_bbox=true | @@ -182,7 +182,7 @@ mc mb myminio/myminio | 模型文件 | 路径 | 说明 | |----------|------|------| -| best-640.rknn | `./models/best-640.rknn` | YOLOv8 目标检测 (3 classes) | +| best-768.rknn | `./models/best-768.rknn` | YOLOv8 PPE检测 (11 classes,使用3,6) | | RetinaFace_mobile320.rknn | `./models/RetinaFace_mobile320.rknn` | 人脸检测 | | mobilefacenet_arcface.rknn | `./models/mobilefacenet_arcface.rknn` | 人脸识别 | | face_gallery_cam1.db | `./models/face_gallery_cam1.db` | 人脸库 (cam1) | diff --git a/plugins/preprocess/preprocess_node.cpp b/plugins/preprocess/preprocess_node.cpp index 2c8515b..85cda1f 100644 --- a/plugins/preprocess/preprocess_node.cpp +++ b/plugins/preprocess/preprocess_node.cpp @@ -586,13 +586,8 @@ private: valid_w = (valid_w / 16) * 16; if (valid_w <= 0) valid_w = 16; - LogInfo("[preprocess] " + id_ + " letterbox crop: frame=" + std::to_string(frame->width) + "x" + std::to_string(frame->height) + - " valid=" + std::to_string(valid_w) + "x" + std::to_string(valid_h) + - "(16-aligned) target=" + std::to_string(dst_w_) + "x" + std::to_string(dst_h_)); - if (valid_w <= 0 || valid_h <= 0 || valid_x < 0 || valid_y < 0 || valid_x + valid_w > frame->width || valid_y + valid_h > frame->height) { - LogInfo("[preprocess] " + id_ + " letterbox: invalid region"); return FailStatus("invalid letterbox region"); } @@ -609,10 +604,8 @@ private: // Step 1: Crop valid region from RGB frame bool crop_ok = CropFrameSoftware(*frame, cropped, valid_x, valid_y, valid_w, valid_h); if (!crop_ok) { - LogInfo("[preprocess] " + id_ + " letterbox: crop failed, format=" + std::to_string(static_cast(frame->format))); return FailStatus("crop failed - only RGB/BGR supported for letterbox crop"); } - LogInfo("[preprocess] " + id_ + " letterbox: crop success"); // Step 2: Resize to target size (may include format conversion) PixelFormat target_fmt = (dst_fmt_ != PixelFormat::UNKNOWN) ? dst_fmt_ : frame->format; @@ -622,16 +615,13 @@ private: resized.height = dst_h_; resized.format = target_fmt; if (!InitFrameStorage(resized)) { - LogInfo("[preprocess] " + id_ + " letterbox: alloc resize buffer failed"); return FailStatus("alloc resize buffer failed"); } Status resize_st = image_processor_->Resize(cropped, resized); if (resize_st.Failed()) { - LogInfo("[preprocess] " + id_ + " letterbox: resize failed: " + resize_st.ErrMessage()); return resize_st; } - LogInfo("[preprocess] " + id_ + " letterbox: resize success"); // Use resized as output Frame out = std::move(resized);