Commit Graph

10 Commits

Author SHA1 Message Date
0191e498f1 feat: 告警HTTP上报 + 日志精简 + 边缘节点统一为edge
- 新增 alarm_upload_worker.py 异步告警上报(COS+HTTP)
- result_reporter 重构为Redis队列模式
- config_sync 适配WVP直推的聚合配置格式
- settings 默认 EDGE_DEVICE_ID 改为 edge
- 日志设置非告警模块为WARNING级别减少噪音
- main.py 集成新的告警上报流程

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 15:21:45 +08:00
93a2278626 fix: 优化边缘端稳定性和日志管理
1. database.py: 优化数据库连接和错误处理
2. postprocessor.py: 改进后处理逻辑
3. result_reporter.py: 完善告警上报字段
4. video_stream.py: 增强视频流稳定性
5. main.py: 优化启动流程和异常处理
6. logger.py: 改进日志格式和轮转配置

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 17:47:41 +08:00
ff3d6e2653 fix: 修复告警上报字段缺失和 MQTT 连接不稳定
- AlertInfo.to_dict() 补充 bind_id、device_id、algorithm 字段
- AlertInfo 新增 device_id 和 algorithm 属性
- MQTTConfig 新增 device_id 配置项(环境变量 EDGE_DEVICE_ID)
- main.py 创建 AlertInfo 时传入 device_id 和 algorithm
- 心跳上报使用配置的 device_id 代替硬编码字符串
- MQTT 协议从 MQTTv5 降级为 MQTTv311 提高兼容性
- MQTT client_id 添加随机后缀防止冲突

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 14:13:49 +08:00
cea4cb877b fix: MQTT连接兼容paho-mqtt 1.x和2.x版本
- 添加paho-mqtt版本检测,兼容CallbackAPIVersion
- 修复回调函数签名,支持1.x的整数返回码和2.x的对象返回码
- 增强错误处理和日志输出
- 确保ResultReporter.initialize()被正确调用

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 16:02:32 +08:00
98595402c6 fix: 修复10个关键bug提升系统稳定性和性能
1. YOLO11输出解析错误: 移除不存在的objectness行,正确使用class_scores.max()
2. CPU NMS逻辑错误: keep_mask同时标记保留和抑制框导致NMS失效,改用独立suppressed集合
3. 坐标映射缺失: _build_tracks中scale_info未使用,添加revert_boxes还原到ROI裁剪空间
4. batch=1限制: 恢复真正的动态batch推理(1~8),BatchPreprocessor支持多图stack
5. 帧率控制缺失: _read_frame添加time.monotonic()间隔控制,按target_fps跳帧
6. 拉流推理耦合: 新增独立推理线程(InferenceWorker),生产者-消费者模式解耦
7. 攒批形同虚设: 添加50ms攒批窗口+max_batch阈值,替代>=1立即处理
8. LeavePost双重等待: LEAVING确认后直接触发告警,不再进入OFF_DUTY二次等待
9. register_algorithm每帧调用: 添加_registered_keys缓存,O(1)快速路径跳过
10. GPU context线程安全: TensorRT infer()内部加锁,防止多线程CUDA context竞争

附带修复:
- reset_algorithm中未定义algorithm_type变量(NameError)
- update_roi_params中循环变量key覆盖外层key
- AlertInfo缺少bind_id字段(TypeError)
- _logger.log_alert在标准logger上不存在(AttributeError)
- AlarmStateMachine死锁(Lock改为RLock)
- ROICropper.create_mask坐标解析错误
- 更新测试用例适配新API

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 16:47:26 +08:00
29d3ea0bc4 feat: 传递离岗时长到告警记录
- ResultReporter AlertInfo 添加 duration_minutes
- main.py 使用 report_alert 替代 report_detection_alert
- _store_alert 保存 duration_minutes
2026-01-30 17:27:39 +08:00
4632ae74f3 fix: 修复运行错误
- algorithms.py 添加 threading/redis/logger 导入
- ResultReporter 添加 report_heartbeat() 和 close() 方法
2026-01-30 15:15:09 +08:00
2c0fe7f3c5 fix: 适配 SQLite API 替换 MySQL
- config_sync.py:
  - 修复导入: get_sqlite_manager 替代 get_database_manager
  - 修复方法: get_all_camera_configs 替代 get_camera_info
  - 修复方法: get_rois_by_camera 替代 get_roi_configs
  - 修复方法: get_camera_config 替代 get_camera_info
  - 修复方法: get_roi_config 替代 get_roi_configs

- result_reporter.py:
  - 更新注释: 移除 MySQL 相关描述
2026-01-30 11:46:15 +08:00
ccb021677c feat: 重构存储策略为 SQLite
- 新增 config/database.py: SQLite 数据库管理器
  - WAL 模式提升写入性能
  - 异步批量写入队列
  - 滚动清理机制(保留7天)

- 新增 core/storage_manager.py: 图片存储管理
  - 异步保存抓拍图片
  - 本地缓存断网容灾
  - 按日期分目录存储

- 更新 config/settings.py: 添加 SQLite 配置
  - SQLiteConfig 数据类
  - 环境变量支持

- 更新 core/result_reporter.py: 适配新存储
  - 使用 SQLite 替代 MySQL
  - AlertInfo 数据类重构
  - 断网自动缓存到本地
2026-01-30 11:34:51 +08:00
b0ddb6ee1a feat(project): move edge_inference_service contents to root and update paths
- Moved all project files and directories (config, core, models, etc.) from
  edge_inference_service/ to the repository root ai_edge/
- Updated model path in config/settings.py to reflect new structure
- Revised usage paths in __init__.py documentation
2026-01-29 18:43:19 +08:00