Lightweight detection method and device for trace cracks and storage medium
By designing a lightweight feature extraction module and a multi-scale feature fusion detection model DSCP-Unet, the problem of large parameters and insufficient detection accuracy in the existing crack detection methods is solved, and high-precision trace crack detection and model lightweighting are achieved. Suitable for mobile device applications.
Patent Information
- Application Number
- CN202411081688.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-08
- Publication Date
- 2024-12-06
AI Technical Summary
The existing crack detection methods have problems such as large amount of parameters, insufficient detection accuracy, slow inference speed, and limited detection ability for fine cracks.
Using lightweight feature extraction module DGConv and pooling module SAPool, combined with round trip sampling module PASG and strengthening module MFFS, the lightweight detection model DSCP-Unet is designed to achieve trace quantity through sub-pixel convolution upsampling and multi-scale feature fusion. High-precision detection of cracks.
The number of model parameters is reduced, the feature extraction ability and crack resolution ability are improved, the edge feature loss is reduced, and high-precision trace crack detection is achieved, which is suitable for mobile device applications.
Smart Images

Figure CN119091115A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of target detection, and in particular relates to a lightweight detection method, device and storage medium for trace cracks. Background Art
[0002] Cracks can reflect the stability of an object's structure, and timely detection of cracks is of great significance to improving safety performance. Traditional artificial visual detection methods are costly, inefficient, and lack objectivity, and cannot meet actual detection requirements. Machine vision detection methods have emerged, such as edge detection, threshold segmentation, wavelet transform, and region growing. However, machine vision methods are greatly affected by background interference and have limitations in practical applications. With the development of deep learning, target detection and semantic segmentation methods have good results in crack detection. The target detection method uses an "anchor frame" to obtain the position and category of the target, but can only obtain the position and relative size of the crack, and cannot determine the specific shape of the crack, so it cannot accurately judge the grade of the crack.
[0003] The semantic segmentation method determines the category of pixel points to obtain the topological structure of the crack. However, cracks have the characteristics of diverse shapes and sizes, complex structures, and low recognition, which brings challenges to crack semantic segmentation. Existing methods have improved the accuracy of crack detection from the perspective of multi-scale feature fusion, but have also greatly increased the computational complexity of the model, resulting in slow reasoning speed and difficulty in practical application deployment. Other methods have initially balanced the accuracy and speed of crack detection from the perspective of attention mechanism and module lightweight, but such methods have limited ability to detect small cracks and have problems of missed detection and false detection.
[0004] Therefore, how to detect trace cracks quickly and accurately is an urgent problem to be solved. Summary of the invention
[0005] The purpose of the embodiments of the present invention is to provide a lightweight detection method, device and storage medium for trace cracks, so as to solve the problems of large number of parameters and insufficient detection accuracy in existing crack detection methods.
[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is a lightweight detection method for trace cracks, comprising the following steps:
[0007] S1: build dataset images;
[0008] S2: Build the detection model DSCP-Unet;
[0009] S3: training model;
[0010] S4: Testing model.
[0011] Furthermore, the S1 includes:
[0012] Select a data set, perform random color transformation, add Gaussian noise, and rotation operations on the data set images; then randomly divide the data set into training sets and test sets.
[0013] Further, the S2 includes:
[0014] S21: build encoder module;
[0015] The encoder module consists of four feature extraction modules ASG bottleneck and one round-trip sampling module PASG in sequence;
[0016] S22: construct a decoder module;
[0017] The decoder module is composed of the upsampling module and the Concat module;
[0018] S23: construct the reinforcement module MFFS;
[0019] S24: Get the final output of the model.
[0020] Further, the S21 includes:
[0021] S211: Construct convolution module DGConv;
[0022] In the DGConv module, the input F0 passes through three DConv convolution blocks to obtain the feature map F1. DConv consists of a 3×3 convolution, a batch normalization BN, and a Prelu activation function in sequence. The third DConv convolution block outputs two parallel branches; the first branch passes through a 1×1 convolution to obtain the feature map F2, and the second branch passes through a 3×3 depth-separable convolution DSC to obtain the feature map F3; then, the feature maps F2 and F3 are spliced in the channel direction to obtain the output feature map F4 of the DGConv module;
[0023] The feature extraction process of the DGConv module is:
[0024] f DConv (input) = PRelu(BN(Conv 3*3 (input))) (1)
[0025] F1=f DConv (f DConv (f DConv (input))) (2)
[0026] F2=Conv 1*1 (F1) (3)
[0027] F3=DWConv3*3 (F1) (4)
[0028] F4=Concat(F2,F3) (5)
[0029] Among them, input refers to the input feature map F0 of the DGConv module, PRelu refers to the PRelu activation function, BN refers to the batch normalization operation, Conv 3*3 Refers to the 3×3 convolution operation, Conv 1*1 represents a 1×1 convolution operation, f DConv Refers to the operation of the DConv module, DWConv 3*3 Refers to the 3*3 depth-separable convolution operation, and Concat refers to the concatenation operation in the channel direction;
[0030] S212: Building module ASG bottleneck; module ASG bottleneck consists of 2 convolution modules DGConv, 1 dual-channel attention mechanism CBAM and 1 pooling module SAPool in sequence;
[0031] In the module ASG bottleneck, the input feature map X0 is passed through two layers of DGConv to obtain the feature map X1, and then through the dual-channel attention mechanism CBAM to obtain the feature map X2, and the output of CBAM is transmitted to two parallel branches; then enter the SAPool module, the first branch passes through a 2×2 MaxPooling to obtain the feature map X3, the second branch passes through a 2×2 AvgPooling, and then the output of AvgPooling is filtered through the Threshold threshold operation to obtain the feature map X4, and then the feature map X3 and the feature map X4 are dot-multiplied, and finally the result of the dot-multiplication of the feature map X3 and the feature map X4 is added to the feature map X3 to obtain the output feature map X5 of the feature extraction module ASG bottleneck;
[0032] The feature extraction process of ASG bottleneck is:
[0033] X1=f DGConv (f DGConv (input)) (6)
[0034] X2=CBAM(X1) (7)
[0035] X3=MaxPooling 2*2 (X2) (8)
[0036] X4=Threshold(AvgPooling 2*2 (X2)) (9)
[0037] X5=add(X3,X3·X4) (10)
[0038] Among them, f DGConv Refers to the DGConv module operation, CBAM refers to the dual-channel attention mechanism, MaxPooling 2*2 Refers to the 2×2 maximum pooling operation, Threshold refers to the Threshold operation, AvgPooling 2*2 Refers to the 2×2 average pooling operation, add refers to the element-by-element addition operation, and · refers to the element-by-element multiplication operation;
[0039] In the encoder module, the output feature maps after the four ASG bottleneck modules are N1, N2, N3, and N4 respectively.
[0040] Furthermore, the S21 further includes:
[0041] S213: construct a round-trip sampling module PASG; the round-trip sampling module PASG is composed of 1 Pixelshuffle, 1 Concat and 1 ASG bottleneck modules in sequence;
[0042] In the PASG module, the input feature map N4 is subjected to a pixel shuffle operation to obtain a feature map P1; then, the feature map P1 is concatenated with the output feature map N2 of the second ASG bottleneck module in the channel direction to obtain the feature map P2, and then, after passing through an ASG bottleneck module, the output feature map D0 of the PASG module is obtained;
[0043] S214: In the encoder module, the image to be detected is passed through four ASG bottleneck modules and one PASG module connected in sequence to extract crack features, and the feature maps N1, N2, N3, N4, and D0 are respectively sent to the decoder module.
[0044] Further, the S22 includes:
[0045] S22: In the upsampling module of the decoder module, the input feature map S0 is subjected to a bilinear interpolation upsampling operation to obtain the feature map S1; then, it is sequentially passed through two 3×3 DGConv modules to obtain the feature map S2, and then through a dual-channel attention mechanism CBAM to obtain the output result S3 of the upsampling module;
[0046] In the decoder module, the feature map D0 received from the PASG module is concat-concatenated with the output N4 of the fourth ASGbottleneck module in the encoder, and then passed through the upsampling module to obtain the feature map D1; D1 is concat-concatenated with the output N3 of the third ASG bottleneck module, and then passed through the upsampling module to obtain the feature map D2; D2 is concat-concatenated with the output N2 of the second ASG bottleneck module, and then passed through the upsampling module to obtain the feature map D3; D3 is concat-concatenated with the output N1 of the first ASG bottleneck module, and then passed through the upsampling module to obtain the feature map D4.
[0047] Further, the S23 includes:
[0048] In the MFFS module, three Pixelshuffle modules are used to expand the D1 feature map by 8 times, the D2 feature map by 4 times, and the D3 feature map by 2 times.
[0049] Further, the S24 includes:
[0050] In the decoder module, the three feature maps enlarged by the Pixelshuffle module are concatenated with the D4 feature map to obtain feature map D5. Finally, a 1×1 convolution is used to reduce the number of channels and output the final result D6.
[0051] Another technical solution adopted by the present invention is a lightweight detection device for trace cracks, which adopts the above method to achieve lightweight detection of trace cracks.
[0052] Another technical solution adopted by the present invention is a lightweight detection storage medium for trace cracks, which adopts the above method to realize lightweight detection of trace cracks.
[0053] The beneficial effects of the present invention are
[0054] 1. Existing crack detection methods have a large number of parameters and weak feature extraction capabilities. The present invention proposes a lightweight feature extraction module DGConv and a pooling module SAPool. By lightweight learning of crack features and adaptive screening of crack features, a balance between detection accuracy and parameter quantity is achieved, which can reduce the number of model parameters and improve feature extraction capabilities.
[0055] 2. Existing crack detection methods have the problems of limited receptive field and insufficient crack resolution capability. The present invention designs a PASG module, which utilizes sub-pixel convolution upsampling and uses the ASG bottleneck module to further fuse multi-scale features. The module expands the overall perception of the model by acquiring multi-scale features and deep semantic information. This not only expands the overall perception of the model and improves the crack resolution capability, but also ensures the lightweight of the module, thereby improving the model's ability to resolve crack features.
[0056] 3. The crack feature map output by the existing crack detection method has the problem of blurred edges. The present invention constructs the MFFS module, which reduces the loss of trace crack edge features through Pixelshuffle and multi-scale feature fusion, and further captures the edge information of small cracks. It not only reduces the loss of trace crack edge features, but also improves the edge clarity of the crack feature map, realizes high-precision detection of trace cracks, and the module is also relatively lightweight. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0058] Figure 1 It is a flow chart of the method of the present invention.
[0059] Figure 2 It is a flow chart of the feature extraction module ASG bottleneck of the method of the present invention.
[0060] Figure 3 It is a flow chart of the convolution module DGConv of the method of the present invention.
[0061] Figure 4 It is a flow chart of the upsample layer module Upsample Layer of the method of the present invention.
[0062] Figure 5 It is a flow chart of the round-trip sampling module PASG of the method of the present invention.
[0063] Figure 6 This is a comparison chart of the detection results of trace cracks by the method of the present invention and the semantic segmentation methods of UNet, CPFNet, PIDNet and DDRNet. DETAILED DESCRIPTION
[0064] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0065] This embodiment provides a lightweight detection method for trace cracks. The complete steps of the method of the present invention are as follows:
[0066] S1: Constructing the dataset. The dataset uses the public crack datasets of CFD and CRACK500. Random color transformation, Gaussian noise and rotation operations are performed on CFD. Each image of CRACK500 is divided into 16 non-overlapping sub-images, and images with crack pixel numbers greater than 1000 are retained. The enhanced CFD and CRACK500 datasets have 236 and 3368 images respectively. The training set and test set are randomly divided on the datasets CFD and CRACK500.
[0067] S2: Construct the detection model DSCP-Unet. Figure 1 ,The detection model DSCP-Unet consists of an encoder module, an enhancement module MFFS, and a decoder module. The specific steps are described as follows:
[0068] S21: Construct the encoder module. The encoder module is composed of four lightweight feature extraction modules ASG bottleneck and one round-trip sampling module PASG in sequence, aiming to reduce the model complexity and parameter quantity while maintaining sufficient accuracy, enhance the model's perception and anti-interference capabilities for cracks, and thus improve the model's detection effect on trace cracks. The specific steps are described as follows:
[0069] S211: Construct DGConv module. DGConv is designed to reduce the number of model parameters while overcoming the problem of local information loss and limited feature expression capability caused by separate calculation of channel and regional information in traditional DSC.
[0070] like Figure 3As shown in the figure, in the DGConv module, the input F0 is passed through 3 layers of DConv to obtain the feature map F1. DConv is composed of 1 3*3 convolution, 1 batch normalization BN, and 1 Prelu activation function in sequence. It preliminarily extracts the surface features of the cracks and outputs two parallel branches; then, the first branch is passed through a 1*1 convolution (cv1) to obtain the feature map F2, which is used to retain the crack features and reduce the number of channels. The second branch is passed through a 3*3 depth-separable convolution DSC to obtain the feature map F3; finally, the outputs of cv1 and DSC, namely the feature maps F2 and F3, are spliced in the channel direction to obtain the output feature map F4 of the DGConv module.
[0071] The feature extraction process of DGConv is:
[0072] f DConv (input) = PRelu(BN(Conv 3*3 (input))) (1)
[0073] F1=f DConv (f DConv (f DConv (input))) (2)
[0074] F2=Conv 1*1 (F1) (3)
[0075] F3=DWConv 3*3 (F1) (4)
[0076] F4=Concat(F2,F3) (5)
[0077] Among them, input refers to the input feature map F0 of the DGConv module, Prelu refers to the Prelu activation function, BN refers to the batch normalization operation, Conv 3*3 Refers to the 3×3 convolution operation, Conv 1*1 represents a 1×1 convolution operation, f DConv Refers to the operation of the DConv module, DWConv 3*3 It refers to depth-wise separable convolution, and Concat refers to the concatenation operation in the channel direction.
[0078] S212: Construct feature extraction module ASG bottleneck. Figure 2 As shown in the figure, the lightweight feature extraction module ASGbottleneck consists of 2 DGConvs, 1 dual-channel attention mechanism (CBAM) and 1 SAPool in sequence.
[0079] In the ASG bottleneck, the input feature map X0 is passed through two layers of DGConv to obtain the feature map X1, so as to reduce the number of model parameters while maintaining the detection accuracy; then, after passing through the dual-channel attention mechanism CBAM, the feature map X2 is obtained, and the output is transmitted to two parallel branches to enhance the model's attention to the crack features; then, after SAPool, that is, the first branch passes through a 2*2 MaxPooling (po1) to obtain the feature map X3, which is used to enhance the crack features, and the second branch passes through a 2*2 AvgPooling (po2) to filter out background interference, and then the output of po2 is filtered by Threshold (th1) to obtain the feature map X4, and then the outputs of po1 and th1, namely the feature maps X3 and X4, are multiplied element by element, and finally the result of the element-by-element multiplication of the feature maps X3 and X4 is added to the output of po1, namely the feature map X3, to obtain the output feature map X5 of the feature extraction module ASGbottleneck.
[0080] The feature extraction process of ASG bottleneck is:
[0081] X1=f DGConv (f DGConv (input)) (6)
[0082] X2=CBAM(X1) (7)
[0083] X3=MaxPooling 2*2 (X2) (8)
[0084] X4=Threshold(AvgPooling 2*2 (X2)) (9)
[0085] X5=add(X3,X3·X4) (10)
[0086] Among them, f DGConv Refers to the DGConv module operation, CBAM refers to the dual-channel attention mechanism, MaxPooling 2*2 Refers to the 2*2 maximum pooling operation, Threshold refers to the Threshold operation, AvgPooling 2*2 Refers to the 2*2 average pooling operation, add refers to the element-by-element addition operation, and · refers to the element-by-element multiplication operation.
[0087] In the encoder module, the output feature maps after four ASG bottleneck modules are N1, N2, N3, and N4.
[0088] S213: Construct a round trip sampling module PASG. Figure 5As shown in Figure 1, the round-trip sampling module (PASG) consists of 1 Pixelshuffle, 1 Concat, and 1 ASG bottleneck in sequence.
[0089] In the PASG module, the input feature map N4 is upsampled to high resolution through the Pixelshuffle operation to obtain the feature map P1; then, it is spliced with the output feature map N2 of the second ASG bottleneck module in the channel direction to obtain the feature map P2. By fusing the deep and shallow crack features, the feature extraction range of the model is expanded; finally, after an ASGbottleneck module, the output feature map D0 of the PASG module is obtained. On the basis of expanding the crack feature extraction range of the model, the ASG bottleneck module is used to further process the fused crack features, which enhances the model's ability to extract crack features, so the model's perception ability is improved.
[0090] S214: The encoder passes the image to be detected through four groups of DGConv+CBAM+SAPool blocks connected in sequence, namely the module ASG bottleneck, to achieve a 16-fold expansion of the number of output feature channels and an 8-fold compression of the feature map size, while realizing multi-scale feature extraction, and then enters the module PASG to expand the overall perception of the model through multi-scale fusion, thereby improving the model's ability to segment cracks, thereby reducing the false detection and missed detection rates of trace cracks, and improving the model's ability to detect small cracks, and obtaining the output feature map D0 of the encoder module; in the encoder module, the image, namely the normal image and the cracked image, can be used to extract the characteristics of the cracks, and divided into five paths N1, N2, N3, N4, and D0, and the shallow and deep features are sent to the decoder at the same time.
[0091] S22: Construct a decoder module. Figure 4 As shown in the figure, the decoder consists of an upsample layer and a concat layer, which is responsible for fusing features and achieving pixel-level semantic segmentation. The specific steps are as follows:
[0092] In the decoder module, in the upsample layer, the input feature map S0 undergoes a bilinear interpolation upsampling operation to obtain the feature map S1; then, it passes through two 3*3 DGConv modules in sequence to obtain the feature map S2, achieving a balance between detection accuracy and parameter quantity; finally, a CBAM is used to further enhance the crack features to obtain the output result S3 of the upsample layer.
[0093] In the decoder module, the feature map D0 received from the PASG module is concat-concatenated with the output N4 of the fourth ASGbottleneck module in the encoder, and then passed through the upsampling layer to obtain the feature map D1; D1 is concat-concatenated with N3, and then passed through the upsampling layer to obtain the feature map D2; D2 is concat-concatenated with N2, and then passed through the upsampling layer to obtain the feature map D3; D3 is concat-concatenated with N1, and then passed through the upsampling layer to obtain the feature map D4.
[0094] S23: Construct the enhancement module MFFS. MFFS is responsible for high-resolution recovery of deep features and obtaining richer crack boundary information, thereby improving the problem of loss of detail information during upsampling.
[0095] The core of MFFS is the sub-pixel convolution module (Pixelshuffle). Pixelshuffle can achieve pixel rearrangement through convolution operation, thereby achieving upsampling from low resolution to high resolution. Compared with traditional interpolation methods, Pixelshuffle better retains crack detail information and does not increase the number of network parameters, which is conducive to reducing the complexity and computation of the model. The three-way output features of the three Pixelshuffle modules are spliced in the channel direction and then spliced with the output of the fourth layer of the decoder in the channel direction; specifically, in MFFS, three Pixelshuffles are used to expand the D1 feature map by 8 times, the D2 feature map by 4 times, and the D3 feature map by 2 times.
[0096] S24: Get the final output of the model. Then, in the decoder module, the three enlarged feature maps are concatenated with the D4 feature map to obtain the feature map D5. Finally, a 1*1 convolution is used to reduce the number of channels and output the segmentation result D6.
[0097] S3: Train the model using the training set and update the model parameters.
[0098] S4: Test the model using the test set.
[0099] Four classic semantic segmentation networks are compared: CPFNet, UNet, PIDNet, and DDRNet. The experimental results are shown in Table 1, where bold represents the best indicators.
[0100] Table 1 Comparison of test results of DSCP-UNet and other models on CFD dataset
[0101] Methods Pa(%) Recall(%) F1(%) Params(M) FLOPs(G) CPFNet 61.29 66.36 63.72 4.01 0.55 UNet 57.94 72.42 64.38 218.96 31.04 PIDNet 54.15 66.13 59.54 22.29 28.54 DDRNet 55.05 60.87 57.82 17.97 20.15 DSCP-UNet 63.87 84.53 72.76 30.23 3.07
[0102] Table 1 shows the detection results of each model in the CFD test set. Compared with the UNet, CPFNet, PIDNet and DDRNet models, the accuracy of DSCP-UNet increased by 10.23%, 4.21%, 17.95% and 16.02% respectively, which verifies the role of modules MFFS, SAPool and PASG in improving the accuracy of crack detection. The recall rate increased by 16.72%, 27.38%, 27.82% and 38.87% respectively. The cracks in the CFD dataset are small, the structure is complex, and the environmental interference is small. Therefore, the PASG module expands the receptive field and perception ability of the model, which is advantageous for identifying complex crack structures and retaining the fine edges of cracks, which verifies the improvement of the overall perception ability of the model by the PASG module. The F1 value increased by 13.02%, 14.19%, 22.20% and 25.84% respectively. In terms of model complexity, DSCP-UNet is second only to CPFNet and has a faster processing speed, which verifies that DGConv convolution can significantly make the model lightweight.
[0103] Table 2 Comparison of test results of DSCP-UNet and other models on CRACK500 dataset
[0104] Methods Pa(%) Recall(%) F1(%) Params(M) FLOPs(G) CPFNet 89.64 53.00 66.61 4.01 0.55 UNet 84.18 57.53 68.35 218.96 31.04 PIDNet 81.59 48.64 60.95 22.29 28.54 DDRNet 72.47 68.85 70.61 17.97 20.15 DSCP-UNet 79.34 71.36 75.14 30.23 3.07
[0105] Table 2 shows the detection results of each model in the CRACK500 test set. Compared with UNet, CPFNet, PIDNet, and DDRNet models, the recall rate of DSCP-UNet is improved by 24.04%, 34.64%, 46.71%, and 3.65%, respectively, which reflects the effectiveness of modules MFFS, SAPool, and CBAM in complex crack detection. The cracks in the CRACK500 dataset are wide, simple in structure, and have large environmental interference. Modules MFFS, SAPool, and CBAM have the function of enhancing crack features, which are advantageous for identifying wide and simple cracks, verifying the ability of module PASG in model anti-interference. The F1 value is increased by 9.93%, 12.81%, 23.28%, and 6.42%, respectively. Although DSCP-UNet sacrifices some accuracy when improving the recall rate, the comprehensive index F1 has been greatly improved, which further shows that the model has good generalization ability.
[0106] like Figure 6As shown in the figure, in order to comprehensively evaluate the detection performance of DSCP-UNet, six crack images were randomly selected on the CFD test set, and DSCP-UNet was compared with GT, UNet, CPFNet, PIDNet, and DDRNet in subjective indicators. Observing the images of Group B, Group C, and Group E, the images are clear and the crack structure is simple. From the results, it can be seen that PIDNet has the most serious missed detection, followed by DDRNet. The other methods can detect the general structure of the crack, but DSCP-UNet detects the crack most clearly. Observing the images of Group A, there is a horizontal main crack in the image and a small crack extends to both sides. From the comparison results of Group A, it can be seen that UNet, CPFNet, PIDNet, and DDRNet can detect the main crack, but the detection effect of the small cracks on both sides is poor. From the detection results of DSCP-UNet, it can be seen that the overall structure of the detected cracks is continuous, and the boundaries of the small cracks are the clearest, which reflects the ability of MFFS and SAPool modules in detecting small cracks. Observing the images of Group D, the images are blurred and the cracks are more divergent. From the results of group D, it can be seen that the overall perception ability of UNet, CPFNet, PIDNet, and DDRNet is poor, and there are many missed detections. Their detection results are quite different from GT. Compared with GT, DSCP-Unet has a small number of missed detections, but compared with other models, DSCP-Unet has the highest crack integrity. DSCP-UNet can still detect the overall structure of the crack when the picture is blurred, which reflects the role of the PASG module in improving the overall perception ability of the model. Observing the pictures of group F, the pictures have background interference and the crack texture is complex. From the results of group F, it can be seen that the crack detection results of UNet, CPFNet, PIDNet, and DDRNet in the background interference are not clear. Observing the detection results of DSCP-UNet, the completeness of the crack and the clarity of the boundary details are better than GT, which reflects the advantages of the modules CBAM, SAPool and PASG in jointly detecting cracks, indicating that the model can enhance the strong perception of crack features through the module MFFS, and realize the accurate detection of complex crack structures and fine edges. Taking all factors into consideration, DSCP-UNet has the best detection effect.
[0107] In summary, the DSCP-UNet network proposed in the present invention has high detection accuracy even in small cracks and backgrounds of different complexity, and can meet the application of mobile devices in terms of model lightweight.
[0108] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0109] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A lightweight detection method for trace cracks, characterized in that: The following steps are involved: S1: build dataset images; S2: Build the detection model DSCP-Unet; S3: training model; S4: Testing model.
2. A lightweight detection method for trace cracks according to claim 1, characterized in that: The S1 includes: Select a data set, perform random color transformation, add Gaussian noise, and rotation operations on the data set images; then randomly divide the data set into training sets and test sets.
3. A lightweight detection method for trace cracks according to claim 1, characterized in that: The S2 includes: S21: build encoder module; The encoder module consists of four feature extraction modules ASG bottleneck and one round-trip sampling module PASG in sequence; S22: construct a decoder module; The decoder module is composed of the upsampling module and the Concat module; S23: construct the reinforcement module MFFS; S24: Get the final output of the model.
4. A lightweight detection method for trace cracks according to claim 3, characterized in that: The S21 includes: S211: Construct convolution module DGConv; In the DGConv module, the input F0 passes through three DConv convolution blocks to obtain the feature map F1. DConv consists of a 3×3 convolution, a batch normalization BN, and a Prelu activation function in sequence. The third DConv convolution block outputs two parallel branches; the first branch passes through a 1×1 convolution to obtain the feature map F2, and the second branch passes through a 3×3 depth-separable convolution DSC to obtain the feature map F3; then, the feature maps F2 and F3 are spliced in the channel direction to obtain the output feature map F4 of the DGConv module; The feature extraction process of the DGConv module is: f DConv (input)=PRelu(BN(Conv 3*3 (input))) (1) F1=f DConv (f DConv (f DConv (input))) (2) F2=Conv 1*1 (F1) (3) F3=DWConv 3*3 (F1) (4) F4=Concat(F2,F3) (5) Among them, input refers to the input feature map F0 of the DGConv module, PRelu refers to the PRelu activation function, BN refers to the batch normalization operation, Conv 3*3 Refers to the 3×3 convolution operation, Conv 1*1 represents a 1×1 convolution operation, f DConv Refers to the operation of the DConv module, DWConv 3*3 Refers to the 3*3 depth-separable convolution operation, and Concat refers to the concatenation operation in the channel direction; S212: Building module ASG bottleneck; module ASG bottleneck consists of 2 convolution modules DGConv, 1 dual-channel attention mechanism CBAM and 1 pooling module SAPool in sequence; In the module ASG bottleneck, the input feature map X0 is passed through two layers of DGConv to obtain the feature map X1, and then through the dual-channel attention mechanism CBAM to obtain the feature map X2, and the output of CBAM is transmitted to two parallel branches; then enter the SAPool module, the first branch passes through a 2×2 MaxPooling to obtain the feature map X3, the second branch passes through a 2×2 AvgPooling, and then the output of AvgPooling is filtered through the Threshold threshold operation to obtain the feature map X4, and then the feature map X3 and the feature map X4 are dot-multiplied, and finally the result of the dot-multiplication of the feature map X3 and the feature map X4 is added to the feature map X3 to obtain the output feature map X5 of the feature extraction module ASG bottleneck; The feature extraction process of ASG bottleneck is: X1=f DGConv (f DGConv (input)) (6) X2=CBAM(X1) (7) X3=MaxPooling 2*2 (X2) (8) X4=Threshold(AvgPooling 2*2 (X2)) (9) X5=add(X3,X3·X4) (10) Among them, f DGConv Refers to the DGConv module operation, CBAM refers to the dual-channel attention mechanism, MaxPooling 2*2 Refers to the 2×2 maximum pooling operation, Threshold refers to the Threshold operation, AvgPooling 2*2 Refers to the 2×2 average pooling operation, add refers to the element-by-element addition operation, and · refers to the element-by-element multiplication operation; In the encoder module, the output feature maps after the four ASG bottleneck modules are N1, N2, N3, and N4 respectively.
5. A lightweight detection method for trace cracks according to claim 4, characterized in that: The S21 further includes: S213: construct a round-trip sampling module PASG; the round-trip sampling module PASG is composed of 1 Pixelshuffle, 1 Concat and 1 ASG bottleneck modules in sequence; In the PASG module, the input feature map N4 is subjected to a pixel shuffle operation to obtain a feature map P1; then, the feature map P1 is concatenated with the output feature map N2 of the second ASG bottleneck module in the channel direction to obtain the feature map P2, and then, after passing through an ASG bottleneck module, the output feature map D0 of the PASG module is obtained; S214: In the encoder module, the image to be detected is passed through four ASG bottleneck modules and one PASG module connected in sequence to extract crack features, and the feature maps N1, N2, N3, N4, and D0 are respectively sent to the decoder module.
6. A lightweight detection method for trace cracks according to claim 5, characterized in that: The S22 includes: S22: In the upsampling module of the decoder module, the input feature map S0 is subjected to a bilinear interpolation upsampling operation to obtain the feature map S1; then, it is sequentially passed through two 3×3 DGConv modules to obtain the feature map S2, and then through a dual-channel attention mechanism CBAM to obtain the output result S3 of the upsampling module; In the decoder module, the feature map D0 received from the PASG module is concat-concatenated with the output N4 of the fourth ASG bottleneck module in the encoder, and then passed through the upsampling module to obtain the feature map D1; D1 is concat-concatenated with the output N3 of the third ASGbottleneck module, and then passed through the upsampling module to obtain the feature map D2; D2 is concat-concatenated with the output N2 of the second ASG bottleneck module, and then passed through the upsampling module to obtain the feature map D3; D3 is concat-concatenated with the output N1 of the first ASG bottleneck module, and then passed through the upsampling module to obtain the feature map D4.
7. A lightweight detection method for trace cracks according to claim 6, characterized in that: The S23 includes: In the MFFS module, three Pixelshuffle modules are used to expand the D1 feature map by 8 times, the D2 feature map by 4 times, and the D3 feature map by 2 times.
8. A lightweight detection method for trace cracks according to claim 7, characterized in that: The S24 includes: In the decoder module, the three feature maps enlarged by the Pixelshuffle module are concatenated with the D4 feature map to obtain feature map D5. Finally, a 1×1 convolution is used to reduce the number of channels and output the final result D6.
9. A lightweight detection device for trace cracks, characterized in that: The method according to any one of claims 1 to 8 is used to realize lightweight detection of trace cracks.
10. A lightweight storage medium for detecting trace cracks, characterized in that: The method according to any one of claims 1 to 8 is used to realize lightweight detection of trace cracks.
