A light guide plate defect detection method based on an SC-YOLOv8 neural network model
By constructing an SC-YOLOv8 neural network model, improving feature extraction using the ConvNeXt module and the SA attention module, and combining CIOU and DFL loss functions, the accuracy and generalization problems in light guide plate defect detection are solved, and efficient multi-scale target detection is achieved.
Patent Information
- Application Number
- CN202410966589.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2044-07-18
AI Technical Summary
Existing technologies for detecting defects in light guide plates suffer from low detection accuracy and poor generalization ability, especially in detecting small target defects and those under complex backgrounds.
An SC-YOLOv8 neural network model was constructed. The C2f1 module was improved by introducing the ConvNeXt module to enhance feature extraction capabilities. An SA attention module was introduced between the backbone network units and the neck unit for feature fusion. CIOU and DFL loss functions were used to improve detection accuracy.
It achieves high-precision detection of white spots, bright lines, dark lines and regional defects in light guide plates, improving detection efficiency and generalization ability, especially significantly improving the detection effect in small target detection and complex background.
Smart Images

Figure CN118840349B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for detecting defects in a light guide plate, specifically a method for detecting defects in a light guide plate based on an SC-YOLOv8 neural network model, belonging to the field of image detection technology. Background Technology
[0002] As a key component of the backlight module, the light guide plate transforms the point and line light sources emitted by LEDs into a uniform surface light source. Therefore, the quality of the light guide plate directly affects the image quality of the LCD screen. However, during the production process, due to factors such as raw material composition, equipment usage, processing technology, and manual operation, defects such as bright spots, scratches, and shadows inevitably appear on the surface of the light guide plate. To avoid assembling defective light guide plates into the LCD screen and causing greater resource waste, defective light guide plates must be inspected before leaving the factory, and defective light guide plates must be rejected.
[0003] Based on the imaging characteristics and production practices of light guide plates, defects in light guide plates can be mainly classified into four categories: white spot defects, bright line defects, dark line defects, and area defects. An example of a white spot defect is shown below. Figure 1 As shown, it is brighter than the surrounding light guide points, and its area is also slightly larger than the surrounding light guide points, with a size between 4 and 22 pixels. An example of a bright line defect is shown below. Figure 2 As shown, it is brighter than the surrounding light guide points and its length exceeds 50 pixels. An example of a dark line defect is shown below. Figure 3 As shown, it is a small scratch with low contrast to the background, shaped like a thin strip, less than 3 pixels wide, and difficult to observe. Examples of regional defects are as follows... Figure 4 As shown, the dirty areas appear as large white spots, while the crushed areas appear as large black areas.
[0004] The following challenges exist in defect detection of light guide plates: 1. The light guide points on the plate are distributed irregularly from left to right, ranging from sparse to dense. Areas with denser light guide point distribution exhibit higher brightness but also more blurred images. 2. The imaging characteristics of dust on the light guide plate are very similar to those of white spot defects, easily leading to misjudgments in sparse areas. 3. Some minor linear scratches are less than one pixel wide and have complex textures and backgrounds, posing significant detection difficulties. 4. The sizes of point, line, and area defects on the light guide plate vary considerably, requiring the image detection model to have excellent detection capabilities for multi-scale targets.
[0005] While existing machine vision detection methods employing image detection models for online defect detection exist, traditional methods often involve image preprocessing, thresholding, and feature selection. These methods are susceptible to interference from environmental factors such as lighting and dust, exhibiting weak generalization ability and poor algorithm stability and versatility. Some image detection models, such as the YOLOv7 neural network model, while possessing powerful detection capabilities in single-level object detection networks, suffer from lost semantic information regarding small defects in application scenarios involving complex surface textures, diverse defect types and shapes, and small defect sizes. This results in low accuracy or missed detections of small defects. Summary of the Invention
[0006] Based on the above background, the purpose of this invention is to provide a method for detecting defects in light guide plates based on the SC-YOLOv8 neural network model, which achieves high detection accuracy for white spot defects, bright line defects, dark line defects, and area defects in light guide plates.
[0007] To achieve the above-mentioned objectives, the present invention provides the following technical solution:
[0008] A method for detecting defects in a light guide plate based on the SC-YOLOv8 neural network model, comprising the following steps:
[0009] An SC-YOLOv8 neural network model is constructed based on the YOLOv8 neural network model. The SC-YOLOv8 neural network model includes a backbone network unit, a neck unit, and a head unit connected in sequence. The backbone network unit includes five CBL modules and four CN-C2f1 modules. The head unit includes three detection head modules. The neck unit includes one SPPF module, two upsampling modules, four Concat modules, four C2f2 modules, and two CBL modules. The three C2f2 modules are each connected to one detection head module of the head unit, and two of the C2f2 modules are also connected to a Concat module through a CBL module. Three SA attention modules are provided between the backbone network unit and the neck unit. The three CN-C2f1 modules located at the end of the backbone network unit are each connected to the neck unit through an SA attention module.
[0010] The pre-collected dataset of light guide plate defects is fed into the SC-YOLOv8 neural network model for training. After training, the collected light guide plate images are input into the trained SC-YOLOv8 neural network model for defect detection.
[0011] Preferably, the CN-C2f1 module includes two CBL modules, a Split module, multiple Bottleneck modules, a ConvNeXt module, a Concat module, and a CBL module. The first CBL module performs a first convolution operation on the input data. The Split module divides the data after the first convolution operation into three branches. The data from the first branch is directly output to the Concat module. The data from the second branch is processed by multiple Bottleneck modules and then output to the Concat module. The data from the third branch is processed by the ConvNeXt module and then output to the Concat module. The Concat module performs feature fusion on the data output from all branches. The second CBL module performs a second convolution operation on the feature-fused data and then outputs the result.
[0012] Preferably, the ConvNeXt module includes three convolutional layers connected in sequence. The first convolutional layer is a depthwise convolution and is connected to the second convolutional layer through a layer normalization layer. The second convolutional layer is connected to the third convolutional layer through a GELU activation function layer. The third convolutional layer is connected to the dropout path layer through a layer scale layer. The data input to the first convolutional layer is connected to the data output from the third convolutional layer through the dropout path layer.
[0013] Preferably, the first convolutional layer of the ConvNeXt module has a kernel size of 7×7, a stride of 1, and the number of input channels is equal to the number of output channels; the second convolutional layer of the ConvNeXt module has a kernel size of 1×1, a stride of 1, and the number of output channels is four times the number of input channels; the third convolutional layer of the ConvNeXt module has a kernel size of 1×1, a stride of 1, and the number of input channels is four times the number of output channels.
[0014] Preferably, the SA attention module includes a feature grouping module, a channel attention module, a spatial attention module, and an aggregation module. The feature grouping module is used to divide the input data into multiple sub-features along the channel dimension, and further divide each sub-feature into two branches of data. The channel attention module is used to sequentially perform global average pooling on the data of the first branch, apply a linear function to enhance the channel features, adjust the output range of the linear function to obtain the weights of each channel, and multiply each channel weight by the data before outputting. The spatial attention module is used to sequentially perform spatial normalization on the data of the second branch, apply a linear function to enhance the spatial features, adjust the output range of the linear function to obtain the spatial weights, and multiply each spatial weight by the data before outputting. The aggregation module is used to fuse the output data of the channel attention module and the output data of the spatial attention module, and aggregate the fused data of all sub-features before outputting.
[0015] Preferably, the loss function of the SC-YOLOv8 neural network model includes a localization loss function and a classification loss function, wherein the localization loss function is the CIOU loss function and the DFL loss function, and the classification loss function is the VFL loss function.
[0016] Compared with the prior art, the present invention has the following advantages:
[0017] The present invention discloses a light guide plate defect detection method based on the SC-YOLOv8 neural network model. By constructing the SC-YOLOv8 neural network model, the method detects surface defects of the light guide plate. It achieves high detection accuracy and high detection efficiency for white spot defects, bright line defects, dark line defects and area defects of the light guide plate. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0019] Figure 1 This is a schematic diagram of the white spot defect in the light guide plate;
[0020] Figure 2 This is a schematic diagram of the bright line defects in the light guide plate;
[0021] Figure 3 This is a schematic diagram of the dark line defects in the light guide plate;
[0022] Figure 4 This is a schematic diagram of regional defects in the light guide plate;
[0023] Figure 5 This is a schematic diagram of the structure of the SC-YOLOv8 neural network model constructed in this invention;
[0024] Figure 6 This is a schematic diagram of the CN-C2f1 module in the SC-YOLOv8 neural network model constructed in this invention;
[0025] Figure 7 This is a schematic diagram of the ConvNeXt module in the SC-YOLOv8 neural network model constructed in this invention;
[0026] Figure 8 This is a schematic diagram of the SA attention module in the SC-YOLOv8 neural network model constructed in this invention;
[0027] Figure 9This is a graph showing the CIOU loss function results of each model in the ablation experiment during the model training and validation phases in this invention;
[0028] Figure 10 These are the DFL loss function results of each model in the ablation experiment of this invention during the model training and validation phases;
[0029] Figure 11 These are the VFL loss function results of each model in the ablation experiment of this invention during the model training and validation phases;
[0030] Figure 12 These are the defect detection results of each model in the comparative experiment based on the light guide plate surface defect dataset in this invention;
[0031] Figure 13 This is a diagram showing the defect detection results of each model in the comparative experiment based on the textile surface defect dataset in this invention. Detailed Implementation
[0032] The technical solution of the present invention will be further described in detail below through specific embodiments and in conjunction with the accompanying drawings. It should be understood that the implementation of the present invention is not limited to the following embodiments, and any modifications and / or alterations made to the present invention will fall within the protection scope of the present invention.
[0033] In this invention, unless otherwise specified, all parts and percentages are by weight, and the equipment and raw materials used are commercially available or commonly used in the art. Unless otherwise specified, the methods in the following embodiments are conventional methods in the art. Unless otherwise specified, the components or equipment in the following embodiments are general standard parts or components known to those skilled in the art, and their structures and principles can be learned by those skilled in the art through technical manuals or conventional experimental methods.
[0034] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings. In this detailed description, numerous specific details are set forth to facilitate explanation and provide a thorough understanding of the embodiments of the present invention. However, one or more embodiments may be practiced by those skilled in the art without these specific details.
[0035] An embodiment of the present invention discloses a method for detecting defects in a light guide plate based on an SC-YOLOv8 neural network model, the method comprising the following steps:
[0036] The SC-YOLOv8 neural network model is constructed based on the YOLOv8 neural network model. The SC-YOLOv8 neural network model includes a backbone network unit, a neck unit, and a head unit connected in sequence. The backbone network unit includes five CBL modules and four CN-C2f1 modules. The head unit includes three detection head modules. The neck unit includes one SPPF module, two upsampling modules, four Concat modules, four C2f2 modules, and two CBL modules. The three C2f2 modules are each connected to one detection head module of the head unit, and two of the C2f2 modules are also connected to a Concat module through a CBL module. Three SA attention modules are set between the backbone network unit and the neck unit. The three CN-C2f1 modules located at the end of the backbone network unit are each connected to the neck unit through an SA attention module.
[0037] The pre-collected dataset of light guide plate defects is fed into the SC-YOLOv8 neural network model for training. After training, the collected images of the light guide plate are input into the trained SC-YOLOv8 neural network model for defect detection.
[0038] The following section provides a detailed explanation of the specific steps involved in constructing the SC-YOLOv8 neural network model.
[0039] The SC-YOLOv8 neural network model is built upon the YOLOv8 neural network model. In the traditional YOLOv8 neural network model, the C2f1 module plays a crucial role in utilizing features at different scales and integrating contextual information, which helps improve detection accuracy. However, this module has a small receptive field and weak ability to capture local object information, making it prone to low detection accuracy and missed detections when handling multi-scale objects and small targets. Therefore, this embodiment introduces the ConvNeXt module to improve the C2f1 module. The ConvNeXt module adds a new branch to the C2f1 module, forming the CN-C2f1 module. The ConvNeXt module can acquire a larger receptive field and richer spatial information, thereby enhancing the feature extraction capability of the CN-C2f1 module. This helps improve the overall performance of the neural network model, especially the small target detection performance. Furthermore, the residual structure adopted by the ConvNeXt module effectively avoids the gradient vanishing and gradient exploding problems caused by increasing network depth, making the CN-C2f1 module more robust and reliable in handling various object detection tasks.
[0040] The traditional YOLOv8 neural network model employs a unique bottom-up and top-down architecture in its neck unit, which facilitates the comprehensive fusion of features from different scales, thereby making fuller use of features across multiple scales. However, during feature fusion, the increase in channel dimension may introduce redundant information, leading to a decrease in network feature extraction efficiency. To address this, this embodiment introduces a lightweight hybrid attention mechanism between the backbone network unit and the neck unit: three SA (Shuffle Attention) modules. The SA attention modules first group the input data into multiple sub-feature groups, and then simultaneously construct channel attention and spatial attention for each sub-feature group. This enables more efficient and comprehensive extraction of key features from the input data, thereby improving the ability to represent feature information.
[0041] Finally, the structure of the constructed SC-YOLOv8 neural network model is as follows: Figure 5 As shown.
[0042] like Figure 6 As shown, the CN-C2f1 module includes two CBL modules, a Split module, multiple Bottleneck modules, a ConvNeXt module, a Concat module, and another CBL module. The first CBL module performs the first convolution operation on the input data. The Split module divides the data after the first convolution operation into three branches. The data from the first branch is directly output to the Concat module. The data from the second branch is processed by multiple Bottleneck modules before being output to the Concat module. The data from the third branch is processed by the ConvNeXt module before being output to the Concat module. The Concat module fuses the features from all the branches. The second CBL module performs a second convolution operation on the feature-fused data before outputting the final result.
[0043] like Figure 7As shown, the ConvNeXt module consists of three sequentially connected convolutional layers. The first convolutional layer is a depthwise convolution (Conv2d), connected to the second convolutional layer (Conv2d) via a layer normalization layer (Lay Norm). The second convolutional layer is connected to the third convolutional layer (Conv2d) via a GELU activation function layer. The third convolutional layer is connected to a drop path layer via a layer scale layer. The data input to the first convolutional layer is concatenated with the data output from the third convolutional layer via the drop path layer. Specifically, the first convolutional layer of the ConvNeXt module has a 7×7 kernel size, a stride of 1, and the same number of input and output channels. Depthwise convolution can reduce the size of training parameters while ensuring separation accuracy. Larger kernels can capture a larger receptive field and richer spatial information, thereby enhancing the feature extraction capability of the CN-C2f1 module. The second convolutional layer of the ConvNeXt module has a 1×1 kernel size, a stride of 1, and the number of output channels is four times the number of input channels. The third convolutional layer in the ConvNeXt module has a 1×1 kernel size, a stride of 1, and four times the number of input channels as output channels. A normalization layer is used to normalize features and speed up training. A scaling layer is used to improve the network's convergence speed and accuracy. A dropout path layer enhances generalization ability and prevents overfitting.
[0044] like Figure 8 As shown, the SA attention module includes a feature grouping module (Split), a channel attention mechanism, a spatial attention mechanism, and an aggregation module.
[0045] The feature grouping module is used to divide the input data into multiple sub-features along the channel dimension, and then further divide each sub-feature into two branches of data. For a given feature... Figure X Process, X∈R C×H×W Here, C, H, and W represent the number of channels, spatial height, and width, respectively. The input data is divided into G sub-features along the channel dimension, and then each sub-feature is further subdivided. One branch aims to generate a channel attention map by capturing the relationships between channels, while the other branch aims to generate a spatial attention map by capturing the spatial relationships between features. This logical structure ensures that correlation information is effectively captured at both the feature level and the spatial level.
[0046] The channel attention module sequentially performs global average pooling on the data from the first branch, applies a linear function to enhance channel features, adjusts the output range of the linear function to obtain the weights of each channel, and multiplies each channel weight by the data before outputting the result. First, global average pooling is performed on the input data to obtain the feature information of each channel. Next, a linear function is applied to enhance the channel features to improve their expressive power. Then, the output range of the linear function is adjusted using the sigmoid function to obtain the weights of each channel. Finally, the weights are multiplied by the input data to effectively filter out important channel information.
[0047] The spatial attention module is used to sequentially perform spatial normalization on the data in the second branch, enhance spatial features using linear functions, adjust the output range of the linear function to obtain spatial weights, and multiply each spatial weight by the data before outputting the result. First, spatial normalization is applied to the input data, and spatial features are extracted using Group Norm technology. Next, these spatial features are enhanced using linear functions to give them stronger feature representation capabilities. Then, the output range of the linear function is adjusted using the Sigmoid function to obtain the weights for each space. Finally, these weights are multiplied by the input data to accurately filter out key spatial information.
[0048] The aggregation module fuses the output data from the channel attention module and the spatial attention module, and outputs the aggregated data of all sub-features. During the fusion phase of channel and spatial attention, the size of the output feature map is the same as the input data. In the aggregation part, all sub-features are comprehensively processed, and a channel shuffling operator is introduced to ensure effective information exchange between the sub-features.
[0049] The loss functions of the SC-YOLOv8 neural network model include a localization loss function and a classification loss function.
[0050] The localization loss functions are CIOU loss and DFL loss. CIOU loss is an improvement on IOU loss, considering not only the overlap of bounding boxes but also the distance between center points. DFL loss focuses on the distance between the predicted bounding box and the target bounding box, performing a probabilistic regression. This probabilistic regression is an improvement on the cross-entropy loss function, adding a regulation factor to measure the difference between the model's predicted probability distribution and the true probability distribution. The expression for the DFL loss function is...
[0051] DFL(S i ,S i+1 )=-((y i+1 -y)log(S i )+(yy i)log(S i+1 ))
[0052] In the formula, S i and S i+1 These are two adjacent probability values predicted by the model, while y i and y i+1 This is the corresponding true probability value, where y represents the coordinates of the true bounding box center point.
[0053] The main function of the DFL loss function is to measure the difference between the probability distribution predicted by the model and the true probability distribution. The closer the two are, the smaller the loss value; conversely, the larger the loss value, the greater the difference. This design allows the model to more accurately regress the location of the bounding box, unaffected by the size and shape of the bounding box.
[0054] The classification loss function is the VFL loss function. This function is an improvement on the cross-entropy loss function by adding a regulating factor to reduce the loss value of easily classified samples, making the model focus more on difficult-to-classify samples. The expression for the VFL loss function is as follows:
[0055]
[0056] In the formula, p represents the probability predicted by the model, and q represents the IoU (Intersection over Union) between the predicted bounding box and the ground truth bounding box. α and γ are two hyperparameters used to adjust the weights of positive and negative samples. When q is greater than 0, it indicates that the predicted bounding box overlaps with the ground truth bounding box and is considered a positive sample; while when q equals 0, it indicates that there is no overlap and it is considered a negative sample.
[0057] The VFL loss function considers not only the confidence level of the bounding boxes but also their localization accuracy. This design allows VFL to more effectively suppress low-quality bounding boxes, thereby improving detection accuracy and robustness.
[0058] The SC-YOLOv8 neural network model constructed in this embodiment is mainly based on the YOLOv8 neural network model with two major improvements. In order to verify the effectiveness of each improvement and the effectiveness of the combination of the two improvements, an ablation experiment was conducted in this embodiment. The experimental results are shown in Table 1.
[0059] Table 1 Ablation experiments based on light guide plate surface defect dataset
[0060] method SAttenton ConvNext mAP FPS YOLOv8 97.6% 270 YOLOv8+ConvNext √ 98.1% 201 YOLOv8+SAttention R 98.2% 190 SC-YOLOv8 √ 0 98.7% 150
[0061] As shown in Table 1, the mAP of YOLOv8 is 97.6%. Adding the ConvNext module only to the backbone of the YOLOv8 network improves the mAP by 0.5%, indicating that the C2f1 module improved by ConvNext can acquire a larger receptive field and richer spatial information, thereby enhancing the network's feature extraction capability. This helps improve the overall performance of the network, especially in small object detection. Adding the SAttenton module only between the neck and backbone of the YOLOv8 network improves the mAP by 0.6%, indicating that the SA module can extract key features of the input data more effectively and comprehensively by grouping the input data into multiple sub-features and simultaneously constructing channel and spatial attention on each sub-feature group, thereby improving the network's ability to represent multi-scale and feature information. The combined improvement of these two parts results in an mAP of 98.7% and an FPS of 150 for SC-YOLOv8, indicating that SC-YOLOv8 has significant improvements in both detection accuracy and speed.
[0062] The CIOU loss function results for the YOLOv8 model, YOLOv8+ConvNext model, YOLOv8+SAttention model, and SC-YOLOv8 model during the model training and validation phases are as follows: Figure 9 As shown, its DFL loss function results are as follows: Figure 10 As shown, its VFL loss function results are as follows: Figure 11 As shown, the loss functions of the SC-YOLOv8 model converge rapidly within the first 100 training iterations and finally converge after 300 training iterations. The results of the loss functions of the YOLOv8 network with the added improved modules are significantly better than those of the original YOLOv8 network. During the validation phase, the loss functions of YOLOv8, YOLOv8+SAttention, and YOLOv8+ConvNext exhibited several significant abrupt changes in the first 100 epochs, indicating incorrect validation on some data sets. However, SC-YOLOv8 did not experience these problems. Clearly, the SC-YOLOv8 model is the best-performing model after the improvements, resulting in very reasonable loss function results, no abrupt changes during validation, and rapid network convergence.
[0063] This embodiment also compares the SC-YOLOv8 model with the YOLOv3-Tiny, YOLOv3, YOLOv5, YOLOv7, and YOLOv8 models to verify their accuracy and effectiveness. All comparison models are built based on the same parameters as the SC-YOLOv8 model and use the original dataset of the light guide plate in the models. The performance comparison results of each model are shown in Table 2.
[0064] Table 2 Comparison of model performance based on light guide plate surface defect dataset
[0065]
[0066]
[0067] In this embodiment, seven images were randomly selected and tested on various models. The defect detection results are as follows: Figure 12 As shown in the figure, the first column displays the white spot defect detection results for each model, the second and third columns display the bright line defect detection results, the fourth and fifth columns display the dark line defect detection results, and the sixth and seventh columns display the region defect detection results. It can be seen from the figure that the SC-YOLOv8 model has significantly higher detection accuracy for all four types of defects than the other models.
[0068] Furthermore, to further verify the effectiveness of the SC-YOLOv8 model, this embodiment also conducted a comparative experiment based on a textile surface defect dataset, using the same method as the experiment based on a light guide plate surface defect dataset. The textile surface defect dataset is constructed from images of defective fabrics. The sample images in the dataset have a resolution of 400×400 and consist of a total of 878 defective fabric images, with defect types including holes, long thread defects, and short thread defects. Labels were created for these 878 defective images, and the dataset was expanded by methods such as horizontal flipping and brightness variations. The expanded dataset size was 2634, and then it was divided into a training set, a validation set, and a test set in a 6:2:2 ratio.
[0069] Table 3 shows the comparison results of the SC-YOLOv8 model with YOLOv3-Tiny, YOLOv3, YOLOv5, YOLOv7 and YOLOv8 in detecting surface defects in textiles.
[0070] Table 3 Comparison of model performance based on textile surface defect dataset
[0071]
[0072]
[0073] In this embodiment, six images were also randomly selected for testing on each model, and the defect detection results are as follows: Figure 13As shown in the figure, the first and second columns show the hole defect detection results for each model, the third and fourth columns show the long-line defect detection results for each model, and the fifth and sixth columns show the short-line defect detection results for each model. It can be seen from the figure that even based on a textile surface defect dataset, the SC-YOLOv8 model has higher detection accuracy for the three types of textile surface defects than other models.
[0074] This embodiment uses an SC-YOLOv8 neural network model to detect surface defects in a light guide plate. The SC-YOLOv8 model incorporates a ConvNeXt module to improve the C2f1 module, enhancing feature extraction capabilities, particularly in small target detection. The ConvNeXt module can acquire a larger receptive field and richer spatial information. A residual structure is used to address the vanishing and exploding gradient problems. Furthermore, the SA attention module introduced between the backbone and neck units comprehensively extracts key features from the input data through feature grouping, channel attention, and spatial attention, avoiding excessive increases in computational parameters. Experiments verify that these improvements significantly enhance the performance of the SC-YOLOv8 model, especially in multi-scale target detection tasks.
[0075] This article uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. It should be noted that those skilled in the art can make several improvements and modifications to the present invention without departing from the principles of the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
Claims
1. A method for detecting defects in a light guide plate based on an SC-YOLOv8 neural network model, characterized in that: The method includes the following steps: An SC-YOLOv8 neural network model is constructed based on the YOLOv8 neural network model. The SC-YOLOv8 neural network model includes a backbone network unit, a neck unit, and a head unit connected in sequence. The backbone network unit includes five CBL modules and four CN-C2f1 modules. The head unit includes three detection head modules. The neck unit includes one SPPF module, two upsampling modules, four Concat modules, four C2f2 modules, and two CBL modules. The three C2f2 modules are each connected to one detection head module of the head unit, and two of the C2f2 modules are also connected to a Concat module through a CBL module. Three SA attention modules are provided between the backbone network unit and the neck unit. The three CN-C2f1 modules located at the end of the backbone network unit are each connected to the neck unit through an SA attention module. The pre-collected light guide plate defect dataset is substituted into the SC-YOLOv8 neural network model for training. After training, the collected light guide plate images are input into the trained SC-YOLOv8 neural network model for defect detection. The CN-C2f1 module includes two CBL modules, a Split module, multiple Bottleneck modules, a ConvNeXt module, a Concat module, and another CBL module. The first CBL module performs a first convolution operation on the input data. The Split module divides the data after the first convolution operation into three branches: the data from the first branch is directly output to the Concat module; the data from the second branch is processed by multiple Bottleneck modules and then output to the Concat module; the data from the third branch is processed by the ConvNeXt module and then output to the Concat module. The Concat module fuses the features of all the output data. The second CBL module performs a second convolution operation on the fused data and then outputs the result. The SA attention module includes a feature grouping module, a channel attention module, a spatial attention module, and an aggregation module. The feature grouping module divides the input data into multiple sub-features along the channel dimension, and further divides each sub-feature into two branches. The channel attention module performs global average pooling, applies a linear function to enhance the channel features, adjusts the output range of the linear function to obtain the channel weights, and multiplies each channel weight with the data before outputting the result. The spatial attention module performs spatial normalization, applies a linear function to enhance the spatial features, adjusts the output range of the linear function to obtain the spatial weights, and multiplies each spatial weight with the data before outputting the result. The aggregation module merges the output data of the channel attention module and the output data of the spatial attention module, and aggregates the fused data of all sub-features before outputting the result.
2. The method for detecting defects in a light guide plate based on the SC-YOLOv8 neural network model according to claim 1, characterized in that: The ConvNeXt module includes three convolutional layers connected in sequence. The first convolutional layer is a depthwise convolution and is connected to the second convolutional layer through a layer normalization layer. The second convolutional layer is connected to the third convolutional layer through a GELU activation function layer. The third convolutional layer is connected to the dropout path layer through a layer scaling layer. The data input to the first convolutional layer is connected to the data output from the third convolutional layer through the dropout path layer.
3. The method for detecting defects in a light guide plate based on the SC-YOLOv8 neural network model according to claim 2, characterized in that: The first convolutional layer of the ConvNeXt module has a kernel size of 7×7, a stride of 1, and the number of input channels is equal to the number of output channels; the second convolutional layer of the ConvNeXt module has a kernel size of 1×1, a stride of 1, and the number of output channels is four times the number of input channels; the third convolutional layer of the ConvNeXt module has a kernel size of 1×1, a stride of 1, and the number of input channels is four times the number of output channels.
4. The method for detecting defects in a light guide plate based on the SC-YOLOv8 neural network model according to claim 1, characterized in that: The loss function of the SC-YOLOv8 neural network model includes a localization loss function and a classification loss function. The localization loss function is the CIOU loss function and the DFL loss function, and the classification loss function is the VFL loss function.
