Commit Graph

25 Commits

Author SHA1 Message Date
5e9ec7dacc docs: 边缘端运行测试报告 2026-02-02 14:05:37 +08:00
0a1d61c1e2 fix: 修复 TensorRT bindings 问题
- tensorrt_engine.py 添加 pycuda 支持
- CUDA 上下文和流管理
- _is_in_working_hours 支持字符串格式
2026-02-02 14:00:21 +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
f90ff60f6c feat: 添加离岗时长记录
- alert_records 添加 duration_minutes 字段
- AlgorithmManager 输出 duration_minutes
- AlertRecord 添加 duration_minutes 字段
2026-01-30 17:26:12 +08:00
f570245589 docs: 表结构对比报告 2026-01-30 17:22:00 +08:00
4632ae74f3 fix: 修复运行错误
- algorithms.py 添加 threading/redis/logger 导入
- ResultReporter 添加 report_heartbeat() 和 close() 方法
2026-01-30 15:15:09 +08:00
36674edff8 fix: 修复导入错误
- 移除不存在的 init_database 导入
- DatabaseManager  SQLiteManager
2026-01-30 14:54:20 +08:00
fdd3e9ac88 feat: 算法层接管判断权
- 添加 AlgorithmManager 集成
- 新增 _build_tracks() 将检测转为算法输入格式
- 重构 _handle_detections() 让算法决定是否告警
- 注册算法时从 ROI 配置读取参数
- 停止使用 PostProcessor.check_alarm_condition() 做业务判断

新的执行链路:
ROI裁剪  480p预处理  YOLO推理  algorithm.process()  告警
2026-01-30 14:24:34 +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
56820622c6 fix: 统一算法参数
- confirm_seconds 默认值改为 5 秒
- 同步 default_params 中的默认值为 5
2026-01-30 13:27:28 +08:00
c4baf2fd1f fix: 重构算法逻辑
LeavePostAlgorithm:
- 重构状态机:WAITING  ON_DUTY  LEAVING  OFF_DUTY
- 移除 INIT 状态,增加 LEAVING 确认期防抖动
- 添加目标类型过滤 (target_class)
- 统一使用 datetime

IntrusionAlgorithm:
- 修复冷却逻辑 Bug:只在告警后重置
- 添加确认机制:持续检测 N 秒才触发告警
- 添加目标类型过滤 (target_class)
- 二次告警时间改为 2 分钟 (120秒)

AlgorithmManager:
- 更新默认参数
- 统一参数命名
2026-01-30 13:23:22 +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
816a67f33e feat: SQLite 添加设备配置表
- 新增 camera_configs 表(摄像头配置,永不删除)
- 新增 roi_configs 表(ROI配置,永不删除)
- 添加配置表的增删改查方法
- 只清理 alert_records 表(7天过期)
2026-01-30 11:42:12 +08:00
ccb49e9eb9 chore: 忽略 data/ 目录
- 添加 data/ 和 captures/ 到 gitignore
- SQLite 数据库和抓拍图片不随代码提交
2026-01-30 11:35:45 +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
6dc3442cc2 fix: 添加资源释放幂等保护
- 添加 _released 标志防止重复释放
- release() 方法支持幂等调用
2026-01-30 10:48:28 +08:00
b67bda8042 fix: 修复 Python TensorRT 资源释放
- 移除不存在的 .destroy() 方法调用
- Python TensorRT 由 GC 管理,= None 即释放
2026-01-30 10:39:02 +08:00
bcabe65984 chore: 忽略说明文档
- 忽略 *.md、CHANGELOG.md、README.md
- 保留 requirements.txt
2026-01-30 10:14:16 +08:00
02c30d7461 chore: 更新 .gitignore 规则
- 忽略 __pycache__/、*.pyc 等 Python 缓存
- 忽略 .trae/ AI 临时文件
- 忽略 logs/ 日志目录
- 忽略 models/*.onnx 中间产物
- 保留 CHANGELOG.md、build_engine.py 等核心文件
2026-01-30 10:12:09 +08:00
a6130b5102 fix: 修复动态维度内存分配错误
- 处理 TensorRT 引擎的负维度 (-1)
- 将动态 Batch 维度替换为最小值 1
2026-01-30 09:20:05 +08:00
8bbf485f71 fix: 移除无用的 yolo11n.onnx 2026-01-29 18:56:56 +08:00
ab8fa80fba fix: 移除已废弃的 BENCHMARK flag
- BENCHMARK flag 在 TRT 8.5+ 已废弃
- tactic profiling 逻辑内部自动完成
2026-01-29 18:54:26 +08:00
4103b503db fix: 修复 tactic_sources 参数解析错误
- 支持数值格式 (+7) 和名称格式 (+CUBLAS,+CUDNN)
- 添加 tactic_values 常量说明文档
2026-01-29 18:48:27 +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
6733344b11 初始化边缘推理服务 2026-01-29 18:33:12 +08:00