Lightweight wood panel defect detection method incorporating attention mechanism and feature fusion network

Yongxin Cao, Fanghua Liu, Lai Jiang, Cheng Bao, You Miao, Chen Yang

Abstract

In recent years, deep learning has made significant progress in wood panel defect detection. However, challenges remain regarding detection accuracy, inference speed, and the difficulty of deploying models on embedded devices in industrial environments. This paper proposes YOLOv5-LW, a lightweight detection method incorporating attention mechanisms and a specialized feature fusion network. By reconstructing the backbone with ShuffleNetv2 and introducing a Multi-scale Bi-directional Feature Pyramid Network (MBiFPN), the model achieves a high accuracy rate of 92.8% while reducing parameters by 27.78% and computational volume by 41.25%. Experimental results demonstrate a 10.16% improvement in inference speed, making it highly suitable for real-time industrial applications.

Introduction

In the wood processing industry, identifying surface defects—such as dead knots, live knots, and cracks—is vital for quality control and waste reduction. While deep learning has revolutionized image recognition, standard models face a "deployment gap" in industrial settings. Modern models are often too computationally heavy for low-power embedded devices, and fine defects like thin cracks are easily missed by generalized lightweight networks. Furthermore, real-time assembly lines require extremely high inference speeds that many accurate models cannot sustain. YOLOv5-LW aims to bridge this gap by balancing efficiency with high-resolution perception.

Architectural Innovations

The researchers modified the standard YOLOv5 architecture to create YOLOv5-LW. Their approach rests on three architectural pillars designed to maintain performance while stripping away unnecessary computational weight.

1. The ShuffleNetv2-based Backbone

The standard heavy backbone was replaced with a reconstructed ShuffleNetv2 network. This utilizes "channel shuffling" and group convolutions to drastically reduce the number of parameters. To prevent accuracy loss from this downsizing, the authors introduced a Stem Block for better initial feature extraction and Spatial Pyramid Pooling Fast (SPPF) to maintain a global receptive field.

2. Efficient Channel Attention (ECA)

To help the model focus on critical defect information without adding significant overhead, Efficient Channel Attention (ECA) modules were embedded into the backbone. Unlike traditional attention mechanisms that use complex dimensionality reduction, ECA uses a simple 1D convolution to capture cross-channel interactions, improving the model's proficiency in localizing fine defects.

Detailed architecture of YOLOv5-LW, highlighting the ShuffleNetv2 backbone, ECA module, and MBiFPN neck.

Multi-scale Bi-directional Feature Fusion

Standard networks often lose detail as information passes between layers. To combat this, the authors introduced the Multi-scale Bi-directional Feature Pyramid Network (MBiFPN) in the model's "Neck."

Unlike traditional Feature Pyramid Networks (FPN) or Path Aggregation Networks (PANet), MBiFPN removes nodes with only one input—which contribute little to feature representation—and adds cross-layer connections. This allows the model to fuse high-level semantic information with low-level structural details more effectively. By allowing information to flow both up and down the pyramid and skipping redundant nodes, the MBiFPN specifically boosts the model's ability to identify small, localized defects that standard FPNs might blur out.

Evolution of feature fusion networks: (a) FPN, (b) PANet, and (c) the proposed MBiFPN structure.

Experimental Results

The study utilized a dataset of 5,098 augmented high-resolution wood surface images, covering classes such as dead knots, live knots, and cracks. The YOLOv5-LW model was compared against the original YOLOv5s and other classical models (YOLOv3, YOLOv4, Faster R-CNN, SSD):

  • Accuracy: Achieved a mean Average Precision (mAP) of 92.8%.
  • Efficiency: Reduced the number of parameters by 27.78% and compressed the total computational volume (FLOPs) by 41.25%.
  • Speed: Improved inference speed by 10.16%, reaching 195 FPS (Frames Per Second).
  • Fine Defect Detection: Specifically improved the detection accuracy of dead knots and cracks by 0.2% and 1.3% respectively compared to the baseline.

Conclusion

YOLOv5-LW demonstrates that significant efficiency gains can be achieved without sacrificing the precision required for industrial quality control. By combining a lightweight backbone with compensatory features like the Stem Block and ECA, and optimizing feature flow via MBiFPN, the model provides a robust solution for real-time defect detection. Future work will focus on deploying these algorithms onto physical embedded devices in real-world factory environments to further validate durability and practicality in harsh industrial conditions.

Summary updated

Abstract

In recent years, deep learning has made significant progress in wood panel defect detection. However, there are still challenges such as low detection , slow detection speed, and difficulties in deploying embedded devices on wood panel surfaces. To overcome these issues, we propose a lightweight wood panel defect detection method called YOLOv5-LW, which incorporates attention mechanisms and a feature fusion network.Firstly, to enhance the detection capability of acceptable defects, we introduce the Multi-scale Bi-directional Feature Pyramid Network (MBiFPN) as a feature fusion network. The MBiFPN reduces feature loss, enriches local and detailed features, and improves the model's detection capability for acceptable defects.Secondly, to achieve a lightweight design, we reconstruct the ShuffleNetv2 network model as the backbone network. This reconstruction reduces the number of parameters and computational requirements while maintaining performance. We also introduce the Stem Block and Spatial Pyramid Pooling Fast (SPPF) models to compensate for any accuracy loss resulting from the lightweight design, ensuring the model's detection capabilities remain intact while being computationally efficient.Thirdly, we enhance the backbone network by incorporating Efficient Channel Attention (ECA), which improves the network's focus on key information relevant to defect detection. By attending to essential features, the model becomes more proficient in accurately identifying and localizing defects.We validate the proposed method using a self-developed wood panel defect dataset.The experimental results demonstrate the effectiveness of the improved YOLOv5-LW method. Compared to the original model, our approach achieves a 92.8\% accuracy rate, reduces the number of parameters by 27.78\%, compresses computational volume by 41.25\%, improves detection inference speed by 10.16\%
BibTeX
@misc{cao2023lightweight,
  author = {Yongxin Cao and Fanghua Liu and Lai Jiang and Cheng Bao and You Miao and Chen Yang},
  title = {{Lightweight wood panel defect detection method incorporating attention mechanism and feature fusion network}},
  year = {2023},
  eprint = {2306.12113},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.12113},
}
Figure