Light guide plate surface defect detection method based on GCC-YOLOv8 network model
By adopting the detection method based on the GCC-YOLOv8 network model in the surface defect detection of light guide plates, the problems of complex texture background and large differences in defect characteristics in the surface defect detection of light guide plates are solved, and high-precision and fast defect detection are achieved, with good robustness and detection speed.
Patent Information
- Application Number
- CN202411663183.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-11-20
AI Technical Summary
The surface defect detection of light guide plates is challenging due to the complex texture background, the wide variety of defects, and the large differences in defect feature scales, and the automated defect detection is not strong. Traditional machine vision methods are not robust and difficult to meet the real-time detection needs.
The surface defect detection method of light guide plate based on the GCC-YOLOv8 network model is adopted. By introducing the GKA-Conv module into the backbone network unit, CFC, SFC and CPCA modules are introduced into the neck network unit to enhance feature expression capabilities, extract context and spatial information, and dynamically allocate attention weights.
The accuracy and speed of surface defect detection of light guide plates is improved, the detection ability of small targets and low contrast defects is enhanced, the positioning and classification accuracy of the model is improved, and the detection speed is better.
Smart Images

Figure CN119540724A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for detecting surface defects of a light guide plate, and in particular to a method for detecting surface defects of a light guide plate based on a GCC-YOLOv8 network model, and belongs to the technical field of automatic defect detection. Background Art
[0002] The light guide plate is a key component of the liquid crystal panel. During the production process, it is inevitable that the light guide plate will have defects such as bright spots, scratches, dirt, and shadows. Therefore, surface defect detection of the light guide plate during the production process is of great significance to improving the quality of the light guide plate and downstream products.
[0003] In the production process of light guide plates, automatic defect detection is an important way to ensure the quality of light guide plates. However, due to the complex texture and background of light guide plates, a wide variety of defects, and large differences in defect feature scales, its automated defect detection is extremely challenging. With the development of machine vision and deep learning technology, the automatic detection technology of light guide plate surface defects has a certain feasibility. Traditional machine vision methods require image preprocessing, feature extraction, feature selection and other steps, which are easily interfered by environmental factors and have low robustness, making it difficult to meet the needs of real-time defect detection of light guide plates. Compared with traditional machine vision methods, methods based on deep learning have more efficient feature extraction capabilities, strong generalization capabilities, good algorithm flexibility and versatility, and can cope with tasks of different scales and complexities. Using deep learning technology to detect surface defects of light guide plates can greatly improve the accuracy and speed of light guide plate defect detection and optimize the production process of light guide plates.
[0004] The requirements for light guide plate surface defect detection are high. In order to carry out quality control and production process optimization, the detection algorithm needs to be able to output accurate defect category and location information. The classification network based on deep learning can identify the main object categories in the image, but cannot provide the location information of the object. The object detection network can detect multiple different categories of objects in the image and provide accurate location information. It can adapt to complex scenes and meet the requirements of light guide plate surface defect detection tasks.
[0005] YOLOv8 is one of the single-stage target detection networks with the best comprehensive performance at present, with high detection speed and excellent detection accuracy. However, due to the complex texture and background of the light guide plate, the variety of defects, the large difference in defect feature scales, and the low contrast between some defects and the background, it is easy to misdetect or miss the detection. Directly applying the YOLOv8 network to the light guide plate surface defect detection has poor results. Summary of the invention
[0006] Based on the above background, the purpose of the present invention is to provide a light guide plate surface defect detection method based on the GCC-YOLOv8 network model to solve the problems described in the background technology.
[0007] In order to achieve the above-mentioned object of the invention, the present invention provides the following technical solutions:
[0008] A method for detecting surface defects of a light guide plate based on a GCC-YOLOv8 network model, the method comprising the following steps:
[0009] Acquire an image of the light guide plate to be inspected;
[0010] Input the image into the GCC-YOLOv8 network model for defect detection;
[0011] Outputting surface defect information of the light guide plate based on the detection result of the GCC-YOLOv8 network model;
[0012] The GCC-YOLOv8 network model is constructed based on the YOLOv8 network model, and the GCC-YOLOv8 network model includes a backbone network unit, a neck network unit, and a detection head network unit with three parallel detection branches arranged in sequence;
[0013] The backbone network unit is provided with two GKA-C2f1 modules at its end, and the two GKA-C2f1 modules are connected by a CBS module. The GKA-C2f1 module is obtained by replacing multiple bottleneck residual modules in the C2f1 module with a GKA bottleneck residual module. The GKA bottleneck residual module is used to divide the input features into two branches, the first branch is sequentially transformed by two series-connected GKA-Conv modules, the second branch directly transmits the input features, and the output features of the two branches are output after element-by-element addition;
[0014] The neck network unit includes an FPN network unit and a PAN network unit. The FPN network unit includes two upsampling modules, two C2f2 modules, two Concat modules, a SPPF module and a CPCA module. The CPCA module is used to dynamically assign attention weights to the output features of a C2f2 module in the channel dimension and the spatial dimension and then output them to an upsampling module. The PAN network unit includes two CBS modules, two Concat modules, two C2f2 modules, three CPCA modules, a CFC module and an SFC module. The first CPCA module is used to assign attention weights to the output features of a C2f2 module at the end of the FPN network unit. The output features of the 2f2 module are dynamically assigned attention weights in the channel dimension and the spatial dimension and then output to a CBS module and an SFC module. The SFC module is used to calibrate the input spatial features and output it to a detection branch. The second CPCA module is used to dynamically assign attention weights to the output features of a C2f2 module in the channel dimension and the spatial dimension and then output it to a CBS module and another detection branch. The third CPCA module is used to dynamically assign attention weights to the output features of a C2f2 module in the channel dimension and the spatial dimension and then output it to the CFC module. The CFC module is used to calibrate the input contextual features and output it to another detection branch.
[0015] Preferably, the GKA-Conv module is used to divide the input features into two branches, map the features of the first branch to [-1,1] through a tanh activation function, and then perform a Gram polynomial transformation to obtain four feature maps containing different information, which are then superimposed according to the channel dimension, and then SiLU activation function operations and convolution operations are performed in sequence, and the features of the second branch are directly subjected to SiLU activation function operations and convolution operations, and the output features of the two branches are output after element-by-element addition.
[0016] Preferably, the CFC module is used to divide the input features into two branches, perform convolution and reshaping operations on the features of the first branch, obtain multi-scale contexts through the CPP module for the features of the second branch, and then generate two forms of context representations through two convolution operations respectively, the first form of context representation is element-wise multiplied with the output of the first branch and then a Softmax operation is performed to obtain pixel context similarity, the pixel context similarity is element-wise multiplied with the second form of context representation and then context recalibrated through the CRB module to obtain a refined context, and finally the refined context is directly added element-by-element to the input features of the CFC module and output.
[0017] Preferably, the SFC module is used to convert the low-resolution feature F l and high-resolution features F hTwo convolution operations are performed to unify the channels to the same number, and then bilinear interpolation is used to calculate F. l Upsample and cascade the upsampled F l and F h , and then send it to the convolution module to predict two sets of offset maps for aligning the features of the two levels, and predict two gate masks for controlling the flow of feature information of the two levels. Finally, the calibrated cross-level features are output after element-by-element addition.
[0018] Preferably, the CPCA module is used to process the input features through the channel attention module to obtain a one-dimensional channel attention map, multiply the one-dimensional channel attention map by the input features element by element, transfer the channel attention value along the spatial dimension to obtain a refined feature of the channel attention, and then process it through the spatial attention module to obtain a three-dimensional spatial attention map, and output the three-dimensional spatial attention map after multiplying the three-dimensional spatial attention map by the refined feature of the channel attention element by element.
[0019] Preferably, the backbone network unit also includes five CBS modules and two C2f1 modules. Along the processing direction of the input features, the first CBS module, the second CBS module, the first C2f1 module, the third CBS module, the second C2f1 module, the fourth CBS module, the first GKA-C2f1 module, the fifth CBS module and the second GKA-C2f1 module are connected in sequence, the second C2f1 module is also connected to the second Concat module along the input feature processing direction in the FPN network unit, the first GKA-C2f1 module is also connected to the first Concat module along the input feature processing direction in the FPN network unit, and the second GKA-C2f1 module is connected to the SPPF module of the FPN network unit;
[0020] In the FPN network unit, along the processing direction of the input feature, the SPPF module, the first upsampling module, the first Concat module, the first C2f2 module, the CPCA module, the second upsampling module, the second Concat module and the second C2f2 module are connected in sequence, the SPPF module is also connected to the second Concat module along the input feature processing direction in the PAN network unit, the first C2f2 module is also connected to the first Concat module along the input feature processing direction in the PAN network unit, and the second C2f2 module is connected to the first CPCA module along the input feature processing direction in the PAN network unit;
[0021] In the PAN network unit, along the processing direction of the input features, the first CPCA module, the first CBS module, the first Concat module, the first C2f2 module, the second CPCA module, the second CBS module, the second Concat module, the second C2f2 module and the third CPCA module are connected in sequence.
[0022] Preferably, the loss function of the GCC-YOLOv8 network model includes a classification loss function and a bounding box regression loss function, and the classification loss function is a BCEWithLogitsLoss function, whose mathematical expression is:
[0023]
[0024] In the formula, σ represents the Sigmoid function, p i Indicates the probability that a sample is predicted as a positive example, y i Represents the true label of the sample;
[0025] The bounding box regression loss function is a CIoULoss function and a DFL function. The mathematical expression of the CIoULoss function is:
[0026]
[0027]
[0028] In the formula, IoU represents the ratio of the intersection and union of the predicted box and the real box, d represents the distance between the center points of the predicted box and the real box, c represents the diagonal distance of the minimum circumscribed rectangle, and v represents the correction factor;
[0029] The mathematical expression of the DFL function is:
[0030] DFL(S i ,S i+1 )=-((y i+1 -y)log(S i )+(yy i )log(S i+1 ));
[0031] In the formula, S i and S i+1 Represents the two nearest predicted values of the network output, y represents the actual value of the label, and y i ,y i+1 represents the actual values of the two labels closest to y.
[0032] Preferably, the correction factor v is calculated by the following mathematical expression:
[0033]
[0034] In the formula, w G Indicates the width of the target box, h G Indicates the height of the target box, w p Indicates the width of the prediction box, h p Indicates the height of the prediction box.
[0035] Preferably, the bounding box regression loss function is used in the training of the GCC-YOLOv8 network model by the following method: first, the loss of the bounding box distribution probability and the label distribution probability is calculated by the DFL function, and then the bounding box distribution probability is restored to the prediction box, and the loss of the prediction box and the actual box of the label is calculated by the CIoULoss function.
[0036] Preferably, the training parameters of the GCC-YOLOv8 network model are as follows: batch size is 16, momentum is 0.937, initial learning rate is 0.01, final learning rate is 0.0001, data enhancement method is Mosaic data enhancement method, data enhancement coefficient is 1.0, input image size is 640*640 pixels, number of training rounds is 200, number of preheating rounds is 3, and weight decay is 0.0005.
[0037] Compared with the prior art, the present invention has the following advantages:
[0038] The invention discloses a light guide plate surface defect detection method based on a GCC-YOLOv8 network model. The method improves the traditional YOLOv8 network model, replaces the convolution module of the Bottleneck in the two C2f1 modules after the backbone network unit of the traditional YOLOv8 network model with a GKA-Conv module, so that the model can more effectively capture nonlinear relationships and enhance the feature expression ability of the model; introduces a CFC module with a context feature calibration mechanism and an SFC module with a spatial feature calibration mechanism in the neck network unit, efficiently mines context and spatial information with less calculation amount, and improves the detection ability of the model for small targets and low-contrast defects. Improve the positioning and classification accuracy of the model; and introduce a CPCA module with a channel prior convolutional attention mechanism in the neck network unit, dynamically allocate attention weights in the channel and spatial dimensions, and use multi-scale deep convolution to extract spatial relationships without affecting the channel prior, further enhance the feature expression ability of the model, and enable the model to simultaneously detect defects of different scales; the light guide plate surface defect detection method of the present invention can effectively deal with light guide plate images with complex texture backgrounds, a small proportion of some defective pixels and low contrast with the background, large differences in defect features, and small target defects that are difficult to detect. It has good light guide plate surface defect detection performance and robustness, and takes into account a better detection speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0040] Figure 1 It is a schematic diagram of the structure of the GCC-YOLOv8 network model in the present invention;
[0041] Figure 2 It is a schematic diagram of the structure of the GKA-Conv module of the GCC-YOLOv8 network model in the present invention;
[0042] Figure 3 It is a structural diagram of the CFC module of the GCC-YOLOv8 network model in the present invention;
[0043] Figure 4 It is a structural diagram of the SFC module of the GCC-YOLOv8 network model in the present invention;
[0044] Figure 5 It is a structural diagram of the CPCA module of the GCC-YOLOv8 network model in the present invention;
[0045] Figure 6 It is a test result diagram of the light guide plate defect data set in the present invention on different network models;
[0046] Figure 7 is the GradCAM visualization output diagram of the present invention;
[0047] Figure 8 These are the test results of the NEU-DET hot-rolled steel strip defect dataset in the present invention on different network models. DETAILED DESCRIPTION
[0048] The technical solution of the present invention is 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 form of modification and / or change made to the present invention will fall within the protection scope of the present invention.
[0049] In the present invention, unless otherwise specified, all parts and percentages are weight units, and the equipment and raw materials used can be purchased from the market or are commonly used in the art. The methods in the following embodiments, unless otherwise specified, are conventional methods in the art. The components or equipment in the following embodiments, unless otherwise specified, are universal standard parts or components known to those skilled in the art, and their structures and principles are known to those skilled in the art through technical manuals or conventional experimental methods.
[0050] The embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present invention. However, one or more embodiments may also be implemented by those skilled in the art without these specific details.
[0051] Light guide plate defects mainly include white spot defects, bright line defects, dark line defects and surface defects. White spot defects usually appear as non-uniform dot marks. The imaging characteristics of white spot defects are that the brightness of a certain light guide point is significantly greater than that of the surrounding light guide points, and the contrast with the background is high. The size of white spot defects is about 4-20 pixels, which is slightly larger than normal light guide points. It is usually caused by air bubbles or foreign debris in the manufacturing process. Bright line defects have a high contrast with the background, and appear as a linear profile with a length exceeding a certain range and a width within a few pixels. Often during the transmission process, the surface of the light guide plate is scratched or collided, resulting in bright line defects. The size, shape and formation reasons of dark line defects are similar to those of bright line defects, but the brightness is darker, the contrast with the background is low, and the detection is more difficult. The imaging characteristics of surface defects are irregular and large bright and dark areas. Generally, it is because the light guide plate contacts foreign matter during long-distance transmission, resulting in surface defects on the surface of the light guide plate.
[0052] According to the imaging characteristics of the above-mentioned light guide plates and the characteristics and causes of various defects of the light guide plates, the detection of surface defects of light guide plates has the following difficulties: First, the background of the light guide plate image is complex. The complex texture background greatly increases the difficulty of detecting defects with low contrast with the background, and the different density characteristics of the light guide plate image require the detection network to have the ability to adapt to backgrounds with different densities and distribution patterns. Second, white spot defects and some minor line defects are small in size, making them difficult to detect, and white spot defects are similar to dust features, which can easily lead to misjudgment. Third, the characteristics of various defects in light guide plates vary greatly. White spot defects are small in size and high in brightness, dark line defects are long strips with low contrast with the background, and surface defects are large in size. This requires the detection network to be able to detect defects of different sizes at the same time.
[0053] In view of the above technical difficulties, an embodiment of the present invention discloses a method for detecting surface defects of a light guide plate based on a GCC-YOLOv8 network model, the method comprising the following steps:
[0054] Acquire an image of the light guide plate to be inspected;
[0055] Input the image into the GCC-YOLOv8 network model for defect detection;
[0056] The detection results based on the GCC-YOLOv8 network model output the surface defect information of the light guide plate.
[0057] like Figure 1 As shown, the GCC-YOLOv8 network model includes a backbone network unit, a neck network unit, and a detection head network unit with three parallel detection branches, which are arranged in sequence.
[0058] The backbone network unit is provided with two GKA-C2f1 modules at its end, and the two GKA-C2f1 modules are connected by a CBS module. The GKA-C2f1 module is obtained by replacing multiple bottleneck residual modules in the C2f1 module with a GKA bottleneck residual module. The GKA bottleneck residual module is used to divide the input features into two branches. The first branch performs feature transformation in turn through two series-connected GKA-Conv modules, and the second branch directly passes the input features. The output features of the two branches are output after element-by-element addition.
[0059] The neck network unit includes an FPN network unit and a PAN network unit. The FPN network unit includes two upsampling modules, two C2f2 modules, two Concat modules, a SPPF module and a CPCA module. The CPCA module is used to dynamically assign attention weights to the output features of a C2f2 module in the channel dimension and the spatial dimension and then output them to an upsampling module; the PAN network unit includes two CBS modules, two Concat modules, two C2f2 modules, three CPCA modules, a CFC module and a SFC module. The first CPCA module is used to assign attention weights to a C2f2 module at the end of the FPN network unit. The output features of the block are dynamically assigned attention weights in the channel dimension and the spatial dimension and then output to a CBS module and an SFC module. The SFC module is used to calibrate the input spatial features and then output it to a detection branch. The second CPCA module is used to dynamically assign attention weights to the output features of a C2f2 module in the channel dimension and the spatial dimension and then output it to a CBS module and another detection branch. The third CPCA module is used to dynamically assign attention weights to the output features of a C2f2 module in the channel dimension and the spatial dimension and then output it to the CFC module. The CFC module is used to calibrate the input contextual features and then output it to another detection branch.
[0060] The backbone network unit also includes five CBS modules and two C2f1 modules. Along the processing direction of the input features, the first CBS module, the second CBS module, the first C2f1 module, the third CBS module, the second C2f1 module, the fourth CBS module, the first GKA-C2f1 module, the fifth CBS module and the second GKA-C2f1 module are connected in sequence. The second C2f1 module is also connected to the second Concat module along the input feature processing direction in the FPN network unit. The first GKA-C2f1 module is also connected to the first Concat module along the input feature processing direction in the FPN network unit. The second GKA-C2f1 module is connected to the SPPF module of the FPN network unit.
[0061] In the FPN network unit, along the processing direction of the input features, the SPPF module, the first upsampling module, the first Concat module, the first C2f2 module, the CPCA module, the second upsampling module, the second Concat module and the second C2f2 module are connected in sequence. The SPPF module is also connected to the second Concat module along the input feature processing direction in the PAN network unit. The first C2f2 module is also connected to the first Concat module along the input feature processing direction in the PAN network unit. The second C2f2 module is connected to the first CPCA module along the input feature processing direction in the PAN network unit.
[0062] In the PAN network unit, along the processing direction of the input features, the first CPCA module, the first CBS module, the first Concat module, the first C2f2 module, the second CPCA module, the second CBS module, the second Concat module, the second C2f2 module and the third CPCA module are connected in sequence.
[0063] The above GCC-YOLOv8 network model is constructed based on the traditional YOLOv8 network model. Although YOLOv8 is one of the single-stage target detection networks with the best comprehensive performance, it has efficient detection speed and excellent detection accuracy. However, due to the complex texture background of the light guide plate image, the variety of defects, the large difference in defect feature scales, and the low contrast between some defects and the background, it is easy to misdetect or miss. If the YOLOv8 network is directly applied to the light guide plate surface defect detection, the effect is not good. Therefore, the method of this embodiment mainly makes the following three improvements on the basis of the traditional YOLOv8 network model.
[0064] First, the Gram Kolmogorov-Arnold Conv (GKA-Conv) module is introduced into the backbone network unit, and the Bottleneck convolution module in the last two C2f1 modules of the YOLOv8 backbone network is replaced, so that the network can more effectively capture nonlinear relationships, enhance the network's feature expression capabilities, and improve the network's parameter utilization. Compared with the original convolution module, the GKA-Conv module maps the input data to a high-dimensional space through the Gram polynomial transformation, further extracts deep feature information, reduces the complexity of the network, and improves the generalization ability of the network. In addition, combined with the Bottleneck structure, the speed of network training and reasoning is improved, and the network's ability to model complex data is enhanced.
[0065] Second, the YOLOv8 network lacks global information when extracting defect features, which will lead to pixel context mismatch. For the case of large scale differences and low contrast of light guide plate defects, inaccurate positioning and classification are prone to occur, especially for defects with a small pixel ratio, the network detection accuracy is low. To this end, the context and spatial feature calibration (CSFC) module is introduced, which contains the context feature calibration (CFC) module and the spatial feature calibration (SFC) module, and is embedded in the neck network unit. The CFC module uses a cascaded pyramid pooling module to efficiently capture nested contexts, and then aggregates the private context of each pixel according to the pixel context similarity to achieve context feature calibration. The SFC module divides the features into multiple groups of sub-features along the channel dimension, and propagates the sub-features among them through learnable sampling, thereby achieving spatial feature calibration. Through these two modules, the CSFC module can efficiently mine context and spatial information with less computational effort, improve the network's detection ability for small targets and low-contrast defects, and improve the network's positioning and classification accuracy.
[0066] Third, in order to solve the problem that the defect features of light guide plates are very different, there are many types, and it is difficult to detect small targets, the channel prior convolutional attention (CPCA) module is introduced and inserted after each C2f2 module in the neck. The CPCA module has the ability to focus on channel information and important areas, can dynamically allocate attention weights in the channel and spatial dimensions, and uses multi-scale deep convolution to extract spatial relationships without affecting the channel prior, which enhances the feature expression ability of the network and enables the network to detect defects of different scales at the same time.
[0067] The following is a detailed description of each module involved in the improvement.
[0068] like Figure 2As shown in the figure, the GKA-Conv module is used to divide the input features into two branches. The features of the first branch are mapped to [-1,1] through the tanh activation function and then subjected to the Gram polynomial transformation to obtain four feature maps containing different information. They are then superimposed according to the channel dimension to expand the features to a higher dimension and optimize the network's selection of features. The SiLU activation function operation and convolution operation are then performed in sequence, so that the network can capture the complex relationship between the input features, potentially improving the generalization ability of the network. The features of the second branch are directly subjected to the SiLU activation function operation and convolution operation. Finally, the output features of the two branches are added element by element and then output. The residual connection fine-tunes the results of the Gram polynomial transformation to obtain highly optimized learning features and improve the network's expression ability and efficiency.
[0069] The GKA-Conv module constructs a residual Gram polynomial transformation to better fit different nonlinear output data. This brings a more flexible and responsive network structure that can dynamically adapt to more complex data patterns and improve the generalization ability of the network. As shown in the following formula, the GKA-Conv module can be expressed as a residual basis function b(x) and a Gram polynomial The sum of, where b(x) is SiLU(x), ω b Factors are used to better control the overall magnitude of the function. is a set of n-degree polynomials of x, ω i is the weight function.
[0070]
[0071]
[0072]
[0073] The GKA-Conv module uses the simplicity of Gram polynomial transformation and its unique discreteness to enable faster convergence when processing discrete data in images, enhance the network's adaptability to spatial information, and improve the network's ability to express nonlinear features. As shown below, the GKA-Conv module maps the original data space to a high-dimensional space through the Gram polynomial, improves the network's ability to capture nonlinear relationships between input data, and enhances the network's ability to use complex function mapping, so that the network better fits the transmitted information and provides a rich and adaptable response surface for network input.
[0074]
[0075] in, are polynomial coefficients, b n is the adjustment factor.
[0076] The contextual feature calibration (CFC) module and the spatial feature calibration (SFC) module together form the contextual and spatial feature calibration (CSFC) module. The traditional YOLOv8 network divides the image into grids and predicts the object bounding box and category in each grid to detect objects. This method requires the network to detect objects in each grid instead of understanding the entire image globally, which will lead to the problem of pixel context mismatch. The size of light guide defects varies greatly, among which the dark line defects have low contrast with the background. Since there is not enough global context information to assist detection decisions, the network lacks adaptability to different inputs. Context information can provide rich scene category priors to correct incorrect classifications. The CFC module can crop and refine the semantic context for each pixel, capture multi-scale context information through efficient pooling operations, and then match pixels and context to solve the problem of pixel-context mismatch. The SFC module groups the channel dimension into multiple sub-features and then calibrates them separately to alleviate the problem of spatial feature misalignment.
[0077] like Figure 3 As shown in the figure, the CFC module is used to divide the input features into two branches, perform convolution and reshaping operations on the features of the first branch, obtain multi-scale contexts through the CPP module for the features of the second branch, and then generate two forms of context representations through two convolution operations respectively. The first form of context representation is element-wise multiplied with the output of the first branch and then a Softmax operation is performed to obtain pixel context similarity. The pixel context similarity is element-wise multiplied with the second form of context representation and then context recalibrated through the CRB module to obtain a refined context. Finally, the refined context is directly added element-by-element to the input features of the CFC module and then output.
[0078] The CFC module aggregates context from semantically closer regions to capture the most instructive context for classification. For the input feature X∈R C×H×W , firstly process it to obtain a highly abstract multi-scale context Z∈R C×M , and then calculate the pixel context similarity θ∈R N×M , where N = H × W, M represents the total number of pixels and contexts. Taking θ as a guide, the context of each pixel is aggregated to achieve context feature calibration. Finally, the response value of each semantic context is further adjusted to generate fine-grained context information, thereby achieving context recalibration. The expression of the CFC module is as follows,
[0079]
[0080] Among them, {x i ,y i ,a i ,zj}∈R C×1 They represent input, output, recalibration factor and context respectively. The value range of i is [1,…,H×W], and f(·) represents the pairwise function used to calculate the similarity between features.
[0081] The CFC module uses an efficient cascade pyramid pooling (CPP) module to capture multi-scale contexts, and then calculates the similarity between pixels and contexts to aggregate semantically relevant contexts for each pixel, thereby achieving context feature calibration. After that, with the help of the context recalibration (CRB) module, local contexts are conditionally learned by sharpening large objects and retaining spatial details to solve the problem of merging contexts and destroying small target features.
[0082] For the input feature X∈R c×H×W , first use a 1×1 convolutional layer to generate the dimension reduction feature Q∈R C′×H×W , where C′ is much smaller than C. Then, the CPP module is used to obtain the multi-scale context Z∈R C×M Finally, Z is introduced into two convolutional layers (with BN and ReLU) to produce two forms of context representation, namely K∈R c′×M and V∈R c×M Then, reshape and transpose Q into R N×C′ , and matrix multiplication is performed between Q and K and added to the softmax layer to produce the pixel context similarity θ∈R N×M :
[0083]
[0084] Among them, θ i,j represents the i-th pixel Q i and the jth context K j Finally, between V and θ T Perform matrix multiplication between them to obtain the calibrated semantic context E∈R C×N , and reshape E into R C×H×W After obtaining the calibrated context E, it is sent to the context recalibration (CRB) module to generate the refined context E′. The CRB module adopts a residual-like design and can be expressed as:
[0085]
[0086] Among them, α∈E C×H×W is the recalibration factor, and Represents a convolutional layer. The tanh function is used here to remove redundant information and highlight useful information in the context (such as boundaries and small objects).
[0087] Finally, the element-wise summation between X and E′ is performed to generate the final output Y∈R C×H×W , as shown below:
[0088] Y=X+E′.
[0089] like Figure 4 As shown, the SFC module is used to transform the low-resolution feature F l and high-resolution features F h Two convolution operations are performed to unify the channels to the same number, and then bilinear interpolation is used to calculate F. l Upsample and cascade the upsampled F l and F h , and then send it to the convolution module to predict two sets of offset maps for aligning the features of the two levels, and predict two gate masks for controlling the flow of feature information of the two levels. Finally, the calibrated cross-level features are output after element-by-element addition.
[0090] In order to compensate for the loss of spatial details caused by progressive downsampling, for a given low-resolution feature and high-resolution features The SFC module groups the channel dimensions into multiple sub-features for calibration operations respectively, and integrates a gating mechanism to adaptively fuse cross-layer features.
[0091] In terms of feature calibration, the SFC module uses feature resampling to reconstruct features. Assume that the spatial coordinates of each position on the feature map are {(1,1), (1,2), …, (H, W)}, and the learned 2D offset mapping is Δ∈R 2×H×W , then the calibration function τ(·) can be expressed as:
[0092]
[0093] The sampling characteristics are The output U h,w , and use bilinear kernel interpolation to obtain the features of the sampling positions. For finer calibration, the SFC module divides the features F into G groups in the channel dimension and then aligns the features within each group separately.
[0094] In addition, the SFC module adaptively fuses the calibrated semantic features F′ through a gating strategy l and fine-grained features F′ h , to bridge the representation gap between them, as shown in the following formula,
[0095]
[0096] Among them, β l and β h Indicates a door mask.
[0097] The specific processing flow of the SFC module is as follows: and First, two convolutional layers are used to unify their channels to the same number C. Then, bilinear interpolation is used to interpolate F. l Upsample and cascade the upsampled F l and F h Afterwards, they are fed into a convolutional module to predict two sets of offset maps: Δ l ∈R (2×G)×H×W and Δ h ∈R (2×G)×H×W , used to align the features of the two levels and predict two gate masks β l ,β h ∈R 1×H×W , which is used to control the flow of feature information between the two levels. Finally, the calibrated cross-level features are summed element by element to obtain the output. The SFC module can be written as follows:
[0098]
[0099] Where u(·) represents the bilinear upsampling function, Represents a convolutional layer with BN and ReLU.
[0100] The weights of the last convolutional layer of the convolutional block are initialized to zero to gradually learn more accurate offsets and masks, so that the SFC module can be inserted into the network without affecting the original performance of the network. In addition, the gate mask uses 1+tanh as the activation function, so that τ(F,0) becomes an identity mapping, and β=1+tanh(0)=1. Therefore, the SFC module can be expressed as:
[0101] O=u(W l F l )+W h F h .
[0102] like Figure 5 As shown in the figure, the CPCA module is used to process the input features through the channel attention module to obtain a one-dimensional channel attention map, multiply the one-dimensional channel attention map with the input features element by element, transfer the channel attention value along the spatial dimension to obtain the refined features of the channel attention, and then process it through the spatial attention module to obtain a three-dimensional spatial attention map, and multiply the three-dimensional spatial attention map with the refined features of the channel attention element by element and output them.
[0103] The CPCA module first obtains the channel attention map through the CA module, and then uses the deep convolution module to sequentially extract the key spatial areas of each channel, thereby generating a dynamically distributed spatial attention map on each channel. These dynamically distributed spatial attention maps are closer to the actual feature distribution on each channel, effectively improving the network's detection performance for complex defects of light guide plates.
[0104] For the input feature map F∈R C×H×W , after being processed by the CA module, we get a one-dimensional channel attention map M C ∈R C ×1×1 Then, M c Multiply the input feature F element by element and pass the channel attention value along the spatial dimension to obtain the channel attention refined feature F c ∈R C×H×W Next, the SA module performs c Processing is performed to generate a three-dimensional spatial attention map M s ∈R C×H×W Finally, M s With F c Multiply elements by element to get the output features The overall process of CPCA module is as follows: Represents element-wise multiplication.
[0105]
[0106] In the channel attention part, the channel attention map is generated by the CA module by exploring the inter-channel relationship in the feature. The CA module uses average pooling and maximum pooling operations to aggregate spatial information from the feature map. The results of the aggregation process are fed into the shared MLP respectively, and the two outputs are added element by element to obtain the channel attention map. The calculation method of the channel attention map is shown in the following formula, where σ represents the sigmoid function.
[0107] CA(F)=σ(MLP(AvgPool(F))+MLP(MaxPool(F))).
[0108] In the spatial attention part, the spatial attention map is generated by extracting the spatial mapping relationship. The SA module uses deep convolution to capture the spatial relationship between features and adopts a multi-scale structure to enhance the ability of convolution operations to capture spatial relationships. In addition, the SA module uses 1×1 convolution at the end to achieve channel mixing, thereby producing a more refined attention map. The spatial attention map calculation method is shown in the following formula:
[0109]
[0110] Among them, DwConv represents deep convolution, and Branch i Denotes the i-th branch (i∈{0,1,2,3}). The SA module uses two depth-wise strip convolutions to approximate the standard channel-by-channel convolution with a large kernel. The kernel size of each channel is different, which can capture multi-scale information and enhance the network's ability to process complex data.
[0111] The above describes in detail each module involved in the improvement. The following is a detailed description of the training settings of the GCC-YOLOv8 network model.
[0112] The loss functions of the GCC-YOLOv8 network model include classification loss function and bounding box regression loss function.
[0113] The classification loss function is the BCEWithLogitsLoss function, and its mathematical expression is:
[0114]
[0115] In the formula, σ represents the Sigmoid function, p i Indicates the probability that a sample is predicted as a positive example, y i Indicates the true label of the sample. The BCEWithLogitsLoss function combines the Sigmoid activation function and the Binary Cross Entropy (BCE) loss function. It is more stable numerically, can effectively avoid the problem of gradient vanishing or gradient exploding, and is more computationally efficient, which helps improve the efficiency of training.
[0116] The bounding box regression loss functions are CIoU Loss function and DFL function.
[0117] The mathematical expression of CIoU Loss function is:
[0118]
[0119]
[0120] Where IoU represents the ratio of the intersection and union of the predicted box and the true box, d represents the distance between the center points of the predicted box and the true box, c represents the diagonal distance of the minimum circumscribed rectangle, and v represents the correction factor.
[0121] The CIoU loss function takes into account the shape information of the target box in its design. By introducing a correction factor, the loss is made more robust to target boxes of different shapes, which makes it easier for the model to capture the accurate shape of the target. In addition, the CIoU loss function comprehensively considers multiple factors such as position, shape, and orientation, allowing the model to learn the characteristics of the target box more comprehensively, which helps improve the performance of the model in complex scenes.
[0122] The correction factor v is used to further adjust the loss function, taking into account the shape and orientation of the target box, which is calculated by the following mathematical expression,
[0123]
[0124] In the formula, w G Indicates the width of the target box, h G Indicates the height of the target box, w p Indicates the width of the prediction box, h p Indicates the height of the prediction box.
[0125] The mathematical expression of the DFL function is,
[0126] DFL(S i ,S i+1 )=-((y i+1 -y)log(S i )+(yy i )log(S i+1 ));
[0127] In the formula, S i and S i+1 Represents the two nearest predicted values of the network output, y represents the actual value of the label, and y i ,y i+1 represents the actual values of the two labels closest to y.
[0128] The DFL function optimizes the probabilities of the two positions closest to the label y in the form of cross entropy, allowing the network to focus on the target position and the distribution of the surrounding area more quickly. This loss of learning the position around the label can enhance the generalization ability of the model in complex situations such as occlusion and moving objects.
[0129] The bounding box regression loss function is used in the training of the GCC-YOLOv8 network model in the following way: first, the DFL function is used to calculate the loss of the bounding box distribution probability and the label distribution probability, so as to optimize each edge, and then the bounding box distribution probability is restored to the predicted box, and the CIoU Loss function is used to calculate the loss of the predicted box and the actual box of the label, so as to optimize the predicted box as a whole.
[0130] The effect of this method is illustrated below with reference to a light guide plate surface defect detection experiment.
[0131] The light guide plate defect dataset is acquired by a 16K linear array camera on a factory production line. The defective light guide plate images are manually selected and labeled. The original light guide plate image resolution is large and cannot be directly applied to the deep learning network for training. Therefore, this experimental design uses a cropping window of size 224×224 to crop the image. At the same time, according to the defect type, the dataset is divided into white spot defects, bright line defects, dark line defects, and surface defects. The original dataset size is 1926. Since there are certain differences in the number of different defects in the collected images, in order to ensure the rationality of the training, the number of each defect image is expanded by translation, mirroring, rotation, etc. The number of expanded datasets is 4111. The specific number of each defect image is shown in Table 1.
[0132] Table 1 Self-made light guide plate defect dataset
[0133]
[0134] Considering the number of samples in the light guide plate defect dataset and the rationality of training, the dataset is divided into training set, validation set and test set in a ratio of 6:2:2. The division results are shown in Table 2.
[0135] Table 2 Division of training set, validation set and test set
[0136]
[0137]
[0138] Using the Mosaic data enhancement method, four pictures are randomly read from the data set, and random flipping, random translation, random brightness adjustment and other operations are performed on the four pictures, and the processed four pictures are cropped based on the bounding box information. Subsequently, the cropped pictures are spliced into a new picture according to the random splicing points and sent to the network as training data.
[0139] The training parameters of the GCC-YOLOv8 network model are: batch size is 16, momentum is 0.937, initial learning rate is 0.01, final learning rate is 0.0001, data enhancement method is Mosaic data enhancement method, data enhancement coefficient is 1.0, input image size is 640*640 pixels, number of training rounds is 200, number of warm-up rounds is 3, and weight decay is 0.0005.
[0140] In order to test the performance of the GCC-YOLOv8 network model, this experiment selected mean accuracy (AP), average mean accuracy (mAP), confusion matrix, FPS, GFlops and parameter quantity as performance evaluation indicators.
[0141] In order to analyze the impact of the GKA-Conv module, CSFC module and CPCA module on the performance of the GCC-YOLOv8 network model, this experiment first conducted an ablation experiment. The experimental results are shown in Table 3.
[0142] Table 3 Ablation experiment results of light guide plate defect dataset
[0143]
[0144]
[0145] As shown in Table 3, the mAP of the traditional YOLOv8 network is 97.9%. After the GKA-Conv module is introduced separately in the network backbone, the mAP is increased to 98.4%, and the AP of the four defects is improved. Among them, the detection accuracy of dark line defects is significantly improved, and its AP is increased by 1.2%. This shows that the GKA-Conv module improves the feature extraction and nonlinear fitting capabilities of the network, so that the network can accurately identify small-sized and low-contrast defects such as dark lines. In addition, although the network parameters increased by 1.77M, the GFlops did not increase significantly, indicating that the GKA-Conv module improves the parameter utilization of the model.
[0146] After adding the CSFC module to the network alone, the mAP increased to 98.3%. Among them, the detection accuracy of surface defects was significantly improved, with an AP increase of 1.6%. Compared with the introduction of the GKA-Conv module alone, the AP of surface defect detection increased by 1.2%. This shows that the CSFC module effectively calibrates the context and spatial information of pixels and improves the accuracy of feature information, so that the network obtains sufficient and accurate feature information of surface defects and correctly identifies them.
[0147] Due to the complex texture background of the light guide plate image and insufficient feature extraction capability of the original network, the key information of the feature map obtained was lost or the feature context information did not match, causing the CPCA module located at the neck to focus on the wrong channel information and fail to focus on the correct and effective feature area. As a result, after adding the CPCA module alone, the mAP dropped by 0.3%. Therefore, this experiment combined the modules and added them to the network for experiments to verify their effectiveness.
[0148] When the GKA-Conv module and the CPCA module are introduced at the same time, the mAP is increased to 98.6%, among which the AP for white spot defect detection, dark line defect detection and surface defect detection are increased by 0.2%, 0.8% and 1.7%, respectively. This shows that after obtaining the rich feature information extracted by the backbone network improved by the GKA-Conv module, the CPCA module focuses on accurate and important channel information and spatial areas, and retains more important information in the feature fusion stage, reducing the loss of information during transmission and enhancing the network's ability to identify multi-scale defects.
[0149] When the GKA-Conv module and the CSFC module are introduced at the same time, the mAP is increased to 98.7%, indicating that the network not only extracts more abundant information, but also greatly improves the correlation between feature information, thereby improving the detection performance of the network. In addition, compared with the introduction of the CSFC module alone, the GFlops is reduced by 0.9, indicating that the GKA-Conv module effectively reduces the complexity of the network, further proving that the GKA-Conv module effectively improves the parameter utilization of the network.
[0150] When the three modules are added to the network at the same time, the mAP reaches 99.0%. The detection accuracy of white spot defects, bright line defects, dark line defects, and surface defects are improved by 0.2%, 0.3%, 2.2%, and 1.8%, respectively. The detection effect of defects with large feature differences, low contrast, and different sizes is improved, and the FPS reaches 412, which proves that the GCC-YOLOv8 network model has excellent detection performance for surface defects of light guide plates, and it can meet the requirements of real-time detection in industrial sites.
[0151] In order to verify the accuracy and effectiveness of the GCC-YOLOv8 network model for light guide plate surface defect detection, this experiment also compared the GCC-YOLOv8 network model with the YOLOv5, YOLOv7, YOLOv8, YOLOv9 and RT-DETR networks, and conducted experiments based on the same light guide plate defect dataset. The experimental results are shown in Table 4.
[0152] Table 4 Comparative experimental results of light guide plate defect dataset
[0153]
[0154] As shown in Table 4, the GCC-YOLOv8 network model has the best performance, with mAP reaching 99.0%, which is 0.7%, 1.0%, 1.1%, 0.8% and 1.5% higher than the YOLOv5, YOLOv7, YOLOv8, YOLOv9 and RT-DETR networks, respectively. The detection speed of the GCC-YOLOv8 network model is higher than that of the YOLOv7, YOLOv9 and RT-DETR networks, with an FPS of 412. In addition, the GFlops and parameters of the GCC-YOLOv8 network model are both smaller than those of the YOLOv5, YOLOv7, YOLOv9 and RT-DETR networks, further proving its advantages of fast detection speed and easy deployment.
[0155] This experiment randomly selects images of each defect to test YOLOv5, YOLOv7, YOLOv8, YOLOv9, RT-DETR and GCC-YOLOv8 networks. The test results of different networks are shown in Figure 6 As shown in the figure, the GCC-YOLOv8 network model can obtain the highest confidence in the detection of different defects and has better detection performance.
[0156] In order to further verify the performance and effectiveness of the GCC-YOLOv8 network, this experiment selects each defect image and uses the GradCAM method to visualize the network output and observe the focus area of the network for a given category, such as Figure 7 As shown in the figure, for a given image, the YOLOv8 network cannot effectively focus on the target information and is easily disturbed by surrounding information, while the GCC-YOLOv8 network model can focus on the target information more accurately, thereby achieving higher detection accuracy.
[0157] In order to further verify the performance and robustness of the GCC-YOLOv8 network model, this paper conducted a comparative experiment based on the NEU-DET hot-rolled steel strip defect dataset. The defect types in this dataset are divided into cracking, patches, inclusions, pitted-surface, rolled-in_scale and scratches. The defect image size is 200×200, with a total of 1800 images, and is divided according to the ratio of 6:2:2. The GCC-YOLOv8 network proposed in this paper is compared with the YOLOv5, YOLOv7, YOLOv8, YOLOv9 and RT-DETR networks. The experimental results are shown in Table 5.
[0158] Table 5 Comparative experimental results of NEU-DET hot-rolled steel strip defect dataset
[0159]
[0160]
[0161] As shown in Table 5, the GCC-YOLOv8 network model has the highest detection accuracy, with a mAP of 75.6%, which is 4.4%, 3.6%, 0.9%, 0.3% and 0.9% higher than YOLOv5, YOLOv7, YOLOv8, YOLOv9 and RT-DETR networks, respectively. Compared with YOLOV8, the detection accuracy of cracks, plaques and inclusions is increased by 6.3%, 1.1% and 2.2%, respectively.
[0162] This experiment randomly selects pictures of each defect and tests the YOLOv5, YOLOv7, YOLOv8, YOLOv9, RT-DETR and GCC-YOLOv8 network models respectively. The test results are shown in the figure. Figure 8 As shown in the figure, the GCC-YOLOv8 network model has the best performance, which shows that the GCC-YOLOv8 network has excellent robust performance.
[0163] In summary, a light guide plate surface defect detection method based on a GCC-YOLOv8 network model disclosed in an embodiment of the present invention is improved on the basis of a traditional YOLOv8 network model, and a GKA-Conv module is used to replace the convolution module of the Bottleneck in the two C2f1 modules after the backbone network unit of the traditional YOLOv8 network model, so that the model can more effectively capture nonlinear relationships and enhance the feature expression ability of the model; a CFC module with a context feature calibration mechanism and an SFC module with a spatial feature calibration mechanism are introduced into the neck network unit to efficiently mine context and spatial information with less computational effort, thereby improving the model's accuracy for small targets and The detection capability of low-contrast defects improves the positioning and classification accuracy of the model; in addition, a CPCA module with a channel prior convolutional attention mechanism is introduced in the neck network unit to dynamically allocate attention weights in the channel and spatial dimensions, and use multi-scale deep convolution to extract spatial relationships without affecting the channel prior, further enhancing the feature expression capability of the model, so that the model can simultaneously detect defects of different scales; this method can effectively deal with light guide plate images with complex texture backgrounds, small proportion of some defective pixels and low contrast with the background, large difference in defect features, and small target defects that are difficult to detect. It has good light guide plate surface defect detection performance and robustness, and takes into account a better detection speed.
[0164] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core ideas of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made to the present invention without departing from the principles of the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A method for detecting surface defects of a light guide plate based on a GCC-YOLOv8 network model, characterized in that: The method comprises the following steps: Acquire an image of the light guide plate to be inspected; Input the image into the GCC-YOLOv8 network model for defect detection; Outputting surface defect information of the light guide plate based on the detection result of the GCC-YOLOv8 network model; The GCC-YOLOv8 network model is constructed based on the YOLOv8 network model, and the GCC-YOLOv8 network model includes a backbone network unit, a neck network unit, and a detection head network unit with three parallel detection branches arranged in sequence; The backbone network unit is provided with two GKA-C2f1 modules at its end, and the two GKA-C2f1 modules are connected by a CBS module. The GKA-C2f1 module is obtained by replacing multiple bottleneck residual modules in the C2f1 module with a GKA bottleneck residual module. The GKA bottleneck residual module is used to divide the input features into two branches, the first branch is sequentially transformed by two series-connected GKA-Conv modules, the second branch directly transmits the input features, and the output features of the two branches are output after element-by-element addition; The neck network unit includes an FPN network unit and a PAN network unit. The FPN network unit includes two upsampling modules, two C2f2 modules, two Concat modules, a SPPF module and a CPCA module. The CPCA module is used to dynamically assign attention weights to the output features of a C2f2 module in the channel dimension and the spatial dimension and then output them to an upsampling module. The PAN network unit includes two CBS modules, two Concat modules, two C2f2 modules, three CPCA modules, a CFC module and an SFC module. The first CPCA module is used to assign attention weights to the output features of a C2f2 module at the end of the FPN network unit. The output features of the 2f2 module are dynamically assigned attention weights in the channel dimension and the spatial dimension and then output to a CBS module and an SFC module. The SFC module is used to calibrate the input spatial features and output it to a detection branch. The second CPCA module is used to dynamically assign attention weights to the output features of a C2f2 module in the channel dimension and the spatial dimension and then output it to a CBS module and another detection branch. The third CPCA module is used to dynamically assign attention weights to the output features of a C2f2 module in the channel dimension and the spatial dimension and then output it to the CFC module. The CFC module is used to calibrate the input contextual features and output it to another detection branch.
2. According to claim 1, a method for detecting surface defects of a light guide plate based on a GCC-YOLOv8 network model is characterized in that: The GKA-Conv module is used to divide the input features into two branches, map the features of the first branch to [-1,1] through the tanh activation function, and then perform Gram polynomial transformation to obtain four feature maps containing different information, which are then superimposed according to the channel dimension, and then SiLU activation function operations and convolution operations are performed in sequence, and the features of the second branch are directly subjected to SiLU activation function operations and convolution operations, and the output features of the two branches are output after element-by-element addition.
3. The method for detecting surface defects of a light guide plate based on a GCC-YOLOv8 network model according to claim 1, characterized in that: The CFC module is used to divide the input features into two branches, perform convolution and reshaping operations on the features of the first branch, obtain multi-scale contexts through the CPP module for the features of the second branch, and then generate two forms of context representations through two convolution operations respectively. The first form of context representation is element-wise multiplied with the output of the first branch and then a Softmax operation is performed to obtain pixel context similarity. The pixel context similarity is element-wise multiplied with the second form of context representation and then context recalibrated through the CRB module to obtain a refined context. Finally, the refined context is directly added element-by-element to the input features of the CFC module and then output.
4. The method for detecting surface defects of a light guide plate based on a GCC-YOLOv8 network model according to claim 1, characterized in that: The SFC module is used to transform the low-resolution feature F l and high-resolution features F h Two convolution operations are performed to unify the channels to the same number, and then bilinear interpolation is used to calculate F. l Upsample and cascade the upsampled F l and F h , and then send it to the convolution module to predict two sets of offset maps for aligning the features of the two levels, and predict two gate masks for controlling the flow of feature information of the two levels. Finally, the calibrated cross-level features are output after element-by-element addition.
5. The method for detecting surface defects of a light guide plate based on a GCC-YOLOv8 network model according to claim 1, characterized in that: The CPCA module is used to process the input features through the channel attention module to obtain a one-dimensional channel attention map, multiply the one-dimensional channel attention map with the input features element by element, transfer the channel attention value along the spatial dimension to obtain the channel attention refined features, and then process it through the spatial attention module to obtain a three-dimensional spatial attention map, and multiply the three-dimensional spatial attention map with the channel attention refined features element by element and output them.
6. The method for detecting surface defects of a light guide plate based on a GCC-YOLOv8 network model according to claim 1, characterized in that: The backbone network unit also includes five CBS modules and two C2f1 modules. Along the processing direction of the input features, the first CBS module, the second CBS module, the first C2f1 module, the third CBS module, the second C2f1 module, the fourth CBS module, the first GKA-C2f1 module, the fifth CBS module and the second GKA-C2f1 module are connected in sequence, the second C2f1 module is also connected to the second Concat module along the input feature processing direction in the FPN network unit, the first GKA-C2f1 module is also connected to the first Concat module along the input feature processing direction in the FPN network unit, and the second GKA-C2f1 module is connected to the SPPF module of the FPN network unit; In the FPN network unit, along the processing direction of the input feature, the SPPF module, the first upsampling module, the first Concat module, the first C2f2 module, the CPCA module, the second upsampling module, the second Concat module and the second C2f2 module are connected in sequence, the SPPF module is also connected to the second Concat module along the input feature processing direction in the PAN network unit, the first C2f2 module is also connected to the first Concat module along the input feature processing direction in the PAN network unit, and the second C2f2 module is connected to the first CPCA module along the input feature processing direction in the PAN network unit; In the PAN network unit, along the processing direction of the input features, the first CPCA module, the first CBS module, the first Concat module, the first C2f2 module, the second CPCA module, the second CBS module, the second Concat module, the second C2f2 module and the third CPCA module are connected in sequence.
7. The method for detecting surface defects of a light guide plate based on a GCC-YOLOv8 network model according to claim 1, characterized in that: The loss function of the GCC-YOLOv8 network model includes a classification loss function and a bounding box regression loss function. The classification loss function is a BCEWithLogitsLoss function, and its mathematical expression is: In the formula, σ represents the Sigmoid function, p i Indicates the probability that a sample is predicted as a positive example, y i Represents the true label of the sample; The bounding box regression loss function is a CIoULoss function and a DFL function. The mathematical expression of the CIoULoss function is: In the formula, IoU represents the ratio of the intersection and union of the predicted box and the real box, d represents the distance between the center points of the predicted box and the real box, c represents the diagonal distance of the minimum circumscribed rectangle, and v represents the correction factor; The mathematical expression of the DFL function is: DFL(S i ,S i+1 )=-((y i+1 -y)log(S i )+(y-y i )log(S i+1 )); In the formula, S i and S i+1 Represents the two nearest predicted values of the network output, y represents the actual value of the label, and y i ,y i+1 represents the actual values of the two labels closest to y.
8. The method for detecting surface defects of a light guide plate based on a GCC-YOLOv8 network model according to claim 7, characterized in that: The correction factor v is calculated by the following mathematical expression, In the formula, w G Indicates the width of the target box, h G Indicates the height of the target box, w p Indicates the width of the prediction box, h p Indicates the height of the prediction box.
9. The method for detecting surface defects of a light guide plate based on a GCC-YOLOv8 network model according to claim 7, characterized in that: The bounding box regression loss function is used in the training of the GCC-YOLOv8 network model by the following method: first, the loss of the bounding box distribution probability and the label distribution probability is calculated by the DFL function, and then the bounding box distribution probability is restored to the prediction box, and the loss of the prediction box and the actual box of the label is calculated by the CIoULoss function.
10. The method for detecting surface defects of a light guide plate based on a GCC-YOLOv8 network model according to claim 1, characterized in that: The training parameters of the GCC-YOLOv8 network model are as follows: batch size is 16, momentum is 0.937, initial learning rate is 0.01, final learning rate is 0.0001, data enhancement method is Mosaic data enhancement method, data enhancement coefficient is 1.0, input image size is 640*640 pixels, number of training rounds is 200, number of warm-up rounds is 3, and weight decay is 0.0005.
Citation Information
Patent Citations
Three-stage cascade detection method for defects of glass fabric
CN117974572A
Commutator inner side image defect detection method based on fusible feature pyramid
WO2024208100A1
Cited By
Shaving board surface multi-scale defect detection method, equipment, medium and product
CN120013946A
Multi-dimensional spatial transformation self-sensing attention mechanism image processing method and application thereof
CN120107617A
Surface defect small target detection method based on multi-scale feature interaction
CN120374613A
PCB welding spot defect detection system and method based on image recognition
CN120689335A