Wood defect detection method based on improved YOLOv5

By improving the YOLOv5 model and combining it with a lightweight network and multi-scale feature fusion, the problems of low efficiency and insufficient accuracy in wood defect detection are solved, and efficient and robust defect detection is achieved, which is suitable for complex environments and real-time detection.

CN120725964APending Publication Date: 2025-09-30HECHI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510698602.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-28
Publication Date
2025-09-30

AI Technical Summary

Technical Problem

Existing wood defect detection methods are inefficient and lack accuracy, especially in complex backgrounds and lighting changes. The lack of standard datasets limits the promotion and application of the algorithms.

Method used

An improved YOLOv5 model is adopted. By introducing the lightweight backbone network CSPNet and the multi-scale feature fusion mechanism, combined with the SIoU loss function, the model is optimized to improve detection accuracy and adaptability, and an efficient wood defect detection system is constructed.

Benefits of technology

It significantly improves the accuracy and real-time performance of wood defect detection, adapts to complex textures and lighting changes, reduces hardware resource requirements, and meets the real-time detection needs of industrial assembly lines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120725964A_ABST
    Figure CN120725964A_ABST
Patent Text Reader

Abstract

The invention discloses an improved YOLOv5-based wood defect detection method, which provides an efficient, accurate and robust solution for wood defect detection through innovation and optimization of a deep learning technology, remarkably improves the automation level of wood processing, and shows important theoretical value and wide industrial application prospects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of wood defect detection, and in particular to a wood defect detection method based on improved YOLOv5. Background Art

[0002] With the rapid development of industrial intelligence, wood defect detection, as a key link in wood processing, has a crucial impact on product quality and production efficiency. However, traditional wood defect detection methods, such as manual visual inspection or rule-based image processing technology, have significant limitations such as low efficiency, insufficient accuracy, and difficulty adapting to complex environments.

[0003] Currently, common wood defect detection methods still rely primarily on manual visual inspection or rule-based image processing techniques. However, these traditional methods are cumbersome and inefficient, struggle to cope with the complex and varied texture characteristics of wood surfaces, and suffer from significant deficiencies in the accuracy of defect location and classification.

[0004] In contrast, computer vision-based wood defect detection methods use industrial cameras to capture high-resolution images of the wood surface and analyze and identify potential defect areas. These methods offer significant advantages such as non-contact, high automation, and strong adaptability. These features make them particularly suitable for demanding scenarios such as industrial assembly line inspection. However, traditional computer vision methods often rely on hand-crafted features and rule-based algorithms, performing poorly in complex textured backgrounds and being significantly affected by varying lighting conditions, resulting in significant limitations in detection accuracy and versatility.

[0005] With the rapid development of deep learning technology, particularly breakthroughs in object detection, deep learning-based wood defect detection methods have become a research hotspot. For example, the object detection algorithm YOLOv5 is a variant of the YOLO (You Only Look Once) family of object detection algorithms. It aims to provide faster inference speed and reduced computational resource consumption while maintaining high detection accuracy, making it suitable for scenarios requiring real-time object detection. It enables efficient extraction of defect features within the complex textures of wood surfaces, significantly improving detection accuracy and real-time performance, and further promoting the development of intelligent wood processing.

[0006] Although the wood defect detection method based on deep learning has overcome the shortcomings of traditional methods to a certain extent, it still faces some challenges that need to be addressed in practical applications:

[0007] ① Background feature similarity problem: The natural texture of wood and the features of defective areas are often highly similar, which significantly interferes with the model's detection.

[0008] ② Insufficient target detection accuracy: In scenes with uneven lighting or complex backgrounds, the existing deep learning model's ability to extract defect features still needs to be further optimized.

[0009] ③ Lack of standard data sets: The lack of public wood defect detection data sets has severely restricted the comparative research and promotion and application of algorithms. Summary of the Invention

[0010] To address the challenges of existing wood defect detection methods, such as background interference, detection accuracy, and insufficient datasets, this paper proposes a wood defect detection method based on an improved YOLOv5 algorithm. This method, powered by deep learning, addresses the low efficiency and accuracy of traditional wood defect detection methods. This method utilizes YOLOv5 target detection to accurately identify and locate wood defect detection image information. By introducing the advanced YOLOv5 model and optimizing various aspects of its design, this paper achieves significant technical and application results.

[0011] The technical solutions of the present invention are as follows:

[0012] A wood defect detection method based on improved YOLOv5 is as follows:

[0013] 1. Data acquisition and enhancement:

[0014] A high-resolution industrial camera was used to collect image data from the wood surface, covering eight defect types: Quartz, Live Knot, Bone Marrow, Resin, Dead Knot, Knot with Crack, Knot Missing, and Crack. A fault dataset was constructed by performing brightness adjustment and noise addition on the original images to increase the data volume and enhance the model's generalization capabilities.

[0015] 2. Model optimization:

[0016] Based on YOLOv5, a lightweight backbone network (such as CSPNet optimization) is introduced to improve detection speed, and a multi-scale feature fusion mechanism (such as FPN+PAN architecture) is combined to enhance the model's detection performance for small target defects.

[0017] 3. Loss function improvement:

[0018] The SIoU loss function is used to replace the traditional IoU loss to improve the positioning accuracy of the target box, especially the defect area in the complex background.

[0019] The purpose of the present invention is achieved through the following technical solutions:

[0020] A wood defect detection method based on improved YOLOv5, the steps are as follows:

[0021] S1. Data acquisition and enhancement:

[0022] We collected wood surface images using high-resolution industrial cameras and publicly available images online to construct a wood defect detection image dataset. We then randomly rotated, flipped, translated, changed brightness, and added Gaussian noise to the original images to expand the dataset.

[0023] S2. Model training and optimization:

[0024] S2-1. Model training:

[0025] Use annotation tools to mark defect areas and categories in the image to create an object detection dataset. The dataset includes bounding boxes and category labels for various types of defects. Use this dataset to train an optimized YOLOv5 model, optimizing model weights through forward propagation, backpropagation, and parameter updates.

[0026] S2-2. Optimize the YOLOv5 backbone network:

[0027] Introducing a lightweight Cross Stage Partial Network (CSPNet) to optimize the Backbone module of YOLOv5 and improve feature extraction efficiency;

[0028] S2-3. Loss function improvement:

[0029] Replace the Complete Intersection over Union (CIoU) loss function in the original YOLOv5 with the improved Scaled Intersection over Union (SIoU) loss function;

[0030] SIoU comprehensively considers IoU, center point distance, angle deviation and shape difference when regressing the target bounding box, effectively improving the positioning accuracy of the target box. The loss function formula of SIoU is as follows:

[0031] L SIoU =L IoU +α·L distance +β·L angle +γ·L shape

[0032] Among them, L IoU is the IoU loss, L distance 、L angle 、L shapeThey represent the loss terms of center point distance, angle deviation and shape matching respectively. α, β and γ are weighting coefficients used to balance the weights of the losses of each part.

[0033] S3, practical application and deployment:

[0034] S3-1. Model deployment:

[0035] Adapt the optimized model to the real-time detection requirements of industrial production lines and deploy it on edge devices to achieve efficient operation at low computing costs.

[0036] S3-2, Online Defect Detection:

[0037] In the wood processing line, wood surface images are captured in real time, input into the model for defect detection, and defect location, type, and confidence information are output to assist quality control and production management.

[0038] Furthermore, the labeling tool described in S2-1 is selected from LabelImg.

[0039] Furthermore, the CSPNet described in S2-2 reduces redundant computations through branching paths, achieving network lightweighting while enhancing the detection performance of small target defects in complex texture backgrounds.

[0040] Compared with the prior art, the present invention has the following beneficial effects:

[0041] The wood defect detection method based on improved YOLOv5 described in the present invention has achieved significant technical and application effects by introducing an advanced YOLOv5 model and optimizing the design of each link, as follows:

[0042] 1. Accurate and efficient defect detection:

[0043] The detection accuracy of existing wood inspection technologies is not ideal, especially for Quartz and knot_with_crack defects. By adopting an improved YOLOv5 model, using a lightweight backbone network (optimized CSPNet) and an improved loss function (SIoU), the detection capabilities of targets and complex defects are significantly improved.

[0044] 2. Real-time performance and deployment adaptability:

[0045] The model's lightweight design and multi-scale feature fusion technology significantly improve detection efficiency, meeting the real-time needs of industrial assembly lines while reducing hardware resource requirements, facilitating edge device deployment and embracing broad application adaptability.

[0046] 3. Excellent robustness and generalization ability:

[0047] By expanding the diversity of the training set through data augmentation technology and combining it with an optimized deep learning model, the system performs stably under conditions of changing lighting, complex textures, and various defects, ensuring the reliability and versatility of detection in industrial scenarios.

[0048] In summary, the wood defect detection method based on improved YOLOv5 described in the present invention provides an efficient, accurate, and robust solution for wood defect detection through innovative optimization of deep learning technology, significantly improves the level of automation in wood processing, and demonstrates important theoretical value and broad industrial application prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 This is an example diagram of wood defect annotation of a wood defect detection method based on an improved YOLOv5 according to an embodiment of the present invention;

[0050] Figure 2 This is a flowchart of a wood defect detection method based on an improved YOLOv5 according to an embodiment of the present invention, wherein a convolutional block layer (CBL) and a spatial pyramid pooling (SPP) are used;

[0051] Figure 3 This is a PR curve graph of wood defect detection based on a wood defect detection method based on an improved YOLOv5 according to an embodiment of the present invention, wherein: Live Knot, Dead Knot, Knot with Crack, Crack, Resin, Bone Marrow, Knot Missing, and Quaetz;

[0052] Figure 4 This is a wood defect recognition accuracy graph of a wood defect detection method based on an improved YOLOv5 according to an embodiment of the present invention, wherein: Live Knot, Dead Knot, Knot with Crack, Crack, Resin, Bone Marrow, Knot Missing, and Quaetz;

[0053] Figure 5This is a real-time online wood defect detection diagram of a wood defect detection method based on an improved YOLOv5 according to an embodiment of the present invention, including dead knot (Dead_Knot), crack (crack), resin (Resin), and bone marrow (Bone_Marrow). DETAILED DESCRIPTION

[0054] The present invention is further described below by way of examples, but the present invention is not limited to the scope of the examples.

[0055] Figure 1 This is an example diagram of wood defect annotation of a wood defect detection method based on an improved YOLOv5 described in an embodiment;

[0056] Figure 2 This is a technical flow chart of a wood defect detection method based on an improved YOLOv5 described in an embodiment;

[0057] Example:

[0058] A wood defect detection method based on improved YOLOv5 includes the following steps:

[0059] S1. Data acquisition and enhancement:

[0060] We collected wood surface images using high-resolution industrial cameras and publicly available images online to construct a wood defect detection image dataset. We then randomly rotated, flipped, translated, changed brightness, and added Gaussian noise to the original images to expand the dataset.

[0061] S2. Model training and optimization:

[0062] S2-1. Model training:

[0063] Use annotation tools to mark defect areas and categories in the image to create an object detection dataset. The dataset includes bounding boxes and category labels for various types of defects. Use this dataset to train an optimized YOLOv5 model, optimizing model weights through forward propagation, backpropagation, and parameter updates.

[0064] The labeling tool is selected from LabelImg;

[0065] S2-2. Optimize the YOLOv5 backbone network:

[0066] Introducing lightweight CSPNet (Cross Stage Partial Network) to optimize the Backbone module of YOLOv5 and improve feature extraction efficiency;

[0067] The CSPNet reduces redundant computations through branching paths, achieving network lightweighting while enhancing the detection performance of small target defects in complex textured backgrounds.

[0068] S2-3. Loss function improvement:

[0069] Replace the CIoU loss function in the original YOLOv5 with an improved loss function (Scaled Intersection over Union, SIoU);

[0070] SIoU comprehensively considers IoU, center point distance, angle deviation and shape difference when regressing the target bounding box, effectively improving the positioning accuracy of the target box. The loss function formula of SIoU is as follows:

[0071] L SIoU =L IoU +α·L distance +β·L angle +γ·L shape

[0072] Among them, L IoU is the IoU loss, L distance 、L angle 、L shape They represent the loss terms of center point distance, angle deviation and shape matching respectively. α, β and γ are weighting coefficients used to balance the weights of the losses of each part.

[0073] S3, practical application and deployment:

[0074] S3-1. Model deployment:

[0075] Adapt the optimized model to the real-time detection requirements of industrial production lines and deploy it on edge devices to achieve efficient operation at low computing costs.

[0076] S3-2, Online Defect Detection:

[0077] In the wood processing line, wood surface images are captured in real time, input into the model for defect detection, and defect location, type, and confidence information are output to assist quality control and production management.

[0078] Figure 3 This is a PR curve diagram of a wood defect detection method based on an improved YOLOv5 described in an embodiment, through Figure 3As can be seen, the mean average precision (mAP@0.5) for Quartz, Live_Knot, Bone_Marrow, Resin, Dead_Knot, knot_with_crack, Knot_missing, and crack reached 0.722, 0.956, 0.995, 0.976, 0.961, 0.755, 0.878, and 0.953, respectively, demonstrating the model's strong recognition capabilities for these categories. Furthermore, the overall mean average precision (mAP@0.5) for all categories is 0.900, further validating the model's effectiveness and accuracy in wood defect detection.

[0079] Figure 4 This is a wood defect recognition accuracy diagram of a wood defect detection method based on improved YOLOv5 described in the embodiment, through Figure 4 As can be seen, the wood defect detection results based on the improved YOLOv5 model can accurately identify defects such as live knots, dead knots, quartz, marrow, and cracks. The model's predicted confidence score is close to 1, indicating high recognition accuracy. The improved model has significantly improved both mAP and recall, meeting the high requirements for defect detection in wood processing.

[0080] Figure 5 This is a real-time online wood defect detection diagram of a wood defect detection method based on an improved YOLOv5 described in an embodiment. This model is suitable for wood processing production lines, can meet the needs of real-time detection, and improve the automation and quality control level of wood processing.

[0081] Comparative Example:

[0082] Acoustic emission monitoring technology can monitor defects such as cracks, knots, and cavities inside wood in real time by detecting the internal energy release signals (sound waves) generated by wood under force or external interference.

[0083] The following are the specific steps of acoustic emission monitoring technology in wood defect detection:

[0084] Step 1: Signal acquisition:

[0085] Choose a highly sensitive piezoelectric sensor suitable for monitoring the surface or interior of wood. Fix the sensor to the wood surface to ensure that it can receive acoustic signals that can trigger cracks or defects inside the wood through mechanical loading, vibration, or temperature changes.

[0086] Step 2: Signal monitoring and acquisition:

[0087] The sensor monitors the acoustic emission signals inside the wood in real time, such as crack formation or expansion. The signal waveform and intensity are recorded to reflect the severity of the defect.

[0088] Step 3: Signal analysis:

[0089] Use time-frequency analysis methods (such as wavelet transform) to improve the signal-to-noise ratio of the signal, compensate for the attenuation of the acoustic signal, and optimize the accuracy of the signal;

[0090] Step 4: Defect source location and identification:

[0091] Use multiple sensors to locate and accurately identify defect locations. Classify defects based on signal characteristics (frequency, energy, etc.);

[0092] Step 5: Result output and feedback:

[0093] Output information such as the location, size, and type of defects, conduct real-time monitoring based on the results, and provide a basis for decision-making.

[0094] Summary and discussion:

[0095] The wood defect detection method based on the improved YOLOv5 described in the present invention has a good performance in wood defect detection. The overall mAP@0.5 is 0.900, and the detection effect is particularly good for various categories such as bone marrow and resin.

[0096] The acoustic emission monitoring technology of the comparative example is suitable for real-time dynamic monitoring and microcrack detection. The wood defect detection method based on the improved YOLOv5 of the present invention adopts deep learning technology that is suitable for large-scale data analysis and high-precision defect identification.

[0097] The above description is only a preferred embodiment of the present invention. It should be pointed out that for those skilled in the art, without departing from the creative concept of the present invention, they can make non-essential improvements and changes, which all fall within the scope of protection of the present invention.

Claims

1. A wood defect detection method based on improved YOLOv5, characterized by: Here are the steps: S1. Data acquisition and enhancement: By collecting wood surface images with high-resolution industrial cameras and collecting public wood surface image datasets on the Internet, we comprehensively constructed a wood defect detection image dataset. We also fully expanded the dataset by randomly rotating, flipping, translating, changing brightness, and adding Gaussian noise to the original images. S2. Model training and optimization: S2-1. Model training: Use annotation tools to mark defect areas and categories in the image to create an object detection dataset. The dataset includes bounding boxes and category labels for various types of defects. Use this dataset to train an optimized YOLOv5 model, optimizing model weights through forward propagation, backpropagation, and parameter updates. S2-2. Optimize the YOLOv5 backbone network: Introducing a lightweight cross-stage partial network to optimize the Backbone module of YOLOv5 to improve feature extraction efficiency; S2-3. Loss function improvement: Replace the complete intersection-over-union loss function in the original YOLOv5 with an improved loss function; SIoU comprehensively considers IoU, center point distance, angle deviation and shape difference when regressing the target bounding box, effectively improving the positioning accuracy of the target box. The loss function formula of SIoU is as follows: L SIoU =L IoU +α·L distance +β·L angle +γ·L shape Among them, L IoU is the IoU loss, L distance 、L angle 、L shape They represent the loss terms of center point distance, angle deviation and shape matching respectively. α, β and γ are weighting coefficients used to balance the weights of the losses of each part. S3, practical application and deployment: S3-1. Model deployment: Adapt the optimized model to the real-time detection requirements of industrial production lines and deploy it on edge devices to achieve efficient operation at low computing costs. S3-2, Online Defect Detection: In the wood processing line, wood surface images are captured in real time, input into the model for defect detection, and defect location, type, and confidence information are output to assist quality control and production management.

2. A wood defect detection method based on improved YOLOv5 according to claim 1, characterized in that: The labeling tool described in S2-1 is selected from LabelImg.

3. A wood defect detection method based on improved YOLOv5 according to claim 1, characterized in that: The CSPNet described in S2-2 reduces redundant computations through branching paths, achieving network lightweighting while enhancing the detection performance of small target defects in complex texture backgrounds.