From 267f0e3080bf792d8a62da1060871498bde9386f Mon Sep 17 00:00:00 2001 From: zqc <835569504@qq.com> Date: Thu, 26 Feb 2026 15:10:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=8D=A1=E7=82=B9=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E6=A1=86=E4=BB=8E=E5=8F=82=E6=95=B0=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- biz/checkpoint/checkpoint_biz.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/biz/checkpoint/checkpoint_biz.py b/biz/checkpoint/checkpoint_biz.py index 6a3f3a7..965df49 100644 --- a/biz/checkpoint/checkpoint_biz.py +++ b/biz/checkpoint/checkpoint_biz.py @@ -47,7 +47,10 @@ RTSP_TARGET_FPS = 10.0 # ========================= Kadian TrafficMonitor(精简版,专为服务设计) ========================= class KadianDetector: - def __init__(self, roi_points=ROI_RELATIVE, params=None): + def __init__(self, params=None): + # 摄像头额外参数 + self.params = params if params is not None else {} + # 模型加载 self.detector = YOLOv8_ONNX(DETECT_MODEL_PATH, conf_threshold=0.25, iou_threshold=0.45, input_size=PERSON_CAR_INPUT_SIZE) @@ -66,13 +69,10 @@ class KadianDetector: self.fps = RTSP_TARGET_FPS - # ROI 处理(支持相对/绝对) - #self.roi_points = roi_points.astype(np.int32) + # ROI 处理:优先从 params 获取,否则使用默认值 ROI_RELATIVE + roi_points = self.params.get('roi_points', ROI_RELATIVE) self.roi_points = np.array(roi_points, dtype=np.float64) if roi_points is not None else None - # 摄像头额外参数 - self.params = params if params is not None else {} - # ========================================== # 超参数设置 (Hyperparameters) # ========================================== @@ -738,7 +738,7 @@ class FrameProcessorWorker(threading.Thread): if cam_id not in self.kadian_detectors: camera_config = self.cameras.get(cam_id) params = camera_config.params if camera_config else None - self.kadian_detectors[cam_id] = KadianDetector(params=params) + self.kadian_detectors[cam_id] = KadianDetector(params) detector = self.kadian_detectors[cam_id] # 执行检测