Well wall crack defect detection method and device and storage medium

By building an optimized well wall crack detection model, using technologies such as YOLOv8n and feature enhancement module, the problems of inaccurate positioning and model complexity in well wall crack detection are solved, and efficient and accurate detection of real-time underground inspection is achieved.

CN118968218APending Publication Date: 2024-11-15ANHUI UNIV OF SCI & TECH
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202411026016.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

The existing well wall crack detection methods have problems such as inaccurate target positioning, missed inspection and missed inspection, large amount of model parameters and calculations, and difficulty in deploying to downhole edge equipment for real-time inspection.

Method used

A well wall crack detection method is adopted, including obtaining the well wall crack data set, processing and division, and constructing a well wall crack detection model. Using the YOLOv8n model and introducing the feature enhancement module C2fEIR in its backbone, neck and head network. CSP_EDRAN and dual attention DAM, combined with lightweight detection head GDetect, optimize the model to adapt to the underground environment.

Benefits of technology

It improves the accuracy and efficiency of well wall crack detection, reduces the leakage detection rate and error detection rate, and is suitable for deploying edge equipment in underground environments for real-time inspection, taking into account detection accuracy and model complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118968218A_ABST
    Figure CN118968218A_ABST
Patent Text Reader

Abstract

The invention provides a well wall crack defect detection method and device and a storage medium. The detection method comprises the following steps that S1, a well wall crack data set is obtained; s2, performing data processing on the well wall crack data set and dividing the well wall crack data set into a training set, a verification set and a test set; s3, constructing a well wall crack detection model; s4, using the well wall crack data set to train and verify the well wall crack detection model; and S5, testing the well wall crack detection model. The S3 comprises the steps that S31, a backbone network of the well wall crack detection model is constructed, and a YOLOv8n model is adopted; s32, constructing a neck network of the well wall crack detection model; and S33, constructing a head network of the well wall crack detection model. The problems that in an existing detection method, positioning of a complex target is not accurate, missing detection and false detection occur, the model parameter quantity and the calculation quantity are large, and it is difficult to deploy edge equipment for real-time inspection in the underground environment are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of target detection, and in particular relates to a method, a device and a storage medium for detecting well wall crack defects. Background Art

[0002] The surface of the shaft is made of concrete, which is located thousands of meters underground. It is often affected by temperature stress and ground stress at different depths, which can easily cause cracks of different degrees and types on the surface of the shaft wall. The cracks in the shaft wall will weaken the shaft's impermeability, and as the cracks spread, the concrete will carbonize, reducing the durability of the concrete material. Once the shaft breaks, it will bring a series of adverse and serious consequences, threatening the production safety of the coal mine. Therefore, it is necessary to monitor the cracks in the shaft wall in real time, establish an effective early warning system, and ensure the strength and stability of the shaft.

[0003] Traditional well wall crack defect detection is mainly done through manual inspection, which has slow overall detection efficiency and low accuracy. It is difficult to correctly classify defects, and there are problems such as false detection and high missed detection rates. With the rapid development of science and technology, manual defect detection methods can no longer meet the needs of industry development.

[0004] With the continuous development of deep learning, target detection based on deep learning has become popular. The inventors found that although the existing deep learning method has improved the accuracy of crack detection, it has not fully considered the detection of small targets in complex backgrounds and the problems of missed detection and false detection caused by large differences in crack aspect ratios. The model has a large number of parameters and calculations, and it is difficult to deploy it to edge devices for real-time inspection in underground environments. Summary of the invention

[0005] The purpose of the embodiments of the present invention is to provide a method, device and storage medium for detecting well wall crack defects, so as to solve the problems in existing detection methods such as inaccurate positioning of complex targets, missed detections and false detections, large model parameter and calculation amount, and difficulty in deploying to edge devices for real-time inspections in underground environments, while taking into account both efficiency and accuracy.

[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0007] A method for detecting well wall crack defects comprises the following steps:

[0008] S1: Obtain wellbore fracture dataset;

[0009] S2: Process the wellbore fracture data set and divide it into training set, validation set and test set;

[0010] S3: Construct a wellbore crack detection model;

[0011] S4: Use the wellbore crack dataset to train and validate the wellbore crack detection model;

[0012] S5: Test the wellbore crack detection model.

[0013] Furthermore, in S1: the wellbore fracture data set includes fracture images under different lighting conditions and backgrounds, and the fracture types in the fracture images include transverse fractures, longitudinal fractures, and reticular fractures.

[0014] Further, the S2 includes:

[0015] S21: Annotate the S1 dataset;

[0016] S22: Divide the labeled data set into a training set, a validation set, and a test set, add random flipping, random contrast, and random Gaussian noise operations to the training set images, and expand the data set.

[0017] Further, the S3 includes:

[0018] S31: Construct the backbone network of the wellbore crack detection model using the YOLOv8n model;

[0019] S32: Constructing the neck network of the wellbore crack detection model;

[0020] S33: constructing the head network of the wellbore crack detection model;

[0021] The backbone network consists of 5 Conv modules, 4 C2f modules, and 1 SPPF module;

[0022] In S31, the feature enhancement module C2fEIR is introduced at the positions where the number of channels in the backbone network is 512 and 1024, forming the backbone network of the wellbore crack detection model;

[0023] The neck network of the YOLOv8n model consists of 2 UpSample upsampling layers, four concat layers, and 2 Conv modules;

[0024] In S32, in the neck network of the YOLOv8n model, the efficient void heavy parameter aggregation network CSP_EDRAN modules are introduced after the first concat splicing, the second concat splicing, the third concat splicing, and the fourth concat splicing respectively. There are four CSP_EDRAN modules in total; the dual attention DAM module is introduced after the first three CSP_EDRAN modules; forming the neck network of the well wall crack detection model;

[0025] The head network of the YOLOv8n model consists of two parallel 1×1 conv2d convolutions;

[0026] In S33, the GSConv module is introduced into the head network of the YOLOv8n model to form the head network of the wellbore crack detection model.

[0027] Further, the S31 includes:

[0028] S311: Construct a feature extraction module EIRBlock; in the feature extraction module EIRBlock, firstly, the input feature map is convolved by 1×1; then, BN normalization and Swish activation operations are performed in sequence, and then DWC depthwise separable convolution is performed, followed by BN normalization, Swish activation operation, EffectiveSE attention operation, and 1×1 convolution is used for dimensionality reduction, followed by BN normalization and Dropout regularization, and the obtained feature map is added to the input feature map of the EIRBlock module to obtain the output of the EIRBlock module;

[0029] S312: Construct a feature enhancement module C2fEIR; in the feature enhancement module C2fEIR, firstly extract preliminary features from the input feature map of the module C2fEIR through the first convolution layer of size 3×3, and then use the Split operation to divide the number of channels of the preliminary features into two branches, the first branch skips the EIRBlock module, and the second branch is processed by the EIRBlock module; the feature maps obtained from the two branches are spliced ​​together through the Concat operation, and then through the second convolution layer of size 3×3 to obtain the output of the module C2fEIR.

[0030] Furthermore, the construction process of the CSP_EDRAN module in S32 includes:

[0031] S321: Construct a CSP_EDRAN module; in the CSP_EDRAN module, the input feature map of the CSP_EDRAN module is divided into two branches after the standard convolution layer, BN normalization, and Swish activation operation. The first branch extracts features through the Dilated ReparamBlock structure; in the Dilated Reparam Block structure, the feature map after the standard convolution layer, BN normalization, and Swish activation operation passes through a 9×9 convolution with a dilation rate of 1, a 5×5 convolution with a dilation rate of 1, a 5×5 convolution with a dilation rate of 2, a 3×3 convolution with a dilation rate of 3, and a 3×3 convolution with a dilation rate of 4 in parallel, and passes through the BN normalization operation respectively, to obtain five output features; the second branch skips the Dilated Reparam Block structure, concats the five output features of the Dilated Reparam Block module, and then performs a standard convolution layer, BN normalization, and Swish activation operation; the output of the CSP_EDRAN module is obtained.

[0032] Furthermore, the S32 further includes:

[0033] S322: Construct a DAM attention module; the DAM attention module is composed of a channel attention module CAM and a spatial attention module SAM;

[0034] In the DAM attention module, a 3×3 convolutional layer is used to reduce the dimension of the input features, and the reduced features are sent to CAM and SAM respectively;

[0035] In CAM, the input feature map is X, and the size of X is C×H×W, where C represents the number of channels of the feature map, H represents the height of the feature map, and W represents the width of the feature map. First, perform a gropus operation to divide the number of channels C of the feature map into G groups to obtain the feature map x C / / G×H×W , and at the same time the feature map x C / / G×H×W Divide into four branches, and transform the characteristic graphs x of the first branch and the second branch C / / G×H×W Perform one-dimensional operations on the height and width dimensions to obtain the feature map x C / / G×1×W 、x C / / G×H×1 ;

[0036] Then, one-dimensional global average pooling is used in the first branch to encode the channel along the horizontal spatial direction to obtain the pooling result in the horizontal direction; one-dimensional global average pooling is used in the second branch to encode the channel along the vertical spatial direction to obtain the pooling result in the vertical direction; the pooling results in the horizontal and vertical directions are then spliced ​​together and reduced in dimension through a 1×1 convolution; the channel information is then decomposed into two vectors according to the channel height and width; these two vectors are respectively passed through the Sigmoid function to generate two channel directions, namely the attention maps y1 and y2 in the X direction and the Y direction, and then the attention maps y1 and y2 are combined with the feature map x of the third branch. C / / G×H×W A reweighting Re-weight operation is performed, and then after Group Norm, global average pooling, and Softmax function processing, the channel attention map y3 with a size of 1×H×W is obtained by matrix multiplication matmul; in the fourth branch, a 3×3 convolution operation is performed on the feature map, and then global average pooling is performed, and the pooled feature map is processed by the Softmax function, and a feature map y4 with a size of 1×H×W is output through matrix multiplication operation; at the same time, the output of the Group Norm layer in the first branch and the output of the matrix multiplication layer in the fourth branch are cross-channel interactively learned, and the convolution layer output of the fourth branch and the matrix multiplication layer output of the first branch are cross-channel interactively learned; y3 and y4 are element-by-element added, the Sigmoid function operation is performed, and then added to the feature map x of the third branch. C / / G×H×W Perform Re-weight operation to obtain the output Y1 of module CAM;

[0037] In the spatial attention module SAM, the input feature map X is subjected to global maximum pooling and global average pooling to obtain two 1×H×W weight vectors, which are then concat-concatenated to generate a 2×H×W spatial weight matrix. This is then subjected to a 7×7 convolutional layer for dimensionality reduction, followed by a Sigmoid function operation to obtain the SAM module output Y2.

[0038] The outputs Y1 and Y2 are added to fuse the features, and then the output feature map Y of the module DAM is generated through a 3×3 convolutional layer;

[0039] The process of extracting the characteristics of wellbore fractures by the DAM module is as follows:

[0040] y1=σ{Conv 1×1 [Concat(X_AvgPool(x C / / G×1×W ))]}

[0041] y2=σ{Conv 1×1 [Concat(Y_AvgPool(x C / / G×H×1 ))]}

[0042] y3=matmul{δ[AvgPool(GroupNorm(∑(x C / / G×H×W ,y1,y2)))]}

[0043] y4 = matmul{δ[AvgPool(Conv 3×3 (x C / / G×H×W ))]}

[0044] Y1=∑(x C / / G×H×W ,σ(y3+y4))

[0045] Y2=σ{f 7×7 (Concat[AvgPool(x C×H×W );MaxPool(x C×H×W )])}

[0046] Y=Conv 3×3 (Y1+Y2)

[0047] Among them, σ represents the Sigmoid function; δ represents the Softmax function; f 7×7 Indicates a convolution operation with a filter size of 7×7; Conv 1×1 、Conv 3×3Respectively represent convolutions with kernels of 1×1 and 3×3; AvgPool, MaxPool, X_AvgPool, and Y_AvgPool represent global average pooling, global maximum pooling, horizontal average pooling, and vertical average pooling, respectively; matmul represents matrix multiplication; ∑ represents Re-weight operation; Concat represents concatenation operation; GroupNorm represents group normalization; y1 represents the feature map x C / / G×1×W The feature map is obtained after horizontal pooling, splicing, convolution, and Sigmoid function processing; y2 represents the feature map x C / / G×H×1 The feature map is obtained after vertical pooling, splicing, convolution, and Sigmoid function processing; y3 represents the feature map obtained by weighted operation on y1 and y2, global average pooling, Softmax function processing, and matrix multiplication; y4 represents the feature map x C / / G×H×W The feature map is obtained by performing 3×3 convolution operation, global average pooling operation, Sigmoid function processing, and matrix multiplication operation; Y1 is the feature map output by the CAM module, Y2 is the feature map output by the SAM module, and Y is the feature map output by the DAM module.

[0048] Further, the S33 includes:

[0049] Construct a Gsconv module. In the Gsconv module, first pass through a standard convolution layer, then perform a depth-wise separable convolution DWConv operation, and then concatenate the output of each channel in the channel dimension; finally, perform a shuffle operation to obtain the output of the Gsconv module;

[0050] Construct a GDetect module. In the GDetect module, the input feature map is divided into two branches. In each branch, two consecutive GSConv modules and a 1×1 conv2d convolution are used to obtain the output feature map. The output feature map is used to calculate the bounding box loss and classification loss. Finally, the final output of the well wall crack detection model is obtained.

[0051] Another technical solution adopted by the present invention is a well wall crack defect detection device, which adopts the above method to realize the well wall crack defect detection.

[0052] Another technical solution adopted by the present invention is a detection storage medium for well wall crack defects, which adopts the above method to realize the detection of well wall crack defects.

[0053] The beneficial effects of the present invention are

[0054] 1. Compared with the traditional backbone network in YOLOv5n, YOLOv6n, YOLOv7-tiny and YOLOv8n models, the feature enhancement module C2fEIR proposed in this invention uses the EffectiveSE attention mechanism and residual connection in the deep network of the backbone to learn the correlation between feature channels to enhance useful features, retain more fracture geometry details, make the network focus on important channels, and improve the detection accuracy of the model for wellbore cracks.

[0055] 2. Compared with MED-YOLOv8s, BL-YOLOv8n and YOLOv5n-CBoT, the model EDG-YOLO proposed in the present invention takes into account both the detection accuracy and the complexity of the model. The CSP_EDRAN module proposed in the present invention uses parallel dilated convolution to optimize the information flow and the representation ability of the network during upsampling and downsampling. The large-size convolution kernel is used to extract the spatial information of the feature map, and the small convolution kernel increases the size of the receptive field within the local receptive field through different expansion rates, thereby enhancing the network's perception of information of different scales and promoting the integration and interaction of semantic information between feature channels.

[0056] 3. The dual attention mechanism DAM proposed in this paper captures remote context information in the channel and spatial dimensions respectively. Channel attention enables the network to focus on channels that contribute more to semantic information, enhance the discrimination of crack semantic information, and improve sensitivity to key features. Spatial attention allows the network to focus on specific areas of the crack and obtain semantic information at different spatial positions, thereby reducing missed detection and false detection rates.

[0057] 4. Compared with Faster-RCNN, Cascade-RCNN and RT-DETR, which have high parameter count and high computational complexity, the lightweight detection head GDetect proposed in this invention not only takes into account the detection accuracy, but also the spatial limitation of model deployment. It lightweights the network through the GSConv module with two parallel branches, and integrates the information generated by channel dense convolution into the information generated by depthwise separable convolution through shuffle, thereby avoiding the decrease of detection accuracy.

[0058] 5. The present invention proposes a method for detecting crack defects in the well wall. It only needs to input the image of the crack to be detected into the target detection model proposed by the present invention to obtain the accurate crack type and position, which greatly improves the safety and efficiency of underground automated inspection. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] 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.

[0060] Figure 1 It is a flow chart of the present invention.

[0061] Figure 2 It is a flow chart of the present invention.

[0062] Figure 3a It is the EIRBlock module process architecture diagram of the present invention.

[0063] Figure 3b It is the C2fEIR module process architecture diagram of the present invention.

[0064] Figure 4 It is a flow chart of the CSP_EDRAN module of the present invention.

[0065] Figure 5a It is the CAM process architecture diagram of the present invention.

[0066] Figure 5b This is the DAM attention mechanism process architecture diagram of the present invention.

[0067] Figure 5c It is the SAM module process architecture diagram of the present invention.

[0068] Figure 6 It is the process architecture diagram of the GDetect module of the present invention.

[0069] Figure 7 It is a loss change diagram during the training and verification process of the EDG-YOLO and YOLOv8n algorithms of the present invention.

[0070] Figure 8 This is a comparison chart of the detection results of EDG-YOLO of the present invention and other algorithms on the wellbore crack data set. DETAILED DESCRIPTION

[0071] 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.

[0072] This embodiment provides a method for detecting crack defects in a well wall, see Figure 1 The complete steps of the method of the present invention are as follows:

[0073] S1: Obtain wellbore fracture dataset.

[0074] In this embodiment, a self-made wellbore crack data set is generated based on the wellbore simulation platform of the State Key Laboratory of Deep Coal Mine Mining Response and Disaster Prevention and Control of Anhui University of Science and Technology.

[0075] The well wall fracture dataset contains fracture images under different lighting conditions and backgrounds, including transverse fractures, longitudinal fractures, and alligator fractures. The purpose is to better reflect the actual underground environment and improve the generalization of the model.

[0076] Through manual screening, images with poor quality are removed to obtain a dataset of wellbore fractures.

[0077] S2: Annotate the obtained wellbore fracture dataset and enhance the image data. The specific steps are as follows:

[0078] S21: Use the labeling tool to manually annotate the original image, use a rectangular frame to outline the specific location of the crack defect on the well wall surface, add the corresponding label, and finally save it as an .xml format file.

[0079] S22: Divide the images into training set, validation set and test set, and only add random flipping, random contrast, random Gaussian noise and other operations to the training set images to enhance and expand the data set to 2472 images.

[0080] S3: Construct a well wall crack detection model. The specific steps are as follows:

[0081] like Figure 2 As shown in the figure, in this embodiment, when constructing the well wall crack defect detection model, the feature extraction module EIRBlock is designed, and C2fEIR is constructed to enhance the ability of the backbone network to extract the feature information of shallow cracks in the well wall; CSP_EDRAN is integrated in the neck network to realize the reuse of crack feature information and promote the interaction between shallow and deep semantic information. At the same time, the DAM attention mechanism is embedded to enhance the expression ability of well wall crack features; finally, a lightweight detection head GDetect is constructed, and the network is further lightweighted with the help of the GSConv module. The specific construction process is as follows:

[0082] S31: Construct the backbone network of the present invention, that is, the feature extraction network.

[0083] The backbone network of YOLOv8n consists of 5 Conv modules, 4 C2f modules and 1 SPPF module.

[0084] As the number of network layers of the feature extraction network of YOLOv8n increases, the spatial resolution of the feature map decreases. The high-level network contains more parameters, and training and reasoning require more memory and computing power. When extracting small crack features with complex backgrounds, the high-level network focuses on learning abstract semantic information, but it will cover up the shallow geometric detail features, affecting the effective detection of shallow small cracks.

[0085] Therefore, this embodiment proposes a feature extraction module EIRBlock, and builds a feature enhancement module C2fEIR based on it, and introduces C2fEIR at the positions where the number of channels in the YOLOv8n backbone network is 512 and 1024. It can improve the ability to extract geometric information of the well wall crack surface.

[0086] S311: Figure 3a As shown in the figure, the feature extraction module EIRBlock is constructed. In the feature extraction module EIRBlock, the input feature map is firstly increased in dimension by a 1×1 convolution, and the depthwise separable convolution is used to reduce the amount of network calculation; then BN normalization and Swish activation operations are performed in sequence, followed by DWC depthwise separable convolution, followed by BN normalization and Swish activation operations again, and EffectiveSE attention operation. The EffectiveSE attention mechanism is a simplified SE mechanism with only one fully connected layer, which avoids the loss of information between channels and enhances the network's ability to extract target features. Then, 1×1 convolution is used for dimensionality reduction. After BN normalization and Dropout regularization, the obtained feature map is added to the input feature map of this module to obtain the output of the EIRBlock module. Residual connections help to transfer geometric information between different layers of the network, avoid the problem of gradient disappearance in deep networks, and enhance the learning ability of the model in the process of dimensionality increase and dimensionality reduction.

[0087] S312: Figure 3b As shown in the figure, a feature enhancement module C2fEIR is constructed. In the feature enhancement module C2fEIR, the initial features are first extracted from the input feature map through the first convolutional layer of size 3×3. The number of channels of the initial feature information is divided into two branches using Split. The first branch is directly passed to the output, and the second branch is processed by n EIRBlock modules to capture crack features of different scales, where n=1. The feature maps of the two branches operated by the Split operation and the EIRBlock module are spliced ​​together through the Concat operation to integrate the diverse features extracted from multiple paths, improve the expression ability of the model, and more accurately identify and locate cracks. The second convolutional layer of size 3×3 is then used to further process the fused features, so that the final output features are more suitable for crack detection tasks.

[0088] S32: Construct the neck network. And input the feature map in the backbone network into the neck network. This embodiment proposes a CSP_EDRAN module (CSP Efficient Dilated Reparam Aggregation Networks), which is embedded in the first concat splicing, the second concat splicing, the third concat splicing, and the fourth concat splicing in the YOLOv8n neck network. The DAM attention mechanism is introduced after the first three CSP_EDRAN modules. It can fuse crack features of different scales and realize the reuse of crack feature information.

[0089] In the crack detection task, cracks appear at different scales in the image, and a single-scale receptive field often cannot capture the crack features at all scales at the same time. For tiny cracks, a small receptive field is needed to capture their subtle features; for larger cracks, a large receptive field is needed to capture their global information. The lack of sufficient information exchange between the multi-scale defect receptive fields of cracks will lead to the loss or incompleteness of feature information, affecting the accuracy of detection.

[0090] Secondly, the coal mine shaft is located underground, and the light inside is usually dim and uneven, making it difficult to distinguish cracks from the background, which is prone to false detection and missed detection.

[0091] S321: Build CSP_EDRAN module. Figure 4As shown in the figure, in the CSP_EDRAN module, the input feature map is divided into two paths after the standard convolution layer, BN normalization, and Swish activation operation. One path extracts features through the Dilated Reparam Block structure. The Dilated Reparam Block structure contains multi-scale branch operations. In the model training phase, dilated convolution is used to realize multi-scale feature extraction. Each convolution operation has a different dilation rate. In the model testing phase, the structural reparameterization method is used to equivalently merge the small kernel dilated convolution into a single large kernel non-dilated convolution, that is, multiple dilated convolutions in the DRB module are equivalently converted into a convolution with a dilation rate of 1. Specifically, the input feature map is divided into two branches after the standard convolution layer, BN normalization, and Swish activation operation. In the Dilated Reparam Block module, the first branch passes through 9×9 convolution with a dilation rate of 1, 5×5 convolution with a dilation rate of 1, 5×5 convolution with a dilation rate of 2, 3×3 convolution with a dilation rate of 3, and 3×3 convolution with a dilation rate of 4 in parallel, and passes through BN normalization operations respectively to obtain five output features. The second branch skips the Dilated Reparam Block structure, takes the features that skip the Dilated Reparam Block structure as the residual, concats them with the five output features of the Dilated Reparam Block module, and then sends them to the next ConvBNSilu composite layer to perform standard convolutional layer, BN normalization, and Swish activation operations for fusion and further feature extraction.

[0092] The CSP_EDRAN module can capture contextual information of different scales. During the sampling process, the CSP_EDRAN module uses parallel dilated convolution to optimize the information flow and the representation ability of the network. The large-size convolution kernel, i.e., the 9×9 convolution kernel, is used to extract the spatial information of the feature map. The small convolution kernel, i.e., the 5×5 and 3×3 convolution kernel, increases the size of the receptive field within the local receptive field through different dilation rates, enhances the network's perception of information of different scales, and promotes the integration and interaction of semantic information between feature channels.

[0093] S322: Construct a DAM attention module. This embodiment proposes a dual attention module (DAM) that combines CBAM and EMA. DAM consists of channel and spatial attention mechanisms, which capture remote context information in two dimensions respectively. Channel attention enables the network to focus on channels that contribute more to semantic information, enhance the discrimination of crack semantic information, and improve sensitivity to key features. Spatial attention allows the network to focus on specific areas of the crack and obtain semantic information at different spatial positions.

[0094] like Figure 5bAs shown in FIG. 1 , a 3×3 convolutional layer is first applied to reduce the dimension of the input features, and then these features are respectively transmitted to the channel attention module (CAM) and the spatial attention module (SAM). In this embodiment, the module EMA is used as the channel attention module CAM. Figure 5a As shown in Figure 1, in the channel attention module (CAM), the input feature map is X, and the size of X is C×H×W, where C represents the number of channels of the feature map, H represents the height of the feature map, and W represents the width of the feature map. The gropus operation first divides the number of channels C of the feature map into G groups to obtain the feature map x C / / G×H×W At the same time, the feature map after channel grouping is divided into four branches. In the first branch, one-dimensional global average pooling is used to encode the channel along the horizontal spatial direction to obtain the pooling result in the horizontal direction. In the second branch, one-dimensional global average pooling is used to encode the channel along the vertical spatial direction to obtain the pooling result in the vertical direction. Then the pooling results in the horizontal and vertical directions are spliced ​​together and reduced in dimension through a 1×1 convolution; then the channel information is decomposed into two vectors according to the height and width. These two vectors are respectively passed through the Sigmoid function to generate the attention maps y1 and y2 in the two channel directions, namely the X direction and the Y direction, and then the attention maps y1 and y2 are combined with the feature map x of the third branch. C / / G×H×W The re-weighting operation is performed, followed by Group Norm, global average pooling, and then processed by the Softmax function. Finally, matrix multiplication (matmul) is used to obtain a comprehensive channel attention map y3 of size 1×H×W; in the fourth branch, only a 3×3 kernel size convolution is used to capture local cross-channel interaction information to expand the feature space and capture the spatial structure information of wellbore cracks at different scales. First, a 3×3 convolution operation is performed on the feature map, followed by global average pooling, and the pooled feature map is processed by the Softmax function. Finally, a feature map y4 of size 1×H×W is output through a matrix multiplication operation. At the same time, the Group Norm output in the first branch and the matrix multiplication output in the fourth branch are cross-channel interactively learned, and the convolution output of the fourth branch and the matrix multiplication output of the first branch are cross-channel interactively learned. Finally, y3 and y4 are element-by-element added, Sigmoid function operated, and then combined with the feature map x of the third branch. C / / G×H×W Perform a re-weighting operation to obtain the output Y1 of the module (CAM).

[0095] like Figure 5cAs shown in the figure, in the spatial attention module (SAM), the input feature map C×H×W is subjected to global maximum pooling and global average pooling to obtain two 1×H×W weight vectors, and then the two weight vectors are concat-concatenated to generate a 2×H×W spatial weight matrix, which is then passed through a 7×7 convolutional layer for dimensionality reduction, and then a Sigmoid function operation is performed to obtain the spatial attention map Y2.

[0096] Finally, the two-dimensional outputs Y1 and Y2 are added together to fuse the features, and then the final output feature map Y is generated through a 3×3 convolutional layer.

[0097] The process of extracting the characteristics of wellbore fractures by the DAM module is as follows:

[0098] y1=σ{Conv 1×1 [Concat(X_AvgPool(x C / / G×1×W ))]}

[0099] y2=σ{Conv 1×1 [Concat(Y_AvgPool(x C / / G×H×1 ))]}

[0100] y3=matmul{δ[AvgPool(GroupNorm(Σ(x C / / G×H×W ,y1,y2)))]}

[0101] y4 = matmul{δ[AvgPool(Conv 3×3 (x C / / G×H×W ))]}

[0102] Y1=∑(x C / / G×H×W ,σ(y3+y4))

[0103] Y2=σ{f 7×7 ([AvgPool(x C×H×W );MaxPool(x C×H×W )])}

[0104] Y=Conv 3×3 (Y1+Y2)

[0105] Among them, σ represents the Sigmoid function; δ represents the Softmax function; f 7×7 Indicates a convolution operation with a filter size of 7×7; Conv 1×1 、Conv 3×3Respectively represent convolutions with kernels of 1×1 and 3×3; AvgPool, MaxPool, X_AvgPool, and Y_AvgPool represent global average pooling, global maximum pooling, and horizontal and vertical average pooling, respectively; matmul represents matrix multiplication; ∑ represents Re-weight operation; Concat represents concatenation operation; GroupNorm represents group normalization; y1 represents the feature map obtained after horizontal pooling operation, convolution, and Sigmoid function processing; y2 represents the feature map obtained after vertical pooling operation, convolution, and Sigmoid function processing; y3 represents the feature map obtained by weighting y1 and y2, performing global average pooling, and matrix multiplication after Softmax function; y4 represents the matrix multiplication operation of the output feature map after 3×3 convolution operation on the third branch, global pooling operation, and Sigmoid function processing; Y1 is the feature map output by the CAM module, Y2 is the feature map output by the SAM spatial dimension module, and Y is the feature map output by the DAM module. C / / G×H×W It means that after the input feature map is operated by Groups, the number of channels is divided into G groups, the number of channels in each group is C / / G, and the height and width of each channel are H and W respectively; x C / / G×1×W The number of channels in each group of the feature map is C / / G, and the feature map x is obtained by performing a one-dimensional operation on the height dimension. C / / G×1×W .x C / / G×H×1 The number of channels in each group of the feature map is C / / G, and the feature map x is obtained by performing a one-dimensional operation on the width dimension. C / / G×H×1 .

[0106] S33: Build the head network. Integrate the GSConv module into the detection head of the YOLOv8n model to build a lightweight detection head GDetect, and use the deep separable convolution and shuffle mechanism to lighten the network.

[0107] In the actual application of wellbore crack detection, the model needs to be deployed and run in an environment with limited resources. YOLOv8n adopts a decoupling head structure, which includes two parallel branches: the classification branch is used to extract category features, and the regression branch is used to extract location features. The design of the decoupling head avoids mutual interference between features, but increases the overall parameter volume and computational complexity of the network.

[0108] This embodiment proposes a lightweight detection head GDetect, which simultaneously calculates the regression and classification losses of the bounding box. Each branch consists of two consecutive GSConv modules and a 1×1 conv2d convolution to perform classification and positioning tasks. The Gsconv module contains a deep separable convolution DWConv. GSConv first passes through a standard convolution layer to halve the number of channels. The deep separable convolution DWConv operates on each channel independently, and the output is spliced ​​in the channel dimension; finally, a shuffle operation is performed to rearrange the channels. The principle of deep separable convolution (DWConv) is used to reduce the overall complexity of the network. Assuming that the input feature map size is C F ×C F ×Μ, the output feature map size is C F ×C F × Ν, the convolution kernel size is C K ×C K , the network computational ratio after depth-separable convolution and standard convolution is:

[0109]

[0110] Among them, FL DC , FL SC They represent the computational FLOPs of standard convolution and depthwise separable convolution respectively, M and N represent the number of convolution kernels; C K Represents the convolution kernel size. When the convolution kernel size is 3×3, the computational complexity of depthwise separable convolution is about 1 / 9 of that of standard convolution.

[0111] like Figure 6 As shown in the figure, the GDetect module handles bounding box regression and classification tasks at the same time. The regression branch (Bbox.loss) is processed by two consecutive GSConv modules to obtain an enhanced feature map, and then passes through a standard two-dimensional convolutional layer (Conv2d) for further feature extraction and size adjustment. The final output feature map is used to calculate the bounding box loss; the classification branch (cls.loss) uses two GSConv modules to enhance and extract features, and a standard two-dimensional convolutional layer further processes the feature map. The final output feature map is used to calculate the classification loss.

[0112] The GDetect module retains the random sorting strategy to infiltrate the information generated by ordinary convolution into every part of DWConv, which not only ensures that the feature information is evenly exchanged between the channels of the deep separable convolution output, but also eliminates the need for additional complex measures. Through the shuffling operation, the significant drop in detection accuracy when using deep separable convolution directly is compensated. This design makes full use of the advantages of ordinary convolution and deep separable convolution, thereby enhancing the ability of the GDetect module to capture crack features and maintain detection accuracy.

[0113] S4: Use the wellbore crack data set constructed in S2 to train the wellbore crack detection model constructed in S3, and evaluate the model performance. The specific operation method is:

[0114] Train and validate a wellbore fracture detection model.

[0115] In this embodiment, the experimental environment is a Linux system, the GPU is NVIDIA A100, based on Python3.8+Pytorch1.11.0+Cuda11.3 framework. Experimental parameters: epoch is 500 rounds, batch is 32, initial learning rate is 0.01, optimizer SGD, momentum is 0.937, weight decay coefficient is 0.0005, and after setting the parameters, the training set is used to train the well wall crack detection model. The model parameters such as weights and biases are continuously updated during the training process. And the model is verified using the validation set.

[0116] Comparison of loss during model training and validation.

[0117] The model is evaluated based on the loss function curve. The loss curve usually shows the change of model loss as the number of training batches increases. It can evaluate the convergence speed of the model, overfitting or underfitting problems, and help adjust the training strategy to improve the performance of the model.

[0118] like Figure 7 As shown, the training and verification loss curves of the basic model YOLOv8n and the model of the present invention are shown. After 250 iterations, the verification loss curve of the model of the present invention begins to stabilize, showing a better descent rate and convergence ability than the basic model.

[0119] S5: Perform model testing.

[0120] The trained model EDG-YOLO was tested, and the experiment selected accuracy (Precision), recall rate (Recall), mean average precision (mAP), model parameter quantity (Params), model calculation amount (GFLOPs), single image inference time (Inference) and other evaluation indicators of model performance.

[0121] This paper compares seven classic target detection models, including Faster-RCNN, Cascade-RCNN, RT-DETR, YOLOv5, YOLOv6, YOLOv7, and YOLOv8, as well as the literature MED-YOLOv8s, BL-YOLOv8n, and YOLOv5n-CBoT, as shown in Table 1.

[0122] Table 1 Comparison experimental results of different detection models

[0123] Model mAP@0.5 / % Precision Recall Params / M GFLOPs Inference / ms Faster R-CNN 81.8 44.2 91.0 41.75 104.0 21.0 Cascade-RCNN 82.3 54.3 91.8 69.16 132.0 27.3 RT-DETR-l 81.2 82.8 71.9 28.45 100.6 26.9 YOLOv5n 80.6 79.0 77.4 1.76 4.1 8.2 YOLOv6n 80.9 82.3 75.8 4.63 11.3 13.7 YOLOv7 tiny 84.9 85.6 79.6 6.01 13.0 11.4 YOLOv8n 85.1 80.3 78.2 3.01 8.1 9.8 YOLOv5n-CBoT 80.3 76.0 79.6 1.93 4.6 10.0 MED-YOLOv8s 86.7 80.9 79.4 1.74 5.2 11.4 BL-YOLOv8n 85.8 83.2 77.6 2.24 7.3 12.2 EDG-YOLO 87.4 83.7 80.4 2.01 4.3 13.2

[0124] Compared with the two-stage target detection models Faster-RCNN and Cascade-RCNN, EDG-YOLO's detection accuracy increased by 5.6 and 5.1 percentage points respectively. The recall rate of Cascade-RCNN reached 91.8%, but the accuracy was extremely low. Faster-RCNN and Cascade-RCNN have a large number of parameters and high computational complexity, which are not suitable for deployment on the terminal. Compared with the real-time end-to-end detection algorithm RT-DETR-1, EDG-YOLO's detection accuracy increased by 6.2 percentage points, and the number of parameters and computational complexity were reduced by 93% and 96% compared with RT-DETR.

[0125] YOLOv5n performs best in terms of lightweight, but sacrifices more detection accuracy, which is 6.8 percentage points lower than EDG-YOLO; compared with YOLOv6n, YOLOv7 tiny, YOLOv8n and the literature MED-YOLOv8s, BL-YOLOv8n, YOLOv5n-CBoT, EDG-YOLO improves the detection accuracy of well wall cracks by 6.5, 2.5, 2.3, 1.5, 0.7, 1.6, and 7.1 percentage points respectively, and the model parameters and calculation amount are only 2.01M and 4.3GFLOPs. The inference time of a single image of EDG-YOLO is 13.2ms, which meets the requirements of industrial real-time detection. Therefore, EDG-YOLO is the best overall. While maintaining the accuracy of the model and the detection speed, it reduces the model size and the number of network parameters, making it easier to deploy on embedded devices.

[0126] In order to further intuitively verify the detection effect of the EDG-YOLO model, a comparative test was carried out on the wellbore fracture dataset with YOLOv5n, YOLOv7-tiny and YOLOv8n.

[0127] like Figure 8 As shown in the figure, in the first figure, YOLOv7-tiny missed a transverse crack; YOLOv8n mistakenly detected three transverse cracks, but there were only two in fact, and there was overlap in the detection frame; in the second figure, YOLOv7-tiny missed detection; YOLOv5n and YOLOv8n did not accurately detect the position of the longitudinal cracks, while the improved algorithm EDG-YOLO accurately detected these cracks. In the third comparison figure, YOLOv5n and YOLOv8n performed poorly in identifying fine cracks and missed detection, while the model of the present invention can effectively detect these fine cracks.

[0128] It can be seen that the EDG-YOLO network proposed in the present invention still has high detection accuracy even in backgrounds of different complexity, and can meet the application of mobile devices in terms of model lightweight.

[0129] 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.

[0130] 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 method for detecting crack defects in a wellbore, characterized in that: The following steps are involved: S1: Obtain wellbore fracture dataset; S2: Process the wellbore fracture data set and divide it into training set, validation set and test set; S3: Construct a wellbore crack detection model; S4: Use the wellbore crack dataset to train and verify the wellbore crack detection model; S5: Test the wellbore crack detection model.

2. A method for detecting well wall crack defects according to claim 1, characterized in that: In S1: the wellbore fracture data set includes fracture images with different lighting conditions and backgrounds, and the fracture types in the fracture images include transverse fractures, longitudinal fractures, and reticular fractures.

3. A method for detecting well wall crack defects according to claim 2, characterized in that: The S2 includes: S21: Annotate the S1 dataset; S22: Divide the labeled data set into a training set, a validation set, and a test set, add random flipping, random contrast, and random Gaussian noise operations to the training set images, and expand the data set.

4. A method for detecting well wall crack defects according to claim 1, characterized in that: The S3 includes: S31: Construct the backbone network of the wellbore crack detection model using the YOLOv8n model; S32: Constructing the neck network of the wellbore crack detection model; S33: constructing the head network of the wellbore crack detection model; The backbone network consists of 5 Conv modules, 4 C2f modules, and 1 SPPF module; In S31, the feature enhancement module C2fEIR is introduced at the positions where the number of channels in the backbone network is 512 and 1024, forming the backbone network of the wellbore crack detection model; The neck network of the YOLOv8n model consists of 2 UpSample upsampling layers, four concat layers, and 2 Conv modules; In S32, in the neck network of the YOLOv8n model, the efficient void heavy parameter aggregation network CSP_EDRAN modules are introduced after the first concat splicing, the second concat splicing, the third concat splicing, and the fourth concat splicing respectively. There are four CSP_EDRAN modules in total; the dual attention DAM module is introduced after the first three CSP_EDRAN modules; forming the neck network of the well wall crack detection model; The head network of the YOLOv8n model consists of two parallel 1×1 conv2d convolutions; In S33, the GSConv module is introduced into the head network of the YOLOv8n model to form the head network of the wellbore crack detection model.

5. A method for detecting well wall crack defects according to claim 4, characterized in that: The S31 includes: S311: Construct a feature extraction module EIRBlock; in the feature extraction module EIRBlock, firstly, the input feature map is convolved by 1×1; then, BN normalization and Swish activation operations are performed in sequence, and then DWC depthwise separable convolution is performed, followed by BN normalization, Swish activation operation, EffectiveSE attention operation, and 1×1 convolution is used for dimensionality reduction, followed by BN normalization and Dropout regularization, and the obtained feature map is added to the input feature map of the EIRBlock module to obtain the output of the EIRBlock module; S312: Construct a feature enhancement module C2fEIR; in the feature enhancement module C2fEIR, firstly extract preliminary features from the input feature map of the module C2fEIR through the first convolution layer of size 3×3, and then use the Split operation to divide the number of channels of the preliminary features into two branches, the first branch skips the EIRBlock module, and the second branch is processed by the EIRBlock module; the feature maps obtained from the two branches are spliced ​​together through the Concat operation, and then through the second convolution layer of size 3×3 to obtain the output of the module C2fEIR.

6. A method for detecting well wall crack defects according to claim 4, characterized in that: The construction process of the CSP_EDRAN module in S32 includes: S321: Construct a CSP_EDRAN module; in the CSP_EDRAN module, the input feature map of the CSP_EDRAN module is divided into two branches after the standard convolution layer, BN normalization, and Swish activation operation. The first branch extracts features through the Dilated ReparamBlock structure; in the Dilated Reparam Block structure, the feature map after the standard convolution layer, BN normalization, and Swish activation operation passes through a 9×9 convolution with a dilation rate of 1, a 5×5 convolution with a dilation rate of 1, a 5×5 convolution with a dilation rate of 2, a 3×3 convolution with a dilation rate of 3, and a 3×3 convolution with a dilation rate of 4 in parallel, and passes through the BN normalization operation respectively, to obtain five output features; the second branch skips the Dilated Reparam Block structure, concats the five output features of the Dilated Reparam Block module, and then performs a standard convolution layer, BN normalization, and Swish activation operation; the output of the CSP_EDRAN module is obtained.

7. A method for detecting well wall crack defects according to claim 4, characterized in that: The S32 further includes: S322: Construct a DAM attention module; the DAM attention module is composed of a channel attention module CAM and a spatial attention module SAM; In the DAM attention module, a 3×3 convolutional layer is used to reduce the dimension of the input features, and the reduced features are sent to CAM and SAM respectively; In CAM, the input feature map is X, and the size of X is C×H×W, where C represents the number of channels of the feature map, H represents the height of the feature map, and W represents the width of the feature map. First, perform a gropus operation to divide the number of channels C of the feature map into G groups to obtain the feature map x C / / G×H×W , and at the same time the feature map x C / / G×H×W Divide into four branches, and transform the characteristic graphs x of the first branch and the second branch C / / G×H×W Perform one-dimensional operations on the height and width dimensions to obtain the feature map x C / / G×1×W 、x C / / G×H×1 ; Then, one-dimensional global average pooling is used in the first branch to encode the channel along the horizontal spatial direction to obtain the pooling result in the horizontal direction; one-dimensional global average pooling is used in the second branch to encode the channel along the vertical spatial direction to obtain the pooling result in the vertical direction; the pooling results in the horizontal and vertical directions are then spliced ​​together and reduced in dimension through a 1×1 convolution; the channel information is then decomposed into two vectors according to the channel height and width; these two vectors are respectively passed through the Sigmoid function to generate two channel directions, namely the attention maps y1 and y2 in the X direction and the Y direction, and then the attention maps y1 and y2 are combined with the feature map x of the third branch. C / / G×H×W A reweighting Re-weight operation is performed, and then after Group Norm, global average pooling, and Softmax function processing, the channel attention map y3 with a size of 1×H×W is obtained by matrix multiplication matmul; in the fourth branch, a 3×3 convolution operation is performed on the feature map, and then global average pooling is performed, and the pooled feature map is processed by the Softmax function, and a feature map y4 with a size of 1×H×W is output through matrix multiplication operation; at the same time, the output of the Group Norm layer in the first branch and the output of the matrix multiplication layer in the fourth branch are cross-channel interactively learned, and the convolution layer output of the fourth branch and the matrix multiplication layer output of the first branch are cross-channel interactively learned; y3 and y4 are element-by-element added, the Sigmoid function operation is performed, and then added to the feature map x of the third branch. C / / G×H×W Perform Re-weight operation to obtain the output Y1 of module CAM; In the spatial attention module SAM, the input feature map X is subjected to global maximum pooling and global average pooling to obtain two 1×H×W weight vectors, which are then concat-concatenated to generate a 2×H×W spatial weight matrix. This is then subjected to a 7×7 convolutional layer for dimensionality reduction, followed by a Sigmoid function operation to obtain the SAM module output Y2. The outputs Y1 and Y2 are added to fuse the features, and then the output feature map Y of the module DAM is generated through a 3×3 convolutional layer; The process of extracting the characteristics of wellbore fractures by the DAM module is as follows: y1=σ{Conv 1×1 [Concat(X_AvgPool(x C / / G×1×W ))]} y2=σ{Conv 1×1 [Concat(Y_AvgPool(x C / / G×H×1 ))]} y3=matmul{δ[AvgPool(GroupNorm(Σ(x C / / G×H×W ,y1,y2)))]} y4=matmul{δ[AvgPool(Conv 3×3 (x C / / G×H×W ))]} Y1=∑(x C / / G×H×W ,σ(y3+y4)) Y2=σ{f 7×7 (Concat[AvgPool(x C×H×W );MaxPool(x C×H×W )])} Y=Conv 3×3 (Y1+Y2) Among them, σ represents the Sigmoid function; δ represents the Softmax function; f 7×7 Indicates a convolution operation with a filter size of 7×7; Conv 1×1 、Conv 3×3 Respectively represent convolutions with kernels of 1×1 and 3×3; AvgPool, MaxPool, X_AvgPool, and Y_AvgPool represent global average pooling, global maximum pooling, horizontal average pooling, and vertical average pooling, respectively; matmul represents matrix multiplication; Σ represents Re-weight operation; Concat represents concatenation operation; GroupNorm represents group normalization; y1 represents the feature map x C / / G×1×W The feature map is obtained after horizontal pooling, splicing, convolution, and Sigmoid function processing; y2 represents the feature map x C / / G×H×1 The feature map is obtained after vertical pooling, splicing, convolution, and Sigmoid function processing; y3 represents the feature map obtained by weighted operation on y1 and y2, global average pooling, Softmax function processing, and matrix multiplication; y4 represents the feature map x C / / G×H×W The feature map is obtained by performing 3×3 convolution operation, global average pooling operation, Sigmoid function processing, and matrix multiplication operation; Y1 is the feature map output by the CAM module, Y2 is the feature map output by the SAM module, and Y is the feature map output by the DAM module.

8. A method for detecting well wall crack defects according to claim 4, characterized in that: The S33 includes: Construct a Gsconv module. In the Gsconv module, first pass through a standard convolution layer, then perform a depth-wise separable convolution DWConv operation, and then concatenate the output of each channel in the channel dimension; finally, perform a shuffle operation to obtain the output of the Gsconv module; Construct a GDetect module. In the GDetect module, the input feature map is divided into two branches. In each branch, two consecutive GSConv modules and a 1×1 conv2d convolution are used to obtain the output feature map. The output feature map is used to calculate the bounding box loss and classification loss. Finally, the final output of the well wall crack detection model is obtained.

9. A detection device for well wall crack defects, characterized in that: The method according to any one of claims 1 to 8 is used to detect well wall crack defects.

10. A detection storage medium for well wall crack defects, characterized in that: The method according to any one of claims 1 to 8 is used to detect well wall crack defects.

Citation Information

Cited By

  • Light-weight industrial product surface defect detection method

    CN119313659A

  • Home human body tumble detection method based on YOLOv8 improvement

    CN119763184A

  • Netting damage detection model establishment and detection method

    CN120047797A

  • A detection method for establishing a model for detecting damage in net clothing

    CN120047797B

  • Method and system for identifying external envelope structure crack of super high-rise building

    CN121259528A