Research on Fabric Defect Detection Algorithm Based on Lightweight YOLOv7-Tiny

Tang Li,Mei Shunqi,Shi Yishan,Zhou Shi,Zheng Quan,Hongkai Jiang,Xu Qiao,Zhang Zhiming
DOI: https://doi.org/10.1080/15440478.2024.2352753
2024-06-14
Journal of Natural Fibers
Abstract:The current advanced neural network models are expanding in size and complexity to achieve improved detection accuracy. This study designs a lightweight fabric defect detection algorithm based on YOLOv7-tiny, called YOLOv7-tiny-MGCK. Its objectives are to improve the performance of fabric defect detection against complex backgrounds and to find a balance between the algorithm's lightweight nature and its accuracy. The algorithm utilizes the Mish activation function, known for its superior nonlinear performance capability and smoother curve, enabling the neural network to manage more complex challenges. The Ghost convolution module is also incorporated to reduce computation and model parameters. The lightweight upsampling technique CARAFE facilitates the flexible extraction of deep features, coupled with their integration with shallow features. In addition, an improved K-Means clustering algorithm, KMMP, is employed to select appropriate anchor box for fabric defects. The experimental results show: a reduction in the number of parameters by 45.5% and computational volume by 41.0%, along with increases in precision by 3.9%, recall by 7.0%, and mAP by 3.0%. These results indicated that the improved algorithm achieves a more effective balance between detection performance and the requirement for a lightweight solution. 目前先进的神经网络模型在规模和复杂度上都在扩展,以提高检测精度. 本研究设计了一种基于YOLOv7-tiny 的轻量级织物缺陷检测算法,称为YOLOv7-tiny-MGCK.其目标是提高织物缺陷检测在复杂背景下的性能,并在算法的轻量级和准确性之间找到平衡. 该算法利用了Mish激活函数,该函数以其卓越的非线性性能和更平滑的曲线而闻名,使神经网络能够应对更复杂的挑战. 还加入了鬼卷积模块,以减少计算和模型参数. 轻量级的上采样技术CARAFE有助于灵活提取深层特征,并将其与浅层特征相结合. 此外,还采用改进的K-Means聚类算法KMMP来选择合适的锚盒来解决织物缺陷. 实验结果表明:参数数量减少了45.5%,计算量减少了41.0%,精度提高了3.9%,召回率提高了7.0%,mAP提高了3.0%. 这些结果表明,改进的算法在检测性能和对轻量级解决方案的要求之间实现了更有效的平衡.
materials science, textiles
What problem does this paper attempt to address?
The paper mainly addresses the issue of fabric defect detection in textiles, aiming to develop an efficient detection algorithm. Specifically, the research objectives are: 1. **Improve detection performance**: Enhance the accuracy of fabric defect detection in complex backgrounds. 2. **Achieve a balance between lightweight and high precision**: Reduce the model size and computational requirements while maintaining high detection accuracy. To achieve these goals, the paper proposes an improved algorithm based on YOLOv7-tiny (referred to as YOLOv7-tiny-MGCK) and employs the following key techniques: - **Mish activation function**: Due to its excellent non-linear performance and smoother curve characteristics, the Mish activation function is used to improve the neural network's ability to handle complex problems. - **Ghost convolution module**: This module simplifies the network structure by reducing the amount of computation and the number of model parameters. It generates the main feature maps with fewer convolution kernels and captures redundant feature maps through low-cost linear operations. - **CARAFE upsampling technique**: This is a lightweight upsampling technique that can flexibly extract deep features and fuse them with shallow features, helping to improve the detection of small objects. - **Improved K-Means clustering algorithm (KMMP)**: Used to select anchor box sizes that are more suitable for fabric defect detection. Experimental results show that this improved algorithm, compared to the original version, has significant improvements in terms of the number of parameters, computational load, precision, recall rate, and mean Average Precision (mAP). Specifically, the number of parameters is reduced by 45.5%, the computational load is reduced by 41.0%, precision is increased by 3.9%, recall rate is increased by 7.0%, and mAP is increased by 3.0%. This indicates that the improved algorithm achieves the lightweight requirement while ensuring high detection performance. In summary, the core contribution of this paper is the proposal of a lightweight and efficient fabric defect detection algorithm that significantly reduces the demand for computational resources while ensuring detection accuracy, making it suitable for real-time detection and other application scenarios.