Defect detection method for industrial manufacturing and computer program product
Through average pooling, maximum pooling and multi-scale convolution structure combined with large-core attention mechanism and improved detection head structure, the pruning algorithm optimizes the defect detection model, solves the problem of high computational complexity, and realizes efficient and lightweight detection in steel surface defect detection.
Patent Information
- Application Number
- CN202510613224.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-13
- Publication Date
- 2025-09-16
AI Technical Summary
Existing deep learning-based defect detection models have high computational complexity in industrial manufacturing and are difficult to deploy efficiently on terminal devices with limited computing power. This is particularly challenging in steel surface defect detection, where reducing the computational complexity of the model while ensuring high detection accuracy becomes a challenge.
Average pooling and maximum pooling are used to determine the target downsampled feature map of the input feature map. The multi-scale convolution structure is combined to perform group convolution operations. The large-core attention mechanism and the improved detection head structure are used to process the multi-scale feature map. The pruning algorithm is used to remove redundant features and a lightweight defect detection model is designed.
While ensuring detection accuracy, it significantly reduces computational complexity, achieves lightweight models, adapts to resource-constrained terminal devices, and improves detection efficiency and applicability.
Smart Images

Figure CN120655962A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision technology, and in particular to a defect detection method and computer program product for industrial manufacturing. Background Art
[0002] With the rapid development of the global industrial manufacturing industry, intelligent manufacturing has become a key driving force for industrial innovation. Within this process, the application of automated quality inspection technologies not only effectively improves production efficiency but also ensures the stability and consistency of product quality. As a key raw material for automotive parts, the quality of steel directly impacts the performance, safety, and durability of the entire vehicle. In particular, during the automotive production process, surface defects on steel plates, such as scratches, cracks, and bubbles, can result in substandard component strength, further impacting the safety of the entire vehicle. Therefore, surface defect detection on steel plates has always been a crucial step in ensuring automotive quality.
[0003] Deep learning-based visual inspection technology can automatically identify, locate, and classify surface defects during the production process, significantly improving detection accuracy and speed, thereby driving the manufacturing industry towards intelligence and automation. However, despite the remarkable success of deep learning-based object detection technology in various fields, its consumption of computing resources remains a prominent issue. Most deep learning models require high-performance computing hardware for training and inference, which is limited by the hardware environment in actual production, especially in terminal devices with limited computing power. How to reduce the computational complexity of the model while ensuring high detection accuracy has become a major challenge in the current field of steel surface defect detection. Summary of the Invention
[0004] The main purpose of this application is to provide a defect detection method and computer program product for industrial manufacturing, aiming to solve the technical problem of high computational complexity of existing defect detection models for industrial manufacturing.
[0005] To achieve the above objectives, the present application proposes a defect detection method for industrial manufacturing, the method comprising:
[0006] Determine a target downsampled feature map of the input feature map based on average pooling and maximum pooling, and perform a grouped convolution operation on the target downsampled feature map based on a multiscale convolution structure to obtain a multiscale feature map;
[0007] According to the large-core attention mechanism and the improved detection head structure, the multi-scale feature map is processed to obtain a defect detection feature map;
[0008] The redundant features of the defect detection feature map are processed by a pruning algorithm to obtain a target feature map, and a defect detection result is obtained according to the target feature map.
[0009] In one embodiment, the step of processing the multi-scale feature map according to the large-core attention mechanism and the improved detection head structure to obtain the defect detection feature map includes:
[0010] Based on the large-core attention mechanism, the multi-scale feature map is processed by a large-core convolution layer to obtain a spatial attention map, and a multi-scale enhanced feature map is obtained based on the spatial attention map;
[0011] Inputting the multi-scale enhanced feature map into the improved detection head structure, and extracting features of the multi-scale enhanced feature map through the shared convolutional layer of the improved detection head structure;
[0012] The features are enhanced in detail by using a deconvolution algorithm to obtain enhanced features, and the enhanced features are dynamically scaled to obtain a defect detection feature map.
[0013] In one embodiment, the step of processing the multi-scale feature map through a large kernel convolution layer based on a large kernel attention mechanism to obtain a spatial attention map, and obtaining a multi-scale enhanced feature map based on the spatial attention map includes:
[0014] The large-core convolution layer is decomposed through the large-core attention mechanism to obtain smaller depth convolution;
[0015] Dividing the multi-scale feature map into different sub-feature maps, applying the depthwise convolution to the sub-feature maps to obtain a multi-scale output feature map;
[0016] Obtaining a spatial attention map based on the multi-scale output feature map;
[0017] Processing the spatial attention map through an activation function to determine a spatial selection weight;
[0018] An element-by-element product operation is performed on the spatial selection weight and the sub-feature map to obtain a multi-scale enhanced feature map.
[0019] In one embodiment, the step of obtaining a spatial attention map based on the multi-scale output feature map includes:
[0020] Performing average pooling on the multi-scale output feature map to obtain a first spatial relationship feature map, and performing maximum pooling on the multi-scale output feature map to obtain a second spatial relationship feature map;
[0021] cascading the first spatial relationship feature map and the second spatial relationship feature map to obtain a cascaded spatial relationship feature map;
[0022] The cascaded spatial relationship feature map is transformed by a transformation function to obtain a spatial attention map.
[0023] In one embodiment, the step of determining a target downsampled feature map of the input feature map based on average pooling and maximum pooling, and performing a grouped convolution operation on the target downsampled feature map based on a multiscale convolution structure to obtain a multiscale feature map includes:
[0024] Downsample the input feature map through average pooling to obtain the initial feature map;
[0025] Obtaining a target downsampled feature map based on the initial feature map, maximum pooling, and point-by-point convolution;
[0026] Based on the multi-scale convolution structure, the backbone feature extraction network of the original convolutional neural network is reconstructed to obtain the reconstructed network;
[0027] The reconstructed network is used to perform a group convolution operation on the target downsampled feature map to obtain a multi-dimensional feature map.
[0028] In one embodiment, the step of performing a group convolution operation on the target downsampled feature map through the reconstructed network to obtain a multi-scale feature map includes:
[0029] Based on the reconstructed network, the target downsampled feature map is divided into multiple groups of feature maps;
[0030] Extracting different-scale features of multiple sets of feature maps through convolution kernels of different scales, and obtaining an initial multi-scale feature map based on the different-scale features;
[0031] Based on the original number of channels of the input feature map, the initial multi-scale feature map is spliced in the channel dimension to obtain a multi-scale feature map.
[0032] In one embodiment, the step of obtaining a target downsampled feature map based on the initial feature map, maximum pooling, and point-by-point convolution includes:
[0033] Dividing the initial feature map along the channel dimension to obtain a first feature part and a second feature part;
[0034] Performing feature extraction and dimensionality reduction processing on the first feature part to obtain a first down-sampled output;
[0035] Performing feature enhancement and dimensionality reduction processing on the second feature part by maximum pooling and point-by-point convolution to obtain a second down-sampled output;
[0036] A target down-sampled feature map is obtained by concatenating the first down-sampled output and the second down-sampled output.
[0037] In one embodiment, the defect detection result includes a first detection result and a second detection result. The step of processing redundant features of the defect detection feature map using a pruning algorithm to obtain a target feature map, and obtaining the defect detection result based on the target feature map includes:
[0038] Based on the global pruning of the pruning algorithm, the network weight absolute values of the defect detection feature map are sorted to obtain the sorting results;
[0039] Remove redundant features of the defect detection feature map according to the sorting result and a preset pruning rate to obtain a target feature map;
[0040] Determine unknown defects in the target feature image that are lower than a preset defect discrimination threshold, process the unknown defects using a preset classification strategy, and obtain a first detection result;
[0041] A second detection result is obtained based on known defects in the target feature map that are not lower than the preset defect discrimination threshold.
[0042] In one embodiment, before the step of determining a target downsampled feature map of the input feature map based on average pooling and maximum pooling, and performing a grouped convolution operation on the target downsampled feature map based on a multiscale convolution structure to obtain a multiscale feature map, the step further includes:
[0043] Based on the data enhancement algorithm, the original input data set is automatically oriented at the pixel level to obtain the adjusted input data set;
[0044] Performing grayscale processing, random cropping processing, and silhouette adding processing on the adjusted input data set to obtain a processed input data set;
[0045] Randomly rotating the processed input data set according to a preset rotation range to obtain a rotated input data set;
[0046] Preset random noise is added to the rotated input data set to obtain an input feature map.
[0047] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the steps of the defect detection method for industrial manufacturing as described above.
[0048] The technical solution proposed in this application determines the target down-sampled feature map of the input feature map based on average pooling and maximum pooling, and performs group convolution operations on the target down-sampled feature map based on a multi-scale convolution structure to obtain a multi-scale feature map. The multi-scale feature map is processed according to the large-core attention mechanism and the improved detection head structure to obtain a defect detection feature map. The redundant features of the defect detection feature map are processed through a pruning algorithm to obtain a target feature map, and the defect detection result is obtained based on the target feature map. This application enhances the feature extraction capability based on average pooling and maximum pooling, uses a multi-scale convolution structure to reduce the number of parameters, and uses a large-core attention mechanism and an improved detection head structure to reduce computational complexity while taking into account both accuracy and speed. The pruning algorithm is used to further achieve lightweighting. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0050] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0051] Figure 1 This is a flow chart of the first embodiment of the defect detection method for industrial manufacturing of this application;
[0052] Figure 2 This is a schematic diagram of the network structure of the defect detection model for industrial manufacturing in this application;
[0053] Figure 3 This is a flow chart of a second embodiment of the defect detection method for industrial manufacturing of the present application;
[0054] Figure 4 Schematic diagram of the large-core attention mechanism for the defect detection method for industrial manufacturing in this application;
[0055] Figure 5 A flowchart of the third embodiment of the defect detection method for industrial manufacturing provided by this application;
[0056] Figure 6 This is a schematic diagram of the sampling of the defect detection method for industrial manufacturing in this application;
[0057] Figure 7 Schematic diagram of the multi-scale convolution structure of the defect detection method for industrial manufacturing in this application;
[0058] Figure 8Schematic diagram of the lightweight effect of the defect detection method for industrial manufacturing in this application.
[0059] The purpose, features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0060] It should be understood that the specific embodiments described herein are merely used to explain the technical solutions of the present application and are not intended to limit the present application.
[0061] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0062] The computational resource consumption of deep learning-based target detection technology is a prominent issue. Most deep learning models require high-performance computing hardware for training and inference, which is limited by the hardware environment in actual production, especially in terminal devices with limited computing power. How to reduce the computational complexity of the model while ensuring high detection accuracy has become a major challenge in the current field of steel surface defect detection.
[0063] Therefore, in order to overcome the above-mentioned defects, this application provides a solution based on average pooling and maximum pooling to enhance feature extraction capabilities, using multi-scale convolution structure to reduce the number of parameters, large-core attention mechanism and improved detection head structure to reduce computational complexity while taking into account accuracy and speed, and further achieve lightweighting by using pruning algorithm.
[0064] It should be noted that the execution entity of each embodiment of the present application can be a computing service system with data processing, network communication, and program execution functions, such as an electronic system capable of implementing the above functions, a defect detection model for industrial manufacturing, etc. The following embodiments are described using the defect detection model for industrial manufacturing as an example (hereinafter referred to as the "model").
[0065] Based on this, the embodiment of the present application provides a defect detection method for industrial manufacturing, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the defect detection method for industrial manufacturing of this application.
[0066] In this embodiment, the defect detection method for industrial manufacturing includes steps S10 to S30:
[0067] Step S10: determining a target down-sampled feature map of the input feature map based on average pooling and maximum pooling, and performing a group convolution operation on the target down-sampled feature map based on a multi-scale convolution structure to obtain a multi-scale feature map.
[0068] It should be noted that the defect detection method for industrial manufacturing in this application has excellent versatility and practicality, and can be widely used in scenarios including but not limited to defect detection of automotive parts, metal products or medical devices.
[0069] The YOLO (You Only Look Once) model is widely used in existing defect detection technologies. It is an end-to-end object detection algorithm that transforms the detection problem into a regression problem, using a single neural network to simultaneously predict the object category and bounding box in an image. Unlike traditional two-stage detection methods, YOLO requires only a single forward pass through the image to detect all objects, significantly improving detection efficiency and real-time performance. YOLO has evolved from YOLOv1 to YOLOv11, with YOLOv8 being one of the most widely used versions.
[0070] YOLOv8 is divided into five versions based on network depth and feature map width: YOLOv8-n, YOLOv8-s, YOLOv8-m, YOLOv8-l, and YOLOv8-x. Its network architecture consists of four main components: the input module, the backbone feature extraction network (Backbone), the neck network (Neck), and the detection head network (Head). The input module is responsible for preprocessing the input image, including mosaic data augmentation (Mosaic), random cropping and splicing (Mixup), adaptive anchor point calculation, and adaptive grayscale padding, and resizing the input feature map to a size suitable for the network input. These diverse data augmentation strategies enrich the sample diversity and improve the model's generalization and robustness. The backbone feature extraction network is used to extract target features and consists of a standard convolutional layer (CBS), a C2f module, and spatial pyramid pooling (SPPF). Multiple standard convolutional layers and C2f modules gradually extract image features, and the spatial pyramid pooling module at the end converts input images of any size into feature vectors of fixed size, enhancing the model's adaptability to objects of different sizes.
[0071] Among them, the C2f module gradually deepens the network through the Bottleneck module in the trunk branch, while retaining the input layer channel and fusing it with the trunk features. The neck network combines the feature pyramid (FPN) and the path aggregation network (PAN) to perform multi-scale fusion of the three feature layers output by the trunk feature extraction network, and adopts the top-down (FPN) and bottom-up (PAN) feature transfer mechanisms to enhance the pyramid features. The detection head network module adopts a decoupling head structure to separate the classification task from the regression task. The classification loss uses BCELoss, while the regression loss combines DFLLoss and CIOULoss. At the same time, the module switches from the traditional Anchor-Based mode to the Anchor-Free mode, which further simplifies the detection process. The detection head network calculates the enhanced features and ultimately outputs the confidence and location information of the target.
[0072] In order to solve the problem that the baseline model YOLOv8-n has a large number of parameters, high computational complexity, and difficulty in efficient deployment on terminal devices with limited computing power in steel defect detection tasks, this application proposes an innovative, efficient and lightweight surface defect detection model (Efficient and Compact Multi-Scale Convolution YOLO, ECMSC-YOLO). The network structure of this model is as follows Figure 2 As shown ( Figure 2Schematic diagram of the network structure of the defect detection model for industrial manufacturing in this application). First, this application performs offline enhancement on the dataset (which can be the NEU-DET dataset) and uses methods such as noise addition and bounding box rotation to improve the model's mAP@50 indicator by 3.0%. In response to the problem that YOLOv8 may cause the loss of fine-grained surface defects during the downsampling process, the ADown module (specifically named in YOLOv9) is used to replace the traditional downsampling module to enhance the feature extraction capability of the model. In order to reduce the number of parameters and the amount of computation of the C2f module, an ECMSC efficient and streamlined multi-scale convolution structure (i.e., the multi-scale convolution structure) is proposed, and the C2f module and Bottleneck module of the baseline model are reconstructed and optimized. This structure not only retains the advantages of traditional convolutional networks in extracting features at different scales, but also significantly reduces the amount of computation and parameters. In order to compensate for the performance degradation that may be caused by the lightweight process, a large-core attention mechanism (Lightweight Spatial Attention, LSKAttention) is introduced in front of the small target detection head. This mechanism effectively improves the model's ability to capture global information by expanding the receptive field. To further achieve lightweight performance, a Detail-Enhanced Shared Convolutional Detection Head (DESCDH) (i.e., an improved detection head structure) was designed. This structure significantly reduces model complexity while balancing accuracy and speed. Finally, an improved pruning algorithm (such as the Group_S1 pruning algorithm) further reduces the model size, making it more adaptable to resource-constrained devices while maintaining high accuracy.
[0073] In addition, it should be noted that Average Pooling (AvgPool) is a downsampling technique that divides the input image or feature map into several rectangular regions (also called local receptive fields, pooling kernels, or windows), then calculates the average of all values for each sub-region and uses the average as the output of the sub-region; Max Pooling (MaxPool) is similar to Average Pooling in that it also divides the input image or feature map into several rectangular regions. However, the difference is that Max Pooling outputs the maximum value for each sub-region instead of the average value; Downsampling refers to reducing the size of the input image or feature map, usually accompanied by reducing the spatial resolution of the image or feature. Its main purpose is to reduce the amount of computation and memory consumption, extract the main feature information, achieve invariance to translation, rotation, and scale, and improve the robustness of the model; In deep learning, convolution operations are usually used to extract features of input data (such as images or text). The convolution layer scans the input data by applying multiple convolution kernels (or called filters) and calculates the dot product between the convolution kernel and the local region of the input data to generate a feature map.
[0074] In order to solve the problem of imbalance in defect categories, the present application introduces a data enhancement algorithm to expand the complexity and diversity of the data set. Therefore, before the above-mentioned step S10 in this embodiment, it may also include: based on the data enhancement algorithm, performing pixel-level automatic orientation processing on the original input data set to obtain an adjusted input data set; performing grayscale processing, random cropping processing and silhouette adding processing on the adjusted input data set to obtain a processed input data set; randomly rotating the processed input data set according to a preset rotation range to obtain a rotated input data set; adding preset random noise to the rotated input data set to obtain an input feature map.
[0075] It should be noted that data augmentation algorithms can include online augmentation, Albumentations library augmentation, DIFFUSEMIX image augmentation, and Roboflow augmentation, all designed to improve model detection performance in complex industrial environments. Except for the online augmentation algorithm, the remaining three methods are offline augmentation algorithms.
[0076] For ease of understanding, the following examples are provided for illustration, but are not intended to limit the present invention's defect detection method for industrial manufacturing. This application performs data augmentation on the NEU-DET training set, expanding the training set size to twice its original size, thereby more comprehensively covering different defect features and enhancing the generalization ability of the model. Among them, the applied Roboflow method is a relatively comprehensive data augmentation strategy. It first performs pixel-level automatic orientation processing on the dataset to ensure the consistency of the sample orientation, and then grayscale processing is used to reduce the interference of color information on the model, so that the model can focus more on the texture features of surface defects. On this basis, the Roboflow method further performs a series of enhancement operations, including random cropping within the range of -15 degrees to +15 degrees, adding 3 silhouettes covering approximately 10% of the pixels to simulate occlusion scenes, random rotation within the range of -15 degrees to +15 degrees, and adding 0.1% random noise to some pixels to enhance the model's robustness to noise interference. Through these complex enhancement strategies, the Roboflow method can significantly improve the diversity of training data and the detection performance of the model.
[0077] Step S20: Process the multi-scale feature map according to the large-core attention mechanism and the improved detection head structure to obtain a defect detection feature map.
[0078] It should be noted that the large-core attention mechanism can flexibly process input feature maps, allowing the model to focus on key information in the input data. Large-core attention mechanisms can include channel attention mechanisms such as squeeze and excitation and efficient channel attention, self-attention mechanisms such as simplified self-attention and context transformer attention, and attention mechanisms that combine channel attention mechanisms with spatial attention mechanisms, such as convolutional block attention modules and bottleneck attention modules. Furthermore, the large-core attention mechanism can effectively expand the receptive field of the convolutional network, helping the network understand a wider range of contextual information and effectively capture a wider range of spatial information. This compensates for the shortcomings of the spatial attention mechanism, which focuses more on localized information and may lose some prior knowledge. In steel defect detection, images are easily affected by factors such as environmental spectral variations and noise, making it difficult for the model to distinguish between the environment and the target object. Rich contextual information can provide more comprehensive background information, helping the model better understand the relationship between the background and the target object in the image. Therefore, the large-core attention mechanism can effectively alleviate this problem. Furthermore, steel defect detection is usually performed on a small target. The enhanced receptive field of the large-core attention mechanism can accurately capture key features and improve sensitivity to small targets. Therefore, this application introduces a large-core attention mechanism placed in front of the improved detection head structure.
[0079] Step S30 , processing redundant features of the defect detection feature map by a pruning algorithm to obtain a target feature map, and obtaining a defect detection result according to the target feature map.
[0080] It should be noted that in deep learning models for steel defect detection, lightweight design can significantly improve the model's parameter count, computational complexity, and weight file size. However, despite lightweight processing, the model may still contain certain redundant features (or redundant parameters). These redundant features not only take up unnecessary storage space, but may also have a negative impact on the model's detection performance, increase computational overhead, and waste system resources. To address this issue, pruning algorithms, as an effective optimization method, can further reduce the model's parameter count while improving its performance.
[0081] Pruning algorithms are generally categorized into two main groups: weight pruning and structural pruning. Weight pruning reduces the number of model parameters by removing connections with small weights from the network. Common weight pruning methods include L1 pruning, random pruning, Slim pruning, and LAMP pruning. L1 pruning, based on the L1 norm, sorts the absolute values of network weights and removes connections with small weights, making it suitable for tasks with high sparsity. Random pruning randomly selects and removes some weights from the network. Slim pruning directly prunes unimportant channels or filters from the convolutional layer. LAMP pruning uses low-rank approximation to remove redundant low-rank matrix weights. Structural pruning reduces the complexity of the network structure by removing entire convolution kernels, channels, or network layers. This method can typically significantly reduce computational effort without significantly sacrificing performance. Common structural pruning algorithms include Group-Norm pruning, Group-Taylor pruning, Group-Hessian pruning, Group-Reg pruning, Group-Slim pruning, and Group-Seg pruning. Group-Norm pruning uses a group normalization-based method to determine which channels or layers contribute less, and then prunes them; Group-Taylor pruning uses the second-order derivative information of Taylor expansion to estimate the impact of each channel or layer on the loss function, and then prunes the parts with less influence; Group-Hessian pruning determines the second-order derivative of each layer or channel by calculating the Hessian matrix, and deletes those parts that have less influence on the loss function; Group-Reg pruning optimizes the network structure based on regularization and reduces redundant parameters; Group-Slim pruning is similar to traditional Slim pruning, but it prunes the entire group of convolution kernels or channels by group, while reducing computational complexity and retaining the most relevant features to the task; Group-Seg pruning retains the features most relevant to steel defect detection and reduces redundant parameters through segmented optimization and pruning strategies.
[0082] Furthermore, the defect detection result includes a first detection result and a second detection result. In this embodiment, the above-mentioned step S30 may include: sorting the absolute values of the network weights of the defect detection feature map based on global pruning of the pruning algorithm to obtain a sorting result; removing redundant features of the defect detection feature map according to the sorting result and the preset pruning rate to obtain a target feature map; determining unknown defects in the target feature map that are lower than a preset defect discrimination threshold, processing the unknown defects through a preset classification strategy to obtain a first detection result; and obtaining a second detection result based on known defects in the target feature map that are not lower than the preset defect discrimination threshold.
[0083] It can be understood that the process of optimizing defect detection models for industrial manufacturing based on pruning algorithms involves: first, using a global pruning method to sort the absolute values of the network weights in the defect detection feature map to determine which weights are important and which are potentially redundant. Next, based on this sorting result and a pre-set pruning rate, features deemed redundant are removed, resulting in a more streamlined and effective target feature map. The goal of this step is to reduce the complexity of the feature map while retaining as much information as possible that is useful for defect detection.
[0084] Then, within the resulting target feature map, unknown defects below a preset defect discrimination threshold are identified. These unknown defects are processed using a preset classification strategy to obtain a first detection result. This classification strategy may include classifying the unknown defect into the closest known defect category or applying special processing based on a specific rule. Meanwhile, known defects within the target feature map that are at or above the preset defect discrimination threshold are directly processed to obtain a second detection result. Because these defects have reached or exceeded the discrimination threshold, they are considered known and clearly identifiable defects.
[0085] It should be noted that the diversity and complexity of steel surface defects means that the model faces a large number of defect types that have never appeared in the training dataset in practical applications. For example, due to factors such as environmental changes and process differences during the production process, certain new and unknown types of surface defects may appear during the detection process. Due to the supervised learning mechanism of deep learning models, new defects that do not appear in the training data may be misclassified as known categories, resulting in erroneous detection results. To address this problem, a preset classification strategy for unknown defects can be introduced. When the probability of the model identifying a defect is lower than the set threshold, it is classified as an unknown defect. This can effectively avoid misjudgments and provide more accurate detection results.
[0086] This embodiment enhances feature extraction capabilities based on average pooling and maximum pooling, uses a multi-scale convolutional structure to reduce the number of parameters, and uses a large-core attention mechanism and an improved detection head structure to reduce computational complexity while taking into account both accuracy and speed. It also uses a pruning algorithm to further achieve lightweighting.
[0087] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above embodiment 1 can be referred to the above introduction and will not be described in detail later. Figure 3 , the step S20 may include steps S201 to S203:
[0088] In step S201, based on the large-core attention mechanism, the multi-scale feature map is processed through a large-core convolution layer to obtain a spatial attention map, and a multi-scale enhanced feature map is obtained based on the spatial attention map.
[0089] It can be understood that the input multi-scale feature map is processed by the large-kernel convolutional layer. The large-kernel convolutional layer is designed to capture a wide range of spatial information in the feature map, thereby generating a spatial attention map. This spatial attention map reflects the importance of different spatial locations, that is, which areas are more critical for subsequent processing. Based on this spatial attention map, the original multi-scale feature map can be weighted to emphasize important spatial regions and suppress unimportant ones, ultimately obtaining an enhanced multi-scale feature map.
[0090] In this embodiment, the above-mentioned step S201 may include: decomposing the large kernel convolution layer through the large kernel attention mechanism to obtain a smaller depth convolution; dividing the multi-scale feature map into different sub-feature maps, applying the depth convolution to the sub-feature map to obtain a multi-scale output feature map; obtaining a spatial attention map based on the multi-scale output feature map; processing the spatial attention map through an activation function to determine a spatial selection weight; performing an element-by-element product operation on the spatial selection weight and the sub-feature map to obtain a multi-scale enhanced feature map.
[0091] It should be understood that the large kernel convolution layer is decomposed based on the large kernel attention mechanism and converted into a smaller depth convolution. Next, the multi-scale feature map is divided into different sub-feature maps, each of which is independently applied with depth convolution to obtain a multi-scale output feature map. These output feature maps are then used to generate spatial attention maps, which are processed by an activation function to determine the spatial selection weights. These weights are element-wise multiplied with the original sub-feature map to weightedly emphasize important spatial regions and generate multi-scale enhanced feature maps.
[0092] Furthermore, the step of obtaining a spatial attention map based on the multi-scale output feature map may include: performing average pooling on the multi-scale output feature map to obtain a first spatial relationship feature map, and performing maximum pooling on the multi-scale output feature map to obtain a second spatial relationship feature map; cascading the first spatial relationship feature map and the second spatial relationship feature map to obtain a cascaded spatial relationship feature map; and converting the cascaded spatial relationship feature map through a conversion function to obtain a spatial attention map.
[0093] For example, the working principle of the large core attention mechanism is as follows Figure 4 As shown ( Figure 4 (Schematic diagram of the large-core attention mechanism for the defect detection method for industrial manufacturing in this application) A large kernel is decomposed into 2 deep convolutions to obtain a wide receptive field with different features, which helps to subsequently select kernels of different sizes. Compared with using a single kernel, decomposing a large kernel can effectively reduce the number of parameters in the model. In addition, the large-core attention mechanism can dynamically select a suitable kernel based on the features possessed by the input target, thereby adapting to the contextual information of different target objects. In order to dynamically select a suitable kernel, the large-core attention mechanism divides the input features into different sub-feature maps, and then applies different deep convolutions to these sub-feature maps to obtain different output feature maps. These features obtained from different kernels are then cascaded with different receptive field ranges.
[0094] Under this operation, spatial relationship extraction is performed based on a combination of channel average pooling and maximum pooling operations, which are converted into spatial attention maps to ensure that they have the same number of depth convolutions. Finally, these spatial attention maps are passed through an activation function (which can be a sigmoid activation function) to obtain different spatial selection weights. The final output is the element-by-element product of the spatial selection weights and the sub-feature map, i.e., a multi-scale enhanced feature map.
[0095] Step S202: input the multi-scale enhanced feature map into the improved detection head structure, and extract features of the multi-scale enhanced feature map through the shared convolution layer of the improved detection head structure.
[0096] Step S203: enhance the details of the feature by using a deconvolution algorithm to obtain an enhanced feature, and perform a dynamic scaling operation on the enhanced feature to obtain a defect detection feature map.
[0097] In the application scenario of steel defect detection, steel surface defects such as cracks, pores, inclusions, etc. are usually manifested as small and delicate features. The detection model needs to take into account both accuracy and speed, which often places high demands on computing resources and inference time. In the baseline model, the parameters of the detection head account for 24.9% of the total network parameters, while the computational cost is as high as 36.3%. In order to further reduce the complexity of the model and improve its applicability on resource-constrained devices, this application proposes a new lightweight detection head structure (i.e., an improved detection head structure), which enables different branches to share part of the convolutional layer, thereby reducing the number of parameters and computational cost of the detection head, while improving the computational efficiency of the model.
[0098] In order to further improve model efficiency, reduce redundant calculations, and enhance detection accuracy, a deconvolution algorithm was introduced to further optimize the details of the feature map and improve multi-scale detection capabilities, thereby improving the overall performance of the model. The deconvolution algorithm can restore details in low-resolution feature maps and enhance the spatial resolution of feature maps, thereby improving detection accuracy. In particular, in steel defect detection, many defects appear as subtle cracks, tiny pores, or inclusions, which are usually difficult to detect in low-resolution feature maps. Deconvolution can help the model restore these tiny features and enhance its detection capabilities. In addition, the deconvolution operation can effectively refine edge information and reduce the ambiguity of defect boundaries, thereby improving the model's adaptability to defects in complex backgrounds and reducing the interference of background noise on the model.
[0099] To further enhance the model's multi-scale detection capabilities, a scale layer can be introduced on top of shared convolutions to dynamically scale features. By dynamically scaling features, the scale layer enables the detector to adapt to defects of varying sizes, further enhancing the model's robustness and accuracy at multiple scales. This design not only effectively reduces the number of parameters and computational overhead, but also significantly improves the efficiency of the improved detection head structure and the overall robustness of the model.
[0100] This embodiment is based on a large-core attention mechanism. It processes multi-scale feature maps through a large-core convolution layer to obtain a spatial attention map. Based on the spatial attention map, a multi-scale enhanced feature map is obtained. The multi-scale enhanced feature map is input into the improved detection head structure. The features of the multi-scale enhanced feature map are extracted through the shared convolution layer of the improved detection head. The features are enhanced in detail through a deconvolution algorithm to obtain enhanced features. The enhanced features are then dynamically scaled to obtain a defect detection feature map. This allows the feature map to be processed through the large-core attention mechanism before entering the detection head to enhance the model's understanding of contextual information and improve sensitivity to small targets, thereby accurately capturing key defect features. The feature map processed by the large-core attention mechanism enters the improved detection head structure, which uses a shared convolution structure to reduce the number of parameters and computational complexity. At the same time, the introduction of the deconvolution algorithm and scaling operation further enhances the feature map's details and multi-scale detection capabilities.
[0101] Based on the first embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those in the above embodiment 1 can be referred to the above introduction and will not be described in detail later. Figure 5 , the step S10 may include steps S101 to S104:
[0102] Step S101: downsample the input feature map through average pooling to obtain an initial feature map.
[0103] It should be understood that traditional convolutional neural networks typically require a large number of parameters and floating-point operations to achieve acceptable accuracy, which often results in a significant amount of redundant information when generating intermediate feature maps. Downsampling plays a crucial role in defect detection by reducing the size of feature maps while retaining key defect signature information. This reduces the computational load and model parameters, thereby accelerating network training and inference.
[0104] Step S102: Obtain a target down-sampled feature map based on the initial feature map, maximum pooling, and point-by-point convolution.
[0105] In the YOLOv8 network, convolution operations are used for downsampling. However, this method may lead to the loss of fine-grained surface defect information, especially when there are complex tiny defects on the steel surface. The loss of details will significantly affect the detection performance. In addition, the steel surface defect dataset (i.e., the input feature map) contains a variety of surface defects, some of which are very small and highly localized. Therefore, the loss of fine-grained surface defect information may significantly affect the detection accuracy of the model. To solve this problem, this application improves YOLOv8 and enhances the feature extraction capability of the model through the ADown module.
[0106] For easier understanding, refer to Figure 6 To explain, Figure 6 This is a schematic diagram of the downsampling defect detection method for industrial manufacturing in this application. Specifically, the ADown module improves the downsampling process in the following ways: First, the input feature map is downsampled using average pooling to reduce its size by half. After downsampling, the feature map is divided into two parts along the channel dimension: ×1 and ×2. Next, a 3×3 convolution operation is applied to the ×1 part for feature extraction and dimensionality reduction; in the ×2 part, maximum pooling and 1×1 pointwise convolution are used to enhance the nonlinear feature representation and further reduce the dimension. Finally, the two convolved partial feature maps are spliced together to generate the output of the ADown module, which is the target downsampled feature map. Therefore, in this embodiment, the above-mentioned step S102 may include: dividing the initial feature map along the channel dimension to obtain a first feature part and a second feature part; performing feature extraction and dimensionality reduction processing on the first feature part to obtain a first down-sampled output; performing feature enhancement and dimensionality reduction processing on the second feature part through maximum pooling and point-by-point convolution to obtain a second down-sampled output; and obtaining a target down-sampled feature map by splicing the first down-sampled output and the second down-sampled output.
[0107] Compared to traditional convolutional downsampling methods, the ADown module combines maximum pooling and average pooling to more comprehensively extract steel surface defect features. Furthermore, the ADown module employs a multi-branch structure, enhancing the network's flexibility and enabling the model to better capture surface defect information of varying scales and types. This variable downsampling approach helps improve the model's detection capability and robustness for steel surface defects, particularly in complex backgrounds and with diverse defects.
[0108] Step S103: reconstruct the backbone feature extraction network of the original convolutional neural network based on the multi-scale convolution structure to obtain a reconstructed network.
[0109] To improve the lightweightness of the C2f module and reduce the computational burden, this application proposes an efficient and streamlined multi-scale convolutional structure for reconstructing the Bottleneck and C2f modules in the original network. By extracting information at multiple scales, the multi-scale convolutional structure not only maintains the advantages of traditional convolutional networks in extracting features at different scales, but also significantly reduces the amount of computation and parameters. By grouping the input feature maps, the multi-scale convolutional structure significantly reduces the computational burden of each convolution layer.
[0110] Step S104: performing a group convolution operation on the target downsampled feature map through the reconstructed network to obtain a multi-dimensional feature map.
[0111] The multi-scale convolution structure of the reconstructed network is as follows Figure 7 As shown ( Figure 7 (This figure shows the multi-scale convolutional architecture of the defect detection method for industrial manufacturing in this application.) The input feature map is divided into multiple groups, each of which undergoes independent convolution. In this way, convolution kernels of different scales can simultaneously extract features of different sizes, enabling the model to better capture defects of varying sizes in steel defect detection tasks.
[0112] In a multi-scale convolutional architecture, grouped feature maps are fed into multiple convolution kernels of different sizes for processing. The multiple modules in the figure illustrate this process, with each kernel focusing on extracting features at a different scale. For example, smaller kernels specialize in capturing fine defects, while larger kernels are capable of processing larger defects. The convolution results of different scales are aggregated and concatenated to form a feature map containing multi-scale information. This design effectively improves the ability to identify different types of defects.
[0113] Furthermore, in this embodiment, the above-mentioned step S104 may include: based on the reconstructed network, dividing the target downsampled feature map into multiple groups of feature maps; extracting different size features of the multiple groups of feature maps through convolution kernels of different scales, and obtaining an initial multi-scale feature map based on the different size features; based on the original number of channels of the input feature map, splicing the initial multi-scale feature map in the channel dimension to obtain a multi-scale feature map.
[0114] To effectively fuse information from different channels, the multi-scale convolutional architecture employs 1x1 convolutions for dimensionality increase and reduction. This process is achieved through a layer of 1x1 convolution, which merges the multiple feature channels generated by the multi-scale convolution and maps them back to the original number of channels. This operation not only ensures the fusion of features at all scales but also further enhances the network's expressive power, making it more adaptable to complex defect detection tasks. Furthermore, the design of the multi-scale convolutional architecture includes an extension of group convolution, which further improves computational efficiency by assigning multiple convolution kernels to different channel groups.
[0115] To verify the effectiveness of this application, a series of experiments were conducted, including data augmentation algorithm experiments, model lightweighting effect experiments, detection head comparison experiments, and pruning algorithm comparison experiments, as follows:
[0116] 1. Experimental Environment
[0117] This application built an experimental platform based on the PyTorch deep learning framework and the YOLOv8n baseline network on a Linux server. The specific experimental environment configuration is shown in Table 1, and the detailed configuration of hyperparameters can be found in Table 2.
[0118] Table 1 Training environment data
[0119] Environmental Parameter Value Operating system Ubuntu 22.04.3LTS CPU x86_64 GPU NVIDIA GeForce RTX 3060 RAM 48GB Programming language Python 3.10.12 Deep learning framework 2.3.1+cu121 CUDA CUDA 12.1
[0120] Table 2 Detailed configuration of hyperparameters
[0121] Hyperparameters value Learning Rate 0.01 Image Size 640×640 Momentum 0.937 Optimizer SGD Batch Size 16 Epoch 300 Weight Decay 0.0005 CPU threads 8 Patience 50
[0122] 2. Dataset and Evaluation Metrics
[0123] To verify the effectiveness of this model, this application used the NEU-DET dataset for validation. The dataset has different characteristics in terms of background interference, illumination variation, and target detection scale, which can well simulate the complex task challenges in real-life scenarios. The dataset was divided into training, validation, and test sets in an 8:1:1 ratio.
[0124] It should be noted that NEU-DET is a public steel surface defect dataset containing 1,800 images, covering 6 types of defects, with 300 images of each defect, and a resolution of 200×200 pixels.
[0125] In order to comprehensively evaluate the performance of the model, this application adopts the evaluation indicators commonly used in the field of target detection, including Precision (P), Recall (R), Average Precision (AP) and Mean Average Precision (mAP). Among them, Precision is used to measure the accuracy of the model's prediction, that is, the proportion of samples predicted as positive that are actually positive; Recall is used to measure the recall ability of the model, that is, the proportion of correct predictions among actual positive samples. AP represents the average precision of a single category under different thresholds, reflecting the overall detection ability of the model for that category; mAP is the average of APs of all categories, which comprehensively considers Precision and Recall, and more comprehensively reflects the detection effect of the model in multi-category scenarios. mAP@50 represents the average precision when the IoU threshold is 0.5, while mAP@50-95 calculates the average precision under stricter evaluation criteria by using IoU thresholds from 0.5 to 0.95 with a step size of 0.05, which evaluates the model performance in more detail.
[0126] To comprehensively assess the lightweighting effect of the model, this application also introduces evaluation metrics such as model parameters, model size, and computational efficiency (GFLOPs). Parameters represents the total number of trainable parameters in the model, which is directly related to storage requirements and computational overhead. GFLOPs (Giga Floating Point Operations) measures the number of floating-point operations required for a single forward pass, reflecting the computational complexity of the model. Lower Parameters and GFLOPs indicate a smaller model and lower computational cost.
[0127] 3. Data augmentation algorithm experiment
[0128] The experimental results are shown in Table 3. The online augmentation algorithm performed the worst, achieving a P-index of only 35.4%, an R-index of 42.1%, and mAP@50 and mAP@50-95 of 37.5% and 14.8%, respectively. This poor performance may be due to the fact that augmented samples are only dynamically generated during training, using a simple augmentation strategy. This results in insufficient diversity and complexity in the generated samples, making it difficult to fully enhance the model's ability to learn complex defect features. In contrast, the Albumentations method achieved the best R-index, reaching 78.1%, and mAP@50 and mAP@50-95 of 79.4% and 45.9%, respectively. The diffusion model further improved the overall performance, achieving a P-index of 80.4%, mAP@50 of 80.1%, and mAP@50-95 of 46.4%, respectively, outperforming the Albumentations method in multiple metrics. The Roboflow method achieved the most significant data augmentation results, particularly in terms of mAP, with mAP@50 increasing to 80.5%, a 3.0% improvement over the baseline model, and mAP@50-95 increasing to 48.6%, a 3.2% improvement over the baseline model. Furthermore, the R metric reached 78.0%, and while the P metric was slightly lower than the diffusion model (74.6%), the overall detection performance was the most balanced. The Roboflow method effectively expanded the complexity and diversity of the training data through diverse augmentation strategies (such as grayscale, random rotation, and silhouette addition).
[0129] Table 3 Effect of different data augmentation algorithms on model detection performance of NEU-DET
[0130] Data augmentation algorithms P(%) R(%) mAP@50(%) mAP@50-95(%) Baseline Model 77.6 69.3 77.5 45.4 Online Enhancement 35.4 42.1 37.5 14.8 Albumentations 74.7 78.1 79.4 45.9 Diffusion Model 80.4 72 80.1 46.4 Roboflow 74.6 78 80.5 48.6
[0131] 4. Model lightweight effect experiment
[0132] Figure 8 ( Figure 8(Schematic diagram of the lightweight effect of the defect detection method for industrial manufacturing in this application) intuitively demonstrates the lightweight effect of the defect detection method for industrial manufacturing (ECMSC-YOLO) in the defect detection of steel for industrial manufacturing, and compares the parameter amount and computational amount of each module of ECMSC-YOLO and YOLOv8n models. The figure includes the number of network layers (Layers), module name (Modules), the computational amount of each module (GFLOPs) and the parameter amount (Params). Through these comparisons, it can be clearly seen that ECMSC-YOLO has significant advantages in lightweighting. In the Backbone module, the parameter amount decreased by 27.24% and the computational amount decreased by 19.21%; in the Neck module, the parameter amount decreased by 5.65% and the computational amount only increased by 1.00%; and in the Head module, the parameter amount decreased by 59.47% and the computational amount increased by 94.3%. Overall, ECMSC-YOLO has achieved a significant reduction in the parameter amount and computational amount of each module. These optimizations not only significantly reduce the model's computational burden and parameter count, but also ensure that the model can run efficiently on terminal devices with limited computing resources, thereby greatly improving its feasibility and practicality in actual industrial applications such as defect detection in steel for industrial manufacturing.
[0133] 5. Detection head comparison experiment
[0134] Table 4 shows the comparative results of different lightweight detection heads (LSCD, LSCSBD, RSCD, LADH, and DESCDH) in steel defect detection for industrial manufacturing. As can be seen from the table, DESCDH (i.e., the improved detection head structure) demonstrates superiority in multiple aspects, particularly in detection accuracy and computational efficiency. Compared with other detection heads, DESCDH performs best in mAP@50, reaching 81.7%, significantly exceeding LSCD (80.1%) and LSCSBD (79.4%), with improvements of 1.6% and 2.3%, respectively. DESCDH also performs best in terms of computational complexity, with 5.4 GFLOPs, lower than RSCD's 8.2 and LADH's 5.8, demonstrating that it can achieve higher detection accuracy with a lower computational burden, demonstrating a good balance.
[0135] Table 4 Comparative experimental results of different lightweight detection heads
[0136]
[0137] 6. Comparative Experiments on Pruning Algorithms
[0138] To evaluate the impact of different pruning methods on model weight reduction, six pruning methods, including L1, Lamp, Random, Group-Hessian, Group-Norm, and Group_Taylor, were used to optimize the model. Aside from the different pruning ratios, all other parameters remained consistent. Table 5 shows that, with the exception of Group-Hessian pruning, the other pruning methods not only effectively reduced the model's parameter count and computational complexity, but also achieved varying degrees of improvement in the mAP@50 and mAP@50-95 metrics, demonstrating that pruning helps remove redundant information and thus enhances the model's detection performance. L1 pruning achieved the most significant improvements in mAP@50 and mAP@50-95, increasing by 0.6% and 0.5%, respectively. Considering the overall performance of the model in terms of detection performance and weight reduction, L1 pruning performed optimally.
[0139] Table 5 Experimental results of six pruning algorithms
[0140]
[0141] During model compression, whether to eliminate critical network layers remains a key challenge in pruning. Global pruning considers the sparsity of weights across the entire model and uniformly filters parameters across all layers, aiming to eliminate redundant parameters. Local pruning, on the other hand, independently prunes each layer, typically focusing on redundancy within a single layer. The key differences between the two lie in the scope of pruning and its impact on the model structure. Experiments show that enabling global pruning improves model performance. In particular, on the mAP@50 and mAP@50-95 evaluation metrics, the pruned model's performance not only maintains no degradation but actually improves by 0.6% and 0.5%, respectively. Although global pruning slightly increases the number of parameters compared to local pruning, it reduces the number of parameters by 2.57%, the computational overhead by 9.3%, and the weight file size by 3.2% compared to the pre-optimized model. This demonstrates that global pruning can further improve model accuracy and overall performance while maintaining computational efficiency.
[0142] In summary, compared with existing models, the defect detection method for industrial manufacturing proposed in this paper achieves the best balance between accuracy, lightweight and detection speed, and demonstrates excellent performance on the public dataset NEU-DET. It has broad application prospects and can effectively improve the production efficiency and quality control level of intelligent manufacturing, and has the potential for practical industrial application.
[0143] This embodiment downsamples the input feature map by combining average pooling and maximum pooling while retaining key defect feature information. The multi-branch structure enhances the flexibility of the network and improves the model's ability to capture surface defects of different scales and types.
[0144] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the defect detection method for industrial manufacturing of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0145] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned defect detection method for industrial manufacturing when executed by a processor.
[0146] The computer program product provided in this application can address the high computational complexity of existing defect detection models for industrial manufacturing. Compared to the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the defect detection methods for industrial manufacturing provided in the aforementioned embodiments, and are not further elaborated here.
[0147] The above descriptions are only some embodiments of the present application and do not limit the patent scope of the present application. All equivalent structural transformations made by using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A defect detection method for industrial manufacturing, characterized in that: The method comprises the following steps: Determine a target downsampled feature map of the input feature map based on average pooling and maximum pooling, and perform a grouped convolution operation on the target downsampled feature map based on a multiscale convolution structure to obtain a multiscale feature map; According to the large-core attention mechanism and the improved detection head structure, the multi-scale feature map is processed to obtain a defect detection feature map; The redundant features of the defect detection feature map are processed by a pruning algorithm to obtain a target feature map, and a defect detection result is obtained according to the target feature map.
2. The defect detection method for industrial manufacturing according to claim 1, characterized in that: The step of processing the multi-scale feature map according to the large-core attention mechanism and the improved detection head structure to obtain the defect detection feature map includes: Based on the large-core attention mechanism, the multi-scale feature map is processed by a large-core convolution layer to obtain a spatial attention map, and a multi-scale enhanced feature map is obtained based on the spatial attention map; Inputting the multi-scale enhanced feature map into the improved detection head structure, and extracting features of the multi-scale enhanced feature map through the shared convolutional layer of the improved detection head structure; The features are enhanced in detail by using a deconvolution algorithm to obtain enhanced features, and the enhanced features are dynamically scaled to obtain a defect detection feature map.
3. The defect detection method for industrial manufacturing according to claim 2, characterized in that: The steps of processing the multi-scale feature map through a large kernel convolution layer based on the large kernel attention mechanism to obtain a spatial attention map, and obtaining a multi-scale enhanced feature map based on the spatial attention map include: The large-core convolution layer is decomposed through the large-core attention mechanism to obtain smaller depth convolution; Dividing the multi-scale feature map into different sub-feature maps, applying the depthwise convolution to the sub-feature maps to obtain a multi-scale output feature map; Obtaining a spatial attention map based on the multi-scale output feature map; Processing the spatial attention map through an activation function to determine a spatial selection weight; An element-by-element product operation is performed on the spatial selection weight and the sub-feature map to obtain a multi-scale enhanced feature map.
4. The defect detection method for industrial manufacturing according to claim 3, characterized in that: The step of obtaining a spatial attention map based on the multi-scale output feature map comprises: Performing average pooling on the multi-scale output feature map to obtain a first spatial relationship feature map, and performing maximum pooling on the multi-scale output feature map to obtain a second spatial relationship feature map; cascading the first spatial relationship feature map and the second spatial relationship feature map to obtain a cascaded spatial relationship feature map; The cascaded spatial relationship feature map is transformed by a transformation function to obtain a spatial attention map.
5. The defect detection method for industrial manufacturing according to any one of claims 1 to 4, characterized in that: The step of determining a target downsampled feature map of the input feature map based on average pooling and maximum pooling, and performing a grouped convolution operation on the target downsampled feature map based on a multiscale convolution structure to obtain a multiscale feature map includes: Downsample the input feature map through average pooling to obtain the initial feature map; Obtaining a target downsampled feature map based on the initial feature map, maximum pooling, and point-by-point convolution; Based on the multi-scale convolution structure, the backbone feature extraction network of the original convolutional neural network is reconstructed to obtain the reconstructed network; The reconstructed network is used to perform a group convolution operation on the target downsampled feature map to obtain a multi-dimensional feature map.
6. The defect detection method for industrial manufacturing according to claim 5, characterized in that: The step of performing a group convolution operation on the target downsampled feature map through the reconstructed network to obtain a multi-scale feature map includes: Based on the reconstructed network, the target downsampled feature map is divided into multiple groups of feature maps; Extracting different-scale features of multiple sets of feature maps through convolution kernels of different scales, and obtaining an initial multi-scale feature map based on the different-scale features; Based on the original number of channels of the input feature map, the initial multi-scale feature map is spliced in the channel dimension to obtain a multi-scale feature map.
7. The defect detection method for industrial manufacturing according to claim 5, characterized in that: The step of obtaining a target downsampled feature map based on the initial feature map, maximum pooling, and point-by-point convolution includes: Dividing the initial feature map along the channel dimension to obtain a first feature part and a second feature part; Performing feature extraction and dimensionality reduction processing on the first feature part to obtain a first down-sampled output; Performing feature enhancement and dimensionality reduction processing on the second feature part by maximum pooling and point-by-point convolution to obtain a second down-sampled output; A target down-sampled feature map is obtained by concatenating the first down-sampled output and the second down-sampled output.
8. The defect detection method for industrial manufacturing according to any one of claims 1 to 4, characterized in that: The defect detection result includes a first detection result and a second detection result. The step of processing redundant features of the defect detection feature map by a pruning algorithm to obtain a target feature map, and obtaining the defect detection result according to the target feature map includes: Based on the global pruning of the pruning algorithm, the network weight absolute values of the defect detection feature map are sorted to obtain the sorting results; Remove redundant features of the defect detection feature map according to the sorting result and a preset pruning rate to obtain a target feature map; Determine unknown defects in the target feature image that are lower than a preset defect discrimination threshold, process the unknown defects using a preset classification strategy, and obtain a first detection result; A second detection result is obtained based on known defects in the target feature map that are not lower than the preset defect discrimination threshold.
9. The defect detection method for industrial manufacturing according to any one of claims 1 to 4, characterized in that: Before the step of determining a target downsampled feature map of the input feature map based on average pooling and maximum pooling, and performing a grouped convolution operation on the target downsampled feature map based on a multiscale convolution structure to obtain a multiscale feature map, the method further includes: Based on the data enhancement algorithm, the original input data set is automatically oriented at the pixel level to obtain the adjusted input data set; Performing grayscale processing, random cropping processing, and silhouette adding processing on the adjusted input data set to obtain a processed input data set; Randomly rotating the processed input data set according to a preset rotation range to obtain a rotated input data set; Preset random noise is added to the rotated input data set to obtain an input feature map.
10. A computer program product, characterized in that The computer program product includes a defect detection program for industrial manufacturing, and when the defect detection program for industrial manufacturing is executed by a processor, the defect detection method for industrial manufacturing according to any one of claims 1 to 9 is implemented.