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] # 执行检测