STMS-YOLOv5: A Lightweight Algorithm for Gear Surface Defect Detection

Rui Yan, Rangyong Zhang, Jinqiang Bai, Huijuan Hao, Wenjie Guo, Xiaoyan Gu, Qi Liu2023 · DOI

TL;DR

This paper introduces STMS-YOLOv5, a novel lightweight deep learning model designed for efficient and accurate gear surface defect detection. By integrating ShuffleNetv2, transposed convolution, MECA attention, and SIOU_Loss, the model significantly reduces computational cost and parameters while maintaining or improving detection performance, addressing a critical need in industrial quality control.

What Problem Does This Paper Address?

Industrial manufacturing processes, especially for critical components like gears, can introduce various surface defects. Detecting these defects is crucial for ensuring product performance and longevity. Traditional manual inspection is labor-intensive, prone to errors, and increasingly costly. While machine vision and deep learning offer automated solutions, existing deep learning models, particularly object detection networks like YOLOv5, often struggle with a trade-off between high accuracy and real-time detection speed. Their complexity leads to high computational demands, making them unsuitable for resource-constrained industrial environments. This paper aims to bridge this gap by developing a lightweight yet accurate model specifically for gear surface defect detection.

Methods

The core of this work is the modification of the YOLOv5 architecture to create STMS-YOLOv5. The key innovations include:

  • Lightweight Backbone: The standard YOLOv5 backbone (CSPDarknet) is replaced with ShuffleNetv2. This module is known for its efficiency, reducing computational costs (GFLOPs) and parameter count without a significant drop in accuracy.
  • Transposed Convolution Upsampling: To enhance feature representation and compensate for potential accuracy loss from the lightweight backbone, transposed convolution is used for upsampling in the neck of the network. This learnable upsampling method can better preserve semantic information and sharp boundaries compared to traditional interpolation.
  • MECA Attention Mechanism: A novel Max Efficient Channel Attention (MECA) module is integrated into the neck. This module, inspired by ECA-Net, adaptively extracts critical information and enhances multi-scale feature fusion, helping the network focus on relevant defect features and mitigating accuracy degradation.
  • SIOU_Loss Function: The bounding box regression loss is switched from GIOU_Loss to SIOU_Loss. SIOU_Loss considers the angle and distance between predicted and ground truth bounding boxes, leading to faster convergence and improved regression accuracy, crucial for precise defect localization.
  • Mosaic Data Augmentation: Used during training to improve robustness and generalization by stitching multiple images together.

Datasets

The paper utilizes two datasets for training and evaluation:

  • Gear Dataset: A custom dataset provided by Guizhou University, containing 3000 images of gear surfaces with three defect types: break, lack, and scratch.
  • NEU-DET Dataset: A publicly available dataset for steel surface defect detection, comprising 1800 images across six defect categories. This dataset is used to evaluate the generalization capabilities of the proposed model.

Key Insights and Ideas

  • Balancing Act: The paper demonstrates that it's possible to achieve both high detection accuracy and significant speed improvements in object detection by strategically combining lightweight architectural components with attention mechanisms and improved loss functions.
  • Attention for Efficiency: The MECA attention module proves effective in recovering accuracy lost due to backbone simplification, highlighting the power of targeted feature refinement.
  • Loss Function Matters: Shifting to SIOU_Loss not only speeds up convergence but also contributes to better bounding box regression, which is vital for accurate defect localization.
  • Generalization is Key: Testing on the NEU-DET dataset validates that the STMS-YOLOv5 model is not just tailored for gears but possesses broader applicability in industrial defect detection.

Key Results

STMS-YOLOv5 achieves impressive results:

  • Speed: Achieves 130.4 FPS on the gear dataset and 133.5 FPS on the NEU-DET dataset.
  • Efficiency: Reduces parameters by 44.44% and GFLOPs by 50.31% compared to the original YOLOv5.
  • Accuracy: Reaches an [email protected] of 98.6% on the gear dataset and 73.5% on the NEU-DET dataset.
  • Model Size: The final model size is a mere 8.5MB.
  • Ablation Studies: Each component (ShuffleNetv2 backbone, transposed convolution, MECA attention, SIOU_Loss) individually contributes to improved performance, with their combined effect being synergistic.

Limitations and Future Work

  • Dataset Expansion: The authors plan to expand the gear defect dataset to further evaluate and validate the model's applicability.
  • Further Lightweighting: Future work will explore techniques like model pruning and knowledge distillation to achieve even greater detection speed.
  • Broader Applications: The paper suggests continuing to explore lightweight processing methods to enhance detection speed for broader applications.

Summary updated

BibTeX
@misc{yan2023stms,
  author = {Rui Yan and Rangyong Zhang and Jinqiang Bai and Huijuan Hao and Wenjie Guo and Xiaoyan Gu and Qi Liu},
  title = {{STMS-YOLOv5: A Lightweight Algorithm for Gear Surface Defect Detection}},
  year = {2023},
  doi = {10.3390/s23135992},
}
Figure