OrangePi3588Media/configs/production_4ch.json

352 lines
9.7 KiB
JSON

{
"global": {
"metrics_port": 9000,
"web_root": "web"
},
"queue": {
"size": 8,
"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": 5,
"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
},
"class_filter": [3, 6, 10]
},
{
"id": "trk",
"type": "tracker",
"role": "filter",
"enable": true,
"mode": "bytetrack_lite",
"per_class": true,
"state_key": "${name}",
"track_classes": [3, 6, 10],
"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": "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",
"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", "violation"]
},
{
"id": "post",
"type": "preprocess",
"role": "filter",
"enable": true,
"dst_w": 1920,
"dst_h": 1080,
"dst_format": "nv12",
"resize_mode": "stretch",
"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", "violation"],
"rules": [
{
"name": "non_compliant_boots",
"class_ids": [10],
"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
}
],
"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,
"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}"
}
},
"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
}
}
}
],
"edges": [
["in", "pre"],
["pre", "ai"],
["ai", "trk"],
["trk", "logic"],
["logic", "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/cam",
"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.11:8554/cam",
"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/cam",
"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/cam",
"face_gallery_path": "./models/face_gallery.db",
"minio_endpoint": "http://10.0.0.49:9000",
"minio_bucket": "myminio",
"minio_ak": "minioadmin",
"minio_sk": "minioadmin"
}
}
]
}