diff --git a/internal/service/tuning.go b/internal/service/tuning.go index 039f421..34fe469 100644 --- a/internal/service/tuning.go +++ b/internal/service/tuning.go @@ -19,6 +19,7 @@ type TuningItem struct { Unit string `json:"unit,omitempty"` Group string `json:"group,omitempty"` Hint string `json:"hint,omitempty"` + Desc string `json:"desc,omitempty"` Value float64 `json:"value"` } @@ -180,27 +181,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: "告警", 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.rules[0].cooldown_ms", Label: "劳保鞋告警冷却", Type: "slider", Min: 5000, Max: 300000, Step: 1000, Unit: "ms", Group: "告警", Hint: "测试 15s,生产 60s", Desc: "同一违规两次告警的最短间隔,值越大告警越少"}, + {Path: "alarm_violation.rules[0].min_duration_ms", Label: "违规最小持续时间", Type: "slider", Min: 200, Max: 10000, Step: 100, Unit: "ms", Group: "告警", Hint: "测试 800ms,生产 1500ms", Desc: "违规需持续多久才触发告警,值越大越不敏感"}, + {Path: "alarm_violation.rules[0].min_hits", Label: "违规最小命中帧数", Type: "slider", Min: 1, Max: 10, Step: 1, Unit: "帧", Group: "告警", Hint: "测试 2,生产 3", Desc: "连续检测到多少次才确认违规,值越大误报越少"}, + {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", Desc: "检测结果的可信度门槛,值越高告警越准确但可能漏报"}, // ── 人脸 ── - {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: "alarm_violation.face_rules[0].cooldown_ms", Label: "陌生人脸冷却", Type: "slider", Min: 2000, Max: 120000, Step: 1000, Unit: "ms", Group: "人脸", Hint: "测试 7s,生产 30s", Desc: "同一陌生人重复告警的最短间隔,值越大告警越少"}, + {Path: "alarm_violation.face_rules[0].min_hits", Label: "陌生人脸命中帧数", Type: "slider", Min: 1, Max: 10, Step: 1, Unit: "帧", Group: "人脸", Hint: "测试 2,生产 4", Desc: "连续识别为陌生人的帧数,值越大误报越少但响应变慢"}, + {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", Desc: "相似度低于此值才判定为陌生人,值越低陌生人越少"}, + {Path: "alarm_violation.face_rules[0].hit_window_ms", Label: "陌生人脸命中窗口", Type: "slider", Min: 500, Max: 10000, Step: 500, Unit: "ms", Group: "人脸", Hint: "测试 1500ms,生产 3000ms", Desc: "累计命中帧数的时间窗口,窗口越大越容易触发告警"}, + {Path: "alarm_violation.face_rules[1].cooldown_ms", Label: "已知人员冷却", Type: "slider", Min: 2000, Max: 120000, Step: 1000, Unit: "ms", Group: "人脸", Hint: "测试 7s,生产 30s", Desc: "同一已知人员重复告警的最短间隔,值越大告警越少"}, + {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", Desc: "相似度超过此值才认作已知人员,值越高匹配越严格"}, + {Path: "alarm_violation.face_rules[1].min_hits", Label: "已知人员命中帧数", Type: "slider", Min: 1, Max: 10, Step: 1, Unit: "帧", Group: "人脸", Hint: "测试 2,生产 3", Desc: "连续识别为同一人的帧数,值越大越可靠但识别变慢"}, + {Path: "alarm_violation.face_rules[1].hit_window_ms", Label: "已知人员命中窗口", Type: "slider", Min: 500, Max: 10000, Step: 500, Unit: "ms", Group: "人脸", Hint: "测试 1500ms,生产 2000ms", Desc: "累计命中帧数的时间窗口,窗口越大越容易触发告警"}, + {Path: "recognize_face.threshold.accept", Label: "人脸识别接受阈值", Type: "slider", Min: 0.3, Max: 0.9, Step: 0.05, Group: "人脸", Hint: "默认 0.45", Desc: "人脸特征匹配的全局门槛,值越高误识别越少但漏识别增多"}, // ── 工鞋 ── - {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_shoe.conf", Label: "工鞋检测置信度", Type: "slider", Min: 0.1, Max: 0.8, Step: 0.05, Group: "工鞋", Hint: "默认 0.22", Desc: "检测到工鞋的可信度门槛,值越高检测越严格"}, + {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", Desc: "工鞋检测结果的最低可信度,值越高误检越少"}, + {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", Desc: "人员检测结果的最低可信度,值越高只对清晰人体做鞋检测"}, // ── 检测 ── - {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"}, + {Path: "detect_person.conf", Label: "人体检测置信度", Type: "slider", Min: 0.1, Max: 0.8, Step: 0.05, Group: "检测", Hint: "默认 0.35", Desc: "检测到人体的可信度门槛,值越高误检越少但可能漏人"}, + {Path: "detect_face.conf_thresh", Label: "人脸检测置信度", Type: "slider", Min: 0.2, Max: 0.9, Step: 0.05, Group: "检测", Hint: "默认 0.5", Desc: "检测到人脸的可信度门槛,值越高误检越少"}, }, } diff --git a/internal/web/ui/assets/style.css b/internal/web/ui/assets/style.css index cdaf0aa..127152f 100644 --- a/internal/web/ui/assets/style.css +++ b/internal/web/ui/assets/style.css @@ -413,7 +413,7 @@ pre{margin-top:12px;padding:12px;border-radius:var(--radius);border:1px solid va .assignment-slider input[type=range]{width:180px} .tuning-item{display:flex;align-items:center;gap:12px;padding:6px 0;border-bottom:1px solid var(--border)} .tuning-item:last-child{border-bottom:none} -.tuning-label{min-width:140px;font-size:13px;font-weight:500;color:var(--text)} +.tuning-label-wrap{min-width:160px}.tuning-label{display:block;font-size:13px;font-weight:500;color:var(--text)}.tuning-desc{display:block;font-size:11px;color:var(--muted);margin-top:1px;font-style:italic} .tuning-control{display:flex;align-items:center;gap:8px;flex:1} .tuning-control input[type=range]{flex:1;max-width:300px} .tuning-control output{min-width:70px;font-size:12px;color:var(--muted);text-align:right} diff --git a/internal/web/ui/templates/template_settings.html b/internal/web/ui/templates/template_settings.html index a4d92a4..408b3e5 100644 --- a/internal/web/ui/templates/template_settings.html +++ b/internal/web/ui/templates/template_settings.html @@ -18,7 +18,10 @@
{{range $items}}
- +
+ + {{if .Desc}}{{.Desc}}{{end}} +