diff --git a/agent/agent_cam1.config.json b/agent/agent.config.example.json similarity index 100% rename from agent/agent_cam1.config.json rename to agent/agent.config.example.json diff --git a/configs/production_4ch.json b/configs/production_4ch.json index 82b0b4b..85166f1 100644 --- a/configs/production_4ch.json +++ b/configs/production_4ch.json @@ -4,7 +4,7 @@ "web_root": "web" }, "queue": { - "size": 4, + "size": 8, "strategy": "drop_oldest" }, "templates": { @@ -53,7 +53,8 @@ "stats": false, "stats_interval": 30, "detections": false - } + }, + "class_filter": [3, 6, 10] }, { "id": "trk", @@ -63,7 +64,7 @@ "mode": "bytetrack_lite", "per_class": true, "state_key": "${name}", - "track_classes": [3, 6], + "track_classes": [3, 6, 10], "ignore_classes": [], "allowed_models": ["yolov8"], "high_th": 0.5, @@ -73,6 +74,22 @@ "min_hits": 2, "max_tracks": 128 }, + { + "id": "logic", + "type": "logic_gate", + "role": "filter", + "enable": true, + "mode": "ppe_boots_check", + "anchor_class": 6, + "boots_class": 3, + "color_check": { + "enable": true, + "method": "hsv", + "dark_threshold": 80, + "roi_expand": 1.0 + }, + "debug": true + }, { "id": "face_det", "type": "ai_face_det", @@ -120,17 +137,13 @@ "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"] + "labels": ["helmet", "gloves", "vest", "boots", "goggles", "none", "Person", "no_helmet", "no_goggle", "no_gloves", "no_boots", "violation"] }, { "id": "post", "type": "preprocess", "role": "filter", "enable": true, - "queue": { - "size": 2, - "policy": "drop_oldest" - }, "dst_w": 1920, "dst_h": 1080, "dst_format": "nv12", @@ -138,17 +151,45 @@ "rga_gate": "${name}", "use_rga": true }, + { + "id": "pub", + "type": "publish", + "role": "filter", + "enable": true, + "queue": { + "size": 2, + "policy": "drop_oldest" + }, + "codec": "h264", + "fps": 30, + "gop": 60, + "bitrate_kbps": 2000, + "use_mpp": true, + "use_ffmpeg_mux": true, + "outputs": [ + { + "proto": "hls", + "path": "./web/hls/${name}/index.m3u8", + "segment_sec": 2 + }, + { + "proto": "rtsp_server", + "port": 8555, + "path": "/live/${name}" + } + ] + }, { "id": "alarm", "type": "alarm", "role": "sink", "enable": true, "eval_fps": 10, - "labels": ["helmet", "gloves", "vest", "boots", "goggles", "none", "Person", "no_helmet", "no_goggle", "no_gloves", "no_boots"], + "labels": ["helmet", "gloves", "vest", "boots", "goggles", "none", "Person", "no_helmet", "no_goggle", "no_gloves", "no_boots", "violation"], "rules": [ { - "name": "ppe_violation", - "class_ids": [3, 6], + "name": "non_compliant_boots", + "class_ids": [10], "roi": { "x": 0.0, "y": 0.0, @@ -165,6 +206,30 @@ "per_track_cooldown_ms": 5000 } ], + "face_rules": [ + { + "name": "unknown_face", + "type": "unknown", + "cooldown_ms": 7000, + "min_sim": 0.35, + "min_hits": 2, + "hit_window_ms": 1500, + "min_face_area_ratio": 0.01, + "min_face_aspect": 0.6, + "max_face_aspect": 1.6 + }, + { + "name": "known_person", + "type": "person", + "cooldown_ms": 7000, + "min_sim": 0.6, + "min_hits": 2, + "hit_window_ms": 1500, + "min_face_area_ratio": 0.01, + "min_face_aspect": 0.6, + "max_face_aspect": 1.6 + } + ], "actions": { "log": { "enable": true, @@ -199,39 +264,19 @@ "access_key": "${minio_ak}", "secret_key": "${minio_sk}" } - } - } - }, - { - "id": "pub", - "type": "publish", - "role": "filter", - "enable": true, - "queue": { - "size": 2, - "policy": "drop_oldest" - }, - "codec": "h264", - "fps": 30, - "gop": 60, - "bitrate_kbps": 4000, - "use_mpp": true, - "use_ffmpeg_mux": true, - "outputs": [ - { - "proto": "rtsp_server", - "port": 8555, - "path": "/live/${name}" }, - { - "proto": "hls", - "path": "./web/hls/${name}/index.m3u8", - "segment_sec": 2 + "external_api": { + "enable": true, + "getTokenUrl": "http://10.0.0.49:8080/api/getToken", + "putMessageUrl": "http://10.0.0.49:8080/api/putMessage", + "tenantCode": "32", + "channelNo": "${name}", + "timeout_ms": 3000, + "include_media_url": true, + "token_header": "X-Access-Token", + "token_json_path": "responseBody.token", + "token_cache_sec": 1200 } - ], - "debug": { - "stats": false, - "stats_interval": 100 } } ], @@ -239,7 +284,8 @@ ["in", "pre"], ["pre", "ai"], ["ai", "trk"], - ["trk", "face_det"], + ["trk", "logic"], + ["logic", "face_det"], ["face_det", "face_recog"], ["face_recog", "osd"], ["osd", "post"], diff --git a/scripts/deploy.sh b/scripts/deploy.sh index a2640d6..15305a3 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -432,7 +432,8 @@ cmd_install_agent() { "max_upload_mb": 200, "config_path": "$INSTALL_DIR/etc/media-server.json", "media_server_process": { - "enable": false + "enable": false, + "configs_dir": "$INSTALL_DIR/etc" }, "media_server_base_url": "http://127.0.0.1:9000", "media_server_timeout_ms": 3000,