Aluminum profile surface defect detection method based on YOLOv8

By introducing large-kernel separable convolutional attention and multi-scale convolutional attention decoders into the YOLOv8 model, combined with the gradient shuffled convolution module, the problems of easy missed detection of small-sized defects and large background interference in aluminum profile surface defect detection are solved, and high-precision and real-time defect detection is achieved.

CN120598933APending Publication Date: 2025-09-05SHANDONG UNIV OF SCI & TECH
View PDF 0 Cites 6 Cited by

Patent Information

Application Number
CN202510951976.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-09-05

AI Technical Summary

Technical Problem

The existing YOLOv8 model has problems in aluminum profile surface defect detection, such as small defects are easily missed, the high similarity between defects and background textures leads to a high false detection rate, and the high similarity of features of different types of defects makes it difficult to distinguish. In addition, it is difficult to balance the model complexity and real-time requirements when improving detection accuracy.

Method used

The large-kernel separable convolutional attention mechanism and multi-scale convolutional attention decoder are introduced, combined with the gradient shuffled convolution module to optimize the model structure, enhance the feature extraction capability of subtle defects in complex backgrounds, and improve detection accuracy and real-time detection applicability.

Benefits of technology

It significantly improves detection accuracy, reduces missed detection and false detection rates, maintains a high inference speed, is suitable for real-time defect screening in industrial sites, and can effectively detect multi-scale and subtle defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120598933A_ABST
    Figure CN120598933A_ABST
Patent Text Reader

Abstract

The invention discloses an aluminum profile surface defect detection method based on YOLOv8, and belongs to the technical field of defect detection. According to the method, an aluminum profile surface defect detection model is built, so that the detection precision of the small defects on the surface of the aluminum profile and the applicability of real-time detection are improved. The features enter the backbone network after being input into the model, the features are extracted layer by layer through a plurality of convolution layers and residual structures, and in the final output stage of the backbone network, a spatial pyramid pooling-large kernel separable convolution attention module and an efficient multi-scale convolution attention decoding module are integrated; then inputting a neck network, and utilizing a gradient shuffling convolution module to reinforce feature fusion and lighten a network structure; and finally, inputting a detection head network to output a detection result of the defect target. According to the method, various defects on the surface of the aluminum profile can be efficiently and accurately detected, and particularly, the method is excellent in performance under the difficult conditions of multi-scale targets, complex background interference, fine defects and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of defect detection technology, and specifically provides a method for detecting surface defects of aluminum profiles based on YOLOv8. Background Art

[0002] Aluminum profiles are linear aluminum alloy materials with a constant cross-sectional shape, manufactured through an extrusion process. Due to their ease of processing, corrosion resistance, light weight, and recyclability, they are widely used in aerospace, new energy vehicles, building structures, and other fields. However, during the aluminum profile production process, various surface defects such as non-conductivity, leaks, orange peel, scratches, and bubbles often appear due to factors such as equipment wear and fluctuations in process parameters. These surface defects not only seriously affect the appearance quality of aluminum profile products but may also reduce their mechanical properties and shorten their service life. Surface defects on aluminum profiles have the following notable characteristics: varying sizes and shapes, easily confused between defects and background, and high similarity between different defect types. These characteristics make the detection of surface defects in aluminum profiles extremely difficult. Traditional methods that rely on manual visual inspection are inefficient and susceptible to subjective factors, making them unable to meet the quality control requirements of modern high-speed industrial production. Traditional surface defect detection methods rely primarily on image processing and hand-crafted features. Typical methods, such as Local Binary Patterns (LBP), Gray Level Co-occurrence Matrix (GLCM), and edge detection operators like the Sobel operator, have been used to characterize the morphological characteristics of defects. While these methods have achieved some success in simple backgrounds, they lack robustness under the complex backgrounds and varying lighting conditions of industrial sites.

[0003] With the development of machine learning, artificial neural networks (ANNs) have also been introduced into the field of defect detection. Some studies have fed features extracted from LBP and GLCM into ANN classifiers, improving recognition accuracy to a certain extent. Neural networks, such as the backpropagation algorithm, have also been applied to defect detection with some success. However, these traditional machine learning-based methods have limited generalization capabilities in unknown environments and are unable to address the diverse defects detected against the complex textures of aluminum profiles. In recent years, the rapid development of deep learning, particularly convolutional neural networks (CNNs), has provided new solutions for surface defect detection. Researchers have begun applying general object detection models to industrial defect detection scenarios. For example, Shang et al. successfully applied the Inception V3 network to rail surface defect detection, significantly improving detection automation and accuracy. Papamarkou et al. used the ResNet network to automatically identify corrosion defects on the surface of nuclear fuel containers, significantly enhancing detection performance. In the field of object detection, the single-stage detector YOLO series has garnered widespread attention due to its fast detection speed and high accuracy. The YOLO (You Only Look Once) algorithm, proposed by Redmon et al. in 2016, transforms object detection into an end-to-end regression problem. It simultaneously localizes and classifies objects in a single forward pass, enabling real-time object detection. Since then, the YOLO algorithm has continued to evolve. Compared to its predecessor, YOLOv8 utilizes the more efficient CSPDarknet backbone network and a streamlined feature fusion neck structure. It incorporates technologies such as CutMix data augmentation and the CIoU loss function, reducing the model's computational complexity while improving detection accuracy and generalization. YOLOv8 has achieved excellent results in object detection in natural scenes and also demonstrates potential for application in industrial surface defect detection.

[0004] Although single-stage detectors offer advantages in industrial defect detection, such as speed and end-to-end training, existing methods still have many shortcomings when faced with the specific scenario of aluminum profile surface defects. For example, the scale of defect targets varies greatly, making small defects easily missed; the high similarity between defects and complex backgrounds leads to an increased false detection rate; and the subtle differences in the features of different types of defects make the model easily confused between different defect categories. To address these shortcomings in aluminum profile surface defect detection, some researchers have improved the existing YOLO model. For example, Feng et al. introduced an attention mechanism and a bidirectional feature pyramid (BiFPN) into the YOLOv5 model, effectively improving the recognition ability of small defects; Chen et al. optimized the feature fusion structure and attention module based on YOLOv8, enhancing the model's recognition accuracy for subtle defects on aluminum profile surfaces; and Wang et al. proposed a lightweight improved version based on YOLOv8s, which reduces the number of model parameters while maintaining high detection accuracy, meeting the needs of industrial sites for efficient and real-time detection. While the aforementioned methods have improved aluminum profile defect detection to some extent, existing defect detection solutions still struggle to perfectly address issues such as large variations in defect size and high similarity between defects and backgrounds. Detection of complex textures and backgrounds on aluminum profile surfaces, as well as minute defect features, remains a significant challenge.

[0005] Therefore, it is necessary to propose a surface defect detection method for aluminum profiles based on YOLOv8 to improve the detection capability of multi-scale defects and adaptability to complex backgrounds. Summary of the Invention

[0006] The purpose of this invention is to provide a surface defect detection method for aluminum profiles based on YOLOv8. By introducing a large-kernel separable convolutional attention mechanism and a multi-scale convolutional attention decoder, the model's feature extraction capability for subtle defects in complex backgrounds is enhanced. Gradient shuffled convolution is combined to optimize the model structure, thereby improving the detection accuracy while controlling the model complexity, thereby improving the detection accuracy and applicability of real-time detection of tiny defects on the surface of aluminum profiles.

[0007] To achieve the above object, the present invention provides the following technical solutions:

[0008] A method for detecting surface defects of aluminum profiles based on YOLOv8, comprising the following steps:

[0009] Step 1: Obtain aluminum profile surface images, construct a data set containing aluminum profile surface images, and preprocess the data set;

[0010] Step 2: Build an aluminum profile surface defect detection model, which includes a backbone network, a neck network, and a detection head network;

[0011] The backbone network includes the CBS-C2f module, the SPPF-LSKA module, and the EMCAD module. The SPPF-LSKA module integrates the large-kernel separable convolution attention mechanism into the spatial pyramid pooling layer. The EMCAD module comprehensively utilizes three mechanisms: multi-scale depthwise separable convolution, channel attention, and spatial attention, to perform decoding-based enhancement on the output features.

[0012] The neck network uses the gradient shuffle convolution module and the improved VoVGSCSP module to replace the conventional convolution module and C2f module;

[0013] The processing of the preprocessed data in the aluminum profile surface defect detection model is as follows:

[0014] The preprocessed data first passes through the backbone network, where the CBS-C2f module extracts features layer by layer, and then processes the data through the SPPF-LSKA module and the EMCAD module in sequence. The multi-level features output by the backbone network are input into the neck network, where the high-level features are first upsampled and fused with the low-level features. After fusion, the features are refined through a convolutional structure consisting of a gradient shuffled convolution module and a VoVGSCSPns module. At the same time, the low-level features are fused with the high-level features through downsampling to achieve bidirectional fusion of features at different scales. Finally, the features output by the neck network are input into the detection head network to output defect detection results. The defect detection results include the type, location, confidence level, and detection speed of the aluminum profile surface defects.

[0015] The detection head network includes first, second and third decoupled detection head modules;

[0016] Step 3: Based on the data set of step 1, the aluminum profile surface defect detection model built in step 2 is trained, and then the trained aluminum profile surface defect detection model is used to perform aluminum profile surface defect detection.

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

[0018] 1. Significantly improved detection accuracy and higher recall rate: The present invention introduces a dual attention mechanism and multi-scale feature extraction, which can more accurately detect various types of defect targets. Compared with the baseline YOLOv8s model, the mean average precision (mAP@50), strict average precision (mAP@50-95), precision P, and recall R of the method of the present invention are all improved, indicating that the method of the present invention improves both missed defect detection and false detection, can more reliably detect small defects, and reduces the misjudgment of normal areas as defects.

[0019] 2. Good real-time performance, meeting the requirements of industrial applications: The present invention maintains a high inference speed while improving detection accuracy. The inference speed of the aluminum profile surface defect detection model in the present invention on the GPU is only slightly lower than that of the original YOLOv8s. This slight speed drop is exchanged for a significant improvement in accuracy. Moreover, the processing speed of the model in the present invention can still meet the real-time requirements of online detection of most aluminum profile production lines. Therefore, the method of the present invention is suitable for deployment in industrial sites to perform real-time defect screening on each aluminum profile.

[0020] 3. Strong adaptability to multi-scale defects and outstanding ability to detect subtle defects: This invention utilizes the EMCAD module's multi-scale deep separable convolution and attention fusion to effectively detect defects of varying sizes. Whether it's large surface flaws or subtle scratches imperceptible to the naked eye, the model utilizes multi-scale feature representation and attention-focusing mechanisms to identify them. Furthermore, the VoVGSCSP module ensures that small defect features are not lost during the downsampling process, preserving detailed information while integrating high-level semantics, making the model highly sensitive to subtle defects.

[0021] 4. Resistant to complex background interference and low false detection rate: The present invention uses channel attention and spatial attention to adaptively optimize features, significantly reducing the interference of background noise on the detection results. For aluminum profile surfaces with complex textures or uneven lighting, the model can highlight defect areas and suppress irrelevant backgrounds through the attention mechanism, reducing false positives caused by background textures. At the same time, the channel shuffling of the GSConv module diffuses defect-related information to all channels and smoothes out abnormal activations of a single channel. Therefore, even in the case of complex background environments and the coexistence of multiple interference factors, the method of the present invention can still maintain stable detection performance.

[0022] 5. Lightweight, efficient, and easy-to-deploy model: While incorporating multiple new modules, this paper remains grounded in the lightweight YOLOv8s model. The extensive use of lightweight operators like the GSConv module keeps the number of model parameters and computational complexity within reasonable limits. Compared to simply stacking convolutional layers or using larger models to improve performance, this paper improves performance and accuracy while avoiding excessive model expansion. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments.

[0024] Figure 1 Schematic diagram of the network structure of a method for detecting surface defects of aluminum profiles based on YOLOv8 in Example 1;

[0025] Figure 2Schematic diagram of the network structure of the CBS module in Example 1;

[0026] Figure 3 Schematic diagram of the network structure of the C2f module in Example 1;

[0027] Figure 4 Schematic diagram of the network structure of the SPPF-LSKA module in Example 1;

[0028] Figure 5 Schematic diagram of the network structure of the LSKA module in Example 1;

[0029] Figure 6 Schematic diagram of the network structure of the EMCAD module in Example 1;

[0030] Figure 7 Schematic diagram of the network structure of the GSConv module and the VoVGSCSP module in Example 1;

[0031] Figure 8 Schematic diagram of the network structure of the decoupling detection head module in Example 1. DETAILED DESCRIPTION

[0032] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.

[0033] Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative work shall fall within the scope of protection of the present invention.

[0034] Example

[0035] The following are the main technical challenges faced by existing aluminum profile surface defect detection technologies: First, the large variation in defect target size makes small defects easily missed; second, defects often have a high degree of similarity to background textures, resulting in a high false detection rate in complex backgrounds; third, the high feature similarity between different defect types makes it difficult for the model to distinguish between similar defect categories; and finally, attempts to improve model detection accuracy often significantly increase model complexity, making it difficult to balance detection accuracy with real-time performance. Existing object detection models, such as YOLOv8, do not adequately address these challenges in aluminum profile defect detection scenarios. Specifically, they lack sensitivity to small, low-contrast defects, are susceptible to background noise interference and misjudgment, and have poor accuracy in distinguishing visually similar defect categories, such as "scratches" and "orange peel." These technical bottlenecks limit the application of aluminum profile surface defect detection systems in industrial settings. Therefore, this embodiment describes a YOLOv8-based aluminum profile surface defect detection method to improve the robustness and accuracy of aluminum profile surface defect detection while ensuring that the detection speed meets the requirements of online detection.

[0036] In this embodiment, a YOLOv8-based aluminum profile surface defect detection method is introduced based on the YOLOv8 single-stage target detection framework and optimized by introducing a dual attention mechanism and a gradient shuffle convolution module. The method includes the following steps:

[0037] Step 1: Obtain aluminum profile surface images, construct a data set containing aluminum profile surface images, and preprocess the data set.

[0038] Step 2: Build an aluminum profile surface defect detection model, which includes a backbone network (Backbone), a neck network (Neck) and a detection head network (Head), as shown in Figure 1 shown.

[0039] The backbone network includes the CBS-C2f module, the SPPF-LSKA module and the EMCAD module; the SPPF-LSKA module integrates the large-kernel separable convolution attention mechanism in the spatial pyramid pooling layer; the EMCAD module comprehensively utilizes the three mechanisms of multi-scale depth-wise separable convolution, channel attention and spatial attention to perform decoding-style enhancement on the output features.

[0040] The neck network uses the gradient shuffle convolution module and the improved VoVGSCSP module to replace the conventional convolution module and C2f module;

[0041] The processing of the preprocessed data in the aluminum profile surface defect detection model is as follows:

[0042] The preprocessed data first passes through the backbone network, where the CBS-C2f module extracts features layer by layer, and then the data is processed in sequence by the SPPF-LSKA module and the EMCAD module; the multi-level features output by the backbone network are input into the neck network, where the high-level features are first upsampled and fused with the low-level features. After fusion, the features are refined by a convolution structure composed of a gradient shuffled convolution module (GSConvns module) and a VoVGSCSPns module. At the same time, the low-level features are fused with the high-level features through downsampling (downsampling is performed in the GSConvns module) to achieve bidirectional fusion of features of different scales; finally, the features output by the neck network are input into the detection head network to output the defect detection results; the defect detection results include the type, location, confidence and detection speed information of the surface defects of the aluminum profile.

[0043] The detection head network consists of three decoupled detection head modules (Detect), namely the first, second and third decoupled detection head modules.

[0044] In this embodiment, the backbone network adopts an improved CSPDarknet structure, which is used to extract multi-scale features from the input aluminum profile surface image; the neck is used to fuse feature maps from different scales; and the head is responsible for outputting the detection results of defect targets. The network input is an aluminum profile surface image of size 640×640×3, and features are extracted layer by layer through several convolutional layers and residual structures (such as CBS module, C2f module, etc.). In the final output stage of the backbone network, the spatial pyramid pooling-large kernel separable convolution attention module (SPPF-LSKA module) and the efficient multi-scale convolution attention decoding module (EMCAD module) are integrated. These modules enhance the backbone network's ability to express features in extracting features, enabling the backbone network to better capture the key image area features containing defects while maintaining computational efficiency.

[0045] The multi-level features extracted by the backbone network are then fed into the neck network for feature fusion. The neck network adopts a top-down and then bottom-up feature fusion path similar to PANet: first, the high-level features are upsampled (Upsample) and concatenated (Concat) with the feature map of the lower layer. After fusion, the features are refined through the convolution layer; at the same time, the low-level features can also be fused with the high-level features through downsampling, thereby realizing bidirectional fusion of features of different scales. This embodiment introduces the gradient shuffled convolution module (GSConv) and its improved VoVGSCSP module in the feature extraction convolution of the neck network to replace the ordinary convolution module of the original YOLOv8 neck network, thereby improving the efficiency of feature fusion and the degree of lightweight.

[0046] Finally, the fused features are fed into the decoupled detection head (detection head network), which outputs the defect category and bounding box coordinates through the classification and regression subnetworks, respectively. Non-maximum suppression (NMS) is then used to obtain the final defect detection results. The overall process of this method includes image preprocessing, feature extraction and fusion using an improved YOLOv8 model, defect location and type prediction, and post-processing output.

[0047] The following describes each module in the backbone network.

[0048] like Figure 1 As shown, the CBS-C2f module consists of multiple CBS modules and multiple C2f modules, namely the first, second, third, fourth, and fifth CBS modules, and the first, second, third, and fourth C2f modules. Preprocessed data is input into the CBS-C2f module and processed sequentially by the first CBS module, the second CBS module, the first C2f module, the third CBS module, the second C2f module, the fourth CBS module, the third C2f module, the fifth CBS module, and the fourth C2f module.

[0049] like Figure 2 As shown in the figure, the processing process of features in each CBS module is the same, which is: first input to a two-dimensional convolution layer (Conv2d) to extract local features; then enter the batch normalization layer (BatchNorm2d) to stabilize training and accelerate convergence; finally, a nonlinear transformation is performed through the SiLU activation function to enhance the feature expression ability, thereby completing the basic encoding of the input features.

[0050] like Figure 3 As shown in the figure, the processing process of features in each C2f module is the same, which is as follows: the input features are first input into a CBS module for preliminary feature extraction; then, the features are divided into several branches (split) and input into multiple bottleneck structures (BottleNeck structures) for deep feature refinement, the number of which is n; after the processing of each branch is completed, its features are concatenated (Concat) in the channel dimension; finally, the fused features are further processed by another CBS module to output the enhanced feature representation.

[0051] like Figure 4As shown in the figure, this embodiment integrates the Large Separable Kernel Attention (LSKA) mechanism into the Spatial Pyramid Pooling (SPPF) layer of the YOLOv8 backbone network to form an improved module, namely the SPPF-LSKA module. The traditional SPPF layer extracts multi-scale contextual information through parallel max pooling operations, while this embodiment improves the SPPF layer to use the Large Separable Kernel Attention mechanism.

[0052] like Figure 4 As shown in the figure, the feature processing process in the SPPF-LSKA module is as follows: first, it is input into a CBS module for preliminary processing; then it is operated in sequence through three two-dimensional maximum pooling layers (MaxPool2d) of the same size to extract contextual information under different receptive fields; the pooled scale features and the original features (the original input features of the SPPF-LSKA module) are concatenated (Concat) in the channel dimension to enhance feature diversity; the concatenated features are then input into the LSKA module (LSK Attention) to model the spatial dependency relationship between long and short distances; finally, they are fused through a CBS module to obtain the final output features of the SPPF-LSKA module.

[0053] like Figure 5 As shown in Figure 1, the LSKA module in the SPPF-LSKA module uses a large-scale separable convolution kernel composed of depthwise convolution (Dw-Conv) and depthwise dilated convolution (Dw-D-Conv) to decompose the conventional two-dimensional convolution into two parts, one-dimensional horizontal convolution kernel and one-dimensional vertical convolution kernel, which are executed sequentially to significantly expand the receptive field with only a slight increase in the amount of computation. Specifically, the LSKA module first applies one-dimensional depthwise convolution (Dw-D-Conv) to the input feature map in the horizontal and vertical directions. Figure 5 Medium gray module), and then apply the horizontal and vertical depth dilated convolution with dilation rate ( Figure 5 The green module in the middle), and finally through a 1×1 convolution ( Figure 5 The purple module in the middle) fuses the extracted features and multiplies the output of the 1×1 convolution with the original input features of the LSKA module element by element ( Figure 5 in represents element-wise weighting) to generate attention-weighted output features. By embedding the LSKA module in the SPPF layer, the model can fully utilize the global contextual information of a large receptive field to enhance the feature extraction and expression capabilities of large-scale defects and complex background areas. In other words, the SPPF-LSKA module makes the backbone network more sensitive to both background areas and defect targets when extracting high-level features, helping to maintain a high defect detection rate under complex lighting and background conditions.

[0054] The features are processed in the LSKA module in the following steps:

[0055] Assume that the input feature map is F∈R C×H×W , where C represents the number of channels, H and W represent the height and width of the feature map respectively.

[0056] The first stage (horizontal 1D depth convolution and depth hole convolution):

[0057]

[0058] in, and is a 1D convolution kernel of size (2d-1)×1 and 1×(2d-1); d is the dilation ratio of the convolution kernel, which is used to indicate the size of the dilated gap between the convolution kernel elements during dilated convolution. When d=1, it indicates ordinary depthwise convolution, and when d>1, it indicates depthwise dilated convolution; F is the input feature map of the LSKA module; It is the intermediate feature map obtained after the input feature map F is processed by the above-mentioned one-dimensional convolution in the horizontal direction, that is, the feature enhancement result in the horizontal direction.

[0059] The second stage (vertical 1D depth convolution and depth hole convolution):

[0060]

[0061] in, and Is the size of and 1D convolution kernel; d represents the void ratio of the convolution kernel; k represents the maximum receptive field size of the convolution kernel; It is the feature map after the second stage (vertical direction) one-dimensional depth convolution and one-dimensional depth hole convolution processing, that is, the feature enhancement result in the vertical direction.

[0062] 1x1 convolution calculates the attention map:

[0063] A C =W 1×1 *Z C (3)

[0064] Among them, A C It is the channel attention map obtained after 1×1 convolution, and its size is the same as the input feature Figure 1 So, it is C×H×W;W 1×1 represents a 1×1 convolution kernel; Z C Represents the intermediate feature map obtained after the previous two stages (horizontal and vertical convolution).

[0065] Adaptive adjustment of the final feature map:

[0066]

[0067] Among them, F C It is the feature map initially input to the LSKA attention mechanism; The final output feature map after adaptive adjustment by the channel attention mechanism has the same size as the input feature map F C same.

[0068] As attached Figure 6 As shown, this embodiment introduces an efficient multi-scale convolutional attention decoder (EMCAD), namely the EMCAD module, at the output end of the backbone network to further focus on the defect area and enhance the multi-scale feature expression. The EMCAD module comprehensively utilizes three mechanisms: multi-scale depthwise convolution (MSDC), channel attention (CAB), and spatial attention (SAB) to perform decoding enhancement on the output features. Within the EMCAD module, the features first pass through the channel attention (CAB) module, then the spatial attention (SAB) module, and finally the multi-scale depthwise separable convolution (MSDC) module.

[0069] like Figure 6 As shown in (a), the channel attention (CAB) module draws on the design ideas of the SE (Squeeze-and-Excitation) and CBAM modules to model the global dependencies of the input feature maps in the channel dimension.

[0070] The input feature map is first split into two branches: one undergoes adaptive max pooling (AMP) and the other undergoes adaptive average pooling (AAP) to obtain global statistical information across different channels. The pooling results of the two branches are then fed into a shared set of 1×1 convolutional layers for channel dimensionality reduction and nonlinear transformation (ReLU activation), before being restored to the original channel dimensions through another set of 1×1 convolutional layers. Finally, the element-wise addition of the two branches is normalized using a sigmoid function to produce an importance weight map for each channel. This channel weight map is the final channel attention map generated by the channel attention module and is used for channel-by-channel multiplication with the input features of the channel attention module to achieve weighted feature adjustment, thereby enhancing defect-related channel responses and suppressing background and irrelevant interference information.

[0071] This module achieves adaptive enhancement of channel-level features by introducing a dual-branch attention mechanism, effectively improving the model's responsiveness to key defect areas.

[0072] The specific process of the feature channel attention (CAB) module is as follows:

[0073] Given an input feature map X∈r C×H×W , firstly, adaptive average pooling (AAP) and adaptive maximum pooling (AMP) are performed in the spatial dimension to extract global feature information. The formula is as follows:

[0074]

[0075] Among them, F avg (c) represents the channel global statistical information obtained after adaptive average pooling of the input feature map of the cth channel; F max (c) represents the channel global statistical information obtained after adaptive maximum pooling of the input feature map of the cth channel; X c (i, j) represents the value of the spatial position (i, j) on the c-th channel of the input feature map.

[0076] Subsequently, the pooling results of the two branches are input into a set of shared 1×1 convolutional layers for channel dimensionality reduction and nonlinear transformation (ReLU activation), and then restored to the original channel dimension through another set of 1×1 convolutional layers. The outputs of the two branches are then element-wise summed, and finally a Sigmoid activation function is used to obtain the channel attention weight map. Finally, the channel attention weight map is multiplied with the original feature map channel by channel to obtain the channel-weighted output feature map X′:

[0077] X′=σ(W2·δ(W1F avg )+W2δ(W1F max ))·X in (7)

[0078] Among them, W1 and W2 represent the learning weights of the convolutional layer, δ is the ReLU activation function, σ is the Sigmoid activation function, and X in Represents the original feature map input to the CAB module.

[0079] like Figure 6 As shown in (b), the spatial attention (SAB) module performs attention weighting on the feature map in the spatial dimension ( Figure 6The specific implementation is as follows: the input feature map (usually processed by CAB) is subjected to maximum pooling and average pooling in the channel dimension to obtain two spatial feature maps, and then the two are spliced ​​in the channel dimension and a 7×7 convolution is used to generate a spatial attention map. The spatial weight is then obtained by Sigmoid activation. The spatial attention map weights the original input feature map element by element, highlighting the spatial locations where defects may exist and suppressing irrelevant areas. Figure 6 As shown by the dashed line in (b), the spatial attention module also introduces a residual connection mechanism to fuse the weighted results with the module's input feature map, enhancing the robustness and fidelity of feature representation. Through the spatial attention (SAB) module, the model can more accurately locate defect areas, effectively reducing false detection and missed detection rates in complex backgrounds.

[0080] The specific processing steps of features in the spatial attention (SAB) module are as follows:

[0081] First, the input feature map X′ processed by the CAB module is subjected to average pooling and maximum pooling operations in the channel dimension to obtain two spatial attention input feature maps, which are shown as follows:

[0082]

[0083] Among them, M avg (i, j) represents the average response value of position (i, j) in the channel dimension, which is the result obtained by averaging the feature values ​​of all channels at that position; M max (i, j) represents the maximum response value of position (i, j) in the channel dimension, which is the result obtained by taking the maximum value of all channel feature values ​​at that position; (i, j) is the spatial coordinate, corresponding to the position index in the height and width directions of the feature map respectively.

[0084] Next, the two feature maps are concatenated along the channel dimension, and then a convolution layer with a convolution kernel size of 7×7 is used to obtain the spatial attention map. The spatial weight is then obtained by Sigmoid activation, and finally the spatial attention map is used to weight the feature map element by element to obtain the output feature map X "" :

[0085] X″=σ(f 7×7 (Concat[M avg ,M max ]))·X′ (10)

[0086] Among them, f 7×7 represents a convolution operation of size 7×7, and σ is the Sigmoid activation function.

[0087] like Figure 6As shown in (c), the multi-scale depthwise separable convolution (MSDC) module uses parallel depthwise convolution with different convolution kernel sizes (see Appendix Figure 6 (Green box), for example, deep convolution kernels of different sizes (p, q, and s) are applied simultaneously to the feature map to extract defect features at different scales. The large convolution kernel branch extracts global semantic information about the defect target, while the small convolution kernel branch retains fine-grained local details. This approach accounts for both large and small defects, mitigating the problem of missed detection due to varying defect scales.

[0088] The outputs of the depthwise convolutions of each size are processed by batch normalization (BN) and activation function (ReLU6), and then fused by pixel-by-pixel addition ( Figure 6 (c) (circled "+") The fusion result is further batch normalized to enhance stability and feature consistency. This module effectively integrates multi-scale information while maintaining the same feature size. The Multi-Scale Depthwise Separable Convolutional Module (MSDC) achieves efficient fusion of multi-scale features with low computational overhead and provides a foundation for subsequent channel compression and residual connections.

[0089] The process of feature extraction in the multi-scale depthwise separable convolution module (MSDC) is as follows:

[0090] Given the feature map processed by the spatial attention (SAB) module as X″, the convolution kernel size set is {K1,K2,...,K n}, then the convolution output of each scale is Y (i) It can be expressed as:

[0091]

[0092] in, Indicates that the convolution kernel size is K i The depth convolution operation of Figure 6 As shown in (c), depthwise convolution (DWC) with kernel sizes of p, q, and s is used to extract defect features at different scales.

[0093] In order to improve the responsiveness of the same channel to multi-scale features, this embodiment first performs pixel-by-pixel addition fusion on the features extracted by different convolution kernel sizes (e.g. Figure 6 (c) shows that the fused feature map is further processed by batch normalization to improve feature consistency and stability.

[0094] In actual deployment, the fusion result can be further input into a 1×1 pointwise convolution layer (PointwiseConvolution) for channel compression and integration, and then the final output feature map is formed through a residual connection with the input feature map, which is expressed as follows:

[0095] Among them, PWConv represents the point-by-point convolution layer, X out Represents the output feature map after fusion. The above channel compression and residual connection structure are not Figure 6 (c) is drawn as part of the subsequent operation of the module.

[0096] The forward propagation process of the EMCAD module is shown in formula (13):

[0097]

[0098] In the EMCAD module, the features pass through the channel attention (CAB) module, the spatial attention (SAB) module and the multi-scale depthwise separable convolution (MSDC) module in sequence.

[0099] The EMCAD module combines the aforementioned Channel Attention Block (CAB) and Spatial Attention Block (SAB) modules in series with the Multi-Scale Depthwise Separable Convolution (MSDC) module to form a complete attention-enhanced decoder architecture. By utilizing depthwise separable convolution and a lightweight attention mechanism, the EMCAD module introduces minimal additional parameters and computational overhead while significantly enhancing the model's ability to capture key features of aluminum profile surface defects. This makes the backbone network more sensitive to defects of varying sizes and significantly improves its adaptability to complex backgrounds.

[0100] The EMCAD module in this embodiment combines three mechanisms: multi-scale depth-separable convolution, channel attention, and spatial attention. It can effectively enhance feature expression without significantly increasing the amount of computation, enabling the model to have a stronger perception of defects of different scales (especially tiny defects), and suppress complex background noise, thereby improving the accuracy of defect detection. If hardware resources are limited, only part of the mechanism can be used, such as using only the channel attention (CAB) module or the spatial attention (SAB) module to enhance the backbone output features, omitting complex multi-scale convolution operations. Similarly, the convolution kernel size set of multi-scale convolution is not fixed. Convolution kernel combinations of different sizes can be selected according to the actual defect size distribution, or pyramid pooling and other methods can be used to extract multi-scale information.

[0101] The various modules in the neck network are described below.

[0102] like Figure 1 As shown, the neck network in this embodiment includes an upsampling module, a connection module, a VoVGSCSP module and a gradient shuffle convolution module.

[0103] The upsampling module includes a first upsampling module and a second upsampling module; the connection module includes a first, second, third and fourth connection modules; the VoVGSCSP module includes a first, second, third and fourth VoVGSCSP modules; and the gradient shuffle convolution module (GSConv module) includes a first and a second gradient shuffle convolution modules.

[0104] The output features of the EMCAD module are fed into the first connection module after passing through the first upsampling module, where they are fused with the output features of the third C2f module. The fused features of the first connection module are first fed into the first VoVGSCSP module, then into the second upsampling module, and then into the second connection module. Within the second connection module, they are fused with the output features of the second C2f module. The fused features of the second connection module are processed by the second VoVGSCSP module before being fed into the first decoupled detection head module. The output features of the second VoVGSCSP module are fed into the third connection module after passing through the first gradient shuffled convolution module, where they are fused with the output features of the first VoVGSCSP module. The fused features of the third connection module are processed by the third VoVGSCSP module before being fed into the second decoupled detection head module. The output features of the third VoVGSCSP module are fed into the fourth connection module after passing through the second gradient shuffled convolution module, where they are fused with the output features of the SPPF-LSKA module. The fused features of the fourth connection module are processed by the fourth VoVGSCSP module before being fed into the third decoupled detection head module.

[0105] This embodiment extensively uses the gradient shuffle convolution module (GSConv module) and its improved VoVGSCSP module in the neck network of the model to replace the conventional convolution module and C2f module to achieve neck slimming acceleration and feature fusion enhancement.

[0106] like Figure 7 As shown in (a), the feature processing process in the first gradient shuffle convolution module is as follows:

[0107] Assume that the input feature map is The number of feature map channels is C out First, the input features are processed by standard convolution (SC) to achieve channel mixing and obtain intermediate feature maps:

[0108]

[0109] Among them, X sc is the output feature of the standard convolution.

[0110] Then X scInput depthwise separable convolution (DSC) for processing to extract spatial detail features:

[0111]

[0112] Among them, X dw is the output feature of depth-wise separable convolution.

[0113] Then, X dw and X sc Concatenate along the channel dimension (Concat), and implement channel mixing and normalization (Shuffle) through a 1×1 convolution:

[0114] Y=σ(BN(W (shuf) (Concat(X sc ,X dw )))) (16)

[0115] Where Y is the final output feature of the first gradient shuffled convolution module; σ represents the activation function (such as ReLU); BN represents batch normalization; W (shuf) Represents the 1×1 convolution kernel weight, which is used to fuse and rearrange the concatenated feature channels to achieve channel mixing.

[0116] The standard convolution branch in the first gradient shuffle convolution module uses 1×1 convolution (with BatchNorm and SiLU activation) for channel mixing and extracting cross-channel information; the depth-wise separable convolution branch uses 5×5 depth-wise convolution to extract spatial detail features; the outputs of the two branches are concatenated (concat) in the channel dimension and then enter a "Shuffle" channel shuffling unit (the purple module in Figure 7(a)). The channel shuffling unit evenly mixes the features of different branches into each channel of the output to achieve efficient information cross-fusion. Similarly, the feature processing process in the second gradient shuffle convolution module is the same as the feature processing process in the first gradient shuffle convolution module.

[0117] The gradient shuffled convolution module (GSConv module) combines the advantages of standard convolution and depth-wise separable convolution in parallel, making its feature expression ability close to that of ordinary convolution but with significantly reduced computational cost. It also uses the channel shuffling mechanism to avoid the isolation of features extracted by different convolution branches, achieving nearly lossless lightweight feature extraction.

[0118] like Figure 7 As shown in (b), the VoVGSCSP module combines the cross-stage partial connection (CSP) network and the one-shot aggregation (One-Shot Aggregation) idea of ​​VoVNet, and integrates the GSConv module into it to form a bottleneck block.

[0119] The first VoVGSCSP module divides the input features into two subpaths, performing feature extraction and retention operations respectively:

[0120] First, the input feature map is processed by the first standard convolution. The output features of the first standard convolution are used as the starting point of the main path and are sequentially input into two series-connected gradient shuffled convolution modules (GSConv modules). The two GSConv modules are connected by standard convolution to improve the cross-module feature transmission capability. Each GSConv module has the same structure as the first gradient shuffled convolution module mentioned above: it consists of a depthwise separable convolution (DSC) and a standard convolution (SC) in parallel, and finally outputs the fused features through channel splicing and channel shuffle (shuffle), as shown in the following example. Figure 7 As shown in (a).

[0121] On the other hand, the output features of the first standard convolution are directly branched into the second standard convolution module to construct a shortcut path to achieve identity mapping and information preservation.

[0122] Then, the output of the main path (the output of the serial GSConv module) and the output of the shortcut path (the output of the second standard convolution) are combined in Figure 7 In (b), element-wise addition and fusion are performed at the black "⊕" nodes. The fused features are then fed into a Concat module for channel-wise feature concatenation or equivalent convolution fusion, followed by a fourth standard convolution. The input feature map of the first VoVGSCSP module undergoes the third standard convolution and then the fourth standard convolution. Finally, the fourth standard convolution produces the final output features of the first VoVGSCSP module.

[0123] The first, second, third and fourth standard convolutions in the first VoVGSCSP module are the same as the standard convolutions in the first gradient shuffled convolution module.

[0124] The entire VoVGSCSP structure effectively retains shallow details and enhances deep semantic expression capabilities through residual connections, deep and shallow information fusion, and channel rearrangement mechanisms, thereby improving the model's perception of multi-scale defect targets and reducing the risk of small target information loss during downsampling.

[0125] Similarly, the processing of the features in the second, third, and fourth VoVGSCSP modules is the same as the processing of the features in the first VoVGSCSP module.

[0126] Since the gradient shuffled convolution module (GSConv module) uses a depth-wise separable convolution branch with a larger kernel (5×5), it provides a larger receptive field to capture the local pattern of small defects, while the 1×1 standard convolution branch enhances the information interaction between channels. Through channel shuffling, these two features are fully integrated, so that the output features take into account both local details and global context, which helps to highlight small defect signals in complex backgrounds. At the same time, the channel shuffling strategy effectively smooths out the abnormal activation of a single channel caused by background noise or local illumination changes by cross-exchanging feature information of different branches between output channels, and evenly distributes defect-related features to all channels. Therefore, the improved VoVGSCSP module further improves the network's adaptability to complex backgrounds and its ability to capture subtle defect patterns. In this embodiment, the gradient shuffled convolution (GSConv) module or the VoVGSCSP module is applied to multiple scale feature fusion layers of the Neck (neck network) to replace the traditional convolution module and C2f module to achieve efficient fusion and enhancement of multi-scale features.

[0127] This embodiment introduces the GSConv module and the improved VoVGSCSP module in the neck network of the model to replace the traditional convolution. The features of the standard convolution and the depthwise separable convolution are fused through the channel shuffling mechanism, which improves the feature fusion efficiency, enhances the model's retention of detail features and the utilization of information from different channels, and significantly improves the model's ability to distinguish small defects and similar defects while controlling the model's computational cost.

[0128] The first, second and third decoupled detection head modules (Detect) in the detection head network are described below.

[0129] After backbone extraction and neck fusion, the enhanced multi-scale features are fed into the first, second, and third decoupled detection head modules of YOLOv8.

[0130] like Figure 8 As shown, each decoupled detection head module (Detect) consists of an independent classification branch ( Figure 8 Arranged from top to bottom, the second branch) and the regression branch ( Figure 8Arranged from top to bottom in the figure, the first branch) consists of: the classification branch is responsible for predicting the probability that each candidate area belongs to each defect category, and the regression branch is responsible for predicting the position coordinates and size of the bounding box. When the feature enters the classification branch, it first passes through two CBS modules, then is processed by two-dimensional convolution (Conv2d), and then is processed by Cls.Loss; when the feature enters the regression branch, it first passes through two CBS modules, then is processed by two-dimensional convolution (Conv2d), and then is processed by Bbox.Loss. The decoupling design can improve the mutual non-interference of positioning and classification tasks, thereby improving detection accuracy. Finally, the model post-processes the prediction results on the feature maps of each scale, including screening the prediction boxes above the set threshold and removing highly overlapping redundant boxes through non-maximum suppression (NMS), retaining only the detection results with the highest confidence. The output detection results include information such as the type, location (rectangular bounding box) and confidence of the surface defects of the aluminum profile.

[0131] Step 3: Based on the data set of step 1, the aluminum profile surface defect detection model built in step 2 is trained, and then the trained aluminum profile surface defect detection model is used to perform aluminum profile surface defect detection.

[0132] The method of this embodiment can complete the automatic detection of aluminum profile surface defects based on the above steps: first, the surface image of the aluminum profile to be detected is collected or input, and after preprocessing, it is input into the aluminum profile surface defect detection model. The model uses the LSKA attention mechanism, EMCAD module and gradient shuffle convolution module (GSConv) to extract and process image features, and finally outputs the location and type of the defect to achieve efficient identification of aluminum profile surface defects.

[0133] In this embodiment, a surface defect detection method for aluminum profiles based on YOLOv8 was applied to a publicly available aluminum profile defect dataset for verification. The results showed that while maintaining real-time detection capabilities, the method in this embodiment significantly outperformed existing mainstream algorithms in terms of accuracy and had practical industrial application value, as shown in the following:

[0134] 1. Significantly Improved Detection Accuracy and Higher Recall: This embodiment introduces a dual attention mechanism and multi-scale feature extraction, enabling more accurate detection of various defect targets. Compared to the baseline YOLOv8s model, the mean average precision (mAP@50) of this embodiment's method increased from 85.0% to 89.6%, an increase of approximately 4.6 percentage points; the strict average precision (mAP@50-95) increased from 67.1% to 71.0%, an increase of 3.9 percentage points. Furthermore, precision (P) increased from 86.6% to 91.0%, and recall (R) increased from 81.6% to 83.8%. These improvements in precision and recall demonstrate improvements in both missed and false detections, enabling more reliable detection of small defects and reducing the misclassification of normal areas as defects.

[0135] 2. Good real-time performance, meeting industrial application requirements: This embodiment improves detection accuracy while maintaining a high inference speed. The aluminum profile surface defect detection model in the present invention has an inference speed of approximately 40FPS on a GPU, which is only slightly lower than the original YOLOv8s (41FPS to 40FPS). This slight speed drop results in a significant improvement in accuracy, and the processing speed of 40 frames per second can still meet the real-time requirements of online detection of most aluminum profile production lines. Therefore, this method is suitable for deployment in industrial sites to perform real-time defect screening on each aluminum profile.

[0136] 3. Strong adaptability to multi-scale defects and outstanding ability to detect subtle defects: Through the EMCAD module's multi-scale deep separable convolution and attention fusion, this method can effectively detect defects of different sizes. Whether it is a large-scale surface flaw or a tiny scratch that is difficult to detect with the naked eye, the model can use multi-scale feature expression and attention focusing mechanisms to identify them. This makes this method particularly good at detecting small target defects, significantly reducing the rate of missed detection of small defects. At the same time, the VoVGSCSP module ensures that small defect features are not lost during the downsampling process, retaining detailed information while integrating high-level semantics, making the model highly sensitive to subtle defects.

[0137] 4. Resistant to complex background interference and low false detection rate: This method uses channel attention and spatial attention to adaptively optimize features, significantly reducing the interference of background noise on detection results. For aluminum profile surfaces with complex textures or uneven lighting, the model can highlight defect areas and suppress irrelevant background through the attention mechanism, reducing false positives caused by background textures. At the same time, the channel shuffling of the GSConv module spreads defect-related information to all channels and smooths out abnormal activations in a single channel. Therefore, even in complex background environments and the coexistence of multiple interference factors, this method can still maintain stable detection performance.

[0138] 5. The model is lightweight, efficient, and easy to deploy: Although the aluminum profile surface defect detection model in this embodiment integrates a variety of new modules, it is still based on the YOLOv8s lightweight model. In addition, the extensive use of lightweight operators such as the GSConv module keeps the model parameter quantity and computational complexity within a reasonable range. Compared with simply stacking convolutional layers or using larger models to improve performance, this model avoids excessive model expansion while improving performance and accuracy. Therefore, this method can run smoothly on devices with limited computing power, such as embedded GPUs, and is easy to deploy on actual production lines. In addition, the modules of this method are clearly decoupled and can be trimmed or replaced as needed, which has the flexibility of engineering implementation.

[0139] Based on the standard YOLOv8 architecture, the method of the present invention introduces specific module improvements based on the characteristics of aluminum profile defects: using the spatial pyramid pooling-large kernel separable convolution attention module (SPPF-LSKA module) to expand the receptive field and enhance background context understanding, using the multi-efficient multi-scale convolution attention decoding module (EMCAD module) to focus on the defect area to improve the detection ability of small defects, and using the gradient shuffled convolution module to strengthen feature fusion and lightweight network structure. This method can efficiently and accurately detect various defects on the surface of aluminum profiles, especially under difficult conditions such as multi-scale targets, complex background interference and subtle defects. The method of the present invention not only improves the accuracy and reliability of defect detection, reduces the risk of missed detection and false detection, but also takes into account the real-time requirements of industrial sites. It has high practical value and is expected to improve the level of automation of aluminum profile production quality inspection and provide an effective means for industrial quality control.

[0140] The embodiments of the present invention are only used to illustrate the technical solutions of the present invention rather than to limit the present invention. Those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for detecting surface defects of aluminum profiles based on YOLOv8, characterized in that: The steps include: Step 1: Obtain aluminum profile surface images, construct a data set containing aluminum profile surface images, and preprocess the data set; Step 2: Build an aluminum profile surface defect detection model, which includes a backbone network, a neck network, and a detection head network; The backbone network includes the CBS-C2f module, the SPPF-LSKA module, and the EMCAD module. The SPPF-LSKA module integrates the large-kernel separable convolution attention mechanism into the spatial pyramid pooling layer. The EMCAD module comprehensively utilizes three mechanisms: multi-scale depthwise separable convolution, channel attention, and spatial attention, to perform decoding-based enhancement on the output features. The neck network uses the gradient shuffle convolution module and the improved VoVGSCSP module to replace the conventional convolution module and C2f module; The processing of the preprocessed data in the aluminum profile surface defect detection model is as follows: The preprocessed data first passes through the backbone network, where the CBS-C2f module extracts features layer by layer, and then processes the data through the SPPF-LSKA module and the EMCAD module in sequence. The multi-level features output by the backbone network are input into the neck network, where the high-level features are first upsampled and fused with the low-level features. After fusion, the features are refined through a convolutional structure consisting of a gradient shuffled convolution module and a VoVGSCSPns module. At the same time, the low-level features are fused with the high-level features through downsampling to achieve bidirectional fusion of features at different scales. Finally, the features output by the neck network are input into the detection head network to output defect detection results. The defect detection results include the type, location, confidence level, and detection speed of the aluminum profile surface defects. The detection head network includes first, second and third decoupled detection head modules; Step 3: Based on the data set of step 1, the aluminum profile surface defect detection model built in step 2 is trained, and then the trained aluminum profile surface defect detection model is used to perform aluminum profile surface defect detection.

2. The aluminum profile surface defect detection method based on YOLOv8 according to claim 1, characterized in that: The CBS-C2f module is composed of a plurality of CBS modules and a plurality of C2f modules, namely the first, second, third, fourth and fifth CBS modules, and the first, second, third and fourth C2f modules; The preprocessed data is input into the CBS-C2f module and processed in sequence by the first CBS module, the second CBS module, the first C2f module, the third CBS module, the second C2f module, the fourth CBS module, the third C2f module, the fifth CBS module and the fourth C2f module.

3. The aluminum profile surface defect detection method based on YOLOv8 according to claim 2, characterized in that: The first CBS module includes a two-dimensional convolutional layer, a batch normalization layer and a SiLU activation function; The features are input into the first CBS module and processed in sequence by the two-dimensional convolution layer, batch normalization layer and SiLU activation function; The processing of features in the second, third, fourth and fifth CBS modules is the same as the processing of features in the first CBS module.

4. The aluminum profile surface defect detection method based on YOLOv8 according to claim 2, characterized in that: The processing process of the feature in the first C2f module is: In the first C2f module, features are first input into a CBS module for preliminary processing; then, the processed features are divided into several branches and input into multiple BottleNeck structures for feature extraction. The number of BottleNeck structures is n; the features extracted from each BottleNeck structure are then concatenated along the channel dimension; finally, the concatenated features are passed through a CBS module again to output the enhanced feature representation; The processing of the feature in the second, third and fourth C2f modules is the same as the processing of the feature in the first C2f module.

5. The aluminum profile surface defect detection method based on YOLOv8 according to claim 1, characterized in that: The feature processing process in the SPPF-LSKA module is as follows: The features input to the SPPF-LSKA module first enter a CBS module for preliminary processing; then, they are operated in sequence through three two-dimensional maximum pooling operations of the same size; the pooled scale features are spliced ​​with the original input features of the SPPF-LSKA module in the channel dimension; the spliced ​​features are sent to the LSKA module for long- and short-range attention modeling; finally, they are fused through a CBS module to obtain the final output features of the SPPF-LSKA module.

6. The aluminum profile surface defect detection method based on YOLOv8 according to claim 5, characterized in that: The feature processing process in the LSKA module is as follows: In the LSKA module, one-dimensional depth convolution is first applied to the input features in the horizontal and vertical directions respectively, and then depth-dilated convolution is applied in the horizontal and vertical directions. Finally, the extracted features are fused through a 1×1 convolution, and the output of the 1×1 convolution is multiplied element-by-element with the original input features of the LSKA module to generate the attention-weighted output features.

7. The aluminum profile surface defect detection method based on YOLOv8 according to claim 1, characterized in that: The EMCAD module includes a channel attention module, a spatial attention module, and a multi-scale depthwise separable convolution module; Within the EMCAD module, the features first pass through the channel attention module, then the spatial attention module, and finally the multi-scale depthwise separable convolution module; In the channel attention module, the input feature map is first divided into two branches, one branch undergoes adaptive max pooling, and the other branch undergoes adaptive average pooling to obtain global statistical information on different channels; Subsequently, the pooling results of the two branches are input into a set of shared 1×1 convolutional layers for channel dimension reduction and nonlinear transformation, and then restored to the original channel dimension through another set of 1×1 convolutional layers; The outputs of the two branches are summed element by element and normalized by the Sigmoid function to obtain the importance weight map of each channel. Finally, the weight map is multiplied channel by channel by the input features of the channel attention module. In the spatial attention module, the input feature map is max-pooled and average-pooled in the channel dimension to obtain two spatial feature maps. The two are then concatenated in the channel dimension and passed through a 7×7 convolution to generate a spatial attention map. The spatial weights are then obtained through sigmoid activation. The spatial attention map weights the original input feature map element by element. The spatial attention module also introduces a residual connection mechanism to fuse the weighted results with the original input feature map of the spatial attention module. In the multi-scale depthwise separable convolution module, parallel depthwise convolutions with different kernel sizes are first applied to the feature map simultaneously to extract defect features at different scales. Then the outputs of the depthwise convolutions of each size are processed by batch normalization and activation function respectively, and then fused by pixel-by-pixel addition. The fusion results are further processed by batch normalization to obtain the final output features of the multi-scale depthwise separable convolution module.

8. The aluminum profile surface defect detection method based on YOLOv8 according to claim 2, characterized in that: The neck network includes an upsampling module, a connection module, a VoVGSCSP module and a gradient shuffle convolution module; The upsampling module includes a first upsampling module and a second upsampling module; the connection module includes a first, a second, a third and a fourth connection module; the VoVGSCSP module includes a first, a second, a third and a fourth VoVGSCSP module; the gradient shuffle convolution module includes a first and a second gradient shuffle convolution module; The output features of the EMCAD module are input into the first connection module after passing through the first upsampling module, and are fused with the output features of the third C2f module in the first connection module. The fused features of the first connection module are first passed through the first VoVGSCSP module, and then through the second upsampling module before being input into the second connection module, and are fused with the output features of the second C2f module in the second connection module. The fused features of the second connection module are processed by the second VoVGSCSP module and then input into the first decoupling detection head module. The output features of the second VoVGSCSP module are input into the third connection module after passing through the first gradient shuffle convolution module, and are fused with the output features of the first VoVGSCSP module in the third connection module. The fused features of the third connection module are processed by the third VoVGSCSP module and then input into the second decoupling detection head module; The output features of the third VoVGSCSP module are input into the fourth connection module after passing through the second gradient shuffle convolution module, and are fused with the output features of the SPPF-LSKA module in the fourth connection module. The fused features of the fourth connection module are processed by the fourth VoVGSCSP module and then input into the third decoupling detection head module.

9. The aluminum profile surface defect detection method based on YOLOv8 according to claim 8, characterized in that: The feature processing process in the first gradient shuffle convolution module is: First, the input features pass through the standard convolution branch and then through the depth-wise separable convolution branch; the standard convolution branch uses 1×1 convolution for channel mixing, and the depth-wise separable convolution branch uses 5×5 depth-wise convolution to extract spatial detail features; The output of the standard convolution branch and the output of the depthwise separable convolution branch are then concatenated in the channel dimension and fed into a channel shuffling unit. The channel shuffling unit evenly mixes the features of different branches into each output channel. After the features are processed by the channel shuffling unit, the final output features of the first gradient shuffled convolution module are obtained. The processing process of the features in the second gradient shuffled convolution module is the same as the processing process of the features in the first gradient shuffled convolution module.

10. The aluminum profile surface defect detection method based on YOLOv8 according to claim 8, characterized in that: The processing process in the first VoVGSCSP module is characterized as follows: First, the input feature map is processed by the first standard convolution. The output features of the first standard convolution are used as the starting point of the main path and are sequentially input into two series-connected gradient shuffled convolution modules. The two gradient shuffled convolution modules are connected by a standard convolution. On the other hand, the output features of the first standard convolution are directly branched into the second standard convolution module to construct the shortcut path; Then, the output of the main path and the output of the shortcut path are element-wise added and fused. The fused features are then input into a Concat module for channel-wise feature concatenation or equivalent convolution fusion operations, and then input into the fourth standard convolution. The input feature map of the first VoVGSCSP module is processed by the third standard convolution and then input into the fourth standard convolution, and finally outputs the final output feature of the first VoVGSCSP module after the fourth standard convolution; The first, second, third and fourth standard convolutions in the first VoVGSCSP module are the same as the standard convolutions in the first gradient shuffled convolution module.

Citation Information

Cited By

  • Constricted space quality detection method based on multi-modal edge cloud transmission

    CN120833545A

  • Unmanned aerial vehicle thermal infrared image straw fire point detection method based on local pixel enhancement

    CN121213563A

  • Straw fire point detection method based on local pixel enhancement of unmanned aerial vehicle thermal infrared image

    CN121213563B

  • Beidou multi-domain feature interference signal identification method, system and device and medium

    CN121385937A

  • Aluminum material surface defect detection method integrating deformable convolution and no-parameter attention

    CN121481981A