A Machine Vision-Based Method for Detecting Surface Defects in Continuous Strip Bamboo Strips
The YOLOv8 target detection method, which integrates full-dimensional dynamic convolution and multi-scale feature fusion, solves the efficiency and accuracy problems of bamboo strip surface defect detection, achieving efficient and accurate bamboo strip defect detection, adapting to complex production environments, and supporting continuous bamboo strip production.
Patent Information
- Application Number
- CN202410329580.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-21
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2044-03-21
AI Technical Summary
Existing methods for detecting surface defects in bamboo strips rely on manual identification, which is inefficient and inconsistent. Traditional machine learning methods are sensitive to ambient light and cannot meet the needs of high-performance composite material production. Furthermore, the limited length of bamboo strips and the presence of nodes or defects affect the uniformity and continuity of quality.
We employ a YOLOv8 object detection method based on full-dimensional dynamic convolution and multi-scale feature fusion. By acquiring images through an industrial camera and combining data augmentation with an improved YOLOv8 model, including a small object detection head and a BiFPN structure, we enhance detection accuracy and adaptability.
It improves the accuracy and speed of surface defect detection in bamboo strips, reduces production costs, adapts to complex environments, and meets the high-efficiency detection needs of continuous bamboo strip production.
Smart Images

Figure CN118229638B_ABST
Abstract
Description
Technical fields:
[0001] This invention relates to a method for detecting surface defects in continuous strip bamboo strips, belonging to the field of bamboo strip manufacturing technology. This method utilizes image processing and deep learning technologies to quickly and accurately detect surface defects in bamboo strips, providing an efficient and precise detection means for the continuous production of bamboo strips. Background technology:
[0002] With the continuous development of science and technology, people's requirements for the performance of composite materials are increasing. In the process of manufacturing high-performance composite materials, continuous and uniform ribbon-like materials, as intermediate materials, must possess advantages such as a smooth surface and small deviations in width and thickness. However, the bamboo strips currently used are limited by industrialized splitting equipment and the structure of bamboo itself, resulting in a limited length of bamboo strips produced (the longest being the height of natural bamboo). Furthermore, the presence of nodes or defects in the bamboo itself leads to uneven tensile mechanical properties of the bamboo strips, thus affecting their quality uniformity and continuity. At the same time, the efficiency of manual production is also significantly constrained.
[0003] Current methods for detecting surface defects in bamboo strips still rely on manual labor. However, manual defect identification is inefficient and subject to subjective judgment, making it difficult to ensure consistency in classification standards across batches. Although image processing-based methods exist, most still employ traditional machine learning methods for detection, which are sensitive to factors such as ambient light and lack adaptability.
[0004] In the continuous production of bamboo strips, raw materials often have defects such as cracks, insect infestation, and mold. These defects can damage the structural integrity of the bamboo strips, making the material brittle and reducing the strength and durability of the bamboo strips. This will have a significant impact on the performance of the produced continuous bamboo strip belts, and will also negatively affect their aesthetics and processability.
[0005] By employing deep learning methods for bamboo strip inspection, the accuracy and speed of inspection can be significantly improved, while production costs are reduced. This will provide crucial technical support for the continuous production of bamboo strips and offer a feasible solution to meet the ever-increasing performance requirements of composite materials. Summary of the Invention:
[0006] The purpose of this invention is to provide a YOLOv8 target detection method based on full-dimensional dynamic convolution and multi-scale feature fusion, so as to improve the accuracy of bamboo strip surface defect detection and deploy it on bamboo strip continuous production equipment.
[0007] The technical problem solved by this invention is achieved through the following steps:
[0008] A machine vision-based method for detecting surface defects in continuous strip bamboo strips includes the following steps:
[0009] Step 1: Obtain an image of the bamboo strip surface:
[0010] An industrial line scan camera is used to acquire images of surface defects in bamboo strips. When acquiring images of the bamboo strip surface, the positions of the line scan camera and the strip light source are adjusted to acquire detailed images of the bamboo strip surface. The captured images are then named and saved.
[0011] Step 2: Establish a dataset of surface defects in bamboo strips:
[0012] The obtained bamboo strip images were labeled. After labeling, the dataset was randomly divided into training, validation, and test sets in an 8:1:1 ratio. Data augmentation was then performed on the training set data, including scaling, translation, rotation, and adding noise.
[0013] Step 3: Add a small object detection head based on the YOLOv8 model:
[0014] Based on the YOLOv8 model, optimizations were made to improve the detection capability for small targets and the overall feature fusion efficiency. To address the characteristics of defects in bamboo strips, the large-object detection head was removed, and a dedicated head for small target detection was introduced.
[0015] Step 4: Integrate the ODConv module into the Neck of the YOLOv8 model:
[0016] The ODConv full-dimensional dynamic convolution module is integrated into the Neck of the YOLOv8 model. It dynamically adjusts the convolution kernel according to the characteristics of the input data, captures more detailed information, and enables the model to respond more sensitively to different input features.
[0017] Step 5: Replace the original feature pyramid network in YOLOv8 with a BiFPN structure.
[0018] By replacing the original structure with BiFPN for multi-scale feature fusion, after extracting the original features of the input image, BiFPN cross-connects features of different scales through an adaptive feature fusion mechanism to establish a bidirectional information flow, effectively enhancing the fusion effect of features of different scales and improving the model's ability to accurately detect targets at multiple scales.
[0019] Step 6: Feed the test set into the improved model to obtain the results.
[0020] After the labeled bamboo strip images are fed into the model for training, a pre-set test set is then input into the trained improved YOLOv8 model (YOLOv8-OD-BF) to evaluate the model's performance in real-world application scenarios, including its recognition accuracy, speed, and stability under various conditions, thereby ensuring that the model can meet the needs of practical applications. Attached image description:
[0021] Figure 1 This is a flowchart of the method of the present invention.
[0022] Figure 2 These are images of bamboo strips in four different situations.
[0023] Figure 3 This is a schematic diagram of the YOLOv8-OD-BF model structure of the present invention.
[0024] Figure 4 This is a schematic diagram of the ODConv full-dimensional dynamic convolution module structure.
[0025] Figure 5 This is a schematic diagram of the BiFPN structure. Detailed implementation method:
[0026] To enable those skilled in the art to better understand the purpose, technical solution, and technical effects of this invention, the technical solution of this invention will be clearly and completely described below with reference to specific embodiments. However, this description is not limited thereto; all aspects not described in detail herein are based on conventional techniques in the art. The overall process of this invention is as follows: Figure 1 As shown.
[0027] step
[0028] (1) Collect images of surface defects in bamboo strips:
[0029] This invention uses an industrial line scan camera to capture surface images of raw bamboo strips during continuous bamboo strip production. When capturing images, the position of the strip light source must be adjusted to ensure sufficient illumination. Secondly, the camera position must be adjusted according to the line scan camera parameters to ensure clear capture of bamboo strip surface details. This invention primarily detects three types of defects on the bamboo strip surface: cracks, insect infestation, and mold. During imaging, the focus is on capturing these different types of defects, ensuring the camera settings accurately record these minute surface features. Finally, the captured images are named and saved. Information such as date and batch number can be combined for subsequent analysis and traceability.
[0030] (2) Label the collected images and divide them into training and testing sets:
[0031] The obtained bamboo strip images were labeled using a YOLO format annotation tool. Four types of bamboo strips—normal, ceasma, wormhole, and mildew—were labeled using the following tags: normal, ceasma, wormhole, and mildew. The label names and their locations were saved in a .txt file. After annotation, a Python script was used to randomly divide the dataset into training, validation, and test sets in an 8:1:1 ratio. Image processing libraries were used to augment the training set, including scaling, translation, rotation, and adding noise.
[0032] (3) Add a small target detection head based on the YOLOv8 model:
[0033] The YOLOv8 model comprises a Backbone, a Neck, and a Head. The Backbone is used for feature extraction, the Neck for feature fusion, and the Head for prediction. The YOLOv8 model employs three different detection heads—small, medium, and large—at the Head to achieve multi-scale object detection. In image processing, if the square root of the ratio of the area of an object's bounding box to the area of the entire image is less than 3%, the object is classified as a small object. Under this classification standard, defects such as insect infestation in bamboo strips are categorized as small objects. Therefore, while maintaining the original advantages of YOLOv8, to improve the detection capability for small objects, the original large-size object detection head was removed, and a dedicated detection head for small object detection was introduced, further optimizing the model's ability to detect small objects and the overall feature fusion efficiency.
[0034] (4) Integrate the ODConv module into the Neck of the YOLOv8 model:
[0035] The ODConv module introduces a multidimensional attention mechanism through a parallel strategy to provide more flexible attention for learning the four dimensions of the convolution kernel space. Figure 4 The diagram shows a full-dimensional dynamic convolutional structure. The ODConv module performs the following steps: Assume the input feature map is X, where the dimensions of X are (H, W, C), representing height, width, and number of channels, respectively. First, a global average pooling operation is performed on the input feature map X as shown in formula (1), summing the mean of the feature map for each channel into a scalar value. This process can be expressed by the formula:
[0036]
[0037] Pooling produces a vector of dimension C containing the channel mean. This vector is then input into the fully connected layer for linear transformation and nonlinear activation. The output of the fully connected layer can be expressed as shown in Equation (2).
[0038] FC(GAP(X))=ReLU(Sigmoid(Softmax(W·GAP(X)+b))) (2)
[0039] Where W is the weight matrix of the fully connected layer, and b is the bias term. The fully connected layer introduces non-linear transformations by stacking activation functions such as ReLU, Sigmoid, and Softmax, thereby enhancing the expressive power of the model.
[0040] Finally, the output of the fully connected layer is used as the dynamic weight matrix D. The dynamic weight matrix is then applied to the input feature map X as shown in Equation (3) to perform a full-dimensional dynamic convolution operation.
[0041] Y i,j,c =∑ k,l,m X i+k,j+l,m ·W c,m,k,l ·D k,l (3)
[0042] Where Y is the output feature map and W is the convolution kernel weights. In the convolution operation, a dynamic weight matrix D is introduced, so that the convolution kernel has different weights at different positions and channels.
[0043] Throughout the process, GAP is used to globally summarize information from the entire input feature map, the fully connected layer maps the result of global average pooling to a dynamic weight matrix, and finally, the ODConv module applies the dynamic weights to the input feature map for convolution. The use of activation functions (ReLU, Sigmoid, and Softmax) increases the network's non-linearity and decision-making ability, making the model more expressive and adaptive. By progressively applying different attention levels to convolutions across dimensions such as location, channel, filter, and kernel, the convolution operation can more sensitively adapt to the diversity of inputs, effectively capturing rich contextual information and improving the overall model performance.
[0044] (5) Replace the original feature pyramid network in YOLOv8 with a BiFPN structure:
[0045] BiFPN structure as follows Figure 5 As shown, BiFPN is an improved version of FPN (Feature Pyramid Network) for more effectively merging features from different scales. BiFPN enhances feature propagation and fusion through bidirectional communication across multiple scales. The core idea of BiFPN is to enhance features through bidirectional paths (top-down and bottom-up). In the bottom-up path, higher-level features are propagated to lower levels through upsampling and fusion. In the top-down path, lower-level features are propagated to higher levels through downsampling and fusion. This bidirectional flow ensures rich and accurate feature representations at all scales. Specifically, assuming there are N feature maps at different scales, each scale's feature map is P... i (i = 1, 2, ..., N). In BiFPN, each P i The feature maps are fused with feature maps of other scales using a weighted summation method as shown in Equation (4). This weight can be learnable or fixed, and is used to balance the importance of feature maps at different scales. This weighted fusion improves the flexibility and effectiveness of feature fusion.
[0046]
[0047] Among them, P′ i It is the fused feature map, ω ij These are weighting coefficients, op(P) j size(P) i )) is to use P j Adjust to P i Operations of the same size can be upsampling or downsampling, size(P) i ) represents P i The size.
[0048] (6) Train the model and feed the test set into the improved model:
[0049] The training set from the bamboo strip surface defect dataset is input into the improved YOLOv8 model (YOLOv8-OD-BF) for training, resulting in the YOLOv8-OD-BF.pt weight file, thus obtaining the YOLOv8-OD-BF model. Then, a pre-defined test set is input into the YOLOv8-OD-BF model to evaluate its performance in real-world application scenarios, including its recognition accuracy, speed, and stability under various conditions, thereby ensuring that the model meets the needs of practical applications.
[0050] Compared to the YOLOv8 model, the YOLOv8-OD-BF model performs better in feature extraction, is better at distinguishing similar features, achieves more thorough multi-scale feature fusion, has stronger ability to detect small targets, and has lower false negative and false positive rates. It achieves good detection results even in complex production environments, exhibiting excellent robustness and generalization, making it suitable for the continuous production requirements of bamboo strips.
[0051] The deep learning framework used in this invention is PyTorch 1.13, Python version is 3.9, CUDA version is 11.7, the training system is Windows 10, and the graphics card used for training is a GeForce 2060.
Claims
1. A method for detecting surface defects in continuous strip bamboo strips based on machine vision, characterized in that... It includes the following steps: Step 1: Use an industrial line scan camera to acquire images of the bamboo strip surface; Step 2: Annotate, classify, and augment the images to create a dataset of surface defects in bamboo strips; Step 3: Add a small target detection head based on the YOLOv8 model; Step 4: Integrate the ODConv module into the Neck of the YOLOv8 model; Step 5: Replace the original feature pyramid network in YOLOv8 with a BiFPN structure; Step 6: Input the labeled images into the model for training, and input the test set into the trained improved model to obtain the results; Step 3, which involves adding a small target detection head, includes: In YOLOv8, three different detection heads are used to achieve multi-scale object detection, including small, medium and large object detection heads. Since the objects to be detected are small, in order to improve the detection accuracy of small objects, a detection head with a lower level of abstraction as input is added. In order to reduce the consumption of computing resources, the original large object detection head is removed. This adjustment aims to optimize the model structure, improve the accuracy of small object detection, and save computing resources. The ODConv module introduced in step 4 to improve YOLOv8's Neck includes: Building upon the YOLOv8 architecture, the ODConv full-dimensional dynamic convolution module is integrated into the original Neck section. This module utilizes global average pooling (GAP) and fully connected layers (FC) to summarize and transform the data. Activation functions include ReLU, Sigmoid, and Softmax to increase the network's nonlinearity and decision-making ability. Four attention scalars are introduced to dynamically adjust the network's learning process. By progressively applying different attention at the position, channel, filter, and kernel dimensions, the convolution operation becomes more sensitive to the diversity of inputs, effectively capturing rich contextual information and improving overall model performance. This improvement introduces a more flexible dynamic convolution mechanism on the basis of the original YOLOv8 structure, enhancing the model's expressive power.
2. The method for detecting surface defects of continuous strip bamboo strips based on machine vision according to claim 1, characterized in that... Step 5: BiFPN multi-scale feature fusion pyramid BiFPN employs a bidirectional fusion strategy, effectively connecting features at different scales and constructing feature fusion channels in both the vertical and horizontal directions. During this process, to consider the importance of features at different resolutions, BiFPN balances features at different scales by setting weights at each connection node, thereby further improving detection accuracy. The BiFPN structure replaces the original PAN structure, enhancing the feature fusion effect and improving detection accuracy. This improvement helps to capture information at different scales more comprehensively, making the model more adaptable to target detection tasks in complex scenarios.
Citation Information
Patent Citations
Wind turbine surface defect detection method
CN115719337A
Visual detection method for surface defects of bearing ring
CN116664941A
