摘 要: 为解决药片包装生产中,药片缺陷检测模型存在参数量大和计算复杂的问题,提出一种基于改进的YOLOv8n的轻量化药片缺陷检测算法。该算法用CSPPC结构替换颈部网络中的C2f模块,降低计算复杂度;利用跨尺度特征融合模块CCFM,并将全局注意力机制(GlobalAttentionMechanism)引入颈部网络,提升特征提取能力;采用WIoU损失函数,加快收敛速度。结果表明,与原算法相比,改进后检测算法的mAP50提高了1.2%,参数量、浮点运算量和模型大小分别降低了40.2%、28.3%和33.3%。研究结果可为药片缺陷检测装备研发提供技术支持。 |
关键词: 药片缺陷检测 YOLOv8n算法 注意力机制 轻量化 |
中图分类号:
文献标识码: A
|
基金项目: 教育部人文社会科学研究一般项目(23YJCZH281);上海市哲学社会科学规划课题(2022ZGL010);信息网络安全公安部重点实验室开放课题 |
|
Lightweight Tablet Defect Detection Algorithm Based on Improved YOLOv8n |
ZHU Youjiang1,2, WEI Pengli3, JIN Jing4, QIAN Miao1,2, ZHANG Jianxin1
|
(1.Faculty of Mechanical Engineering and Automation, Zhejiang Sc-i Tech University, Hangzhou 310018, China; 2.Zhejiang Sc-i Tech University Pingyang Research Institute Company, Wenzhou 325400, China; 3.Zhejiang Changzheng Vocational & Technical College, Hangzhou 310018, China; 4.Zhejiang Yingfeng Technology Co., Ltd., Shaoxing 312073, China)
2119791658@qq.com; 1368352773@qq.com; 1039794488@qq.com; meqiaomiao@zstu.edu.cn; zjx@zstu.edu.cn
|
Abstract: To address the issues of excessive parameters and high computational complexity in tablet defect detection models during pharmaceutical packaging production, this paper proposes a lightweight tablet defect detection algorithm based on an improved YOLOv8n. The algorithm replaces the C2f module in the neck network with a CSPPC structure to reduce computational complexity. It incorporates a cross-scale feature fusion module (CCFM) and introduces the Global Attention Mechanism into the neck network to enhance feature extraction capability. Additionally,the WIoU loss function is adopted to accelerate convergence. Experimental results show that, compared to the original algorithm, the improved detection algorithm achieves a 1.2% increase in mAP50(mean Average Precision @ IoU= 0.5), while reducing the number of parameters, floating-point operations (FLOPs), and model size by 40.2%, 28.3%, and 33.3%, respectively. The findings can provide technical support for the development of tablet defect detection equipment. |
Keywords: tablet defect detection YOLOv8n algorithm attention mechanism lightweight |