diff --git a/internal/service/tuning.go b/internal/service/tuning.go index 913d4f5..039f421 100644 --- a/internal/service/tuning.go +++ b/internal/service/tuning.go @@ -18,6 +18,7 @@ type TuningItem struct { Step float64 `json:"step"` Unit string `json:"unit,omitempty"` Group string `json:"group,omitempty"` + Hint string `json:"hint,omitempty"` Value float64 `json:"value"` } @@ -179,27 +180,27 @@ func (s *ConfigPreviewService) RedeployDevices(deviceIDs []string) ([]string, er var tuningDefinitions = map[string][]TuningItem{ "std_workshop_face_recognition_shoe_alarm": { // ── 告警 ── - {Path: "alarm_violation.rules[0].cooldown_ms", Label: "劳保鞋告警冷却", Type: "slider", Min: 5000, Max: 300000, Step: 1000, Unit: "ms", Group: "告警"}, - {Path: "alarm_violation.rules[0].min_duration_ms", Label: "违规最小持续时间", Type: "slider", Min: 200, Max: 10000, Step: 100, Unit: "ms", Group: "告警"}, - {Path: "alarm_violation.rules[0].min_hits", Label: "违规最小命中帧数", Type: "slider", Min: 1, Max: 10, Step: 1, Unit: "帧", Group: "告警"}, - {Path: "alarm_violation.rules[0].min_score", Label: "违规最低置信度", Type: "slider", Min: 0.1, Max: 0.9, Step: 0.05, Group: "告警"}, + {Path: "alarm_violation.rules[0].cooldown_ms", Label: "劳保鞋告警冷却", Type: "slider", Min: 5000, Max: 300000, Step: 1000, Unit: "ms", Group: "告警", Hint: "测试 15s,生产 60s"}, + {Path: "alarm_violation.rules[0].min_duration_ms", Label: "违规最小持续时间", Type: "slider", Min: 200, Max: 10000, Step: 100, Unit: "ms", Group: "告警", Hint: "测试 800ms,生产 1500ms"}, + {Path: "alarm_violation.rules[0].min_hits", Label: "违规最小命中帧数", Type: "slider", Min: 1, Max: 10, Step: 1, Unit: "帧", Group: "告警", Hint: "测试 2,生产 3"}, + {Path: "alarm_violation.rules[0].min_score", Label: "违规最低置信度", Type: "slider", Min: 0.1, Max: 0.9, Step: 0.05, Group: "告警", Hint: "测试 0.3,生产 0.5"}, // ── 人脸 ── - {Path: "alarm_violation.face_rules[0].cooldown_ms", Label: "陌生人脸冷却", Type: "slider", Min: 2000, Max: 120000, Step: 1000, Unit: "ms", Group: "人脸"}, - {Path: "alarm_violation.face_rules[0].min_hits", Label: "陌生人脸命中帧数", Type: "slider", Min: 1, Max: 10, Step: 1, Unit: "帧", Group: "人脸"}, - {Path: "alarm_violation.face_rules[0].max_known_sim", Label: "陌生人脸相似度上限", Type: "slider", Min: 0.1, Max: 0.8, Step: 0.05, Group: "人脸"}, - {Path: "alarm_violation.face_rules[0].hit_window_ms", Label: "陌生人脸命中窗口", Type: "slider", Min: 500, Max: 10000, Step: 500, Unit: "ms", Group: "人脸"}, - {Path: "alarm_violation.face_rules[1].cooldown_ms", Label: "已知人员冷却", Type: "slider", Min: 2000, Max: 120000, Step: 1000, Unit: "ms", Group: "人脸"}, - {Path: "alarm_violation.face_rules[1].min_sim", Label: "已知人员相似度阈值", Type: "slider", Min: 0.3, Max: 0.95, Step: 0.05, Group: "人脸"}, - {Path: "alarm_violation.face_rules[1].min_hits", Label: "已知人员命中帧数", Type: "slider", Min: 1, Max: 10, Step: 1, Unit: "帧", Group: "人脸"}, - {Path: "alarm_violation.face_rules[1].hit_window_ms", Label: "已知人员命中窗口", Type: "slider", Min: 500, Max: 10000, Step: 500, Unit: "ms", Group: "人脸"}, - {Path: "recognize_face.threshold.accept", Label: "人脸识别接受阈值", Type: "slider", Min: 0.3, Max: 0.9, Step: 0.05, Group: "人脸"}, + {Path: "alarm_violation.face_rules[0].cooldown_ms", Label: "陌生人脸冷却", Type: "slider", Min: 2000, Max: 120000, Step: 1000, Unit: "ms", Group: "人脸", Hint: "测试 7s,生产 30s"}, + {Path: "alarm_violation.face_rules[0].min_hits", Label: "陌生人脸命中帧数", Type: "slider", Min: 1, Max: 10, Step: 1, Unit: "帧", Group: "人脸", Hint: "测试 2,生产 4"}, + {Path: "alarm_violation.face_rules[0].max_known_sim", Label: "陌生人脸相似度上限", Type: "slider", Min: 0.1, Max: 0.8, Step: 0.05, Group: "人脸", Hint: "测试 0.35,生产 0.2"}, + {Path: "alarm_violation.face_rules[0].hit_window_ms", Label: "陌生人脸命中窗口", Type: "slider", Min: 500, Max: 10000, Step: 500, Unit: "ms", Group: "人脸", Hint: "测试 1500ms,生产 3000ms"}, + {Path: "alarm_violation.face_rules[1].cooldown_ms", Label: "已知人员冷却", Type: "slider", Min: 2000, Max: 120000, Step: 1000, Unit: "ms", Group: "人脸", Hint: "测试 7s,生产 30s"}, + {Path: "alarm_violation.face_rules[1].min_sim", Label: "已知人员相似度阈值", Type: "slider", Min: 0.3, Max: 0.95, Step: 0.05, Group: "人脸", Hint: "测试 0.6,生产 0.75"}, + {Path: "alarm_violation.face_rules[1].min_hits", Label: "已知人员命中帧数", Type: "slider", Min: 1, Max: 10, Step: 1, Unit: "帧", Group: "人脸", Hint: "测试 2,生产 3"}, + {Path: "alarm_violation.face_rules[1].hit_window_ms", Label: "已知人员命中窗口", Type: "slider", Min: 500, Max: 10000, Step: 500, Unit: "ms", Group: "人脸", Hint: "测试 1500ms,生产 2000ms"}, + {Path: "recognize_face.threshold.accept", Label: "人脸识别接受阈值", Type: "slider", Min: 0.3, Max: 0.9, Step: 0.05, Group: "人脸", Hint: "默认 0.45"}, // ── 工鞋 ── - {Path: "detect_shoe.conf", Label: "工鞋检测置信度", Type: "slider", Min: 0.1, Max: 0.8, Step: 0.05, Group: "工鞋"}, - {Path: "rule_shoe_association.person_shoe_check.min_shoe_score", Label: "工鞋最低分数", Type: "slider", Min: 0.1, Max: 0.6, Step: 0.02, Group: "工鞋"}, - {Path: "rule_shoe_association.person_shoe_check.min_person_score", Label: "人员最低分数", Type: "slider", Min: 0.1, Max: 0.8, Step: 0.05, Group: "工鞋"}, + {Path: "detect_shoe.conf", Label: "工鞋检测置信度", Type: "slider", Min: 0.1, Max: 0.8, Step: 0.05, Group: "工鞋", Hint: "默认 0.22"}, + {Path: "rule_shoe_association.person_shoe_check.min_shoe_score", Label: "工鞋最低分数", Type: "slider", Min: 0.1, Max: 0.6, Step: 0.02, Group: "工鞋", Hint: "默认 0.22"}, + {Path: "rule_shoe_association.person_shoe_check.min_person_score", Label: "人员最低分数", Type: "slider", Min: 0.1, Max: 0.8, Step: 0.05, Group: "工鞋", Hint: "默认 0.3"}, // ── 检测 ── - {Path: "detect_person.conf", Label: "人体检测置信度", Type: "slider", Min: 0.1, Max: 0.8, Step: 0.05, Group: "检测"}, - {Path: "detect_face.conf_thresh", Label: "人脸检测置信度", Type: "slider", Min: 0.2, Max: 0.9, Step: 0.05, Group: "检测"}, + {Path: "detect_person.conf", Label: "人体检测置信度", Type: "slider", Min: 0.1, Max: 0.8, Step: 0.05, Group: "检测", Hint: "默认 0.35"}, + {Path: "detect_face.conf_thresh", Label: "人脸检测置信度", Type: "slider", Min: 0.2, Max: 0.9, Step: 0.05, Group: "检测", Hint: "默认 0.5"}, }, } diff --git a/internal/web/ui/templates/template_settings.html b/internal/web/ui/templates/template_settings.html index 0b8062e..a4d92a4 100644 --- a/internal/web/ui/templates/template_settings.html +++ b/internal/web/ui/templates/template_settings.html @@ -24,6 +24,7 @@ data-step="{{printf "%v" .Step}}" data-unit="{{.Unit}}" oninput="var s=Number(this.dataset.step);var d=s>=1?0:2;var u=this.dataset.unit||'';this.nextElementSibling.textContent=Number(this.value).toFixed(d)+(u?' '+u:'')"> {{formatTuneValue .Value .Step}}{{if .Unit}} {{.Unit}}{{end}} + {{if .Hint}}({{.Hint}}){{end}} {{end}} diff --git a/safesightd-linux-arm64 b/safesightd-linux-arm64 index fbe4a1d..48c6b91 100644 Binary files a/safesightd-linux-arm64 and b/safesightd-linux-arm64 differ