A surface defect detection method for steel products based on FPDNet
Through the FPDNet-based detection method, using the YOLOv8 framework and HGNetv2 feature extractor, combined with GhostConv and SIoU loss functions, the problems of speed and accuracy in surface defect detection of steel products are solved, and real-time and efficient detection effects are achieved.
Patent Information
- Application Number
- CN202410952226.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2044-07-16
AI Technical Summary
Existing surface defect detection methods for steel products are difficult to achieve fast and accurate real-time detection. Traditional methods have the problems of slow detection speed, great harm to workers and difficulty in achieving real-time online detection.
A detection method based on FPDNet and the YOLOv8 target detection framework were adopted to design a hot-rolled strip surface defect target detection model that includes deformable convolution and attention mechanism. The HGNetv2 network was selected as the feature extractor, and GhostConv was used for lightweighting. The SIoU loss function was combined for training to optimize the detection model.
It achieves high-precision detection of surface defects of steel products at real-time production line speed, improves detection speed and accuracy, and reduces the number of model parameters.
Smart Images

Figure CN118840345B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of steel surface defect detection, and in particular to a steel product surface defect detection method based on FPDNet. Background Art
[0002] Hot-rolled strip is a major steel product, widely used in industry, agriculture, transportation, and construction. During the production process, surface defects that affect product quality are often generated due to factors such as raw materials, production processes, and environmental conditions. Six typical surface defects commonly occur on strip: cracks, scratches, mill scale, plaque, surface opacity, and inclusions. These defects can impair product performance and reduce quality. Therefore, the rapid and accurate classification and location of strip surface defects is crucial for improving hot-rolled strip quality.
[0003] Traditional methods for detecting surface defects in steel strip include manual inspection, infrared testing, eddy current testing, and magnetic flux leakage testing. However, these traditional methods suffer from slow detection speeds, hazards to workers, and difficulty implementing real-time online detection, thus limiting improvements in production efficiency. In recent years, with advances in artificial intelligence (AI), deep learning-based object detection methods have gradually replaced traditional detection methods. Utilizing deep learning-based strip surface defect detection algorithms can not only improve the automation level and production efficiency of steel strip production lines, but also significantly reduce the workload and labor costs of quality inspectors, offering broad application prospects.
[0004] In recent years, with the widespread application of deep learning technologies such as convolutional neural networks, target detection technology is constantly breaking through the technical limitations of traditional detectors and developing rapidly in the direction of lightweight, real-time and robustness. Among them, the two-stage target detection algorithm performs well in terms of accuracy, but a large number of candidate regions need to be generated during the inference process, which increases the amount of calculation and time complexity, resulting in a relatively slow speed and difficulty in meeting real-time detection scenarios. The single-stage target detection algorithm is faster than the two-stage target detection algorithm, but it has the disadvantage of insufficient detection accuracy. Therefore, in order to achieve the speed and accuracy of the strip surface defect detection algorithm, the present invention proposes a steel product surface defect detection method based on FPDNet. Summary of the Invention
[0005] The technical problem to be solved by the present invention is how to detect surface defects of steel products with high precision and meeting the requirements of real-time production line speed. A method for detecting surface defects of steel products based on FPDNet is provided.
[0006] The present invention solves the above technical problems through the following technical solutions, which include the following steps:
[0007] S1: Collect data samples from the strip surface defect image dataset and preprocess the samples;
[0008] S2: Based on the YOLOv8 object detection framework, a hot-rolled strip surface defect target detection model was designed that incorporates deformable convolution and attention mechanisms. The HGNetv2 network was selected as the feature extractor for the target detection model, and GhostConv was used to lightweight the backbone network.
[0009] S3: Use the training set to train the steel surface defect target detection model to obtain the optimal detection model;
[0010] S4: Evaluate the optimal detection model on the test set and output the detection results and detection speed.
[0011] Furthermore, in step S1, the strip surface defect image dataset is NEU-DET, which includes six types of hot-rolled strip surface defects, namely cracks, pressed scale, pitting, plaques, inclusions, and scratches.
[0012] Furthermore, in step S1, the specific processing process is as follows:
[0013] S11: acquiring data samples from a hot-rolled strip surface defect image dataset, and dividing the acquired data samples into a training set and a test set according to a set ratio;
[0014] S12: Perform mosaic data augmentation on the images in the training set and adjust the size of the processed images to the set size.
[0015] Furthermore, in step S2, the specific processing process is as follows:
[0016] S21: Based on the YOLOv8 target detection framework, the backbone network HGNetv2 is selected as the feature extractor;
[0017] S22: Use the GhostConv convolution module to replace the standard convolution layer of the HG block in the backbone network HGNetv2;
[0018] S23: Design a CEDLAM module that includes deformable convolution and attention mechanism, and replace all C2f modules in the neck network with CEDLAM modules;
[0019] S24: Use the SIoU loss function instead of the traditional bounding box regression loss function to obtain the final object detection model.
[0020] Furthermore, in step S21, the backbone network HGNetv2 includes a Stem module and four HG layers. The Stem module is the initial preprocessing layer of the network, that is, the first layer. The second to fifth layers are HG layers. Each HG layer includes at least one HG block. The HG block includes multiple standard convolutional layers. Among them, the third to fifth layers first pass through the depth-wise separable convolution module DWconv and then pass through the HG block.
[0021] Furthermore, in step S22, in the GhostConv convolution module, a standard convolution operation is first performed to convert the input feature map into a smaller number of main feature maps, and a set of linear transformations are applied to each main feature map to generate more ghost feature maps; finally, the main feature map and the ghost feature map are merged to form the final output feature map.
[0022] Furthermore, in step S23, in the CEDLAM module, the input is first passed through a 1×1 convolution layer to adjust the dimension of the feature map, and then the feature map is divided into two equal parts; the first part does not perform any operation, the second part passes through three bottleneck layers in sequence, and finally the feature map obtained by the first and second parts is spliced, and then the 1×1 convolution kernel is used to restore the dimension of the feature map, wherein, in the bottleneck layer, it first passes through a 3×3 convolution layer, then passes through the DCNv2 deformable convolution layer and the MPCA attention layer, and then the input of the bottleneck layer is added to the feature map after passing through the bottleneck layer through the residual mechanism.
[0023] Furthermore, the calculation formula of the DCNv2 deformable convolutional layer is as follows:
[0024]
[0025] Among them, p represents the center position of the convolution kernel currently processed, K represents the K sampling positions of the convolution kernel, and w k and p k Represent the weight of the K-th sampling position and the pre-set offset, Δp k and Δm k are the learnable offset and modulation scalar of the K-th sampling position, respectively, and x represents the input feature map.
[0026] Furthermore, in the MPCA attention layer, the input feature map first passes through the global average pooling layer in the horizontal and vertical directions respectively to obtain the feature map in the width and height directions; in addition, the input feature map passes through the global average pooling branch, which passes through the global average pooling layer and the 1x1 convolution layer to obtain the global attention weight; then the feature map in the width direction is transposed and then stacked with the feature map in the height direction, and the stacked feature map is subjected to convolution, normalization and activation function operations to obtain the feature map; then the feature map passes through the enhanced width and height dimensional branch, which enhances the feature map through the 3×3 convolution layer. After the feature map, sigmoid is taken to obtain the enhanced attention weight, which is split into wide and high-dimensional enhanced attention weights; in addition, the feature map is split into wide and high-dimensional feature maps, and the number of channels is adjusted using a 1×1 convolution layer. Then, the sigmoid is taken to obtain the enhanced wide and high-dimensional attention weights; the global attention weight is then enhanced by multiplying the enhanced wide and high-dimensional attention weights by the global attention weight; finally, the input feature map is multiplied by the global attention weight and the enhanced wide and high-dimensional attention weights to obtain the output feature map.
[0027] Furthermore, in step S3, the specific processing process is as follows:
[0028] S31: Input the training set into the steel surface defect target detection model and use the Adam optimization algorithm for parameter learning and updating;
[0029] S32: After the training is completed, the model weights with the best performance are saved.
[0030] Furthermore, in step S32, the loss function during training adopts the SIoU loss function, which is specifically expressed as follows:
[0031]
[0032] Where Λ is the angle loss, which is expressed as follows:
[0033] Λ=1-2*sin 2 (arcsinx-π / 4)
[0034] in, c h is the height difference between the real frame and the predicted frame, σ is the distance between the center point of the real frame and the predicted frame, α is the horizontal angle between the predicted frame and the real frame, is the coordinate of the center point of the real frame, is the coordinate of the center point of the prediction box;
[0035] Δ is the distance loss, which is expressed as follows:
[0036]
[0037] in, γ=2-Λ,c w is the width difference between the real box and the predicted box;
[0038] Ω is the shape loss, which is expressed as follows:
[0039]
[0040] in, w and w gt The widths of the predicted box and the real box, h and h respectively gt are the heights of the predicted box and the true box, respectively, and θ is used to indicate the degree of attention to shape loss;
[0041] The specific representation of IoU is as follows:
[0042]
[0043] Among them, B is the prediction box, B GT is the real box, and IoU represents the ratio of the intersection and union of the predicted box and the real box.
[0044] Furthermore, in step S4, the specific processing process is as follows:
[0045] S41: Use the optimal weight file to load the model, input the test set into the optimal detection model, and perform non-maximum suppression on the original output of the model;
[0046] S42: Output the network detection result and detection speed.
[0047] Compared with the existing technology, the present invention has the following advantages: the FPDNet-based steel product surface defect detection method is based on the YOLOv8 target detection framework, selects the convolutional neural network HGNetv2 with fewer parameters as the feature extraction network, and designs a CEDLAM module based on modulated deformable convolution and MPCA attention mechanism, and selects the SIoU loss function, which greatly reduces the number of model parameters while improving the detection accuracy and speed of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 1 is a flow chart of a method for detecting surface defects of steel products based on FPDNet in an embodiment of the present invention;
[0049] Figure 2 These are typical defect image samples in the NEU-DET database in the embodiment of the present invention, where (a) is a crack, (b) is an inclusion, (c) is a plaque, (d) is a pitted surface, (e) is mill scale, and (f) is a scratch.
[0050] Figure 3 Schematic diagram of the partial architecture of the steel surface defect target detection model according to an embodiment of the present invention;
[0051] Figure 4 This is a diagram showing the detection effect of the optimal steel surface defect target detection model (FPDNet model) on strip defect images in an embodiment of the present invention. DETAILED DESCRIPTION
[0052] The following is a detailed description of an embodiment of the present invention. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process. However, the protection scope of the present invention is not limited to the following embodiment.
[0053] like Figure 1 As shown, this embodiment provides a technical solution: a method for detecting surface defects of steel products based on FPDNet, comprising the following steps:
[0054] S1: Collect data samples from the strip surface defect image dataset and preprocess the samples;
[0055] S2: Based on the YOLOv8 object detection framework, a hot-rolled strip surface defect target detection model was designed, which includes deformable convolution and attention mechanism modules. The HGNetv2 network was selected as the feature extractor of the target detection model, and GhostConv was used to lightweight the backbone network.
[0056] S3: Use the training set to train the steel surface defect target detection model to obtain the optimal detection model;
[0057] S4: Evaluate the optimal detection model on the test set and output the detection results and detection speed.
[0058] In this embodiment, the specific processing process of step S1 is as follows:
[0059] S11: acquiring data samples from a hot-rolled strip surface defect image dataset, and dividing the acquired data samples into a training set and a test set according to a set ratio;
[0060] S12: Perform mosaic data augmentation on the images in the training set and pad the processed image size to 416×416.
[0061] In this embodiment, in step S1, the database is a hot-rolled steel strip surface defect database (NEU-DET), in which images of six typical surface defects of the hot-rolled steel strip surface and the position coordinate information of the defects in each image are obtained, such as Figure 2As shown in the figure, the six typical surface defects are cracks, inclusions, patches, pitted surface, rolling scale, and scratches.
[0062] In this embodiment, the specific processing process of step S2 is as follows:
[0063] S21: Based on the YOLOv8 target detection framework, the backbone network HGNetv2 is selected as the feature extractor;
[0064] S22: Use GhostConv convolution module to replace the standard convolution layer in the backbone network HGNetv2;
[0065] S23: Design a Csp efficient deformable layer attention module (CEDLAM) containing deformable convolution and attention mechanism, and add it to the neck network;
[0066] S24: Use the SIoU loss function instead of the traditional bounding box regression loss function to obtain the final object detection model.
[0067] In this embodiment, the specific implementation process of using the backbone network HGNetv2 to replace the original YOLOv8 backbone network in step S21 is as follows:
[0068] The overall structure of the HGNetv2 backbone network consists of a Stem module and four HG layers. The first layer of HGNetv2 is the initial network preprocessing layer with 96 channels. It extracts features from the input data through a 3×3 convolutional layer, and then downsamples it through a max pooling operation to obtain input data features at different scales. The second to fifth layers are composed of HG layers, each of which mainly contains a large number of standard convolutional HG blocks. In the third to fifth layers of HGNetv2, the first layer is processed by depthwise separable convolution (DWconv) and then by HG blocks. This operation reduces the computational load, improves the model's inference speed, and enables independent feature learning for each channel.
[0069] In this embodiment, in step S22, the GhostConv convolution module replaces the standard convolution in the backbone network HGNetv2. The implementation process is as follows:
[0070] The HG block contains a large number of standard convolutions. Replacing these with GhostConv convolutions can significantly reduce the number of model parameters. In the GhostConv convolution module, a standard convolution operation is first performed to convert the input feature map into a smaller number of main feature maps. A set of linear transformations (such as depthwise separable convolution) is applied to each main feature map to generate more ghost feature maps. The main feature map and ghost feature map are then merged to form the final output feature map.
[0071] In this embodiment, the steps of designing the Csp efficient deformable layer attention module (CEDLAM) including deformable convolution and attention mechanism in step S23 are:
[0072] S231: In the CEDLAM module, the input is first passed through a 1×1 convolution to adjust the dimension of the feature map, and then the feature map is divided into two equal parts. The first part does not perform any operations; the second part passes through three bottleneck layers (DCCA), which first pass through a 3×3 convolution, then pass through a DCNv2 deformable convolution layer and an MPCA attention layer. The bottleneck layer input is then added to the feature map after the bottleneck layer through a residual mechanism. Finally, the feature map obtained from the first and second parts is concatenated, and the dimensionality of the feature map is restored using a 1×1 convolution kernel.
[0073] S232: The DCNv2 deformable convolution layer adds a weight coefficient to each sampling point based on DCN. Its calculation formula is as follows:
[0074]
[0075] Among them, K represents the K sampling positions of the convolution kernel, w k and p k Represent the weight of the Kth sampling position and the preset offset. Δp k and Δm k are the learnable offset and modulation scalar of the Kth sampling position, respectively. Modulation scalar Δm k lies in the range [0,1], and Δp k is a real number with an unconstrained range. k and Δm k Obtained by a separate convolutional layer applied to the same input feature map x. This convolutional layer has the same spatial resolution and dilation as the current convolutional layer. The output is 3K channels, with the first 2K channels corresponding to the learned offsets The remaining K channels are further fed into a sigmoid layer to obtain the modulation scalar The kernel weights in this single convolutional layer are initialized to zero. Therefore, Δp k and Δm k The initial values of are 0 and 0.5 respectively. The learning rate of the additional convolutional layers used for offset and modulation learning is set to 0.1 times that of the existing convolutional layers.
[0076] S233: MPCA attention layer is improved on the basis of CA attention, introducing enhanced width and height dimension branch and global average pooling branch to further enhance the expressive ability of network learning features. Figure 3First, the input feature map passes through global average pooling layers in the horizontal and vertical directions, respectively, to obtain width and height feature maps. The input feature map also passes through the global average pooling branch, which undergoes a global average pooling layer and a 1x1 convolution to obtain global attention weights. The width feature map is then transposed and stacked with the height feature map. The stacked feature map undergoes convolution, normalization, and activation functions to obtain a feature map. The feature map then passes through the width and height enhancement branch, which enhances the features through a 3x3 convolution and then takes a sigmoid to obtain enhanced attention weights. This splits the feature map into width and height enhanced attention weights. The number of channels is adjusted using a 1x1 convolution. The enhanced attention weights are then multiplied by the width and height enhanced attention weights, and a sigmoid is taken to obtain the enhanced width and height enhanced attention weights. The enhanced width and height enhanced attention weights are then multiplied by the global attention weight to enhance the global attention weights. Finally, the input feature map is multiplied by the global attention weight and the enhanced width and height attention weights to obtain the output feature map.
[0077] In this embodiment, the specific processing process of step S3 is as follows:
[0078] S31: Input the training set into the steel surface defect target detection model and use the Adam optimization algorithm for parameter learning and updating;
[0079] S32: Adjust hyperparameters such as learning rate, batch size, and data augmentation to further optimize model performance and save the model weights with the best performance for subsequent use.
[0080] In this embodiment, step S4 includes the following steps:
[0081] S41: Load the model using the optimal weight file, input the test set into the optimal detection model, and perform non-maximum suppression (NMS) on the original output of the model to remove redundant detection boxes and improve the accuracy of the detection results;
[0082] S42: Output the network detection result and detection speed.
[0083] The network structure of the FPDNet model (optimal detection model) in this embodiment is as follows Figure 3 As shown, it includes a backbone network, a neck network, and a detection head network.
[0084] In this embodiment, all C2f modules in the neck network are replaced with CEDLAM modules. The neck network includes a first upsampling module, a first splicing module, a first CEDLAM module, a second upsampling module, a second splicing module, a second CEDLAM module, a first convolutional layer, a third splicing module, a third CEDLAM module, a second convolutional layer, a fourth splicing module, and a fourth CEDLAM module. The SPPF module is connected to the first upsampling module. The first splicing module splices the features output by the first upsampling module with the output of the fifth HG block and inputs them into the first CEDLAM module and the second upsampling module. The features output by the second upsampling module and the features output by the second HG block are spliced by the second splicing module and input into the second CEDLAM module and the first convolutional layer. The features output by the first convolutional layer and the features output by the first CEDLAM module are spliced by the third splicing module and input into the third CEDLAM module and the second convolutional layer. The features output by the second convolutional layer and the features output by the SPPF module are spliced by the fourth splicing module and input into the fourth CEDLAM module. The features output by the second CEDLAM module, the third CEDLAM module and the fourth CEDLAM module are input into the detection head network.
[0085] The loss function of this embodiment adopts the SIoU loss function, and the SIoU loss function model is as follows:
[0086] The SIoU loss function consists of four parts: angle loss, distance loss, shape loss, and IoU loss. Angle loss measures the difference in rotation angle between the predicted bounding box and the ground-truth bounding box. Distance loss measures the distance between the center point of the predicted bounding box and the center point of the ground-truth bounding box. Shape loss measures the difference in width and height between the predicted bounding box and the ground-truth bounding box. IoU loss measures the degree of overlap between the predicted bounding box and the ground-truth bounding box.
[0087] The formula for angle loss is defined as:
[0088] Λ=1-2*sin 2 (arcsinx-π / 4)
[0089]
[0090] Where c h is the height difference between the real frame and the predicted frame, σ is the distance between the center point of the real frame and the predicted frame, α is the horizontal angle between the predicted frame and the real frame, is the coordinate of the center point of the real frame, is the coordinate of the center point of the prediction box.
[0091] The formula for distance loss is defined as:
[0092]
[0093] Where c w is the width difference between the real box and the predicted box;
[0094] The formula of shape loss is defined as:
[0095]
[0096] Where w and w gt The widths of the predicted box and the real box, h and h respectively gt are the heights of the predicted box and the true box, respectively, and θ reflects the degree of attention to shape loss.
[0097] The IoU loss represents the ratio of the intersection and union between the true box and the predicted box, and its formula is defined as:
[0098]
[0099] Where B is the prediction box, B GT For the real frame.
[0100] In summary, the formula of SIoU loss function is defined as:
[0101]
[0102] As shown in Table 1 below, the surface defect performance evaluation results of steel products using different models are shown. Our work is the optimal detection model (FPDNet model).
[0103] Table 1 Evaluation of surface defect performance of steel products based on different models
[0104]
[0105]
[0106] As shown in Table 2 below, the model detection performance of the YOLOv8 target detection framework under different combinations is shown.
[0107] Table 2 Model detection performance under different combinations
[0108]
[0109] In summary, the FPDNet-based steel product surface defect detection method described in the above embodiment uses the YOLOv8 target detection framework, selects the convolutional neural network HGNetv2 with fewer parameters as the feature extraction network, designs a CEDLAM module based on modulated deformable convolution and MPCA attention mechanism, and selects the SIoU loss function. This significantly reduces the model's parameter count while improving detection accuracy and speed. The steel surface defect target detection model designed by this invention achieves 80.8% mAP on the NEU-DET dataset and a detection speed of 107.3 FPS on an RTX3090, outperforming all currently available steel defect detection models.
[0110] Although the embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and are not to be construed as limitations on the present invention. A person skilled in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.
Claims
1. A method for detecting surface defects of steel products based on FPDNet, characterized in that: The following steps are involved: S1: Collect data samples from the strip surface defect image dataset and preprocess the samples; S2: Based on the YOLOv8 object detection framework, a hot-rolled strip surface defect target detection model was designed that incorporates deformable convolution and attention mechanisms. The HGNetv2 network was selected as the feature extractor for the target detection model, and GhostConv was used to lightweight the backbone network. S3: Use the training set to train the steel surface defect target detection model to obtain the optimal detection model; S4: Evaluate the optimal detection model on the test set and output the detection results and detection speed; In step S2, the specific processing process is as follows: S21: Based on the YOLOv8 target detection framework, the backbone network HGNetv2 is selected as the feature extractor; S22: Use the GhostConv convolution module to replace the standard convolution layer of the HG block in the backbone network HGNetv2; S23: Design a CEDLAM module that includes deformable convolution and attention mechanism, and replace all C2f modules in the neck network with CEDLAM modules; S24: Use SIoU loss function instead of traditional bounding box regression loss function to obtain the final object detection model; In step S23, in the CEDLAM module, the input is first passed through a 1×1 convolution layer to adjust the dimension of the feature map, and then the feature map is divided into two equal parts; the first part does not perform any operation, the second part passes through three bottleneck layers in sequence, and finally the feature maps obtained by the first and second parts are spliced, and then the 1×1 convolution kernel is used to restore the dimension of the feature map, wherein, in the bottleneck layer, it first passes through a 3×3 convolution layer, then passes through the DCNv2 deformable convolution layer and the MPCA attention layer, and then the input of the bottleneck layer is added to the feature map after passing through the bottleneck layer through the residual mechanism.
2. The method for detecting surface defects of steel products based on FPDNet according to claim 1, characterized in that: In step S1, the specific processing process is as follows: S11: acquiring data samples from a hot-rolled strip surface defect image dataset, and dividing the acquired data samples into a training set and a test set according to a set ratio; S12: Perform mosaic data augmentation on the images in the training set and adjust the size of the processed images to the set size.
3. The method for detecting surface defects of steel products based on FPDNet according to claim 1, characterized in that: In step S21, the backbone network HGNetv2 includes a Stem module and four HG layers. The Stem module is the initial preprocessing layer of the network, that is, the first layer. The second to fifth layers are HG layers. Each HG layer includes at least one HG block. The HG block includes multiple standard convolutional layers. Among them, the third to fifth layers first pass through the depth-wise separable convolution module DWconv and then pass through the HG block.
4. The method for detecting surface defects of steel products based on FPDNet according to claim 3, characterized in that: In step S22, in the GhostConv convolution module, a standard convolution operation is first performed to convert the input feature map into a smaller number of main feature maps, and a set of linear transformations are applied to each main feature map to generate more ghost feature maps; finally, the main feature map and the ghost feature map are merged to form the final output feature map.
5. The method for detecting surface defects of steel products based on FPDNet according to claim 1, characterized in that: The calculation formula of the DCNv2 deformable convolutional layer is as follows: Among them, p represents the center position of the convolution kernel currently processed, K represents the K sampling positions of the convolution kernel, and w k and p k Represent the weight of the K-th sampling position and the pre-set offset, Δp k and Δm k are the learnable offset and modulation scalar of the K-th sampling position, respectively, and x represents the input feature map.
6. The method for detecting surface defects of steel products based on FPDNet according to claim 1, characterized in that: In the MPCA attention layer, the input feature map first passes through the global average pooling layer in the horizontal and vertical directions respectively to obtain the feature map in the width and height directions; the input feature map also passes through the global average pooling branch, which passes through the global average pooling layer and the 1x1 convolution layer to obtain the global attention weight; then the feature map in the width direction is transposed and stacked with the feature map in the height direction. The stacked feature map is subjected to convolution, normalization and activation function operations to obtain the feature map; The feature map then passes through the enhanced width and height dimensional branch, which enhances the features through a 3×3 convolution layer and then takes a sigmoid to obtain the enhanced attention weight, splitting it into wide and high dimensional enhanced attention weights. In addition, the feature map is split into wide and high dimensional feature maps, and the number of channels is adjusted using a 1×1 convolution layer. The result is then multiplied by the wide and high dimensional enhanced attention weights, and a sigmoid is taken to obtain the enhanced wide and high dimensional attention weights. Then, the global attention weight is enhanced by multiplying the enhanced wide and high dimensional attention weights by the global attention weight; finally, the input feature map is multiplied by the global attention weight and the enhanced wide and high dimensional attention weights to obtain the output feature map.
7. A method for detecting surface defects of steel products based on FPDNet according to claim 1 or 6, characterized in that: In step S3, the specific processing process is as follows: S31: Input the training set into the steel surface defect target detection model and use the Adam optimization algorithm for parameter learning and updating; S32: After the training is completed, the model weights with the best performance are saved.
8. The method for detecting surface defects of steel products based on FPDNet according to claim 7, characterized in that: In step S32, the loss function during training adopts the SIoU loss function, which is specifically expressed as follows: Where Λ is the angle loss, which is expressed as follows: L=1-2*sin 2 (arcsinx-π / 4) in, c h is the height difference between the real frame and the predicted frame, σ is the distance between the center point of the real frame and the predicted frame, α is the horizontal angle between the predicted frame and the real frame, is the coordinate of the center point of the real frame, is the coordinate of the center point of the prediction box; Δ is the distance loss, which is expressed as follows: in, γ=2-Λ,c w is the width difference between the real box and the predicted box; Ω is the shape loss, which is expressed as follows: in, w and w gt The widths of the predicted box and the real box, h and h respectively gt are the heights of the predicted box and the true box, respectively, and θ is used to indicate the degree of attention to shape loss; The specific representation of IoU is as follows: Among them, B is the prediction box, B GT is the real box, and IoU represents the ratio of the intersection and union of the predicted box and the real box.
Citation Information
Patent Citations
Lightweight steel surface defect detection method based on improved YOLOv8n
CN118196529A
Unmanned aerial vehicle aerial photography small target detection method based on improved YOLOv8s algorithm and electronic equipment
CN118230194A
High body seriola quinqueradiata detection method based on YOLOv8 network structure
CN118279935A