safesight/configs/production_4ch.json

306 lines
8.1 KiB
JSON

{
"global": {
"metrics_port": 9000,
"web_root": "web"
},
"queue": {
"size": 4,
"strategy": "drop_oldest"
},
"templates": {
"ppe_detection_pipeline": {
"nodes": [
{
"id": "in",
"type": "input_rtsp",
"role": "source",
"enable": true,
"url": "${url}",
"fps": 30,
"use_mpp": true,
"use_ffmpeg": false,
"force_tcp": true,
"reconnect_sec": 5,
"reconnect_backoff_max_sec": 30
},
{
"id": "pre",
"type": "preprocess",
"role": "filter",
"enable": true,
"dst_w": 768,
"dst_h": 768,
"dst_format": "rgb",
"dst_packed": true,
"resize_mode": "stretch",
"rga_gate": "${name}",
"use_rga": true
},
{
"id": "ai",
"type": "ai_yolo",
"role": "filter",
"enable": true,
"infer_fps": 10,
"model_path": "./models/best-768.rknn",
"model_version": "v8",
"model_w": 768,
"model_h": 768,
"num_classes": 11,
"conf": 0.35,
"nms": 0.45,
"debug": {
"stats": false,
"stats_interval": 30,
"detections": false
}
},
{
"id": "trk",
"type": "tracker",
"role": "filter",
"enable": true,
"mode": "bytetrack_lite",
"per_class": true,
"state_key": "${name}",
"track_classes": [3, 6],
"ignore_classes": [],
"allowed_models": ["yolov8"],
"high_th": 0.5,
"low_th": 0.1,
"iou_th": 0.3,
"max_age_ms": 1500,
"min_hits": 2,
"max_tracks": 128
},
{
"id": "face_det",
"type": "ai_face_det",
"role": "filter",
"enable": true,
"model_path": "./models/RetinaFace_mobile320.rknn",
"conf": 0.7,
"nms": 0.4,
"max_faces": 10,
"output_landmarks": true,
"input_format": "rgb"
},
{
"id": "face_recog",
"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": "${face_gallery_path}",
"load_on_start": true,
"expected_dim": 512,
"dtype": "auto"
}
},
{
"id": "osd",
"type": "osd",
"role": "filter",
"enable": true,
"draw_bbox": true,
"draw_text": true,
"draw_face_det": true,
"draw_face_bbox": true,
"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",
"type": "preprocess",
"role": "filter",
"enable": true,
"queue": {
"size": 2,
"policy": "drop_oldest"
},
"dst_w": 1920,
"dst_h": 1080,
"dst_format": "nv12",
"resize_mode": "stretch",
"rga_gate": "${name}",
"use_rga": true
},
{
"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"],
"rules": [
{
"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,
"require_track_id": true,
"min_duration_ms": 1500,
"min_hits": 3,
"hit_window_ms": 1500,
"cooldown_ms": 5000,
"per_track_cooldown_ms": 5000
}
],
"actions": {
"log": {
"enable": true,
"level": "info"
},
"snapshot": {
"enable": true,
"min_interval_ms": 15000,
"format": "jpg",
"quality": 85,
"upload": {
"type": "minio",
"endpoint": "${minio_endpoint}",
"bucket": "${minio_bucket}",
"region": "us-east-1",
"access_key": "${minio_ak}",
"secret_key": "${minio_sk}"
}
},
"clip": {
"enable": true,
"min_interval_ms": 15000,
"pre_sec": 5,
"post_sec": 10,
"format": "mp4",
"fps": 30,
"upload": {
"type": "minio",
"endpoint": "${minio_endpoint}",
"bucket": "${minio_bucket}",
"region": "us-east-1",
"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
}
],
"debug": {
"stats": false,
"stats_interval": 100
}
}
],
"edges": [
["in", "pre"],
["pre", "ai"],
["ai", "trk"],
["trk", "face_det"],
["face_det", "face_recog"],
["face_recog", "osd"],
["osd", "post"],
["post", "pub"],
["pub", "alarm"]
]
}
},
"instances": [
{
"name": "cam1",
"template": "ppe_detection_pipeline",
"params": {
"name": "cam1",
"url": "rtsp://10.0.0.49:8554/cam1",
"face_gallery_path": "./models/face_gallery.db",
"minio_endpoint": "http://10.0.0.49:9000",
"minio_bucket": "myminio",
"minio_ak": "minioadmin",
"minio_sk": "minioadmin"
}
},
{
"name": "cam2",
"template": "ppe_detection_pipeline",
"params": {
"name": "cam2",
"url": "rtsp://10.0.0.49:8554/cam2",
"face_gallery_path": "./models/face_gallery.db",
"minio_endpoint": "http://10.0.0.49:9000",
"minio_bucket": "myminio",
"minio_ak": "minioadmin",
"minio_sk": "minioadmin"
}
},
{
"name": "cam3",
"template": "ppe_detection_pipeline",
"params": {
"name": "cam3",
"url": "rtsp://10.0.0.49:8554/cam3",
"face_gallery_path": "./models/face_gallery.db",
"minio_endpoint": "http://10.0.0.49:9000",
"minio_bucket": "myminio",
"minio_ak": "minioadmin",
"minio_sk": "minioadmin"
}
},
{
"name": "cam4",
"template": "ppe_detection_pipeline",
"params": {
"name": "cam4",
"url": "rtsp://10.0.0.49:8554/cam4",
"face_gallery_path": "./models/face_gallery.db",
"minio_endpoint": "http://10.0.0.49:9000",
"minio_bucket": "myminio",
"minio_ak": "minioadmin",
"minio_sk": "minioadmin"
}
}
]
}