From 51125f354ac3fc0fbd833bb9ea974e2a432f2758 Mon Sep 17 00:00:00 2001 From: zqc <835569504@qq.com> Date: Thu, 26 Feb 2026 14:48:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8detector=E5=88=9B=E5=BB=BA=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=EF=BC=8C=E4=BC=A0=E5=85=A5=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- biz/checkpoint/checkpoint_biz.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/biz/checkpoint/checkpoint_biz.py b/biz/checkpoint/checkpoint_biz.py index 755f456..6a3f3a7 100644 --- a/biz/checkpoint/checkpoint_biz.py +++ b/biz/checkpoint/checkpoint_biz.py @@ -47,7 +47,7 @@ RTSP_TARGET_FPS = 10.0 # ========================= Kadian TrafficMonitor(精简版,专为服务设计) ========================= class KadianDetector: - def __init__(self, roi_points=ROI_RELATIVE): + def __init__(self, roi_points=ROI_RELATIVE, params=None): # 模型加载 self.detector = YOLOv8_ONNX(DETECT_MODEL_PATH, conf_threshold=0.25, iou_threshold=0.45, input_size=PERSON_CAR_INPUT_SIZE) @@ -70,6 +70,9 @@ class KadianDetector: #self.roi_points = roi_points.astype(np.int32) 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) # ========================================== @@ -733,7 +736,9 @@ class FrameProcessorWorker(threading.Thread): # 获取检测器实例 if cam_id not in self.kadian_detectors: - self.kadian_detectors[cam_id] = KadianDetector() + camera_config = self.cameras.get(cam_id) + params = camera_config.params if camera_config else None + self.kadian_detectors[cam_id] = KadianDetector(params=params) detector = self.kadian_detectors[cam_id] # 执行检测