[关键词]
[摘要]
目的 针对制药工业胶囊生产线中微小切线缺陷易漏检、背景噪声干扰强以及通用检测模型难以在低算力边缘设备部署等难题,提出一种改进的轻量化目标检测算法。方法 以YOLOv8n为基准架构,通过三重策略进行针对性优化,在骨干网络嵌入坐标注意力(coordinate attention,CA)机制,强化模型对胶囊切线及边缘微小瑕疵的空间感知能力;设计C2f_GhostConv模块重构颈部网络,利用Ghost卷积“主卷积+廉价操作”增强细粒度特征表达;采用深度可分离卷积(depthwise separable convolution,DWConv)全面替换骨干网络标准卷积,将空间卷积与通道融合解耦为2个独立步骤,实现参数量与计算量的深度压缩。结果 在包含1 204张多类胶囊缺陷的工业数据集上,DWG-CA-YOLOv8的平均精度均值(mAP@0.5)达90.5%,表明模型能够对6类缺陷及正常胶囊进行高精度定位与准确分类,具备工业级实时检测所需的可靠性;模型参数量降至2.10 M,浮点运算量降至5.9 GFLOPs,分别减少30.2%和28.1%,显著提升轻量化水平。结论 成功实现了检测精度与模型复杂度的协同优化,为制药生产线的实时在线质量控制提供了可扩展、低成本的轻量化方案。
[Key word]
[Abstract]
Objective To address the challenges of difficult detection of tiny tangential defects, strong background noise interference, and the difficulties in deploying general detection models on low-computing-power edge devices in pharmaceutical capsule production lines, an improved lightweight object detection algorithm is proposed. Methods Using YOLOv8n as the baseline architecture, targeted optimizations are performed through a three-pronged strategy. A coordinate attention (CA) mechanism is embedded in the backbone network to enhance the model’s spatial perception capability for tiny tangential defects and edge micro-defects of capsules. A C2f_GhostConv module is designed to reconstruct the neck network, utilizing Ghost convolution (“primary convolution + cheap operations”) to enhance fine-grained feature representation. Depthwise separable convolution (DWConv) is comprehensively adopted to replace the standard convolution in the backbone, decoupling spatial convolution and channel fusion into two independent steps, thereby achieving deep compression of parameter count and computational load. Results On an industrial dataset containing 1 204 images of various capsule defects, DWG-CA-YOLOv8 achieves a mean Average Precision (mAP@0.5) of 90.5%, demonstrating high-precision localization and accurate classification for six defect types and normal capsules, meeting the reliability required for industrial real-time detection. The model’s parameter count is reduced to 2.10 M, and the floating-point operations (FLOPs) to 5.9 G, representing reductions of 30.2% and 28.1%, respectively, significantly improving lightweight performance. Conclusion This study successfully achieves synergistic optimization of detection accuracy and model complexity, providing a scalable and low-cost lightweight solution for real-time online quality control of pharmaceutical production lines.
[中图分类号]
TP18;R283
[基金项目]
国家重点研发计划项目资助(2023YFC3504504)