新增指定模型文件

This commit is contained in:
zqc
2026-03-09 13:28:38 +08:00
parent 74f555f38c
commit 365dcc94e5
3 changed files with 15 additions and 7 deletions

View File

@@ -13,13 +13,10 @@ from algorithm.common.npu_yolo_pose_onnx import YOLOv8_Pose_ONNX
from yolox.tracker.byte_tracker import BYTETracker
from utils.logger import get_logger
from common.constants import MODEL_ROOT_PATH
logger = get_logger(__name__)
# ========================= 配置区 =========================
# Kadian 模型路径与ROI可根据实际情况修改
DETECT_MODEL_PATH = 'YOLO_Weight/Kadian.onnx'
#DETECT_MODEL_PATH = r'D:\Python_Save\PoliceProject\TestForLiveStream\AIMonitor_KaDian_0304\YOLO_Weight\Kadian.onnx'
#POSE_MODEL_PATH = 'YOLO_Weight/yolov8l-pose.onnx'
# 默认相对ROI与原文件一致
#ROI_RELATIVE = np.array([
@@ -63,9 +60,17 @@ class KadianDetector:
# 摄像头额外参数
self.params = params if params is not None else {}
# 模型路径:从 params 读取,未配置则使用默认值 DETECT_MODEL_PATH
model_path = self.params.get('model_path')
if model_path:
full_model_path = f"{MODEL_ROOT_PATH}/{model_path}"
else:
full_model_path = DETECT_MODEL_PATH
logger.info(f"Loading model from: {full_model_path}")
# 模型加载
self.detector = YOLOv8_ONNX(
DETECT_MODEL_PATH,
full_model_path,
conf_threshold=0.6,
iou_threshold=0.65,
input_size=PERSON_CAR_INPUT_SIZE

View File

@@ -4,6 +4,8 @@ from utils.logger import get_logger
logger = get_logger(__name__)
MODEL_ROOT_PATH = 'YOLO_Weight'
ALERT_PUSH_URL = ""
HLS_ROOT_PATH = ""

View File

@@ -49,15 +49,16 @@ video_clip_default_segment_duration: 2 # 默认分片
service_groups:
- name: "kadian_group" # 服务组名称
video_source_type: "hls"
video_source_type: "rtsp"
ws_host: "0.0.0.0" # WebSocket 服务地址
ws_port: 8765 # WebSocket 服务端口
algorithm: "checkpoint" # 算法类型
algorithm: "corridor" # 算法类型
cameras: # 该组下的摄像头列表
- id: 8
index: "12345"
name: Entrance
params:
model_path: "Kadian.onnx"
roi_points:
- [0.15, 0.001]
- [0.5, 0.001]