Improved YOLOv5-based rolled plate surface defect detection method
By improving the YOLOv5 method, the feature extraction and interaction mechanism of the backbone module and the neck module is used to solve the problem of insufficient recognition ability of complex background and weak feature defects in the surface defect detection of rolled sheets, achieving higher detection accuracy and lower error detection and miss detection rate.
Patent Information
- Application Number
- CN202510059212.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2045-01-15
AI Technical Summary
In the detection of surface defects of rolled sheets, it is difficult to effectively identify similar defects and weak feature defects under complex backgrounds, resulting in low detection accuracy and frequent false detection and missed detection.
Using the method of improving YOLOv5, the feature information is extracted by aggregating convolution kernels of different sizes in the backbone part, the ability to understand complex image content is enhanced, and the global and local information of the image are interacted in the neck part, and the details of deep features are compensated by cross-scale feature fusion.
It improves the accuracy of surface defect detection of rolled sheets, reduces the probability of missed and missed detection, enhances the model's ability to identify complex and dense defects, and ensures efficient operation under limited computing resources.
Smart Images

Figure CN119851042A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method for detecting surface defects of a rolled plate based on improved YOLOv5, and belongs to the field of computer vision. Background Art
[0002] In industrial environments, the surface quality of rolled plates directly affects the performance, durability and safety of products. Traditional methods for detecting surface defects of rolled plates mainly rely on manual inspection, ultrasonic inspection, magnetic particle inspection and penetration inspection, but the detection accuracy of these methods will fluctuate when facing complex backgrounds or undesirable working conditions. For example, the method based on manual inspection relies on the experience of the inspector, which is prone to subjective errors, making it difficult to ensure the consistency of inspection, and has poor recognition effect on tiny surface defects. It is inefficient and the accuracy will be affected by the working time. When the ultrasonic inspection method faces irregular workpieces or workpieces with rough surfaces, it is difficult for the ultrasonic probe to fit completely, resulting in the inability to evenly transmit sound waves and it is difficult to accurately detect surface defects. The magnetic particle inspection scheme can only detect defects on the surface or near the surface of ferromagnetic materials, and cannot be applied to non-ferromagnetic materials. In addition, under high temperature or rough surface environment, the magnetic powder aggregation effect is limited, which may lead to false detection or missed detection. Penetrant inspection requires the surface of the workpiece to be inspected to be thoroughly cleaned before inspection, and the penetrant has a corrosive effect on some materials. The operation is cumbersome and the inspection speed is slow.
[0003] With the advancement of industrial automation and intelligent manufacturing, nondestructive testing technology based on target detection has gradually become mainstream and has been widely used in surface detection of materials such as metals, roads, rails, and glass. In defect detection tasks, feature extraction is the key link to improve detection performance. How to efficiently, comprehensively, and accurately extract defect feature information at different levels has become a research focus in recent years. However, defect feature extraction still faces the challenges of similar defects and weak feature defects. Similar defects are highly consistent in morphology, texture, and size, while weak features are easily masked by complex backgrounds. Conventional feature extraction methods are difficult to effectively distinguish subtle differences. When defects are complex or densely distributed, the risk of false detection and missed detection will increase significantly. Therefore, it is urgent to introduce more advanced feature extraction methods to enhance the ability to identify similar defects and weak features, thereby improving detection accuracy and reducing the occurrence of false detection and missed detection.
[0004] In target detection tasks, the appearance features of the target may be affected by neighboring objects or background textures. Through effective cross-region feature interaction, the model can improve the recognition accuracy and precision of the target. In defect detection tasks, by interacting with features in different regions, a richer feature representation is formed, which can better identify complex defect patterns. Therefore, it is urgent to introduce a more efficient cross-region feature interaction architecture to optimize model computational efficiency and improve task performance.
[0005] Cross-scale features have different receptive fields and semantic information. By integrating features of different scales and levels, defect detection models can detect targets more accurately and reliably in various scenarios. However, since defects will show different characteristic manifestations at different scales, it is particularly important to effectively integrate feature information from different scales and improve the model's ability to identify complex and dense defects. Therefore, it is necessary to effectively use cross-scale features to fully capture and amplify these subtle features without significantly increasing the amount of calculation, so as to enhance the model's detection accuracy for similar defects, weak feature defects, and large-span defects. Summary of the invention
[0006] Compared with the relatively obvious targets in conventional target detection tasks, there are many types of defects in defect detection tasks, and the shape, size, color and other characteristics of the defects vary greatly on the surfaces of different products and materials. At the same time, these defects are visually difficult to distinguish due to their irregular contours and low contrast with the background. Many defect features are very small and hidden, and visually difficult to distinguish from the surface of the workpiece, which further increases the difficulty of accurate identification. On industrial production lines, defect detection algorithms are usually deployed on edge computing devices, which have limited computing resources. Therefore, the model design must balance the number of parameters and detection accuracy to ensure that the model can run efficiently under limited resource conditions.
[0007] The present invention proposes a method for detecting surface defects of rolled plates based on improved YOLOv5. In order to better capture defect features, the present invention aggregates feature information extracted by convolution kernels of different sizes in the backbone part, so as to simultaneously obtain details and global information at the same level, and enhance the ability to understand complex image content. In the neck part, the global features and local information of the interactive image are used to complement each other's advantages, so that the model can better integrate global context information, thereby improving defect detection performance. At the same time, since the features after multiple processing will lose some detail information, the present invention uses a cross-scale feature fusion method at the neck stage, using shallow features to compensate for deep features after multiple feature processing, thereby improving the accuracy and precision of defect detection.
[0008] The technical solution of the present invention is: a method for detecting surface defects of rolled plates based on improved YOLOv5, characterized in that it comprises the following steps:
[0009] S1. A method for detecting surface defects of rolled plates is constructed based on a backbone module, a neck module and a head module;
[0010] S2, construct the backbone module based on CSPDarknet, including the convolution normalization activation operation (Conv-BatchNorm-SiLU, CBS) and residual synchronized convolution operation (Residual Synchronized Convolutional Block, RSCB) modules and fast spatial pyramid pooling operation (Spatial Pyramid Pooling-Fast, SPPF);
[0011] S3, the backbone module described in step S2, characterized in that it includes:
[0012] Perform CBS on the input image 6×6 The operation obtains feature F1;
[0013] Perform CBS on feature F1 3×3 The operation obtains feature F2;
[0014] Perform RSCB operation on feature F2 to obtain feature F3;
[0015] Perform CBS on feature F3 3×3 The operation obtains feature F4;
[0016] Perform RSCB operation on feature F4 to obtain feature F5;
[0017] Perform CBS on feature F5 3×3 The operation obtains feature F6;
[0018] Perform RSCB operation on feature F6 to obtain feature F7;
[0019] Perform CBS on feature F7 3×3 The operation obtains feature F8;
[0020] Perform RSCB operation on feature F8 to obtain feature F9;
[0021] Perform SPPF operation on feature F9 to obtain feature F 10 ;
[0022] S4, step S3 is characterized in that the RSCB operation is: CBS on the input feature 3×3 The feature R1 is obtained by the operation. Based on the Blueprint Separable Conv-BatchNorm-SiLU (BBS), BBS is performed on the feature R1. 3×3 and BBS 5×5 Operation, and the two features are spliced and BBS 7×7 The feature R2 is obtained by operation, and the feature R2 is concatenated with the feature R1 and BBS is performed.7×7 The operation obtains feature R3, which is concatenated with feature R1 and CSB is performed 3×3 Operation to obtain RSCB output characteristics;
[0023] S5. Construct a bottleneck module based on PANet, including CSP Bottleneck with 3 Convolutions (C3), Conv-Multilayer Perceptron (Conv-MLP) and feature fusion operation (Fusion).
[0024] S6. The neck module described in step S5 is characterized by comprising:
[0025] Perform the first Conv-MLP operation on the input features to obtain feature F 11 ;
[0026] For feature F 11 Perform upsampling operation to obtain feature F 12 ;
[0027] F 12 Concatenate the features with F7 and perform C3 and the second Conv-MLP operation in sequence to obtain feature F 15 ;
[0028] For feature F 15 Perform upsampling operation to obtain feature F 16 ;
[0029] For features F2, F5 and F 16 Perform the first Fusion operation and then the C3 operation to obtain feature F 18 ;
[0030] For feature F 18 Perform the third Conv-MLP operation to obtain feature F 19 ;
[0031] For feature F2 and feature F 15 and feature F 19 Perform the second Fusion operation and C3 operation to obtain feature F 21 ;
[0032] For feature F 21 Perform the fourth Conv-MLP operation to obtain feature F 22 ;
[0033] For feature F2 and feature F 11 and feature F 22 Perform the third Fusion operation and C3 operation to obtain feature F24 ;
[0034] S7, step S6 is characterized in that the Conv-MLP operation is: Shift-MLP and CBS are performed on the input features in sequence i×i Operation, the first Conv-MLP operation and the second Conv-MLP operation in step S6 adopt CBS 1×1 , while CBS is used in the third and fourth Conv-MLP operations 3×3 ;
[0035] S8, step S6 is characterized in that the fusion operation is: average pooling operation is performed on feature F2 and feature concatenation operation is performed on the middle-level feature and the deep-level feature to obtain feature S1, and CBS is performed on feature S1 in sequence 1×1 and CBS 3×3 The output features are obtained by operation. Among them, the middle-level features in the first Fusion operation are feature F5, and the deep-level features are feature F 16 ; The middle-level feature in the second Fusion operation is feature F 15 , the deep feature is feature F 19 ; The middle-level feature in the third Fusion operation is feature F 11 , the deep feature is feature F 22 ;
[0036] S9, based on the head module of YOLOv5 itself, combined with feature F 18 , Feature F 21 and feature F 24 Perform defect detection and positioning operations.
[0037] The CBS in step S3 i×i The operation is: sequentially perform a convolution operation with a convolution kernel size of i×i (the value of i is an integer greater than 0), a BatchNorm operation, and a SiLU activation function operation.
[0038] The SPPF operation in step S3 is: perform CBS on the input features 1×1 The feature Y1 is obtained by operation, and three maximum pooling operations are performed on the feature Y1 in sequence to obtain the feature Y2, feature Y3 and feature Y4 respectively; the feature Y1, feature Y2, feature Y3 and feature Y4 are concatenated and CBS is performed 1×1 The operation obtains the output features.
[0039] The BBS in step S4 i×iThe operation is: sequentially perform a blueprint separable convolution operation with a convolution kernel size of i×i (the value of i is an integer greater than 0), a BatchNorm operation, and a SiLU activation function operation.
[0040] The C3 operation in step S5 is: perform CBS on the input features respectively 1×1 Operation and CBS 1×1 Operations are performed to obtain features C1 and C2 respectively. Three Bottleneck operations are performed on feature C1 to obtain feature C3. Feature C3 is concatenated with feature C2 to obtain feature C4. CBS is performed on feature C4. 1×1 The output features of C3 can be obtained by operation.
[0041] The C3 operation in step S5, wherein the Bottleneck operation is a single CBS 1×1 and CBS 3×3 The result of serial operation.
[0042] The Shift-MLP operation in step S6 is: performing vertical sliding operation, Linear operation, DWConv operation, GELU activation function operation, Dropout operation, horizontal sliding operation, Linear operation and Dropout operation on the input features in sequence.
[0043] In general, compared with the existing technical solutions, the present invention adopts a new idea and method, which can achieve the following beneficial effects:
[0044] 1. Aiming at the problem of low accuracy of weak feature defect detection in the task of rolled plate surface defect detection, the present invention proposes a rolled plate surface defect detection method based on improved YOLOv5. By strengthening weak feature extraction, enhancing global information interaction and cross-scale feature fusion, the probability of missed detection or false detection is reduced, and the detection accuracy of rolled plate surface defects is improved.
[0045] 2. The present invention uses RSCB operation to utilize multi-scale convolution kernels for parallel processing when extracting defect features, and combines the design of residual connection to enhance the model's sensitivity to weak feature defects, improve the model's feature expression ability, reduce the risk of gradient vanishing and gradient explosion during training, and ensure the stability of the model during training.
[0046] 3. The present invention integrates the global semantic information of the image and the local detail features of the defect through Conv-MLP operation, optimizes the comprehensiveness of feature expression, further enhances the feature interaction ability between different regions, and improves the model's detection ability for large-span and complex defects.
[0047] 4. The present invention promotes the fusion of cross-scale features through Fusion operation, and enhances the adaptability to multi-scale defects. The shallow features are used to compensate for the deep features, avoiding the problem of feature loss caused by multiple feature processing, and further improving the robustness and detection accuracy of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The drawings constituting a part of this application are used to enhance further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations of the present invention. In the drawings:
[0049] Figure 1 This is a flow chart of the method for detecting surface defects of rolled plates based on improved YOLOv5 proposed by the present invention;
[0050] Figure 2 This is a structural diagram of the backbone modules of the method proposed in the present invention;
[0051] Figure 3 This is the CBS operation principle diagram;
[0052] Figure 4 The operating principle of RSCB;
[0053] Figure 5 It is the operating principle of SPPF;
[0054] Figure 6 This is a structural diagram of the neck module of the method proposed by the present invention;
[0055] Figure 7 This is the Conv-MLP operation principle diagram;
[0056] Figure 8 This is the Fusion operation schematic diagram;
[0057] Fig. 9 This is the C3 operation principle diagram;
[0058] Fig.10 Image comparison of the same defect samples detected by different models DETAILED DESCRIPTION
[0059] The invention is further described below in conjunction with the accompanying drawings and embodiments, but the content of the invention is not limited to the scope of the embodiments.
[0060] like Figure 1 As shown, a method for detecting surface defects of rolled plates based on improved YOLOv5 is characterized in that the method for detecting surface defects of rolled plates is constructed based on a backbone module, a neck module, and a head module.
[0061] The backbone modules are as follows Figure 2As shown, it includes: based on the CSPDarknet architecture and constructed by CBS operation, RSCB operation and SPPF operation, characterized in that: CBS is performed on the input image 6×6 The operation obtains feature F1; CBS is performed on feature F1 3×3 The feature F2 is obtained by operation; the feature F2 is subjected to RSCB operation to obtain the feature F3; the feature F3 is subjected to CBS operation 3×3 The operation obtains feature F4; the RSCB operation is performed on feature F4 to obtain feature F5; the CBS operation is performed on feature F5 3×3 The operation obtains feature F6; the RSCB operation is performed on feature F6 to obtain feature F7; the CBS operation is performed on feature F7 3×3 The feature F8 is obtained by performing the RSCB operation on the feature F8; the feature F9 is obtained by performing the SPPF operation on the feature F9. 10 ; Feature F 10 That is the output feature of the backbone module.
[0062] The CBS i×i Operation Figure 3 As shown, it includes: sequentially performing a convolution operation with a convolution kernel size of i×i (the value of i is an integer greater than 0), a BatchNorm operation, and a SiLU activation function operation.
[0063] The RSCB is Figure 4 As shown, including: CBS of input features 3×3 The feature R1 is obtained by operation, and BBS is performed on the feature R1 3×3 and BBS 5×5 Operation, and the two features are spliced and BBS 7×7 The feature R2 is obtained by operation, and the feature R2 is concatenated with the feature R1 and BBS is performed. 7×7 The operation obtains feature R3, which is concatenated with feature R1 and CSB is performed 3×3 The operation obtains the RSCB output characteristics.
[0064] The SPPF operation includes: performing CBS on the input features 1×1 The feature Y1 is obtained by operation, and three maximum pooling operations are performed on the feature Y1 in sequence to obtain the feature Y2, feature Y3 and feature Y4 respectively; the feature Y1, feature Y2, feature Y3 and feature Y4 are concatenated and CBS is performed 1×1 The operation obtains the output features.
[0065] The BBS i×iOperations include: sequentially performing a blueprint separable convolution operation with a convolution kernel size of i×i (the value of i is an integer greater than 0), a BatchNorm operation, and a SiLU activation function operation on the input features.
[0066] The backbone modules are as follows Figure 5 As shown, it includes: based on the PANet architecture and constructed by C3 operation, Conv-MLP operation and Fusion operation, characterized in that: the first Conv-MLP operation is performed on the input feature to obtain the feature F 11 ; For feature F 11 Perform upsampling operation to obtain feature F 12 ; for F 12 Concatenate the features with F7 and perform C3 and the second Conv-MLP operation in sequence to obtain feature F 15 ; For feature F 15 Perform upsampling operation to obtain feature F 16 ; For features F2, F5 and F 16 Perform the first Fusion operation and then the C3 operation to obtain feature F 18 ; For feature F 18 Perform the third Conv-MLP operation to obtain feature F 19 ; For feature F2, feature F 15 and feature F 19 Perform the second Fusion operation and C3 operation to obtain feature F 21 ; For feature F 21 Perform the fourth Conv-MLP operation to obtain feature F 22 ; For feature F2, feature F 11 and feature F 22 Perform the third Fusion operation and C3 operation to obtain feature F 24 .
[0067] The Conv-MLP operation is as follows Figure 6 As shown, it includes: performing Shift-MLP and CBS on the input features in sequence i×i Operation; Among them, the first Conv-MLP operation and the second Conv-MLP operation adopt CBS 1×1 , while CBS is used in the third and fourth Conv-MLP operations 3×3 .
[0068] The Shift-MLP operation includes: performing vertical sliding operation, Linear operation, DWConv operation, GELU activation function operation, Dropout operation, horizontal sliding operation, Linear operation and Dropout operation on the input features in sequence.
[0069] The Fusion operation is as follows Figure 7 As shown, it includes: performing an average pooling operation on feature F2 and performing feature concatenation operations on the middle-level features and deep-level features to obtain feature S1, and performing CBS on feature S1 in turn. 1×1 and CBS 3×3 The output features are obtained by operation. Among them, the middle-level features in the first Fusion operation are feature F5, and the deep-level features are feature F 16 ; The middle-level feature in the second Fusion operation is feature F 15 , the deep feature is feature F 19 ; The middle-level feature in the third Fusion operation is feature F 11 , the deep feature is feature F 22 .
[0070] The C3 operates as Figure 8 As shown, including: CBS is performed on the input features respectively 1×1 Operation and CBS 1×1 Operations are performed to obtain features C1 and C2 respectively. Three Bottleneck operations are performed on feature C1 to obtain feature C3. Feature C3 is concatenated with feature C2 to obtain feature C4. CBS is performed on feature C4. 1×1 The output features of C3 can be obtained by operation. The Bottleneck operation is a single CBS 1×1 and CBS 3×3 The result of serial operation.
[0071] The head module includes: using the native head module of the YOLOv5 model and combining the feature F 18 , Feature F 21 and feature F 24 Perform final defect detection and location operations.
[0072] Example:
[0073] See also Figure 1 , Figure 2 , Figure 3 , Figure 4 , Figure 5 , Figure 6 , Figure 7 and Figure 8 The present invention proposes a method for detecting surface defects of rolled plates based on improved YOLOv5, comprising the following steps:
[0074] S1. Dataset preprocessing: The Northeastern University hot-rolled steel strip surface defect dataset (NEU-DET) was selected for the experiment. The dataset contains six types of typical steel strip surface defect image data, including rolling scale, plaque, crack, pitting surface, inclusions and scratches. Each type of defect has 200 frames of defect samples, and the dataset has a total of 1,800 frames of defect samples. It is divided into a training validation set and a test set at a ratio of 8:2, and then the training validation set is divided into a training set and a validation set at a ratio of 8:2.
[0075] S2. Model training: YOLOv10x, YOLOv10s, YOLOv9e, YOLOv9c and YOLOv8x were selected as comparison models. All models set the batch size to 4 during training, and used NVIDIA GeForce RTX3090Ti to train 200 epochs on the training set and validation set. In a single training process, the training set is divided into small batches of samples according to the ratio of batch size and input into the model. The samples are forward propagated through the backbone module, neck module and head module in turn to generate the corresponding prediction output. The loss function is calculated based on the predicted output and target value, and the model parameters (weights and biases) are updated through the back propagation algorithm. During the training process, the validation set is used to evaluate the performance of the model under the current training weights, and the training process and model design are optimized based on the evaluation results. If necessary, the hyperparameter configuration is adjusted to further improve the detection performance of the model.
[0076] S3. Training results: After training, the model weights with the best performance on the validation set are selected for performance evaluation on the test set. The detection accuracy, detection rate and overall performance of the model in defect detection tasks are comprehensively evaluated by calculating the mean average precision (mAP@0.5), precision (P), recall (R) and F1-score with an intersection-over-union threshold of 0.5.
[0077] In this embodiment, the present invention selects the results of the optimal weights of the corresponding models on the test set for quantitative and qualitative comparison; Table 1 is the results of quantitative comparison of the optimal weights of different models after training on the NEU-DET dataset on the test set. It can be seen from Table 1 that the method proposed in the present invention is superior to the current advanced target detection method in multiple indicators with a lower number of parameters, which also verifies the effectiveness of the method proposed in the present invention.
[0078] Table 1 Quantitative comparison results on the NEU-DET dataset
[0079]
[0080] Fig. 9This is an image comparison diagram of the same defect sample detected by different models, in which the manually annotated data (Ground-Truth, GT) is used as the standard data for comparison. The comparison results show that the method proposed in the present invention is better than the compared advanced method in identifying and locating typical defects on the surface of steel strip on this data set.
[0081] The specific implementation modes of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above implementation modes, and various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose of the present invention.
Claims
1. A method for surface defect detection of rolled plates based on improved YOLOv5. The method is characterized in that it comprises the following steps: S1. A method for detecting surface defects of rolled plates is constructed based on a backbone module, a neck module and a head module; S2, construct a backbone module based on CSPDarknet, including convolutional normalization activation operation (Conv-BatchNorm-SiLU, CBS), residual synchronized convolution operation (Residual Synchronized Convolutional Block, RSCB) and fast spatial pyramid pooling operation (Spatial Pyramid Pooling-Fast, SPPF); S3, the backbone module described in step S2, characterized in that it includes: Perform CBS on the input image 6×6 The operation obtains feature F1; Perform CBS on feature F1 3×3 The operation obtains feature F2; Perform RSCB operation on feature F2 to obtain feature F3; Perform CBS on feature F3 3×3 The operation obtains feature F4; Perform RSCB operation on feature F4 to obtain feature F5; Perform CBS on feature F5 3×3 The operation obtains feature F6; Perform RSCB operation on feature F6 to obtain feature F7; Perform CBS on feature F7 3×3 The operation obtains feature F8; Perform RSCB operation on feature F8 to obtain feature F9; Perform SPPF operation on feature F9 to obtain feature F 10 ; S4, step S3 is characterized in that the RSCB operation is: CBS on the input feature 3×3 The feature R1 is obtained by the operation, and the feature R1 is subjected to BBS based on the Blueprint Separable Conv-BatchNorm-SiLU (BBS) 3×3 and BBS 5×5 Operation, and the two features obtained are spliced and BBS 7×7 The feature R2 is obtained by operation, and the feature R2 is concatenated with the feature R1 and BBS is performed. 7×7 The operation obtains feature R3, which is concatenated with feature R1 and CSB is performed 3×3 Operation to obtain RSCB output characteristics; S5. Construct a bottleneck module based on PANet, including CSP Bottleneck with 3 Convolutions (C3), Conv-Multilayer Perceptron (Conv-MLP) and feature fusion operation (Fusion). S6. The neck module described in step S5 is characterized by comprising: For the input feature F 10 Perform the first Conv-MLP operation to obtain feature F 11 ; For feature F 11 Perform upsampling operation to obtain feature F 12 ; F 12 Concatenate the features with F7 and perform C3 and the second Conv-MLP operation in sequence to obtain feature F 15 ; For feature F 15 Perform upsampling operation to obtain feature F 16 ; For features F2, F5 and F 16 Perform the first Fusion operation and then the C3 operation to obtain feature F 18 ; For feature F 18 Perform the third Conv-MLP operation to obtain feature F 19 ; For feature F2 and feature F 15 and feature F 19 Perform the second Fusion operation and C3 operation to obtain feature F 21 ; For feature F 21 Perform the fourth Conv-MLP operation to obtain feature F 22 ; For feature F2 and feature F 11 and feature F 22 Perform the third Fusion operation and C3 operation to obtain feature F 24 ; S7, step S6 is characterized in that the Conv-MLP operation is: Shift-MLP and CBS are performed on the input features in sequence i×i Operation, the first Conv-MLP operation and the second Conv-MLP operation in step S6 adopt CBS 1×1 , while CBS is used in the third and fourth Conv-MLP operations 3×3 ; S8, step S6 is characterized in that the fusion operation is: average pooling operation is performed on feature F2 and feature concatenation operation is performed on the middle-level feature and the deep-level feature to obtain feature S1, and CBS is performed on feature S1 in sequence 1×1 and CBS 3×3 The output features are obtained by operation. Among them, the middle-level features in the first Fusion operation are feature F5, and the deep-level features are feature F 16 ; The middle-level feature in the second Fusion operation is feature F 15 , the deep feature is feature F 19 ; The middle-level feature in the third Fusion operation is feature F 11 , the deep feature is feature F 22 ; S9, based on the head module of YOLOv5 itself, combined with feature F 18 , Feature F 21 and feature F 24 Perform defect detection and positioning operations.
2. According to claim 1, a method for detecting surface defects of rolled plates based on improved YOLOv5 is characterized in that: The CBS in step S3 i×i The operation is: sequentially perform a convolution operation with a convolution kernel size of i×i (the value of i is an integer greater than 0), a BatchNorm operation, and a SiLU activation function operation.
3. The method for detecting surface defects of rolled plates based on improved YOLOv5 according to claim 1, characterized in that: The SPPF operation in step S3 is: perform CBS on the input features 1×1 The feature Y1 is obtained by operation, and three maximum pooling operations are performed on the feature Y1 in sequence to obtain the feature Y2, feature Y3 and feature Y4 respectively; the feature Y1, feature Y2, feature Y3 and feature Y4 are concatenated and CBS is performed 1×1 The operation obtains the output features.
4. The method for detecting surface defects of rolled plates based on improved YOLOv5 according to claim 1, characterized in that: The BBS in step S4 i×i The operation is: sequentially perform a blueprint separable convolution operation with a convolution kernel size of i×i (the value of i is an integer greater than 0), a BatchNorm operation, and a SiLU activation function operation.
5. The method for detecting surface defects of rolled plates based on improved YOLOv5 according to claim 1, characterized in that: The C3 operation in step S5 is: perform CBS on the input features respectively 1×1 Operation and CBS 1×1 Operations are performed to obtain features C1 and C2 respectively. Three Bottleneck operations are performed on feature C1 to obtain feature C3. Feature C3 is concatenated with feature C2 to obtain feature C4. CBS is performed on feature C4. 1×1 The output features of C3 can be obtained by operation.
6. The C3 operation according to claim 4, characterized in that: The Bottleneck operation consists of a single CBS 1×1 and CBS 3×3 The result of serial operation.
7. The method for detecting surface defects of rolled plates based on improved YOLOv5 according to claim 1, characterized in that: The Shift-MLP operation in step S6 is: performing vertical sliding operation, Linear operation, DWConv operation, GELU activation function operation, Dropout operation, horizontal sliding operation, Linear operation and Dropout operation on the input features in sequence.
Citation Information
Patent Citations
Improved YOLOv5s-based injection molding part surface defect detection method
CN116542932A
Strip steel surface defect detection method and system based on improved YOLOv5
CN117011231A
Steel surface defect detection method based on improved YOLOv5
CN117541553A
Rail surface defect detection method and device, electronic equipment and storage medium
CN117952946A
Steel defect detection method based on large separable convolution attention mechanism
CN118365623A