| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- """
- 检测配置
- """
- # 检测配置
- DETECTION_CONFIG = {
- 'target_classes': ['person'], # 检测目标类别 (支持中英文)
- 'confidence_threshold': 0.5, # 置信度阈值
- 'detection_fps': 2, # 检测帧率(每秒检测帧数),替代原来的detection_interval
- 'detection_interval': 4, # 兼容保留:检测间隔(秒),当detection_fps=2时间隔为0.5秒
-
- # 检测图片保存配置
- 'save_detection_image': False, # 是否保存检测到人的图片
- 'detection_image_dir': '/home/admin/dsh/detection_images', # 图片保存目录
-
- # 配对图片保存配置(全景+球机图片归入同一目录)
- 'enable_paired_saving': True, # 是否启用配对图片保存
- 'paired_image_dir': '/home/admin/dsh/paired_images', # 配对图片保存目录
- 'paired_time_window': 5.0, # 批次时间窗口(秒),同一窗口内的检测归为一批
-
- # RK3588 平台使用 RKNN 安全检测模型 (包含人体检测)
- # 类别映射: 0=安全帽, 3=人, 4=反光衣
- 'model_path': '/home/admin/dsh/testrk3588/yolo11m_safety.rknn',
- 'model_type': 'rknn', # 模型类型: 'rknn', 'yolo', 'onnx'
- 'use_gpu': False, # RKNN 使用 NPU,不依赖 GPU
-
- # 安全检测模型的类别映射
- 'class_map': {
- 0: 'hat',
- 3: 'person',
- 4: 'reflective'
- },
- 'person_class_id': 3, # 人员在模型中的类别ID
- 'person_threshold': 0.5, # 人员检测置信度阈值(降低以捕获更多目标)
- }
- # 安全检测模型配置
- SAFETY_DETECTION_CONFIG = {
- # 模型路径 - 支持三种格式:
- # - YOLO: .pt 文件, 使用 ultralytics
- # - RKNN: .rknn 文件, 使用 rknnlite (RK3588 平台)
- # - ONNX: .onnx 文件, 使用 onnxruntime
- 'model_path': '/home/admin/dsh/testrk3588/yolo11m_safety.rknn',
-
- 'model_type': 'rknn', # 模型类型: 'auto', 'yolo', 'rknn', 'onnx'
- 'use_gpu': False, # RKNN 使用 NPU,不依赖 GPU
- 'conf_threshold': 0.5, # 一般物品置信度阈值 (安全帽、反光衣)
- 'person_threshold': 0.8, # 人员检测置信度阈值
-
- # 检测类别映射
- 'class_map': {
- 0: 'hat',
- 3: 'person',
- 4: 'reflective'
- },
-
- # 检测帧率配置
- 'detection_fps': 2, # 检测帧率(每秒检测帧数),默认每秒2帧
- 'detection_interval': 0.5, # 兼容保留:检测间隔(秒),由detection_fps计算得出
-
- # 告警控制
- 'alert_cooldown': 3.0, # 同一目标告警冷却时间(秒)
- 'max_alerts_per_minute': 10, # 每分钟最大告警数
-
- # 检测图片保存配置
- 'save_detection_image': True, # 是否保存检测到人的图片
- 'detection_image_dir': '/home/admin/dsh/detection_images', # 图片保存目录
- 'detection_image_max_count': 100, # 最大保存图片数量,超过后自动清理旧图片
- }
|