删除报警相关逻辑
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import time
|
import time
|
||||||
import requests
|
# import requests
|
||||||
from collections import deque
|
from collections import deque
|
||||||
from biz.base_frame_processor import BaseFrameProcessorWorker
|
from biz.base_frame_processor import BaseFrameProcessorWorker
|
||||||
from algorithm.common.npu_yolo_onnx_person_car_phone import YOLOv8_ONNX
|
from algorithm.common.npu_yolo_onnx_person_car_phone import YOLOv8_ONNX
|
||||||
@@ -13,7 +13,7 @@ DETECT_MODEL_PATH = 'YOLO_Weight/kanshousuo.onnx' # 犯人检测onnx模型路
|
|||||||
INPUT_SIZE = 640 # 模型输入尺寸
|
INPUT_SIZE = 640 # 模型输入尺寸
|
||||||
RTSP_FPS = 10 # 视频流目标FPS
|
RTSP_FPS = 10 # 视频流目标FPS
|
||||||
ALERT_PUSH_INTERVAL = 5 # 相同报警5秒内仅推送1次
|
ALERT_PUSH_INTERVAL = 5 # 相同报警5秒内仅推送1次
|
||||||
ALERT_PUSH_URL = "http://123.57.151.210:10000/picenter/websocket/test/process"
|
# ALERT_PUSH_URL = "http://123.57.151.210:10000/picenter/websocket/test/process"
|
||||||
# 消失判定:中心点在ROI内消失后,持续无检测的帧数(1.0秒,可微调)
|
# 消失判定:中心点在ROI内消失后,持续无检测的帧数(1.0秒,可微调)
|
||||||
ROI_LOST_FRAMES_THRESH = int(0.5 * RTSP_FPS) # todo: 从frame改为时间
|
ROI_LOST_FRAMES_THRESH = int(0.5 * RTSP_FPS) # todo: 从frame改为时间
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ class PrisonerDoorDetector:
|
|||||||
self.tracker = BYTETracker(TrackerArgs(), frame_rate=RTSP_FPS)
|
self.tracker = BYTETracker(TrackerArgs(), frame_rate=RTSP_FPS)
|
||||||
|
|
||||||
# 3. 状态变量初始化
|
# 3. 状态变量初始化
|
||||||
self.last_alert_time = 0.0 # 最后报警时间(防重复推送)
|
# self.last_alert_time = 0.0 # 最后报警时间(防重复推送)
|
||||||
# 犯人跟踪信息:{track_id: {'is_cx_in_roi': 中心点是否在ROI, 'lost_frames': 消失帧数, 'lost_roi': 消失的ROI名称, 'last_cxcy': 最后中心点坐标}}
|
# 犯人跟踪信息:{track_id: {'is_cx_in_roi': 中心点是否在ROI, 'lost_frames': 消失帧数, 'lost_roi': 消失的ROI名称, 'last_cxcy': 最后中心点坐标}}
|
||||||
self.prisoner_track_info = {}
|
self.prisoner_track_info = {}
|
||||||
self.frame_width = 0 # 帧宽度(动态获取)
|
self.frame_width = 0 # 帧宽度(动态获取)
|
||||||
@@ -382,15 +382,15 @@ class PrisonerDoorDetector:
|
|||||||
|
|
||||||
if target_info['lost_frames'] >= ROI_LOST_FRAMES_THRESH:
|
if target_info['lost_frames'] >= ROI_LOST_FRAMES_THRESH:
|
||||||
# 触发报警
|
# 触发报警
|
||||||
entry_frame = self.entry_frame_cache.get(target_id, frame_copy)
|
# entry_frame = self.entry_frame_cache.get(target_id, frame_copy)
|
||||||
self.push_alert(
|
# self.push_alert(
|
||||||
camera_id=camera_id,
|
# camera_id=camera_id,
|
||||||
target_id=target_id,
|
# target_id=target_id,
|
||||||
lost_roi=target_info['current_roi'],
|
# lost_roi=target_info['current_roi'],
|
||||||
last_cxcy=target_info['last_cxcy'],
|
# last_cxcy=target_info['last_cxcy'],
|
||||||
timestamp=timestamp,
|
# timestamp=timestamp,
|
||||||
entry_frame=entry_frame
|
# entry_frame=entry_frame
|
||||||
)
|
# )
|
||||||
|
|
||||||
current_frame_alerts.append({
|
current_frame_alerts.append({
|
||||||
"time": timestamp,
|
"time": timestamp,
|
||||||
|
|||||||
Reference in New Issue
Block a user