| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- """
- 检测配置
- """
- # 检测配置
- DETECTION_CONFIG = {
- 'target_classes': ['person'], # 检测目标类别 (支持中英文)
- 'confidence_threshold': 0.5, # 置信度阈值
- 'detection_fps': 2, # 检测帧率(每秒检测帧数),替代原来的detection_interval
- 'detection_interval': 0.5, # 兼容保留:检测间隔(秒),当detection_fps=2时间隔为0.5秒
-
- # 检测图片保存配置
- 'save_detection_image': True, # 是否保存检测到人的图片
- 'detection_image_dir': '/home/admin/dsh/detection_images', # 图片保存目录
-
- # 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.8, # 人员检测置信度阈值
- }
- # 安全检测模型配置
- 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': 1000, # 最大保存图片数量,超过后自动清理旧图片
- }
|