基于轻量化YOLOv8模型的校园安全隐患目标检测应用研究
Applied Research on Object Detection for Campus Safety Hazards Based on a Lightweight YOLOv8 Model
DOI: 10.12677/csa.2026.169301, PDF,    科研立项经费支持
作者: 冉冰艺:重庆外语外事学院智能科学与工程学院,重庆
关键词: YOLOv8轻量化CBAM注意力机制校园安全隐患目标检测边缘部署YOLOv8 Lightweight CBAM Attention Mechanism Campus Safety Hazards Object Detection Edge Deployment
摘要: 校园安全隐患的实时检测是保障师生生命财产安全的重要任务。现有监控系统依赖人工值守,预警滞后,而通用深度学习模型参数量大、计算复杂度高,难以在算力有限的边缘设备上实时运行。针对上述问题,本文提出一种基于协同优化策略的轻量化YOLOv8n校园安全隐患检测方案。该方案并非简单堆叠已有技术,而是遵循“精度保持优先、逐步压缩冗余”的阶梯式设计理念,构建了CBAM注意力机制、Ghost轻量化模块、结构化剪枝与FP16量化的递进式协同体系:CBAM为后续压缩提供特征显著性先验,Ghost从结构源头削减冗余,剪枝在注意力引导下精准剔除不重要通道,量化则以极小精度代价换取边缘端加速。四者形成“精度增强→结构轻量→通道裁剪→数值压缩”的互补链条,每一环节的精度损失由前置或后序操作进行补偿。在自建的三类别校园安全隐患数据集上,改进模型mAP@0.5达到87.4%,较基线仅下降1.8个百分点,参数量从3.01 M降至1.72 M (减少42.9%),浮点运算量降低约45%。在Jetson Nano和RK3588边缘平台上经TensorRT优化后分别达到31 FPS和48 FPS的实时推理速度。本文构建的多类别统一轻量化检测框架,为民办高校低成本智能化安全监控提供了可落地的技术方案。
Abstract: Real-time detection of campus safety hazards is an important task for ensuring the safety of teachers and students’ lives and property. The existing monitoring systems rely on manual operation and have delayed warnings. Moreover, the general deep learning models have large parameters and high computational complexity, making it difficult to run them in edge devices with limited computing power. To address these issues, this paper proposes a lightweight YOLOv8n campus safety hazard detection scheme based on a collaborative optimization strategy. This scheme does not simply stack existing technologies but follows a stepwise design concept of “priority for accuracy, gradual reduction of redundancy”, and builds a progressive collaborative system of CBAM attention mechanism, Ghost lightweight module, structured pruning and FP16 quantization: CBAM provides feature saliency priors for subsequent compression, Ghost reduces redundancy from the structural source, pruning precisely eliminates unimportant channels under the guidance of attention, and quantization sacrifices a small precision cost for acceleration on the edge. The four elements form a complementary chain of “accuracy enhancement → structure lightness → channel pruning → numerical compression”, with each step’s accuracy loss compensated by the preceding or subsequent operations. On the self-built three-category campus safety hazard dataset, the improved model’s mAP@0.5 reaches 87.4%, only decreasing by 1.8 percentage points compared to the baseline, and the parameter size is reduced from 3.01 M to 1.72 M (a 42.9% reduction), and the floating-point operation volume is reduced by approximately 45%. After optimization with TensorRT on Jetson Nano and RK3588 edge platforms, the real-time inference speeds reach 31 FPS and 48 FPS respectively. The multi-category unified lightweight detection framework constructed in this paper provides a feasible technical solution for low-cost intelligent safety monitoring in private colleges.
文章引用:冉冰艺. 基于轻量化YOLOv8模型的校园安全隐患目标检测应用研究[J]. 计算机科学与应用, 2026, 16(9): 199-211. https://doi.org/10.12677/csa.2026.169301

参考文献

[1] Jocher, G., Chaurasia, A. and Qiu, J. (2023) Ultralytics YOLO (Version 8.0.0).
https://github.com/ultralytics/ultralytics
[2] Woo, S., Park, J., Lee, J. and Kweon, I.S. (2018) CBAM: Convolutional Block Attention Module. In: Ferrari, V., Hebert, M., Sminchisescu, C. and Weiss, Y., Eds., Lecture Notes in Computer Science, Springer International Publishing, 3-19.
https://doi.org/10.1007/978-3-030-01234-2_1
[3] Han, K., Wang, Y., Tian, Q., Guo, J., Xu, C. and Xu, C. (2020) GhostNet: More Features from Cheap Operations. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, 13-19 June 2020, 1580-1589.
https://doi.org/10.1109/cvpr42600.2020.00165
[4] Liu, Z., Li, J., Shen, Z., Huang, G., Yan, S. and Zhang, C. (2017) Learning Efficient Convolutional Networks through Network Slimming. 2017 IEEE International Conference on Computer Vision (ICCV), Venice, 22-29 October 2017, 2736-2744.
https://doi.org/10.1109/iccv.2017.298
[5] NVIDIA Corporation (2023) TensorRT: Programmable Inference Accelerator.
https://developer.nvidia.com/tensorrt
[6] 唐佳. 基于改进YOLOv5m的校园火焰检测设计[J]. 青海师范大学学报(自然科学版), 2026, 42(2): 133-140.
[7] 韩逸. 基于YOLO的轻量化烟火检测算法研究[D]: [硕士学位论文]. 武汉: 武汉纺织大学, 2024.
[8] 鞠逸凡. 基于深度学习的铁路周界异物入侵检测方法研究[D]. 青岛: 青岛科技大学, 2024.
[9] 杨宗晔. 智慧校园绿色建筑与AI智慧安防协同构建研究[J]. 陶瓷, 2026(7): 189-191.
[10] 周红志, 秦敏, 墨子向. 基于WIFI技术的高校宿舍安全智能检测系统[J]. 吉林广播电视大学学报, 2015(6): 7-8.
[11] de Venâncio, P.V.A.B., Lisboa, A.C. and Barbosa, A.V. (2022) An Automatic Fire Detection System Based on Deep Convolutional Neural Networks for Low-Power, Resource-Constrained Devices. Neural Computing and Applications, 34, 15349-15368.
[12] Ultralytics (2020) YOLOv5.
https://github.com/ultralytics/yolov5
[13] Wang, C., Bochkovskiy, A. and Liao, H.M. (2023) YOLOv7: Trainable Bag-of-Freebies Sets New State-of-the-Art for Real-Time Object Detectors. 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Vancouver, 17-24 June 2023, 7464-7475.
https://doi.org/10.1109/cvpr52729.2023.00721