diff --git a/biz/prison/indoor_biz.py b/biz/prison/indoor_biz.py index 0fe5898..73235c0 100644 --- a/biz/prison/indoor_biz.py +++ b/biz/prison/indoor_biz.py @@ -96,31 +96,31 @@ class PrisonerDoorDetector: return (True, roi_name) return (False, "outside") - def push_alert(self, camera_id, track_id, lost_roi, last_cxcy, timestamp): - """报警推送:带频率限制,携带消失ROI、最后中心点坐标""" - current_time = time.time() - if current_time - self.last_alert_time < ALERT_PUSH_INTERVAL: - return False - # 构造报警信息(可根据平台要求扩展字段) - alert_info = { - "camera_id": camera_id, - "alert_type": "prisoner_cx_disappear_in_roi", - "prisoner_track_id": track_id, - "disappear_roi": lost_roi, - "last_cx": round(last_cxcy[0], 2), - "last_cy": round(last_cxcy[1], 2), - "timestamp": timestamp, - "details": f"犯人框中心点在{lost_roi}区域内消失,触发报警" - } - # 推送报警请求 - try: - requests.post(ALERT_PUSH_URL, json=alert_info, timeout=3) - print(f"[报警成功] {alert_info}") - self.last_alert_time = current_time - return True - except Exception as e: - print(f"[报警失败] 原因:{str(e)}") - return False + # def push_alert(self, camera_id, track_id, lost_roi, last_cxcy, timestamp): + # """报警推送:带频率限制,携带消失ROI、最后中心点坐标""" + # current_time = time.time() + # if current_time - self.last_alert_time < ALERT_PUSH_INTERVAL: + # return False + # # 构造报警信息(可根据平台要求扩展字段) + # alert_info = { + # "camera_id": camera_id, + # "alert_type": "prisoner_cx_disappear_in_roi", + # "prisoner_track_id": track_id, + # "disappear_roi": lost_roi, + # "last_cx": round(last_cxcy[0], 2), + # "last_cy": round(last_cxcy[1], 2), + # "timestamp": timestamp, + # "details": f"犯人框中心点在{lost_roi}区域内消失,触发报警" + # } + # # 推送报警请求 + # try: + # requests.post(ALERT_PUSH_URL, json=alert_info, timeout=3) + # print(f"[报警成功] {alert_info}") + # self.last_alert_time = current_time + # return True + # except Exception as e: + # print(f"[报警失败] 原因:{str(e)}") + # return False def process_frame(self, frame, camera_id: int, timestamp: float) -> dict: """ @@ -207,18 +207,18 @@ class PrisonerDoorDetector: track_info["lost_frames"] += 1 # 累计消失帧数 # 消失帧数达到阈值,触发报警 if track_info["lost_frames"] >= ROI_LOST_FRAMES_THRESH: - self.push_alert( - camera_id=camera_id, - track_id=track_id, - lost_roi=track_info["lost_roi"], - last_cxcy=track_info["last_cxcy"], - timestamp=timestamp - ) + # self.push_alert( + # camera_id=camera_id, + # track_id=track_id, + # lost_roi=track_info["lost_roi"], + # last_cxcy=track_info["last_cxcy"], + # timestamp=timestamp + # ) # 记录本帧报警信息 current_frame_alerts.append({ "time": timestamp, "camera_id": camera_id, - "action": "prisoner_cx_disappear_in_door", + "action": "Indoor Violation", "prisoner_track_id": track_id, "disappear_roi": track_info["lost_roi"], "last_cx": round(track_info["last_cxcy"][0], 2), diff --git a/config.yaml b/config.yaml index 9e5b83c..5a0f38c 100644 --- a/config.yaml +++ b/config.yaml @@ -138,6 +138,8 @@ alert_types: # 监狱检测 (prison) "prisoner": "带出犯人" "violation": "路线违规" + "Indoor Violation": "违规进入区域" + # 监控室检测 (supervision_room) "Playing Phone": "玩手机" diff --git a/web_page_2/index.html b/web_page_2/index.html index 44f56f0..5f95e49 100644 --- a/web_page_2/index.html +++ b/web_page_2/index.html @@ -245,7 +245,7 @@ const WS_PORT = config.port; const WS_HOST = '29.1.70.11'; - + const liveImage = document.getElementById('liveImage'); const statusBar = document.getElementById('status'); @@ -321,7 +321,8 @@ 'Playing Phone': '玩手机', 'Unvaild Uniform!!': '违规着装', 'Unchecked Trunk': '未检查后备箱', - 'Ignore': '漏检' + 'Ignore': '漏检', + 'Indoor Violation': '违规进入区域' }; tag.textContent = actionMap[action] || action; title.appendChild(tag);