在终端实时显示人物数量#4707
Merged
Merged
Conversation
优化驾驶事故视频识别工具,提升性能、灵活性和日志管理,新增人和小车识别提示。
Refactor accident detection module to include logging and person count output.
donghaiwang
approved these changes
Dec 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修改概述:
为驾驶事故检测工具新增终端实时显示人物数量的功能,同时优化日志一致性与检测总结统计项。
修改的详细描述
1.在detector.py的detect_frame方法中,新增人物(person 类别)数量统计逻辑,并将统计结果作为返回值传递
2.在run_detection循环中,添加 “每 10 帧输出一次人物数量” 的逻辑(可通过output_interval调整间隔),避免终端刷屏
3.将detector.py中的print语句统一替换为logging模块,与主程序日志格式(时间 + 级别 + 内容)保持一致
4.在检测总结环节,新增 “检测过程中最大人物数量” 的统计项,便于回顾检测数据
5.在main.py的日志初始化函数中,补充logger.propagate = False配置,避免日志重复输出
经过了什么样的测试?
1.操作系统:Windows 10、macOS 14、Linux Ubuntu 22.04
2.Python 版本:3.8、3.9、3.10、3.11
运行效果
动图、视频、截图等

![Uploading dface733209cba760ee12a89b3288286.jpg…]()