diff --git a/configs/sample_cam1.json b/configs/sample_cam1.json index b5ef274..3c27be3 100644 --- a/configs/sample_cam1.json +++ b/configs/sample_cam1.json @@ -106,16 +106,16 @@ "require_confirmed": true, "min_count": 1, "max_age_ms": 1000, - "min_interval_ms": 300, - "min_box_area_ratio": 0.01 + "min_interval_ms": 200, + "min_box_area_ratio": 0.02 }, { "id": "pre_face_cam1", "type": "preprocess", "role": "filter", "enable": true, - "dst_w": 1280, - "dst_h": 720, + "dst_w": 0, + "dst_h": 0, "dst_format": "rgb", "dst_packed": true, "keep_ratio": false, @@ -190,8 +190,8 @@ "endpoint": "http://10.0.0.5:9000", "bucket": "test", "region": "us-east-1", - "access_key": "minioadmin", - "secret_key": "minioadmin" + "access_key": "your-access-key", + "secret_key": "your-secret-key" } }, "clip": { @@ -205,8 +205,8 @@ "endpoint": "http://10.0.0.5:9000", "bucket": "test", "region": "us-east-1", - "access_key": "minioadmin", - "secret_key": "minioadmin" + "access_key": "your-access-key", + "secret_key": "your-secret-key" } }, "http": { @@ -241,8 +241,8 @@ "endpoint": "http://10.0.0.5:9000", "bucket": "test", "region": "us-east-1", - "access_key": "minioadmin", - "secret_key": "minioadmin" + "access_key": "your-access-key", + "secret_key": "your-secret-key" } }, "clip": { "enable": false }, @@ -265,10 +265,10 @@ ["post_cam1", "pub_cam1"], ["pub_cam1", "alarm_cam1"], - ["in_cam1", "gate_face_cam1", {"queue": {"size": 2, "strategy": "drop_oldest"}}], - ["gate_face_cam1", "pre_face_cam1", {"queue": {"size": 2, "strategy": "drop_oldest"}}], - ["pre_face_cam1", "face_det_cam1", {"queue": {"size": 2, "strategy": "drop_oldest"}}], - ["face_det_cam1", "face_recog_cam1", {"queue": {"size": 2, "strategy": "drop_oldest"}}], + ["in_cam1", "gate_face_cam1", {"queue": {"size": 1, "strategy": "drop_oldest"}}], + ["gate_face_cam1", "pre_face_cam1", {"queue": {"size": 1, "strategy": "drop_oldest"}}], + ["pre_face_cam1", "face_det_cam1", {"queue": {"size": 1, "strategy": "drop_oldest"}}], + ["face_det_cam1", "face_recog_cam1", {"queue": {"size": 1, "strategy": "drop_oldest"}}], ["face_recog_cam1", "alarm_face_cam1"] ] }, @@ -316,38 +316,6 @@ "nms": 0.45, "class_filter": [] }, - { - "id": "face_det_cam2", - "type": "ai_face_det", - "role": "filter", - "enable": true, - "model_path": "./models/RetinaFace_mobile320.rknn", - "conf": 0.6, - "nms": 0.4, - "max_faces": 10, - "output_landmarks": true, - "input_format": "rgb" - }, - { - "id": "face_recog_cam2", - "type": "ai_face_recog", - "role": "filter", - "enable": true, - "model_path": "./models/mobilefacenet_arcface.rknn", - "align": true, - "emit_embedding": false, - "max_faces": 10, - "input_format": "rgb", - "input_dtype": "uint8", - "threshold": { "accept": 0.45, "margin": 0.05 }, - "gallery": { - "backend": "sqlite", - "path": "./models/face_gallery.db", - "load_on_start": true, - "expected_dim": 512, - "dtype": "auto" - } - }, { "id": "trk_cam2", "type": "tracker", @@ -367,32 +335,6 @@ "max_tracks": 128, "debug": { "stats": false, "stats_interval": 200 } }, - { - "id": "gate_face_cam2", - "type": "gate", - "role": "filter", - "enable": true, - "state_key": "cam2_sample_full_pipeline", - "class_ids": [0], - "require_confirmed": true, - "min_count": 1, - "max_age_ms": 1000, - "min_interval_ms": 300, - "min_box_area_ratio": 0.01 - }, - { - "id": "pre_face_cam2", - "type": "preprocess", - "role": "filter", - "enable": true, - "dst_w": 1280, - "dst_h": 720, - "dst_format": "rgb", - "dst_packed": true, - "keep_ratio": false, - "rga_gate": "cam2_sample_full_pipeline", - "use_rga": true - }, { "id": "osd_cam2", "type": "osd", @@ -461,8 +403,8 @@ "endpoint": "http://10.0.0.5:9000", "bucket": "test", "region": "us-east-1", - "access_key": "minioadmin", - "secret_key": "minioadmin" + "access_key": "alarm_face_cam1", + "secret_key": "your-secret-key" } }, "clip": { @@ -476,8 +418,8 @@ "endpoint": "http://10.0.0.5:9000", "bucket": "test", "region": "us-east-1", - "access_key": "minioadmin", - "secret_key": "minioadmin" + "access_key": "your-access-key", + "secret_key": "your-secret-key" } }, "http": { @@ -493,7 +435,7 @@ "id": "alarm_face_cam2", "type": "alarm", "role": "sink", - "enable": true, + "enable": false, "eval_fps": 5, "labels": [], "rules": [], @@ -512,8 +454,8 @@ "endpoint": "http://10.0.0.5:9000", "bucket": "test", "region": "us-east-1", - "access_key": "minioadmin", - "secret_key": "minioadmin" + "access_key": "your-access-key", + "secret_key": "your-secret-key" } }, "clip": { "enable": false }, @@ -534,13 +476,7 @@ ["trk_cam2", "osd_cam2"], ["osd_cam2", "post_cam2"], ["post_cam2", "pub_cam2"], - ["pub_cam2", "alarm_cam2"], - - ["in_cam2", "gate_face_cam2", {"queue": {"size": 2, "strategy": "drop_oldest"}}], - ["gate_face_cam2", "pre_face_cam2", {"queue": {"size": 2, "strategy": "drop_oldest"}}], - ["pre_face_cam2", "face_det_cam2", {"queue": {"size": 2, "strategy": "drop_oldest"}}], - ["face_det_cam2", "face_recog_cam2", {"queue": {"size": 2, "strategy": "drop_oldest"}}], - ["face_recog_cam2", "alarm_face_cam2"] + ["pub_cam2", "alarm_cam2"] ] } ] diff --git a/plugins/preprocess/preprocess_node.cpp b/plugins/preprocess/preprocess_node.cpp index 1e2336a..679a978 100644 --- a/plugins/preprocess/preprocess_node.cpp +++ b/plugins/preprocess/preprocess_node.cpp @@ -441,7 +441,13 @@ private: int out_w = dst_w_; int out_h = dst_h_; - if (keep_ratio_ && frame->width > 0 && frame->height > 0) { + // Allow config to follow source resolution: + // - dst_w <= 0 => out_w = frame->width + // - dst_h <= 0 => out_h = frame->height + if (out_w <= 0) out_w = frame->width; + if (out_h <= 0) out_h = frame->height; + + if (keep_ratio_ && dst_w_ > 0 && dst_h_ > 0 && frame->width > 0 && frame->height > 0) { float scale = std::min(static_cast(dst_w_) / frame->width, static_cast(dst_h_) / frame->height); out_w = static_cast(frame->width * scale); @@ -716,7 +722,10 @@ private: int out_w = dst_w_; int out_h = dst_h_; - if (keep_ratio_ && frame->width > 0 && frame->height > 0) { + if (out_w <= 0) out_w = frame->width; + if (out_h <= 0) out_h = frame->height; + + if (keep_ratio_ && dst_w_ > 0 && dst_h_ > 0 && frame->width > 0 && frame->height > 0) { float scale = std::min(static_cast(dst_w_) / frame->width, static_cast(dst_h_) / frame->height); out_w = static_cast(frame->width * scale);