Borehole imaging fracture pixel identification method based on CNN-transformer

By adopting a CNN-Transformer-based method for crack pixel recognition in borehole imaging, and combining preprocessing, fusion network and post-processing techniques, the problems of interference, manual interpretation and model adaptability in crack recognition in borehole imaging technology are solved, and high-precision automated crack recognition is achieved.

CN123052500APending Publication Date: 2026-11-06CHENGDU UNIVERSITY OF TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611560834.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-10
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

Existing borehole imaging technology faces challenges in identifying surrounding rock fractures, including feature confusion caused by strong geological interference, low efficiency and high subjectivity of manual interpretation, and insufficient adaptability of deep learning models. These issues make it difficult to meet the accuracy requirements for evaluating the stability of coal mine surrounding rock.

Method used

A CNN-Transformer-based method for identifying crack pixels in borehole imaging is adopted. The method suppresses interference through a preprocessing model, designs a fusion network to segment crack features, and performs post-processing to optimize the mask image, including Gaussian blur denoising, Fourier frequency domain filtering, CLAHE contrast enhancement, morphological transformation, CNN-Transformer architecture feature extraction, and sinusoidal distribution model fitting.

Benefits of technology

It significantly improves the accuracy and completeness of fracture identification, meets the accuracy requirements of coal mine surrounding rock stability evaluation, reduces the false identification rate and the missed identification rate, and improves the degree of automation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123052500A_ABST
    Figure CN123052500A_ABST
Patent Text Reader

Abstract

The application discloses a kind of CNN-Transformer based borehole imaging fissure pixel identification method, belong to computer vision technical field, including steps: constructing pre-processing model;CNN-Transformer architecture is constructed and is fused network;The pre-processing model and fusion network constitute fissure identification network and are trained as fissure pixel identification model;Obtain the borehole imaging development drawing to be identified, corresponding binary mask chart is obtained by fissure pixel identification model;Binary mask chart is post-processed based on sinusoidal fitting.The borehole imaging development drawing of the application is pre-processed by pre-processing model multistage, makes local gradient change more consistent, global gray scale distribution is more stable, subsequent feature extraction is carried out using fusion network, model is more easily converged and can improve feature separability, sinusoidal fitting post-processing reversely improves overall recognition quality, finally the accuracy and integrity of the fissure identification of the application are significantly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision technology, and in particular to a method for identifying crack pixels in borehole imaging based on CNN-Transformer. Background Technology

[0002] As a crucial guarantee of national energy security, coal mining in deep shafts is heavily influenced by the evolution and connection of fissures in the surrounding rock, which are a core contributing factor to safety accidents such as rock mass instability, water inrush, and mudslides. Therefore, accurately identifying the morphology of surrounding rock fissures and obtaining pixel-level distribution information is a critical prerequisite for safe coal mine production.

[0003] Currently, borehole imaging technology, with its advantages of "non-destructive rock mass structure, continuous observation throughout the borehole, and real-time data transmission," has become the mainstream technology for detecting fractures in coal mine surrounding rock. This technology uses a push rod to mount a high-definition camera to scan the borehole wall, "unfolding" the annular borehole wall image into a planar unfolded diagram, enabling visual observation of the borehole wall rock mass. However, in practical engineering applications, fracture pixel recognition still faces three major technological bottlenecks:

[0004] (1) Strong geological interference leads to confusion of features:

[0005] In the borehole imaging unfolded image, the natural texture of the rock (linear grayscale features similar to fractures), residual mud artifacts on the borehole wall (bright or shadowy vertical stripes), and drill bit marks (regular horizontal scratches) highly overlap with the visual features of real fractures. Traditional image segmentation methods (such as threshold segmentation and Canny edge detection) cannot effectively distinguish them, resulting in a high "false recognition rate" and "missed recognition rate" for fractures, which is difficult to meet the engineering accuracy requirements.

[0006] (2) Manual interpretation is inefficient and highly subjective:

[0007] In existing projects, geological experts still manually annotate fracture pixels. The interpretation of a single borehole image unfolding map takes about 30 to 60 minutes. Moreover, due to differences in expert experience, the annotation deviation of different personnel for the same fracture can be more than 20%, making it impossible to output uniform and quantitative fracture mask data, which seriously restricts the reliability of subsequent parameter analysis.

[0008] (3) Existing deep learning models lack adaptability:

[0009] While some studies have applied convolutional neural networks (CNNs) to fracture identification, such as the optimal U-Net method, these methods can only capture local texture and edge features. Furthermore, due to the lack of targeted preprocessing, the pixel accuracy (PA) is generally below 75% when applied directly. In engineering verification, the deviation from the actual fracture location in the rock core is as high as 5-8 mm, far exceeding the fracture location accuracy requirements for coal mine surrounding rock stability evaluation (allowable deviation ≤ 3 mm). Therefore, existing models cannot meet the engineering needs of complex geological environments in coal mines.

[0010] In summary, there is an urgent need for a borehole imaging fracture pixel recognition method that can suppress strong geological interference, capture both local and global features, and has a high degree of automation, in order to overcome the current technical bottlenecks and provide technical support for intelligent coal mining.

[0011] Definitions:

[0012] The Contrast Limited Adaptive Histogram Equalization (CLAHE) algorithm includes (1) uniformly dividing the entire image into multiple non-overlapping sub-blocks, (2) calculating the gray-level histogram for each sub-block, then cropping the gray-level histogram of each sub-block, truncating and redistributing the pixel frequencies that exceed the preset cropping threshold, calculating the cumulative distribution function based on the cropped local histogram, (3) mapping the pixel gray levels according to the cumulative distribution function, and (4) using bilinear interpolation to smoothly fuse the transformation results of each block, eliminating grid marks caused by the block boundaries, and making the enhanced image more natural. Summary of the Invention

[0013] The purpose of this invention is to provide a CNN-Transformer-based method for identifying fracture pixels in borehole imaging, which solves the problems of difficulty in identifying fractures under strong geological interference, high dependence on manual methods, and poor model adaptability.

[0014] To achieve the above objectives, the technical solution adopted by the present invention is as follows: a method for identifying crack pixels in borehole imaging based on CNN-Transformer, comprising the following steps:

[0015] S1, Construct a preprocessing model to preprocess the input borehole imaging unfolded image to obtain the corresponding preprocessed unfolded image. The preprocessing includes Gaussian blur denoising, Fourier frequency domain vertical stripe filtering, CLAHE contrast enhancement and morphological transformation.

[0016] S2. Construct a fusion network with a CNN-Transformer architecture. Based on the CNN and Transformer encoders, extract the local features F1 and global features F2 of the preprocessed unfolded image respectively. Then, fuse F1 and F2 across modalities into a fusion feature F3, and then decode it into a binary mask image with the same size as the preprocessed unfolded image. Pixels with a value of 0 in the image are predicted crack pixels.

[0017] S3. The preprocessed model and the fusion network are combined to form a crack recognition network, which is trained to convergence using the borehole imaging unfolded map dataset to obtain the crack pixel recognition model.

[0018] S4, obtain the unfolded image of the borehole to be identified, and obtain the corresponding binary mask image through the crack pixel recognition model;

[0019] S5, post-processing the binary mask image of S4, including S51~S55;

[0020] S51, Set a sliding window along the vertical axis of the binary mask image, with a total of M windows and overlapping areas between adjacent windows;

[0021] S52, extract pixels with a value of 0 within window m to form the initial crack pixel set G. m0 , for G m0 For each pixel, isolated points are filtered out by using a threshold for the number of neighboring pixels, resulting in a valid point set G. m , 1≤m≤M;

[0022] S53. For the sinusoidal distribution model of the crack, the parameters are solved using a nonlinear least squares algorithm. These parameters include amplitude R, period P, phase β, and centerline position C. Substituting these parameters into the sinusoidal distribution model, the fitted curve C is obtained. m ;

[0023] S54, use the fitted curve to predict the missing crack pixels within window m and fill in G. m and from G m After removing pixels that deviate from the fitted curve by 2 pixels, the final effective point set G is obtained. m-best ;

[0024] S55, process all windows sequentially according to S52~54 to obtain M valid point sets. For pixels in the binary mask image, if they are located in the valid point set, set the pixel value to 0, and otherwise set it to 255 to obtain the crack mask image.

[0025] Preferably, in S1, the Gaussian blur denoising in the preprocessing involves applying a Gaussian kernel function to the grayscale image I of the borehole imaging unfolded image. Gray Perform convolution operation to obtain Gaussian denoised image I G Fourier frequency domain vertical fringe filtering is achieved by using a two-dimensional fast Fourier transform to filter I. GTransforming to the frequency domain, a ring band-stop filter is designed to suppress vertical stripe artifacts, followed by an inverse Fourier transform to obtain the Fourier filter diagram I. FFT CLAHE contrast enhancement is based on the CLAHE algorithm to process I... FFT The enhanced image I is obtained. clahe ; morphological transformation is, for I clahe Perform Top-Hat white-hat transformation and black-hat transformation respectively to obtain the preprocessed unfolded graph.

[0026] As a preferred embodiment, CLAHE contrast enhancement specifically includes Sa1~Sa3;

[0027] Sa1, will I FFT The system is divided into multiple sub-blocks. The local grayscale histogram of each sub-block is cropped, and the frequency of pixels exceeding a preset cropping threshold is truncated and redistributed. The cumulative distribution function is calculated based on the cropped local histogram, where one sub-block is I. local The corresponding cumulative distribution function CDF clip (∙);

[0028] Sa2, calculate sub-block I according to the following formula local Corresponding Enhanced Image I' clahe ;

[0029]

[0030] In the formula, L gray =256 represents grayscale levels, I local (x,y) is I local The grayscale value of the coordinates (x', y'), I' clahe (x',y') is I' clahe The grayscale value of the coordinates (x', y');

[0031] Sa3, stitch together the augmented maps of all sub-blocks according to their original division positions to obtain augmented map I. clahe .

[0032] Preferably, in S2, the fusion network includes a CNN, a Transformer encoder, a feature fusion module, and a decoder;

[0033] The CNN is used as input for preprocessing the unfolded image and extracts local F1 features of the image;

[0034] The Transformer encoder is used to input the preprocessed unfolded image and extract the global feature F2 of the image;

[0035] The feature fusion module is used to perform channel attention weighting and element-wise addition fusion on F1 and F2 to obtain fused feature F3;

[0036] The decoder is used to upsample F3 to the size of the preprocessed unfolded image, and then output a binary mask image through the segmentation head.

[0037] Preferably, the feature fusion module obtains the fused feature F3 according to the following formula;

[0038]

[0039]

[0040]

[0041] In the formula, ϕ1(⋅) and ϕ2(⋅) are the feature mapping operations corresponding to F1 and F2, respectively, used to map F1 and F2 to the same spatial size and number of channels to obtain the corresponding mapped features. , g1(⋅) and g2(⋅) are respectively pairs of , Perform the channel attention weight generation operation, where σ(⋅) is the Sigmoid activation function, A1 and A2 are the channel attention weights corresponding to F1 and F2 respectively, and ⊙ is the element-wise multiplication.

[0042] Preferably, in S3, the borehole imaging unfolded map dataset includes a self-made dataset and a CrackSegmentation dataset, wherein the borehole imaging unfolded map in the self-made dataset is a borehole imaging unfolded map collected in the coal mine roadway of the area to be identified and the crack pixels are manually labeled.

[0043] As a preferred embodiment, in S51, the height of the sliding window is 50 pixels and the step size is 20 pixels.

[0044] As a preferred embodiment, in S52, the threshold for filtering out isolated points by the number of neighboring pixels is specifically as follows: for a pixel, if the number of cracked pixels within its 5×5 range is ≥3, then it is not an isolated point; otherwise, it is an isolated point and is filtered out.

[0045] As a preferred embodiment, in S53, the sinusoidal distribution model of the cracks is as follows:

[0046]

[0047] In the formula, x and y are the horizontal and vertical coordinates of a pixel in the binary mask image, respectively. The objective function of the Levenberg-Marquardt nonlinear least squares algorithm is to minimize the sum of squared residuals, where the residuals are the vertical pixel differences.

[0048] This method achieves gap pixel recognition through a three-stage collaborative process: "preprocessing to suppress interference → fusion network segmentation → post-processing to optimize the mask." Specifically:

[0049] 1. Preprocessing to suppress interference: Refer to step S1. By designing a preprocessing model, Gaussian blur denoising, Fourier frequency domain vertical stripe filtering, CLAHE contrast enhancement, and morphological transformation are performed on the borehole imaging unfolded image in sequence to obtain the preprocessed unfolded image.

[0050] Gaussian blur denoising uses a Gaussian kernel function to perform convolution operation with a grayscale image. While smoothing random noise, it preserves the edge information of cracks through the central symmetry of the kernel, thus effectively suppressing noise points.

[0051] Fourier frequency domain vertical stripe filtering first transforms the grayscale image to the frequency domain using a two-dimensional fast Fourier transform (2D-FFT) to obtain the frequency domain spectrum F(u,v); then, a ring band-stop filter H(u,v) is designed. Based on the frequency domain distribution characteristics of mud vertical stripe noise, the lower distance limit D1=20 and the upper distance limit D2=50 are determined. The distance from the point at position (u,v) in the frequency domain to the origin is... When D1≤D(u,v)≤D2, H(u,v)=0 to suppress this frequency component; otherwise, H(u,v)=1. The filtered spectrum... Perform an inverse Fourier transform (IFFT) to remove vertical stripe artifacts.

[0052] CLAHE contrast enhancement divides the image into 8×8 local sub-blocks, performs histogram equalization on each sub-block, and then crops the cumulative distribution function (CDF). clip Limit excessive enhancement of local contrast and avoid noise amplification to improve the grayscale contrast between the crack and the background.

[0053] Morphological transformations use a 10×10 rectangular structuring element B, applied via white-hat transformations. , The morphological opening operation is used, first eroding and then dilating to highlight the details of the crack edges; then a black hat transform is applied. , · represents the morphological closing operation, which first expands and then corrodes to suppress dark noise on the pore wall, ultimately improving the clarity of the crack edge.

[0054] 2. For the fusion network segmentation, refer to steps S2 and S3. S2 designs a fusion network based on the CNN-Transformer architecture, which can be regarded as a dual-branch structure composed of CNN branches and Transformer branches.

[0055] The CNN branch extracts local texture and edge features from the preprocessed unfolded image through downsampling layers and four convolutional layers, gradually compressing the feature map size (e.g., from 244×1350 pixels to 15×84 pixels). This improves the feature abstraction level and can effectively capture the local edge details of the crack, ultimately outputting the local feature F1 score.

[0056] The Transformer branch divides the preprocessed unfolded image into patches of a preset size, such as 16×16 pixels. Each patch is then transformed into a 512-dimensional feature sequence through a linear unfolding layer. Subsequently, five stacked Transformer encoding layers (each layer containing a multi-head self-attention mechanism and a feedforward network) are used to calculate the global dependencies between patches, capturing the periodic extension features of the cracks in the unfolded image, such as the global trend of a sinusoidal distribution. Finally, through a patch merging operation (merging every 2×2 patches into one), local and global features are gradually integrated, and the global feature F2 is finally output.

[0057] The feature fusion module is used to perform cross-modal fusion of F1 and F2. By allocating channel attention weights, it highlights the feature channels that contribute more to gap recognition and avoids the limitations of single features.

[0058] The decoder uses PixelShuffle upsampling technology (magnification factor 2) to gradually restore the image size. Finally, it outputs a binary mask image with the same resolution as the preprocessed unfolded image (e.g., 244×1350 pixels) through a 1×1 convolution segmentation head (pixel value 0 represents a rift and 255 represents no rift).

[0059] The S3 training network for crack recognition introduces the Crack Segmentation dataset, containing 1200 crack images from different scenes. A self-made dataset is then constructed to form the training dataset together with the Crack Segmentation dataset. The images are first processed by the S1 preprocessing model and then fed into the S2 fusion network, where the parameters of the fusion network are adjusted. The optimizer during training is Adam, with 100 iterations. Cross-entropy loss + Dice loss are used to finally obtain the crack pixel recognition model, which is more suitable for drilling imaging scenarios and improves pixel accuracy.

[0060] 3. Post-processing optimization of the mask: Refer to step S5. Image post-processing optimization: The binary mask obtained by the crack pixel recognition model for the unfolded image of the borehole to be identified is not accurate enough, and there may be problems such as "fractured crack pixels" and "isolated pseudo-noise points". Therefore, the post-processing process of this invention is designed as shown in step S5, wherein S51 divides the window, S52 extracts effective points window by window and filters out isolated points, and in S53 fits the sinusoidal distribution model of the crack, and S54 uses the fitted curve to complete the fractured crack pixels and remove pseudo-noise points (pixels that deviate from the fitted curve by 2 pixels) to improve the integrity and purity of the mask.

[0061] Compared with the prior art, the advantages of the present invention are as follows:

[0062] (1) Cracks in borehole unfolding images have a composite feature of being "narrow locally but exhibiting a sinusoidal trend overall." CNNs alone can only identify local edges, while Transformers alone can easily overlook the narrow structure of cracks. This invention designs a fusion network with a CNN-Transformer architecture. By extracting local and global features through CNNs and Transformers respectively and fusing them with channel attention weights, it possesses the high-resolution edge sensitivity of CNNs and the periodic trend capture characteristics of Transformers.

[0063] (2) Synergistic Gains of Multi-Level Preprocessing and Fusion Network Structure. This invention preprocesses the borehole imaging unfolded image through a multi-level preprocessing model to obtain a preprocessed unfolded image to address different types of interference. While any single method cannot effectively identify borehole imaging cracks, this invention, by combining methods sequentially, makes the "local gradient changes" in the borehole imaging unfolded image more consistent, thus complementing the edge feature extraction characteristics of the CNN branch. Simultaneously, the global grayscale distribution of the preprocessed unfolded image is more stable, making the global attention mechanism of the Transformer branch easier to converge. Therefore, the multi-level preprocessing stage directly improves the feature separability of the subsequent fusion network.

[0064] (3) Sine fitting post-processing improves overall recognition quality. Traditional post-processing is usually only used for smoothing or morphological repair, while this invention utilizes the "sine geometric law" of drill hole cracks to perform parameter fitting in a sliding window. This not only completes the broken pixels that are difficult for the model to identify, but also removes pseudo-noise points through fitting residuals. This actually compensates for the geometric constraints of the model's initial results, achieving bidirectional enhancement of geometry and deep learning.

[0065] Ultimately, this invention significantly improves the accuracy and completeness of crack identification. Attached Figure Description

[0066] Figure 1 This is a flowchart of the present invention;

[0067] Figure 2 Diagram of the crack identification network structure;

[0068] Figure 3 This is a comparison image showing the crack identification effect before and after the invention. Detailed Implementation

[0069] The present invention will be further described below with reference to the embodiments and accompanying drawings.

[0070] Example 1: See Figures 1 to 3 A method for identifying crack pixels in borehole imaging based on CNN-Transformer includes the following steps:

[0071] S1, Construct a preprocessing model to preprocess the input borehole imaging unfolded image to obtain the corresponding preprocessed unfolded image. The preprocessing includes Gaussian blur denoising, Fourier frequency domain vertical stripe filtering, CLAHE contrast enhancement and morphological transformation.

[0072] S2. Construct a fusion network with a CNN-Transformer architecture. Based on the CNN and Transformer encoders, extract the local features F1 and global features F2 of the preprocessed unfolded image respectively. Then, fuse F1 and F2 across modalities into a fusion feature F3, and then decode it into a binary mask image with the same size as the preprocessed unfolded image. Pixels with a value of 0 in the image are predicted crack pixels.

[0073] S3. The preprocessed model and the fusion network are combined to form a crack recognition network, which is trained to convergence using the borehole imaging unfolded map dataset to obtain the crack pixel recognition model.

[0074] S4, obtain the unfolded image of the borehole to be identified, and obtain the corresponding binary mask image through the crack pixel recognition model;

[0075] S5, post-processing the binary mask image of S4, including S51~S55;

[0076] S51, Set a sliding window along the vertical axis of the binary mask image, with a total of M windows and overlapping areas between adjacent windows;

[0077] S52, extract pixels with a value of 0 within window m to form the initial crack pixel set G. m0 , for G m0 For each pixel, isolated points are filtered out by using a threshold for the number of neighboring pixels, resulting in a valid point set G. m , 1≤m≤M;

[0078] S53. For the sinusoidal distribution model of the crack, the parameters are solved using a nonlinear least squares algorithm. These parameters include amplitude R, period P, phase β, and centerline position C. Substituting these parameters into the sinusoidal distribution model, the fitted curve C is obtained. m ;

[0079] S54, use the fitted curve to predict the missing crack pixels within window m and fill in G. m and from G m After removing pixels that deviate from the fitted curve by 2 pixels, the final effective point set G is obtained. m-best A deviation of 2 pixels from the fitted curve refers to a pixel whose vertical distance from the fitted curve exceeds 2 pixels.

[0080] S55, process all windows sequentially according to S52~54 to obtain M valid point sets. For pixels in the binary mask image, if they are located in the valid point set, set the pixel value to 0, and otherwise set it to 255 to obtain the crack mask image.

[0081] In the preprocessing described in S1 of this invention, Gaussian blur denoising involves applying a Gaussian kernel function to the grayscale image I of the borehole imaging unfolded image. Gray Perform convolution operation to obtain Gaussian denoised image I G Fourier frequency domain vertical fringe filtering is achieved by using a two-dimensional fast Fourier transform to filter I. G Transforming to the frequency domain, a ring band-stop filter is designed to suppress vertical stripe artifacts, followed by an inverse Fourier transform to obtain the Fourier filter diagram I. FFT CLAHE contrast enhancement is based on the CLAHE algorithm to process I... FFT The enhanced image I is obtained. clahe ; morphological transformation is, for I clahe Perform Top-Hat white-hat transformation and black-hat transformation respectively to obtain the preprocessed unfolded graph.

[0082] CLAHE contrast enhancement specifically includes Sa1~Sa3;

[0083] Sa1, will I FFT The system is divided into multiple sub-blocks. The local grayscale histogram of each sub-block is cropped, and the frequency of pixels exceeding a preset cropping threshold is truncated and redistributed. The cumulative distribution function is calculated based on the cropped local histogram, where one sub-block is I. local The corresponding cumulative distribution function CDF clip (∙);

[0084] Sa2, calculate sub-block I according to the following formula local Corresponding Enhanced Image I' clahe ;

[0085]

[0086] In the formula, L gray =256 represents grayscale levels, I local (x,y) is I local The grayscale value of the coordinates (x', y'), I' clahe (x',y') is I' clahe The grayscale value of the coordinates (x', y');

[0087] Sa3, stitch together the augmented maps of all sub-blocks according to their original division positions to obtain augmented map I. clahe .

[0088] In S2, the fusion network includes a CNN, a Transformer encoder, a feature fusion module, and a decoder. The CNN is used to take the preprocessed unfolded image as input and extract local features F1 from the image. The Transformer encoder is used to take the preprocessed unfolded image as input and extract global features F2 from the image. The feature fusion module is used to perform channel attention weighting and element-wise addition fusion on F1 and F2 to obtain fused features F3. The decoder is used to upsample F3 to the size of the preprocessed unfolded image and then output a binary mask image through the segmentation head.

[0089] The feature fusion module obtains the fused feature F3 according to the following formula;

[0090]

[0091]

[0092]

[0093] In the formula, ϕ1(⋅) and ϕ2(⋅) are the feature mapping operations corresponding to F1 and F2, respectively, used to map F1 and F2 to the same spatial size and number of channels to obtain the corresponding mapped features. , g1(⋅) and g2(⋅) are respectively pairs of , Perform the channel attention weight generation operation, where σ(⋅) is the Sigmoid activation function, A1 and A2 are the channel attention weights corresponding to F1 and F2 respectively, and ⊙ is the element-wise multiplication.

[0094] In S3, the borehole imaging unfolded map dataset includes a self-made dataset and a Crack Segmentation dataset. The borehole imaging unfolded map in the self-made dataset is a borehole imaging unfolded map collected in the coal mine roadway of the area to be identified and manually labeled with crack pixels.

[0095] In S51, the sliding window has a height of 50 pixels and a step size of 20 pixels. In S52, the neighboring pixel number threshold for filtering out isolated points is as follows: for a pixel, if the number of crack pixels within its 5×5 range is ≥3, it is not an isolated point; otherwise, it is an isolated point and is filtered out. In S53, the sinusoidal distribution model of the cracks is: In the formula, x and y are the horizontal and vertical coordinates of a pixel in the binary mask image, respectively. The objective function of the Levenberg-Marquardt nonlinear least squares algorithm is to minimize the sum of squared residuals, where the residuals are the vertical pixel differences.

[0096] Example 2: See Figures 1-3A method for identifying crack pixels in borehole imaging based on CNN-Transformer includes the following steps:

[0097] Step 1: Data Preparation

[0098] Data source: 21 images of borehole images of the roof of the No. 3 roadway of a coal mine were collected. Each image has a resolution of 244×1350 pixels and is in RGB format. 10 images were used for testing and 11 images were used for model fine-tuning. An external CrackSegmentation dataset was introduced for pre-trained model optimization. The external dataset contains 1200 crack images of different scenes.

[0099] Data annotation: Three geological engineers jointly annotated the fracture pixels, and the intersection was taken as the "gold standard" mask for model accuracy evaluation. After the standardization was completed, the experimental dataset was obtained.

[0100] Step 2: Construct a preprocessing model and preprocess the experimental dataset:

[0101] Gaussian blur denoising: A 5×5 Gaussian kernel function with a standard deviation σ=1.0 was used, implemented through OpenCV's cv2.GaussianBlur. The resulting Gaussian-denoised image is shown in image I. G The number of image noise points is reduced by 65%;

[0102] Fourier frequency domain vertical stripe filtering: After grayscale conversion, perform FFT using numpy.fft.fft2. In the ring bandstop filter, the lower distance limit D1=20 and the upper distance limit D2=50. After inverse Fourier transform, obtain the Fourier filter diagram I. FFT The vertical stripe artifact removal rate reached 88%;

[0103] CLAHE contrast enhancement: Using cv2.createCLAHE with clipLimit=2.0 and tileGridSize=(8,8), the enhanced image I is obtained. clahe The contrast between the cracks and the background in the image is improved by 30% to 40%. Here, clipLimit and tileGridSize are parameters within cv2.createCLAHE. clipLimit is the contrast limit threshold, used to limit the maximum cumulative frequency of a single gray level in the local histogram, preventing excessive enhancement of local contrast and suppressing noise amplification; tileGridSize is the local region division size parameter, used to divide the input image into multiple rectangular sub-regions for local histogram equalization.

[0104] Morphological transformation: 10×10 rectangular structuring element, cv2.morphologyEx performs opening / closing operation to obtain a preprocessed unfolded image, which improves the clarity of crack edges by 25%.

[0105] Step 3: Construct a fusion network with a CNN-Transformer architecture:

[0106] CNN: It uses the first 4 layers of ResNet50 as the basis, replaces the first layer convolutional kernel with 3×3, and outputs 64 channels;

[0107] Transformer encoder: Patch size is set to 16×16 pixels, linear unfolded layer output dimension is 512, number of self-attention heads is 8, number of Transformer blocks is 5, and feed-forward network hidden layer dimension is 2048; if the image is not divisible by the patch, zero-padding expansion is used for image boundary processing.

[0108] Feature fusion module: It adopts a channel attention mechanism, which compresses the number of channels to 1 / 4 of the original dimension through 1×1 convolution, and then activates the output weights through Sigmoid.

[0109] Decoder: Uses 3 layers of PixelShuffle upsampling, with an amplification factor of 2 for each layer. The segmentation head is a 1×1 convolution with sigmoid activation, and the output channel of the 1×1 convolution is 1.

[0110] Step 4: Combine the preprocessing model and the fusion network to form a crack recognition network and train it into a crack pixel recognition model. The training parameters are set as follows:

[0111] Learning rate: Initial value 1e-4, decayed using cosine annealing strategy;

[0112] Batch size BatchSize=16, implemented using 2×NVIDIA RTX4090 GPUs;

[0113] Number of iterations: 100 rounds. Training is stopped early when the accuracy on the validation set shows no improvement for 10 consecutive rounds.

[0114] Loss function: Cross-entropy loss + Dice loss, with a weight ratio of 1:1, used to alleviate the problem of data class imbalance.

[0115] Step 5: Post-processing and result verification:

[0116] Sliding window fitting: window height 50 pixels, step size 20 pixels, Levberg-Marquardt algorithm to fit sinusoidal parameters, residual convergence threshold set to 1e-6;

[0117] Mask optimization: Complete the fracture gaps, with a 100% repair rate for fractures with a length of 5-8 pixels, and remove isolated pseudo-noise points, reducing their number by 90%.

[0118] Results verification: The fracture mask output by this invention was compared with the measured data of borehole cores: Core samples from 5 boreholes were selected, and the actual fracture location and length were measured. Compared with the fracture mask image obtained by S55, the fracture deviation was ≤2mm, and the corresponding pixel deviation was ≤5px, which meets the requirements of the coal mine surrounding rock stability evaluation for fracture positioning accuracy. The allowable deviation is ≤3mm.

[0119] See Figure 3 Select any 3 images from the borehole imaging diagrams of the roof of the No. 3 roadway in a coal mine, such as... Figure 3 As shown in (a), (c), and (e), the recognition results obtained after processing by the present invention are shown in (b), (d), and (f).

[0120] Example 3: See Figures 1-2 To verify the synergistic effect of multi-level preprocessing of the preprocessing model, the fusion network of the CNN-Transformer architecture, and post-processing, ablation experiments were conducted to observe the improvement in pixel accuracy (PA) and intersection-over-union (IoU). The results are as follows:

[0121] First, the accuracy (PA) and intersection-over-union (IoU) were compared in three cases: no preprocessing model paired with a CNN model, preprocessing model with only CLAHE contrast enhancement, and complete preprocessing model paired with the CNN-Transformer architecture of this invention. Table 1 shows the results.

[0122] Table 1. Comparison of the contributions of multi-stage preprocessing to the fracture identification network

[0123]

[0124] As shown in Table 1, the preprocessing model using the multi-level preprocessing of this invention can improve IoU by 13.8%, which is a significant gain.

[0125] Furthermore, for the fusion network of the CNN-Transformer architecture, three methods were compared with the present invention: CNN only, Transformer only, and fusion of CNN and Transformer without using channel attention. Table 2 shows the results.

[0126] Table 2. Comparison of the contributions of fusion networks to crack detection networks

[0127]

[0128] As shown in Table 2, only by adopting the fusion and attention mechanism of the present invention can a performance leap be achieved. This is a synergistic effect produced by combination, rather than a simple superposition.

[0129] The post-processing method of this invention involves first filtering out isolated points, then fitting the curve using a sinusoidal distribution model, and finally removing off-points. This method is referred to as "sinusoidal fitting." The binary mask image obtained from S4 is post-processed using three methods: no post-processing, using traditional morphological closing operations, and using the sinusoidal fitting method of this invention. The results are shown in Table 3.

[0130] Table 3. Comparison of the contribution of post-processing after sine fitting to mask integrity

[0131]

[0132] As shown in Table 3, the crack integrity rate increased from 82% to 93%, which is a significant quantitative enhancement effect.

[0133] Finally, a comprehensive model validation was performed, comparing the method of this invention with the existing best U-Net method. The accuracy PA and intersection-over-union (IoU) were analyzed and obtained in Table 4.

[0134] Table 4. Performance Comparison of Integrated Models

[0135]

[0136] As shown in Table 4, the method of the present invention can reduce the deviation by more than 60%, proving that the overall technical solution of the present invention has significant engineering application value.

[0137] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for identifying crack pixels in borehole imaging based on CNN-Transformer, characterized in that, Includes the following steps: S1, Construct a preprocessing model to preprocess the input borehole imaging unfolded image to obtain the corresponding preprocessed unfolded image. The preprocessing includes Gaussian blur denoising, Fourier frequency domain vertical stripe filtering, CLAHE contrast enhancement and morphological transformation. S2. Construct a fusion network with a CNN-Transformer architecture. Based on the CNN and Transformer encoders, extract the local features F1 and global features F2 of the preprocessed unfolded image respectively. Then, fuse F1 and F2 across modalities into a fusion feature F3, and then decode it into a binary mask image with the same size as the preprocessed unfolded image. Pixels with a value of 0 in the image are predicted crack pixels. S3. The preprocessed model and the fusion network are combined to form a crack recognition network, which is trained to convergence using the borehole imaging unfolded map dataset to obtain the crack pixel recognition model. S4, obtain the unfolded image of the borehole to be identified, and obtain the corresponding binary mask image through the crack pixel recognition model; S5, post-processing the binary mask image of S4, including S51~S55; S51, Set a sliding window along the vertical axis of the binary mask image, with a total of M windows and overlapping areas between adjacent windows; S52, extracting pixels with value 0 in window m to form initial crack pixel set G m0 , G m0 , filtering out isolated points by neighborhood pixel number threshold to obtain effective point set G m , 1≤m≤M; S53. For the sinusoidal distribution model of the crack, the parameters are solved using a nonlinear least squares algorithm. These parameters include amplitude R, period P, phase β, and centerline position C. Substituting these parameters into the sinusoidal distribution model, the fitted curve C is obtained. m ; S54, use the fitted curve to predict the missing crack pixels within window m and fill in G. m and from G m After removing pixels that deviate from the fitted curve by 2 pixels, the final effective point set G is obtained. m-best ; S55, process all windows sequentially according to S52~54 to obtain M valid point sets. For pixels in the binary mask image, if they are located in the valid point set, set the pixel value to 0, and otherwise set it to 255 to obtain the crack mask image.

2. The borehole imaging crack pixel recognition method based on CNN-Transformer according to claim 1, characterized in that, In S1, during the preprocessing, Gaussian blur denoising involves applying a Gaussian kernel function to the grayscale image I of the borehole imaging unfolded. Gray Perform convolution operation to obtain Gaussian denoised image I G ; Fourier frequency domain vertical fringe filtering is achieved by using a two-dimensional fast Fourier transform to filter I. G Transforming to the frequency domain, a ring band-stop filter is designed to suppress vertical stripe artifacts, followed by an inverse Fourier transform to obtain the Fourier filter diagram I. FFT ; CLAHE contrast enhancement is based on the CLAHE algorithm to process I FFT The enhanced image I is obtained. clahe ; Morphological transformation is, for I clahe Perform Top-Hat white-hat transformation and black-hat transformation respectively to obtain the preprocessed unfolded graph.

3. The borehole imaging crack pixel recognition method based on CNN-Transformer according to claim 1 or 2, characterized in that, CLAHE contrast enhancement specifically includes Sa1~Sa3; Sa1, will I FFT The system is divided into multiple sub-blocks. The local grayscale histogram of each sub-block is cropped, and the frequency of pixels exceeding a preset cropping threshold is truncated and redistributed. The cumulative distribution function is calculated based on the cropped local histogram, where one sub-block is I. local The corresponding cumulative distribution function CDF clip (∙); Sa2, calculate sub-block I according to the following formula local Corresponding Enhanced Image I' clahe ; ; In the formula, L gray =256 represents grayscale levels, I local (x,y) is I local The grayscale value of the coordinates (x', y'), I' clahe (x',y') is I' clahe The grayscale value of the coordinates (x', y'); Sa3, stitch together the augmented maps of all sub-blocks according to their original division positions to obtain augmented map I. clahe .

4. The borehole imaging crack pixel recognition method based on CNN-Transformer according to claim 1, characterized in that, In S2, the fusion network includes a CNN, a Transformer encoder, a feature fusion module, and a decoder; The CNN is used as input for preprocessing the unfolded image and extracts local F1 features of the image; The Transformer encoder is used to input the preprocessed unfolded image and extract the global feature F2 of the image; The feature fusion module is used to perform channel attention weighting and element-wise addition fusion on F1 and F2 to obtain fused feature F3; The decoder is used to upsample F3 to the size of the preprocessed unfolded image, and then output a binary mask image through the segmentation head.

5. The borehole imaging crack pixel recognition method based on CNN-Transformer according to claim 4, characterized in that, The feature fusion module obtains the fused feature F3 according to the following formula; ; ; ; In the formula, ϕ1(⋅) and ϕ2(⋅) are the feature mapping operations corresponding to F1 and F2, respectively, used to map F1 and F2 to the same spatial size and number of channels to obtain the corresponding mapped features. , g1(⋅) and g2(⋅) are respectively pairs of , Perform the channel attention weight generation operation, where σ(⋅) is the Sigmoid activation function, A1 and A2 are the channel attention weights corresponding to F1 and F2 respectively, and ⊙ is the element-wise multiplication.

6. The borehole imaging crack pixel recognition method based on CNN-Transformer according to claim 1, characterized in that, In S3, the borehole imaging unfolded map dataset includes a self-made dataset and a Crack Segmentation dataset. The borehole imaging unfolded map in the self-made dataset is a borehole imaging unfolded map collected in the coal mine roadway of the area to be identified and manually labeled with crack pixels.

7. The borehole imaging crack pixel recognition method based on CNN-Transformer according to claim 1, characterized in that, In S51, the height of the sliding window is 50 pixels and the step size is 20 pixels.

8. The borehole imaging crack pixel recognition method based on CNN-Transformer according to claim 1, characterized in that, In S52, the threshold for filtering out isolated points based on the number of neighboring pixels is as follows: for a pixel, if the number of cracked pixels within its 5×5 range is ≥3, then it is not an isolated point; otherwise, it is an isolated point and is filtered out.

9. The borehole imaging crack pixel recognition method based on CNN-Transformer according to claim 1, characterized in that, In S53, the sinusoidal distribution model of the cracks is as follows: ; In the formula, x and y are the horizontal and vertical coordinates of a pixel in the binary mask image, respectively. The objective function of the Levenberg-Marquardt nonlinear least squares algorithm is to minimize the sum of squared residuals, where the residuals are the vertical pixel differences.