3d91aa1a67
功能:area_id 全链路支持 + 截图处理器独立 Redis 连接
...
- CameraInfo 模型添加 area_id 字段
- SQLite 表增加 area_id 列及迁移
- config_sync 同步 area_id 到本地
- 告警 ext_data 携带 area_id
- 截图处理器使用独立 Redis 连接,避免与配置同步阻塞冲突
- get_all_camera_configs 使用 cursor.description 动态获取列名
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-03-18 16:05:04 +08:00
3d88dfc1c6
修复:删除算法绑定后边缘端未停止对应算法推理
...
根本原因:config_sync.py 的 _cleanup_stale_records() 方法接收了
incoming_bind_ids 参数但从未使用,导致当 ROI 仍存在但其中某个
算法绑定被删除时,孤立的绑定记录继续留在 SQLite 中,推理循环
仍然从 SQLite 读取到已删除的绑定并继续生成告警。
修复内容:
1. config/database.py: 添加 get_all_bind_ids() 方法
2. core/config_sync.py: 在 _cleanup_stale_records() 中补全
使用 incoming_bind_ids 清理孤立绑定的逻辑
3. algorithms.py: 在 reload_all_algorithms() 中添加清理内存中
孤立算法实例的逻辑,防止内存泄漏
2026-03-05 17:12:15 +08:00
b6fba4639d
fix(aiot): 修复离岗检测启动立即报警的三个Bug
...
Bug#1(严重): 无人帧不调用算法
- _batch_process_rois 中 len(boxes)>0 才调用 _handle_detections
- 导致离岗检测永远收不到"人走了"的信号
- 修复: 无论检测结果是否为空都调用算法
- 同时移除 _handle_detections 中 tracks 为空的 early return
Bug#2(高): WAITING 一帧就跳 ON_DUTY
- 检测到人第一帧就立即从 WAITING 跳到 ON_DUTY
- confirm_on_duty_sec 参数完全未被使用
- 修复: 新增 CONFIRMING 状态,需连续 10s 检测到人才确认上岗
Bug#3(中): confirm_leave_sec 默认值过短
- 默认 10 秒,用户预期 30 秒
- 修复: 所有默认值统一改为 30s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-02-11 10:01:20 +08:00
181623428a
feat(aiot): 告警冷却时间调整 + 截图本地保留 + 中文路径修复
...
- 离岗检测冷却时间: 300s → 600s(10分钟)
- 入侵检测冷却时间: 120s → 300s(5分钟)
- 入侵告警级别改为高(alarm_level=3)
- COS 不可用时保留本地截图文件,不再上报后删除
- 修复 cv2.imwrite 中文路径失败,改用 imencode + write_bytes
- 配置订阅在 LOCAL 模式下跳过 Redis 连接
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-02-11 09:57:02 +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
fa0304aa47
feat: 重构数据库schema分离空间与业务配置 - 新增algorithm_registry和roi_algo_bind表 - roi_configs简化为纯空间配置 - 新增AlgorithmInfo/ROIAlgoBind数据模型
2026-02-03 14:26:52 +08:00
f90ff60f6c
feat: 添加离岗时长记录
...
- alert_records 添加 duration_minutes 字段
- AlgorithmManager 输出 duration_minutes
- AlertRecord 添加 duration_minutes 字段
2026-01-30 17:26:12 +08:00
101b26fc95
feat: 实现配置热更新机制
...
数据库扩展:
- roi_configs 新增算法参数字段(working_hours, confirm_on_duty_sec等)
- 新增 config_update_log 表记录配置变更日志
Redis缓存:
- ROI/摄像头配置缓存到 Redis(TTL 1小时)
- sync_all_to_redis() 批量同步配置
- notify_config_change() 发布配置变更通知
热更新:
- AlgorithmManager 订阅 Redis config_update 频道
- load_from_redis() 从 Redis 加载算法参数
- reload_algorithm() 热更新单个算法
- reload_all_algorithms() 重新加载所有算法
配置模型:
- ROIInfo 添加算法参数字段
2026-01-30 13:51:58 +08:00
816a67f33e
feat: SQLite 添加设备配置表
...
- 新增 camera_configs 表(摄像头配置,永不删除)
- 新增 roi_configs 表(ROI配置,永不删除)
- 添加配置表的增删改查方法
- 只清理 alert_records 表(7天过期)
2026-01-30 11:42:12 +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