Tile product surface defect detection method based on SAPC-Net network
By adopting a detection method based on SAPC-Net network in tile defect detection, combined with the C2f-SEIF module, improved neck network, PIOU_V2 loss function and channel distillation strategy, the contradiction between detection accuracy and real-time speed in the existing technology is solved, and efficient and accurate tile defect detection is achieved.
Patent Information
- Application Number
- CN202510043312.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-04-25
AI Technical Summary
The prior art is difficult to meet the real-time inspection speed of ceramic tile production lines while ensuring detection accuracy.
The surface defect detection method of ceramic tile products based on SAPC-Net network is adopted, and the detection accuracy and speed are improved by designing the C2f-SEIF module, improved neck network, PIOU_V2 loss function and channel distillation strategy.
It achieves an mAP detection accuracy of 89.1%, and achieves a detection speed of 115.5c-FPS on the RTX3090, which is better than all current tile defect detection models.
Smart Images

Figure CN119887727A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of ceramic tile surface defect detection, and in particular to a ceramic tile product surface defect detection method based on a SAPC-Net network. Background Art
[0002] As an indispensable material in the construction industry, ceramic tiles are widely used in floor and wall decoration. However, during the production, transportation and installation process, ceramic tiles will inevitably suffer from various defects, such as color difference, bulging, thickness deviation, cracking, edge collapse, corner loss, spots and melting holes. These defects not only affect the aesthetics of the ceramic tiles, but may also have an adverse effect on their service life and safety. Therefore, how to efficiently and accurately detect various defects in ceramic tiles has become a key research issue that needs to be solved urgently.
[0003] At present, many companies and manufacturers mainly rely on manual inspection and simple mechanical inspection equipment to detect the surface quality of tiles. Manual inspection requires experienced workers to inspect each tile, which is inefficient and easily affected by subjective factors. Traditional mechanical inspection equipment is usually based on fixed rules and parameters, with limited adaptability, and it is difficult to flexibly respond to diverse defect types and complex environmental changes. Therefore, these traditional inspection methods show obvious limitations in practical applications.
[0004] In recent years, with the widespread application of deep learning technologies such as convolutional neural networks in the field of tile defect detection, detection technology has continuously broken through the technical bottlenecks of traditional methods and has rapidly developed in the direction of lightweight, real-time and high robustness. Among them, the two-stage detection algorithm performs well in defect recognition accuracy, but because the reasoning process requires the generation of a large number of candidate areas, the computational burden and time complexity increase significantly, resulting in a slow detection speed, which is difficult to meet the real-time detection needs of tile production lines. In contrast, the single-stage detection algorithm has more advantages in speed and can be efficiently inferred, but it lacks in detection accuracy.
[0005] The above problems need to be solved urgently. Therefore, a surface defect detection method for ceramic tile products based on SAPC-Net network is proposed. Summary of the invention
[0006] The technical problem to be solved by the present invention is: how to detect the surface defects of ceramic tile products with high precision and meet the requirements of real-time production line speed. A ceramic tile product surface defect detection method based on SAPC-Net network is provided, which further improves the detection accuracy of ceramic tile defects while ensuring a certain detection speed.
[0007] The present invention solves the above technical problems through the following technical solutions, and the present invention comprises the following steps:
[0008] S1: Dataset preprocessing
[0009] Obtain a public dataset of tile surface defects and preprocess the images in the dataset;
[0010] S2: Network Improvements
[0011] Based on the YOLOv8 target detection framework, the C2f-SEIF module, the improved-neck network, and the PIOU_V2 loss function are designed to improve it, and the SAPC-Net network is obtained, and the channel distillation strategy is introduced;
[0012] S3: Model training
[0013] The SAPC-Net network is trained using the training set to obtain a tile surface defect detection model;
[0014] S4: Defect Detection
[0015] Test the tile surface defect detection model on the test set and output the defect detection results and detection speed.
[0016] Furthermore, in step S1, the specific processing process is as follows:
[0017] S11: Slice the image according to size and overlap ratio, and expand the image in the data set;
[0018] S12: Divide the expanded image into a training set, a validation set, and a test set according to a set ratio;
[0019] S13: Perform mosaic data augmentation on the images in the training set and adjust the size of the images.
[0020] Furthermore, in step S2, the specific processing process is as follows:
[0021] S21: Based on the YOLOv8 target detection framework, the SEIF module is designed and introduced into the C2f module in the backbone network of the YOLOv8 target detection framework to obtain the C2f-SEIF module;
[0022] S22: Select the neck network using the ASF-YOLO network as the preliminary neck network, and then improve it to obtain an improved neck network improved_neck;
[0023] S23: Introduce PIOU_V2 loss function to replace CIOU as the regression box loss function;
[0024] S24: Use channel distillation strategy CWD for distillation learning.
[0025] Furthermore, in step S21, the C2f module is replaced by the SEIF module to obtain a C2f-SEIF module, wherein the specific processing process of the SEIF module is as follows:
[0026] S211: Use the Sobel convolution kernel to extract edge features in the x-axis and y-axis directions of the input image, and add the edge information extracted in the two directions to form a SobelConv branch. The processing formula is as follows:
[0027] E(x)=F(Sobel x (x)+Sobel y (x))
[0028] Among them, Sobel x Indicates that the Sobel convolution kernel extracts features in the x-axis direction of the feature map. y Indicates that the Sobel convolution kernel extracts features in the y-axis direction of the feature map, F indicates an Add operation, and E(x) indicates the feature map obtained by performing an Add operation on the features extracted by the Sobel convolution kernel in the x-axis direction of the feature map and the features extracted by the Sobel convolution kernel in the y-axis direction of the feature map;
[0029] S212: At the same time, an additional 3×3 convolution branch is introduced to extract the spatial features of the image;
[0030] S213: Then, the features extracted by the SobelConv branch and the 3×3 convolution branch are fused, and the number of channels is adjusted to match the number of channels of the input image through 1×1 convolution;
[0031] S214: Finally, the fused features are added to the input image through the residual structure, and then a 1×1 convolution is used to adjust the number of channels to the number of channels required for the output.
[0032] Furthermore, in the step S22, the neck network of the ASF-YOLO network includes an SSFF module, a Zoom-cat module and a CPAM module, and the SSFF module and the Zoom-cat module are respectively connected to the CPAM module;
[0033] The SSFF module horizontally stacks feature maps of different scales and uses three-dimensional convolution to extract scale sequence features from them. Its expression is:
[0034] F σ (ω,h)=G σ (ω,h)×f(ω,h)
[0035]
[0036] Where f(ω,h) represents a two-dimensional input image with width ω and height h, F σ (ω,h) is the feature map generated by smoothing a series of convolutions using a two-dimensional Gaussian filter, σ is the scaling parameter for the standard deviation of the Gaussian filter used for convolution, G σ (ω,h) represents a two-dimensional Gaussian filter;
[0037] The Zoom-cat module adjusts the size of the input large-scale feature map and small-scale feature map to be consistent with the medium-scale feature map. Figure 1 The expression is:
[0038] F Zoom_cat =Concat(F l ,F m ,F s )
[0039] Among them, F Zoom_cat Represents the output feature map of the Zoom_cat module, F l 、F m 、F s Represent large, medium, and small scale feature maps respectively;
[0040] The CPAM module includes a channel attention module and a position attention module. The channel attention module processes each channel output by the Zoom_cat module through global adaptive average pooling, generates channel weights, and multiplies the generated channel weights by the input element by element to obtain the output first feature map; the position attention module is used to perform average pooling on the output of the SSFF module in the height and width dimensions respectively, and merge the features obtained by average pooling to generate the output second feature map.
[0041] Furthermore, in the step S22, the process of improving the neck network of the ASF-YOLO network is as follows: the feature map size of the P3 layer and the P4 layer in the neck network is adjusted to 200×200, and the number of channels is adjusted to 128, so that it is consistent with the P2 layer of the backbone network, and they are used as the input of the SSFF module together; the features output by the SSFF module are processed by the CPAM module and then led out as the P2 detection layer of the detection head network.
[0042] Furthermore, in step S23, the PIOU_V2 loss function is as follows:
[0043] L PIOU_V2 =u(λq)L PIOU_V1
[0044] Among them, u(λq) represents the attention function, λ represents the hyperparameter controlling the attention function, q represents the penalty factor, q=e -p,q∈(0,1], p represents the new penalty term, w gt and h gt Represent the width and length of the prediction box respectively. dw1, dw2, dh1, dh2 are used to determine the distance between the prediction box and the target box. L PIOU_V1 Represents the PIOU_V1 loss function.
[0045] Furthermore, in the step S24, in the channel distillation strategy CWD, the C2f-SEIF module, the improved-neck network, and the PIOU_V2 loss function are introduced into the YOLOv8m and YOLOv8s networks respectively, the network obtained after the YOLOv8m network is introduced is used as the teacher model, and the network obtained after the YOLOv8s network is introduced is used as the student model, and the Kullback-Leibler divergence is used to measure the channel similarity between the teacher model and the student model;
[0046] Among them, channel distillation is defined as follows:
[0047]
[0048] in, It means converting the activation value into probability distribution, and its calculation formula is as follows:
[0049]
[0050] Where c represents the channel, c = 1, 2, 3...C, i represents the index of the spatial position of the channel, and t represents the hyperparameter controlling the distillation temperature, t∈[1,5];
[0051] Feature distillation loss L of teacher model and student model dis The expression of (S,T) is as follows:
[0052]
[0053] Among them, S represents the student model, T represents the teacher model, represents the probability distribution of the spatial position index of a specific channel of the teacher model, Represents the probability distribution of the spatial position index of a specific channel of the student model; W and H correspond to the width and height of the feature map, respectively.
[0054] Compared with the prior art, the present invention has the following advantages: the surface defect detection method of ceramic tile products based on SAPC-Net network designs a spatial edge information fusion module SEIF based on Sobel convolution based on the YOLOv8 target detection framework, and introduces it into the C2f module in the backbone network to form a C2f-SEIF module, thereby enhancing the feature extraction capability of the backbone network; further introduces the neck network of the ASF-YOLO network, and improves and optimizes it on this basis to design an improved neck network with a small target detection layer of 200×200. ck, which significantly improves the model's detection performance for small target defects in tiles; in addition, the PIOU_V2 loss function is introduced to replace CIOU as the regression box loss function, which accelerates the convergence of the model and enhances the ability to locate target defects; finally, the channel distillation strategy CWD is adopted to further improve the detection performance while keeping the model lightweight; the designed tile surface defect detection model achieved 89.1% mAP on the Tianchi competition tile public dataset, and achieved a detection speed of 115.5c-FPS on RTX3090, which is better than all current tile defect detection models. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 is a flow chart of a method for detecting surface defects of ceramic tile products based on SAPC-Net network in an embodiment of the present invention;
[0056] Figure 2 The following are typical defect image samples in the Tianchi competition tile data set in the embodiment of the present invention, where (a) is a dark spot defect, (b) is a white spot defect, (c) is an edge abnormality defect, (d) is a corner abnormality defect, (e) is an aperture defect, and (f) is a light block defect;
[0057] Figure 3 Schematic diagram of the structure of the C2f-SEIF module in the embodiment of the present invention, wherein (a) is the C2f module, (b) is the C2f-SEIF, and (c) is the SEIF module;
[0058] Figure 4 This is a schematic diagram of the structure of the SSFF module in an embodiment of the present invention;
[0059] Figure 5 It is a schematic diagram of the structure of the three-feature encoder Zoom-cat in an embodiment of the present invention;
[0060] Figure 6 Schematic diagram of the structure of the channel and position attention mechanism module CPAM in an embodiment of the present invention;
[0061] Figure 7Schematic diagram of the principle of the PIOU_V2 loss function in an embodiment of the present invention;
[0062] Figure 8 Schematic diagram of the channel distillation strategy CWD in an embodiment of the present invention;
[0063] Fig. 9 is a schematic diagram of the architecture of a defect detection network model in an embodiment of the present invention;
[0064] Fig.10 This is a diagram showing the effect of detecting tile defect images in an embodiment of the present invention. DETAILED DESCRIPTION
[0065] The following is a detailed description of an embodiment of the present invention. This embodiment is implemented on the premise of the technical solution of the present invention, and a detailed implementation method and a specific operation process are given, but the protection scope of the present invention is not limited to the following embodiment.
[0066] like Figure 1-10 As shown, this embodiment provides a technical solution: a method for detecting surface defects of ceramic tile products based on SAPC-Net network, comprising the following steps:
[0067] S1: Obtain a public dataset of tile surface defects and preprocess the images in the dataset according to task requirements;
[0068] S2: Based on the YOLOv8 target detection framework, a SAPC-Net network is designed, which integrates the Sobel convolution-based spatial edge information fusion module (SEIF), the improved neck network (improved-neck), the PIOU_V2 loss function, and introduces the channel distillation strategy;
[0069] S3: Use the training set to train the SAPC-Net network to obtain a tile surface defect detection model;
[0070] S4: Test the tile surface defect detection model on the test set and output the defect detection results and detection speed.
[0071] In this embodiment, the specific processing process in step S1 is as follows:
[0072] S11: Since the images in the dataset are too large, the 5388 images are sliced from top to bottom and from left to right in a size of 800×800 with an overlap ratio of 0.2. After slicing, the dataset images are expanded to 22129.
[0073] S12: The expanded 22129 images are divided into training set, validation set and test set in a ratio of 8:1:1, where the training set contains 17703 images, the validation set and the test set contain 2213 images respectively.
[0074] S13: Perform mosaic data augmentation on the images in the training set and resize the processed images to 800×800 as the image input size of the model.
[0075] In this embodiment, the specific processing process of step S2 is as follows:
[0076] S21: Based on the YOLOv8 target detection framework, a spatial edge information fusion module SEIF based on Sobel convolution is designed and introduced into the C2f module in the backbone network to obtain the C2f-SEIF module;
[0077] S22: The neck network using the ASF-YOLO network is selected as the preliminary neck network, and then a small target detection layer (160×160) is introduced to improve it, and an improved neck network improved_neck is obtained;
[0078] S23: Introduce PIOU_V2 loss function to replace CIOU as the regression box loss function, thereby improving the target box positioning accuracy of the model;
[0079] S24: The channel distillation strategy CWD is adopted to further enhance the detection performance of the model while keeping the model lightweight.
[0080] More specifically, in step S21, the bottleneck block in the C2f module is replaced with the SEIF module, and finally a C2f-SEIF module is obtained. The specific processing process of the SEIF module is as follows:
[0081] S211: Use the Sobel convolution kernel to extract edge features in the x-axis and y-axis directions of the input image, and add the edge information extracted in the two directions to form a SobelConv branch. The processing formula is as follows:
[0082] E(x)=F(Sobel x (x)+Sobel y (x))
[0083] Among them, Sobel x Indicates that the Sobel convolution kernel extracts features in the x-axis direction of the feature map. yIt means that the Sobel convolution kernel extracts features in the y-axis direction of the feature map, and E(x) represents the feature obtained by adding the features extracted by the Sobel convolution kernel in the x-axis direction of the feature map to the features extracted by the Sobel convolution kernel in the y-axis direction of the feature map;
[0084] S212: At the same time, an additional 3×3 convolution branch is introduced to extract the spatial features of the image;
[0085] S213: Next, the features extracted by the SobelConv branch and the 3×3 convolution branch are fused and concat, and the number of channels is adjusted to match the number of channels of the input image through 1×1 convolution;
[0086] S214: Finally, the fused features are added to the input image through the residual structure, and then a 1×1 convolution is used to adjust the number of channels to the number of channels required for the output.
[0087] As more specifically, in step S22, the neck network of the ASF-YOLO network includes a scale sequence feature fusion module (Scale Sequence Feature Fusion, SSFF), a three-feature encoder Zoom_cat (Zoom-cat module) and a channel and position attention mechanism module (Channel and Position Attention Mechanism, CPAM);
[0088] More specifically, the SSFF module horizontally stacks feature maps of different scales and uses three-dimensional convolution to extract scale sequence features from them, which is expressed as:
[0089] F σ (ω,h)=G σ (ω,h)×f(ω,h)
[0090]
[0091] Where f(ω,h) represents a two-dimensional input image with width ω and height h, F σ (ω,h) is the feature map generated by smoothing a series of convolutions using a two-dimensional Gaussian filter, σ is the scaling parameter for the standard deviation of the Gaussian filter used for convolution, G σ (ω,h) represents a two-dimensional Gaussian filter, π and e represent natural constants;
[0092] In the SSFF module, first, the number of channels of the feature maps of the P4 and P5 layers is adjusted to 256 through 1×1 convolution to make it consistent with the number of channels of the feature map of the P3 layer. The nearest neighbor interpolation is used as the upsampling method to adjust the size of the feature maps of the P4 and P5 layers to the same size as the feature map of the P3 layer, that is, the size is 100×100. The feature maps of the P3, P4, and P5 layers are converted from three-dimensional tensors (height, width, channel) to four-dimensional tensors (depth, height, width, channel) using the unsqueeze method. These three four-dimensional tensors are concatenated along the depth dimension, that is, the feature maps of three different scales of P3, P4, and P5 are merged into a new four-dimensional tensor in the depth direction. Finally, the concatenated multi-scale features are further processed using three-dimensional convolution, three-dimensional batch normalization, and SiLU activation function.
[0093] As more specific, the three-feature encoder Zoom_cat (Zoom-cat module) first resizes the input large-scale feature map and small-scale feature map to the same size as the medium-scale feature map. Figure 1 To ensure that the feature maps of different scales are consistent in the spatial dimension, the expression is:
[0094] F Zoom_cat =Concat(F l ,F m ,F s )
[0095] Among them, F Zoom_cat represents the output feature map of the three-feature encoder Zoom_cat, F l 、F m 、F s Represent large, medium and small scale feature maps respectively.
[0096] The Channel and Position Attention Mechanism (CPAM) combines information from the SSFF module and the three-feature encoder Zoom_cat and uses it as the input of the attention mechanism. The output information of the three-feature encoder Zoom_cat is first input into the channel attention module. The channel attention module processes each channel through global adaptive average pooling to generate specific channel weights. For this purpose, two fully connected layers and Sigmoid activation functions are used. The final generated channel weights are multiplied element-by-element with the input information to enhance the feature expression. Between the two fully connected layers, a one-dimensional convolution of size k is used, where k represents the coverage of local cross-channel interactions. There is a mapping relationship between the convolution kernel size k and the number of channels of the feature map. The specific mapping relationship is as follows:
[0097] C=ψ(k)=2 (γ×k-b)
[0098] The formula for calculating the size of the convolution kernel k is as follows:
[0099]
[0100] Among them, odd is used to ensure that the convolution kernel size is an odd number. In the general formula, the value of γ is set to 2 and b is set to 1.
[0101] As more specific, the output information of the SSFF module is used as the input of the position attention module. First, the input features are average pooled in the height and width dimensions respectively, and finally these features are merged to generate the output. The operation of average pooling in the height and width dimensions can be expressed as:
[0102]
[0103] Where w and h are the width and height dimensions of the input feature map, respectively, and E(w,j) and E(i,h) are the values at position (i,j) in the input feature map. w and P h Respectively represent the feature information after average pooling in the width and height dimensions.
[0104] The pooled feature information is then concatenated (Concat), which can be further expressed as:
[0105] p(a w ,a h )=Conv[Concat(p w ,p h )]
[0106] Among them, Conv represents 1×1 convolution, (p w ,ph ) represents the features extracted after position attention;
[0107] When the attention features are subsequently split, the resulting position-dependent feature map pairs are as follows:
[0108] S w =Split(a w )
[0109] S h =Split(a h )
[0110] Among them, S w and S h Respectively represent the height and width after splitting.
[0111] The final channel and position attention mechanism module CPAM can be defined as:
[0112] F CPAM =E×S w ×S h
[0113] Among them, E represents the weight obtained through the channel attention mechanism.
[0114] More specifically, in step S22, the process of improving the neck network of the ASF-YOLO network is as follows: the feature map size and channel number of the P3 and P4 layers in the neck network are adjusted to 200×200×128 to be consistent with the P2 layer of the backbone network, and used together as the input of the multi-scale feature fusion module SSFF. The features output by the multi-scale feature fusion module SSFF are processed by the channel and position attention mechanism module CPAM and then led out as the P2 detection layer of the detection head network.
[0115] As more specific, in step S23, the PIOU_V2 loss function is as follows:
[0116] L PIOU_V2 =u(λq)L PIOU_V1
[0117] Among them, u(λq) represents the attention function, λ represents the hyperparameter that controls the attention function, q represents the penalty factor, and L PIOU V1 Represents the PIOU_V1 loss function.
[0118] Among them, the q penalty factor is expressed as: q = e -p ,q∈(0,1];
[0119] Among them, p represents the new penalty term, and e is a natural constant;
[0120] p can be expressed as:
[0121] Among them, w gt and h gt They represent the width and length of the prediction box respectively. dw1, dw2, dh1, and dh2 are used to determine the distance between the prediction box and the target box. The specific meanings can be seen in Figure 7 .
[0122] The PIOU_V1 loss function is as follows: L PIOU_V1 =1-IOU+R PIOU ,0≤L PIOU_V1 ≤2;
[0123] Among them, IOU represents the ratio of the intersection and union between the real box and the predicted box:
[0124] L IOU =1-IOU+R(A,B)
[0125]
[0126] Among them, R represents the penalty function, A and B represent the prediction box and the target box respectively, A∩B represents the intersection area of the prediction box and the target box, and A∪B represents the union area of the prediction box and the target box;
[0127] f(x) represents the new penalty function, which is combined with the penalty term p as the penalty factor f(p) of PIOU-V2. f(p) can adapt according to the change of anchor box quality, which can be expressed as:
[0128]
[0129] R PIOU =f(p)
[0130] In this embodiment, the PIOU_V2 loss function adds an attention function based on the introduction of a new penalty factor in the PIOU-V1 loss function.
[0131] More specifically, in step S24, the channel distillation strategy CWD uses channel distillation to minimize the distribution difference between the teacher model and the student model on a specific channel output, and guides the student model to learn the rich feature information captured by the teacher model. The specific process is as follows:
[0132] The C2f-SEIF module, improved-neck, and PIOU_V2 are introduced into YOLOv8m and YOLOv8s. The improved YOLOv8m network is used as the teacher model, and the improved YOLOv8s network is used as the student model. The Kullback-Leibler (KL) divergence is used to measure the channel similarity between the teacher model and the student model.
[0133] Channel distillation is defined as follows:
[0134]
[0135] in, It means converting the activation value into probability distribution, and its calculation formula is as follows:
[0136]
[0137] Where c = 1, 2, 3...C, represents the channel, i represents the index of the spatial position of the channel, t represents the hyperparameter controlling the distillation temperature, t∈[1,5];
[0138] Feature distillation loss L of teacher model and student model dis The (S,T) expression is as follows:
[0139]
[0140] Among them, S represents the student model, T represents the teacher model, c = 1, 2, 3...C represents the channel, i represents the index of the spatial position of the channel, and t represents the hyperparameter controlling the distillation temperature. represents the probability distribution of the spatial position index of a specific channel of the teacher model, Represents the probability distribution of the spatial position index of a specific channel in the student model. W and H correspond to the width and height of the feature map respectively.
[0141] In this embodiment, step S3 includes the following steps:
[0142] S31: Set the parameters of the model training phase, including 500 iterations, 800 input image size, 16 batch size, and AdamW optimizer.
[0143] S32: After training is completed, save the weights of the teacher model.
[0144] S33: Set channel distillation training parameters, including 250 iterations, 800 input image size, 16 batch size, and AdamW optimizer. Specify the weight path and sample file path of the teacher model, as well as the sample file path of the student model for knowledge distillation training.
[0145] S34: After the training is completed, the final improved SAPC-Net model weights are saved.
[0146] In this embodiment, step S4 includes the following steps:
[0147] S41: Input the test set into the tile surface defect target detection model, and perform non-maximum suppression (NMS) processing on the original output of the model to remove redundant detection frames and improve the accuracy of the detection results;
[0148] S42: Output the network detection result and detection speed.
[0149] In this embodiment, the SAPC-Net network structure is as follows Fig. 9 As shown, it includes a backbone network, a neck network, and a detection head network;
[0150] All C2f modules in the backbone network are replaced with C2f-SEIF modules. The neck network includes a first 1×1 convolutional layer, a second 1×1 convolutional layer, a first Zoom-cat module, a first C2f module, a third 1×1 convolutional layer, a fourth 1×1 convolutional layer, a second Zoom-cat module, a second C2f module, a first downsampling 3×3 convolutional layer, a first splicing module, a third C2f module, a second downsampling 3×3 convolutional layer, a second splicing module, a fourth C2f module, a first SSFF module, a first CPAM module, a first upsampling module, a third splicing module, a fifth C2f module, a second SSFF module, and a second CPAM module. The SPPF module is connected to the first 1×1 convolutional layer, the second C2f-SEIF module is connected to the second 1×1 convolutional layer, and the first Zoom-cat module concatenates the output features of the SPPF after the first 1×1 convolutional layer, the output features of the second C2f-SEIF module after the second 1×1 convolutional layer, and the output features of the third C2f-SEIF module and outputs them to the first C2f module;
[0151] The second Zoom-cat module concatenates the output features of the first C2f-SEIF module after the fourth 1×1 convolutional layer, the output features of the first C2f module after the third 1×1 convolutional layer, and the output features of the second C2f-SEIF module, and outputs them to the second C2f module; the first concatenation module concatenates the output features of the second C2f module after the first downsampling 3×3 convolutional layer and the output features of the first C2f module after the fourth 1×1 convolutional layer, and outputs them to the third C2f module; the second concatenation module concatenates the output features of the third C2f module after the second downsampling 3×3 convolutional layer and the SPPF module after the first 1×1 convolutional layer, and outputs them to the fourth C2 f module; the first SSFF module processes the output features of the second, third and fourth C2f-SEIF modules and outputs them to the first CPAM module; the first CPAM module processes the output features of the first SSFF module and the output features of the second C2f module and outputs them to the first upsampling module; the third splicing module splices the feature information of the first upsampling output module and the output feature information of the first C2f-SEIF module and outputs them to the fifth C2f module; the second SSFF module processes the output features of the first C2f-SEIF module, the output features of the first CPAM module and the output features of the third C2f module and outputs them to the second CPAM module. The features output by the second CPAM module, the first CPAM module, the third C2f module and the fourth C2f module are input to the detection head network.
[0152] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A method for detecting surface defects of ceramic tile products based on SAPC-Net network, characterized in that: The following steps are involved: S1: Dataset preprocessing Obtain a public dataset of tile surface defects and preprocess the images in the dataset; S2: Network Improvements Based on the YOLOv8 target detection framework, the C2f-SEIF module, the improved-neck network, and the PIOU_V2 loss function are designed to improve it, and the SAPC-Net network is obtained, and the channel distillation strategy is introduced; S3: Model training The SAPC-Net network is trained using the training set to obtain a tile surface defect detection model; S4: Defect Detection Test the tile surface defect detection model on the test set and output the defect detection results and detection speed.
2. A method for detecting surface defects of ceramic tile products based on SAPC-Net network according to claim 1, characterized in that: In step S1, the specific processing process is as follows: S11: Slice the image according to size and overlap ratio, and expand the image in the data set; S12: Divide the expanded images into a training set, a validation set, and a test set according to a set ratio; S13: Perform mosaic data augmentation on the images in the training set and adjust the size of the images.
3. The method for detecting surface defects of ceramic tile products based on SAPC-Net network according to claim 1, characterized in that: In step S2, the specific processing process is as follows: S21: Based on the YOLOv8 target detection framework, the SEIF module is designed and introduced into the C2f module in the backbone network of the YOLOv8 target detection framework to obtain the C2f-SEIF module; S22: Select the neck network using the ASF-YOLO network as the preliminary neck network, and then improve it to obtain an improved neck network improved_neck; S23: Introduce PIOU_V2 loss function to replace CIOU as the regression box loss function; S24: Use channel distillation strategy CWD for distillation learning.
4. The method for detecting surface defects of ceramic tile products based on SAPC-Net network according to claim 3 is characterized in that: In step S21, the C2f module is replaced by the SEIF module to obtain a C2f-SEIF module, wherein the specific processing process of the SEIF module is as follows: S211: Use the Sobel convolution kernel to extract edge features in the x-axis and y-axis directions of the input image, and add the edge information extracted in the two directions to form a SobelConv branch. The processing formula is as follows: E(x)=F(Sobel x (x)+Sobel y (x)) Among them, Sobel x Indicates that the Sobel convolution kernel extracts features in the x-axis direction of the feature map. y Indicates that the Sobel convolution kernel extracts features in the y-axis direction of the feature map, F indicates an Add operation, and E(x) indicates the feature map obtained by performing an Add operation on the features extracted by the Sobel convolution kernel in the x-axis direction of the feature map and the features extracted by the Sobel convolution kernel in the y-axis direction of the feature map; S212: At the same time, an additional 3×3 convolution branch is introduced to extract the spatial features of the image; S213: Then, the features extracted by the SobelConv branch and the 3×3 convolution branch are fused, and the number of channels is adjusted to match the number of channels of the input image through 1×1 convolution; S214: Finally, the fused features are added to the input image through the residual structure, and then a 1×1 convolution is used to adjust the number of channels to the number of channels required for the output.
5. A method for detecting surface defects of ceramic tile products based on SAPC-Net network according to claim 4, characterized in that: In the step S22, the neck network of the ASF-YOLO network includes an SSFF module, a Zoom-cat module and a CPAM module, and the SSFF module and the Zoom-cat module are respectively connected to the CPAM module; The SSFF module horizontally stacks feature maps of different scales and uses three-dimensional convolution to extract scale sequence features from them. Its expression is: F σ (ω,h)=G σ (ω,h)×f(ω,h) Where f(ω,h) represents a two-dimensional input image with width ω and height h, F σ (ω,h) is the feature map generated by smoothing a series of convolutions using a two-dimensional Gaussian filter, σ is the scaling parameter for the standard deviation of the Gaussian filter used for convolution, G σ (ω,h) represents a two-dimensional Gaussian filter; The Zoom-cat module adjusts the size of the input large-scale feature map and small-scale feature map to be consistent with the medium-scale feature map, and its expression is: F Zoom_cat =Concat(F l ,F m ,F s ) Among them, F Zoom_cat Represents the output feature map of the Zoom_cat module, F l 、F m 、F s Represent large, medium, and small scale feature maps respectively; The CPAM module includes a channel attention module and a position attention module. The channel attention module processes each channel output by the Zoom_cat module through global adaptive average pooling, generates channel weights, and multiplies the generated channel weights by the input element by element to obtain the output first feature map; the position attention module is used to perform average pooling on the output of the SSFF module in the height and width dimensions respectively, and merge the features obtained by average pooling to generate the output second feature map.
6. A method for detecting surface defects of ceramic tile products based on SAPC-Net network according to claim 5, characterized in that: In the step S22, the process of improving the neck network of the ASF-YOLO network is as follows: the feature map size of the P3 layer and the P4 layer in the neck network is adjusted to 200×200, and the number of channels is adjusted to 128, so that it is consistent with the P2 layer of the backbone network, and they are used as the input of the SSFF module together; the features output by the SSFF module are processed by the CPAM module and then led out as the P2 detection layer of the detection head network.
7. A method for detecting surface defects of ceramic tile products based on SAPC-Net network according to claim 6, characterized in that: In step S23, the PIOU_V2 loss function is as follows: L PIOU_V2 =u(λq)L PIOU_V1 Among them, u(λq) represents the attention function, λ represents the hyperparameter controlling the attention function, q represents the penalty factor, q=e -p ,q∈(0,1], p represents the new penalty term, w gt and h gt Represent the width and length of the prediction box respectively. dw1, dw2, dh1, dh2 are used to determine the distance between the prediction box and the target box. L PIOU_V1 Represents the PIOU_V1 loss function.
8. The method for detecting surface defects of ceramic tile products based on SAPC-Net network according to claim 7, characterized in that: In the step S24, in the channel distillation strategy CWD, the C2f-SEIF module, the improved-neck network, and the PIOU_V2 loss function are introduced into the YOLOv8m and YOLOv8s networks respectively, the network obtained after the YOLOv8m network is introduced is used as the teacher model, and the network obtained after the YOLOv8s network is introduced is used as the student model, and the Kullback-Leibler divergence is used to measure the channel similarity between the teacher model and the student model; Among them, channel distillation is defined as follows: in, It means converting the activation value into probability distribution, and its calculation formula is as follows: Where c represents the channel, c = 1, 2, 3...C, i represents the index of the spatial position of the channel, and t represents the hyperparameter controlling the distillation temperature, t∈[1,5]; Feature distillation loss L of teacher model and student model dis The expression of (S,T) is as follows: Among them, S represents the student model, T represents the teacher model, represents the probability distribution of the spatial position index of a specific channel of the teacher model, Represents the probability distribution of the spatial position index of a specific channel of the student model; W and H correspond to the width and height of the feature map, respectively.
Citation Information
Patent Citations
Steel product surface defect detection method based on model compression
CN113706471A
Multi-target detection method in complex traffic environment
CN118314554A
Transformer substation detection model lightweight method and device based on knowledge distillation
CN118470522A
Knowledge distillation-based lightweight SAR image multi-type target detection method and device, equipment and medium
CN118552846A
Weld defect detection method and system based on WGOA-HHO improved YOLOv8
CN119251588A
Cited By
Text-fused multi-scale edge information multi-target detection method
CN121582546A
A multi-scale edge information multi-object detection method fusing text
CN121582546B