Rock chip image segmentation method based on multi-scale feature enhancement and edge-aware gating
Through the multi-scale feature enhancement and edge-aware gating method, the deficiencies in multi-scale feature fusion and edge detection in the prior art are solved, and high-precision cutting image segmentation is achieved, which is suitable for cuttings analysis in petroleum exploration.
Patent Information
- Application Number
- CN202510821287.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2045-06-19
AI Technical Summary
In the prior art, in the fragment image segmentation, there is a problem that multi-scale feature fusion cannot achieve pixel-level adaptation by using static weight allocation, edge detection modules are not trained in a coordinated manner, and lightweight design leads to loss of detailed information.
The multi-scale feature enhancement and edge-aware gating method is adopted to enhance the feature through the multi-scale feature extraction module ADP, combined with the deep residual network and edge encoder, a dynamic weight generation network and lightweight strategy is designed, and traditional edge operators and deep learning are integrated to generate mixed weights for segmentation.
High-precision and low-latency cutting analysis are realized, which is suitable for real-time particle size analysis and geological parameter calculation of drilling cutting particles, improving the robustness of the model for complex textures and the segmentation accuracy of boundary areas.
Smart Images

Figure CN120355926B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision and oil exploration technology, and in particular to a cuttings image segmentation method based on multi-scale feature enhancement and edge-aware gating, which is suitable for real-time particle size analysis and geological parameter calculation of drilling cuttings particles. Background Art
[0002] During oil drilling exploration, the automated analysis of rock chip microscopic images is a key step in assessing formation lithology and calculating porosity and particle size distribution. Rock chippings are rock fragments generated during the drilling process, and their morphological characteristics and distribution patterns directly reflect the formation structure and oil and gas reservoir performance. Traditional analysis methods rely on manual microscopic observation and manual annotation, which have problems such as low efficiency, strong subjectivity, and difficulty in processing large-scale data. With the development of computer vision technology, image segmentation methods based on deep learning have gradually replaced traditional methods, but they still face the following key challenges in practical applications: In recent years, researchers have attempted to improve the above problems through multi-scale feature fusion, edge optimization modules, and model compression, but there are still limitations: multi-scale feature fusion uses a static weight distribution strategy and cannot achieve pixel-level adaptation; the edge detection module does not train traditional operators in conjunction with deep learning; the lightweight design ignores the dynamic computing requirements of multiple branches, resulting in the loss of detailed information. Summary of the Invention
[0003] In response to the above technical problems, the present invention provides a rock cuttings image segmentation method based on multi-scale feature enhancement and edge-aware gating, providing a set of high-precision, low-latency rock cuttings analysis tools for oil exploration.
[0004] The present invention is implemented by adopting the following technical solution: a rock chip image segmentation method based on multi-scale feature enhancement and edge-aware gating, comprising the following steps:
[0005] Step S1: Input RGB image and perform preprocessing, load the annotated three-channel semantic segmentation label, convert the RGB label into a single-channel category index matrix, extract edge features to generate binary edge labels, and together with the semantic label constitute the supervision signal;
[0006] Step S2: The image processed in step S1 is input into the main encoding path. The features extracted in each layer are enhanced by the multi-scale feature extraction module ADP. The input features are preprocessed by the dynamic weight generation network to generate a spatial attention weight map. Finally, the outputs of each branch are weighted fused, and the original features are retained through residual connections.
[0007] Step S3: Construct an edge encoder based on a deep residual network, initialize the first, third, and fifth convolution kernels as traditional edge operators, fuse the main path and edge path features through the dual-path attention gating module DPAG, enhance the edge features through depthwise separable convolution, generate hybrid weights through channel attention and spatial attention, and finally fuse them to the main path features using residual scaling;
[0008] Step S4: The annotated binary edge map is average pooled to generate a six-layer multi-scale supervision signal, preserving the edge density distribution of each layer. The output features of each layer of the edge encoder are subjected to 3×3 convolution and Sigmoid activation to generate a probability map. The binary cross entropy loss is calculated layer by layer. The total loss function is composed of the weighted combination of the main segmentation task and the edge supervision loss.
[0009] Step S5: Combine the main segmentation task and the edge supervision task and use a lightweight strategy to optimize network parameters;
[0010] Step S6: Each layer of features processed in step S3 is input into the decoder. The decoder gradually restores the feature resolution through bilinear interpolation, combines the features of each stage of the encoder with jump connections, and finally outputs a three-channel probability map. The rock fragment contour is extracted based on the segmentation result to calculate the image index.
[0011] Specifically, step S1 includes the following steps:
[0012] Step S11: Input a preset pixel image and map the pixel values to the [0, 1] interval using the Min-Max normalization formula, which is expressed as:
[0013] ;
[0014] in, is the input image tensor, QUOTE and QUOTE are the global minimum and global maximum respectively;
[0015] Step S12: Convert the RGB labels into a single-channel category index matrix through the color mapping rule, use the edge detection algorithm to extract edge features from the grayscale image, generate binary edge labels, and together with the semantic labels form a supervision signal.
[0016] Specifically, step S2 includes the following sub-steps:
[0017] Step S21: The image processed in step S1 is input into the main coding path. The features extracted in each layer are enhanced by the multi-scale feature extraction module ADP. The multi-scale feature extraction module ADP adopts a four-level parallel depth-separable dilated convolution structure. The dilation rate is configured in geometric series as follows: ={1,2,4,6}, the effective receptive field calculation formula of a single branch is:
[0018] ;
[0019] in, is the dilation rate of the dilated convolution, is the number of convolutional layers;
[0020] Each branch uses depth-wise separable convolution to reduce computational complexity, and the amount of computation is reduced to:
[0021] ;
[0022] in, QUOTE QUOTE represents the feature map spatial dimension, QUOTE QUOTE Represents the number of input and output channels, QUOTE QUOTE Indicates the convolution kernel size; each branch is followed by group normalization and GELU activation function;
[0023] Step S22: Design a dynamic weight generation mechanism, use depthwise separable convolution to extract local context information, and then use a learnable projection matrix to compress the channel dimension to the number of branches to generate a spatial attention weight map;
[0024] Step S23: Output for each branch Perform spatial attention weighting, the expression is:
[0025] ;
[0026] in, represents element-wise multiplication, is the channel adjustment matrix of 1×1 convolution, Indicates the The attention weight of the branch; the final output retains the original features through the residual connection:
[0027] ;
[0028] in QUOTE represents the input features, QUOTE It is the feature enhanced by the multi-scale feature extraction module ADP.
[0029] Specifically, the step S22 includes:
[0030] Step S221: Input features QUOTE After depth-wise separable convolution processing, local context information is captured and position-sensitive information is retained. The expression is:
[0031] ;
[0032] Among them, the depth-wise separable convolution is 3×3, is the batch size, is the spatial size, activation function , QUOTE is the cumulative distribution function of the standard normal distribution N(0,1), QUOTE Represents a depth-wise separable convolution operation, and the kernel function is decomposed into:
[0033] ;
[0034] in Indicates that convolution operation is performed on each input channel separately, and each input channel uses a separate The convolution kernel performs convolution, and the number of output channels is the same as the number of input channels; Indicates use The convolution kernel performs convolution on each position of the input feature map;
[0035] Step S222: Initialize the convolution kernel weight using He normal distribution, the expression is:
[0036] ;
[0037] in, It is the number of input channels multiplied by the area of the convolution kernel. After depth-wise separable convolution, the output shape is ; The convolutional features are channel compressed, and the compression layer is passed through a learnable projection matrix Implementation, expressed as:
[0038] ;
[0039] Step S223: The projection layer maps the features to the branch number dimension, which is 4; the weight generation is regarded as the mapping of spatial position to scale space, and the expression is:
[0040] ;
[0041] in, Corresponding to The projection vector of the branch, Indicates that after compression Positional features;
[0042] Step S224: After Softmax normalization, probability normalization is performed along the channel dimension to finally generate attention weights , the probability normalization expression is:
[0043] .
[0044] Specifically, step S3 includes the following steps:
[0045] Step S31: Initialize the convolution kernel by integrating the prior knowledge of traditional edge detection operators with the adaptive feature learning ability of deep learning. The first layer of convolution kernel is initialized to Operator Horizontal core, used in the third layer Operator Vertical core, the fifth layer uses The diagonal kernel of the operator will The core expands to , the expressions are:
[0046] ,
[0047] ,
[0048] ;
[0049] Through hierarchical feature extraction, the feature calculation at each stage is expressed as:
[0050] ;
[0051] ;
[0052] in, For edge encoder Layer output features, Indicates maximum pooling, kernel size , the step size is 2, is the tensor processed by step S11, represents a depth-wise separable convolution operation;
[0053] Step S32: Pass Convolution matches the channel dimension of the main encoding path feature map with the edge path feature map, and the expression is:
[0054] ;
[0055] in, For group normalization, the number of groups is fixed to 4;
[0056] Step S33: Design a channel-space collaborative attention mechanism to generate dynamic weights through feature interaction. The expression is:
[0057] ;
[0058] ;
[0059] ;
[0060] in, represents the Sigmoid function, is the activation function, For channel splicing operation, Indicates taking the average value, Indicates taking the maximum value, The encoded feature map representing the main path;
[0061] Step S34: The weighted fusion of features is achieved through a gating mechanism, which preserves the semantic information encoded by the main path while enhancing the edge details. The fusion feature expression is:
[0062] ;
[0063] Among them, ⊙ represents element-by-element multiplication, Represents the edge path feature map after dimension matching.
[0064] Specifically, step S4 includes the following steps:
[0065] Step S41: The model is guided to learn refined boundary features through hierarchical edge supervision loss. The binary edge labels generated by the edge detection algorithm are downsampled to six scales through average pooling and serve as supervision signals for each layer of the edge encoder.
[0066] Step S42: Each layer of feature Convolution and Sigmoid functions generate probability maps , the weighted multi-scale loss calculation formula is expressed as:
[0067] ;
[0068] in, Respectively represent The height and width of the layer feature map, Indicates the Layer in position The supervisory signal is composed of the original edge map go through Average pooling generation, the value range is ; Indicates the Layer in position The predicted probability of
[0069] Step S43: Integrate the total loss and jointly optimize the target, the expression is:
[0070] ;
[0071] in, As the main encoder, through multi-scale feature alignment and dynamic weight allocation, the model is guided to learn the hierarchical features of rock fragment boundaries, forming a complementary optimization with the main segmentation task.
[0072] Specifically, the step S5 includes:
[0073] Step S51: Initialize the convolutional layer weights of the main coding path using the He normal distribution to ensure that the variance of the activation value is stable during forward propagation;
[0074] Step S52: For the dynamic weight generation network in the multi-scale feature enhancement module, the first layer is initialized using the kaiming_normal method to match the nonlinear characteristics of the GELU activation function; the second layer is initialized using a zero-mean normal distribution to avoid weight bias in the initial stage;
[0075] Step S53: Use the Adam optimizer, set the initial learning rate to 1e-4, the weight decay coefficient to 1e-4, the initial learning rate starts from 1e-4, and adopts mixed precision and cosine annealing strategy.
[0076] Specifically, step S6 includes:
[0077] Step S61: Based on the fusion features generated in step S34 , the feature map is gradually upsampled through bilinear interpolation, and the features of each stage of the encoder are fused by skip connection, and finally a three-channel probability map is output; the segmentation result is generated by the Argmax operation, which acts on the three channel probability values of each pixel position, and the channel with the highest probability is selected as the category label of the pixel, thereby generating the final segmentation result map;
[0078] Step S62: extracting the rock cuttings contour based on the segmentation result, calculating the equivalent circle diameter and statistically analyzing the particle size distribution.
[0079] The present invention achieves the following benefits: It utilizes four levels of parallel depthwise separable dilated convolution (with dilation rates of 1, 2, 4, and 6) to cover a receptive field of 13×13 to 3×3 pixels, adapting to a particle size range of 0.1-5 mm. A dynamic weight generation network generates spatial attention weights, enabling adaptive fusion of multi-branch features. Traditional edge operator kernels are initialized in shallow layers, while 5×5 learnable convolutions are employed in deeper layers to enhance edge continuity. Channel grouping initialization and a random perturbation strategy preserve the directional sensitivity of traditional operators. Hybrid weights are generated by channel attention (global average pooling + fully connected layers) and spatial attention, injecting edge features into the main path using residual scaling. Attention weights dynamically adjust the contribution of edge and semantic features to ensure high-precision segmentation of boundary regions. Binary edge labels generated by the Canny algorithm are downsampled to six scales to constrain the outputs of each edge encoder layer. A joint loss function prioritizes shallow edge features, improving the model's robustness to complex textures. Compared with the existing segmentation model, this technology can better handle the segmentation of adhered cuttings and is suitable for real-time particle size analysis and geological parameter calculation of drilling cuttings particles. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. 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 the structures shown in these drawings without paying any creative work.
[0081] Figure 1 This is a diagram showing the overall flow of a rock chip image segmentation method with multi-scale feature enhancement and edge-aware gating in an embodiment of the present invention;
[0082] Figure 2 Schematic diagram of a multi-scale feature enhancement module ADP in an embodiment of the present invention;
[0083] Figure 3 Schematic diagram of edge-aware gating in an embodiment of the present invention. DETAILED DESCRIPTION
[0084] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of 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. Generally, the components of the embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations.
[0085] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings.
[0086] The following is combined with Figures 1 to 3 , some embodiments of the present invention are described in detail. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0087] This paper proposes a rock chip image segmentation method based on multi-scale feature enhancement and edge-aware gating. The overall process architecture is as follows: Figure 1 As shown, the specific steps include:
[0088] S1: Input a 3072×3072 pixel RGB image. First, perform Min-Max normalization on the image data, linearly mapping pixel values to the range [0, 1]. Load the annotated three-channel semantic segmentation labels (background, debris body, edge). Use color mapping rules to convert the RGB labels into a single-channel category index matrix. Use an edge detection algorithm to extract edge features from the grayscale image and generate binary edge labels, which together with the semantic labels form the supervisory signal.
[0089] S2: The image processed by S1 is input into the main encoding path, and the features extracted at each layer are enhanced by the multi-scale feature extraction module ADP. The ADP module is designed as follows: First, a four-level parallel depthwise separable dilated convolution structure is constructed, and each branch uses a combination of depthwise convolution and pointwise convolution. The input features are preprocessed using a dynamic weight generation network: local context information is first extracted through depthwise separable convolution, and then the channel dimension is compressed to the number of branches using a learnable projection matrix. A spatial attention weight map is generated, and finally the outputs of each branch are weighted fused, and the original features are preserved through residual connections.
[0090] S3: Build an edge encoder based on a deep residual network, initializing the first, third, and fifth convolution kernels as traditional edge operators. Fusion of main and edge path features is achieved through a dual-path attention gating (DPAG) module: Edge features are enhanced using depthwise separable convolutions, then hybrid weights are generated using channel-wise and spatial-wise attention, ultimately fused to the main path features using residual scaling.
[0091] S4: The annotated binary edge map is average pooled to generate a six-layer multi-scale supervision signal, preserving the edge density distribution at each layer. Each layer of the edge encoder output features undergoes a 3×3 convolution and sigmoid activation to generate a probability map. A binary cross-entropy loss is then calculated layer by layer. The overall loss function is a weighted combination of the primary segmentation task (Dice loss) and the edge supervision loss. During training, the edge loss gradient is preferentially applied to the shallow layers of the encoder to enhance the extraction of low-level edge features.
[0092] S5: Combine the main segmentation task with the edge supervision task and use a lightweight strategy to optimize network parameters.
[0093] S6: Each layer of features processed in step S3 is input to the decoder. The decoder gradually restores the feature resolution through bilinear interpolation and combines the features of each encoder stage with skip connections to ultimately output a three-channel probability map (background, main rock fragment, and edge). Based on the segmentation results, the rock fragment outline is extracted and metrics such as equivalent circle diameter and pixel area are calculated.
[0094] In this embodiment, step S1 includes the following sub-steps:
[0095] S11: Input a 3072×3072 pixel image and map the pixel values to the [0,1] interval using the Min-Max normalization formula:
[0096]
[0097] in is the input image tensor, and are the global minimum and maximum, respectively.
[0098] S12: Convert the RGB labels into a single-channel category index matrix through color mapping rules, use the Canny edge detection algorithm to extract edges from the grayscale image, and generate binary edge labels (0 / 1), which together with the semantic labels constitute the supervision signal.
[0099] In this embodiment, step S2 includes the following sub-steps:
[0100] S21: The image processed by S11~S12 is input into the main coding path. The features extracted in each layer are enhanced by the multi-scale feature extraction module ADP. The ADP module adopts a four-level parallel depth-separable dilated convolution structure, and its dilation rate is configured in geometric series as follows: ={1,2,4,6}. The effective receptive field of a single branch is calculated as:
[0101]
[0102] in is the dilation rate of the dilated convolution, is the number of convolution layers, when = 6, the actual receptive field is expanded to 13×13 (corresponding to 5mm particle size), while the standard 3×3 convolution can only cover 0.2-1mm particles. Each branch uses depthwise separable convolution to reduce computational complexity, and its computational complexity is reduced from standard convolution to:
[0103]
[0104] down to
[0105]
[0106] in represents the feature map spatial dimension, Indicates the number of input and output channels, Represents the convolution kernel size. Each branch is followed by group normalization (GroupNorm) and GELU activation function.
[0107] S22: To adaptively fuse multi-scale features, a dynamic weight generation mechanism is designed. First, the input features After 3×3 depth-separable convolution processing, local context information can be captured and position-sensitive information can be retained:
[0108]
[0109] Where B is the batch size, H×W is the spatial size, and the activation function , is the cumulative distribution function of the standard normal distribution N(0,1), Represents a depth-wise separable convolution operation, whose kernel function is decomposed into:
[0110]
[0111] in Indicates that convolution is performed on each input channel separately. That is, each input channel uses a separate The convolution kernel performs convolution, and the number of output channels is the same as the number of input channels. Indicates use The convolution kernel is used to perform convolution on each position of the input feature map.
[0112] Since the particle size distribution of rock fragments in the dataset is normally distributed, the convolution kernel weights are initialized using the He normal distribution:
[0113]
[0114] in, It is the number of input channels multiplied by the area of the convolution kernel. After depth-wise separable convolution, the output shape is , the convolutional features are channel compressed, and the compression layer is passed through a learnable projection matrix accomplish:
[0115]
[0116] The learnable projection matrix is a linear transformation matrix that takes a The convolution layer is implemented, where , the network is forced to retain the most discriminative frequency components, and the lowest channel 4 avoids gradient disappearance.
[0117] The projection layer maps the features to the branch number dimension (K=4), and its weight generation can be regarded as a mapping from spatial position to scale space:
[0118]
[0119] in The projection vector corresponding to the k-th branch, Indicates that after compression Positional features, the edge of the cuttings during training There is a larger projection in the high frequency direction, resulting in (d=1) gets higher weight at these positions.
[0120] Finally, after Softmax normalization, probability normalization is performed along the channel dimension
[0121]
[0122] Finally generate attention weights .
[0123] S23: Output for each branch Perform spatial attention weighting:
[0124]
[0125] in represents element-wise multiplication, is the channel adjustment matrix of 1×1 convolution, Indicates the The attention weights of the branches. The final output retains the original features through the residual connection:
[0126]
[0127] in represents the input features, It is the feature enhanced by the ADP module.
[0128] In this embodiment, step S3 includes the following sub-steps:
[0129] S31: In view of the poor performance of the main path in extracting the edge features of rock cuttings and the failure to fully enhance the ability to capture edge details, an edge path is designed to enhance the extraction of edge features. The edge path adopts a deep residual network architecture and generates a multi-scale edge response map through hierarchical feature extraction. In the specific implementation, the edge encoder contains 6 downsampling stages, and the number of channels in each stage increases by [4, 8, 12, 16, 20, 24]. The convolution kernel is initialized by fusing the prior knowledge of the traditional edge detection operator with the adaptive feature learning ability of deep learning. The first layer of convolution kernel is initialized to Operator The horizontal kernel, mathematical expression is as follows:
[0130]
[0131] The third layer uses Operator The vertical kernel, the mathematical expression is as follows:
[0132]
[0133] The fifth layer adopts The diagonal kernel of the operator will The core expands to , the mathematical expression is as follows:
[0134]
[0135] Through hierarchical feature extraction, the feature calculation at each stage can be expressed as:
[0136]
[0137]
[0138] In the formula For edge encoder Layer output features, Indicates maximum pooling, kernel size , the step size is 2, is the tensor of the original image after processing in step S11, QUOTE Represents a depthwise separable convolution operation, and its specific meaning is the same as that described in step S22.
[0139] The downsampling method is used to spatially align the features of each resolution stage of the main coding path.
[0140] S32: Pass Convolution achieves channel dimension matching between the main encoding path feature map and the edge path feature map:
[0141]
[0142] In the formula This is group normalization (GroupNorm), and the number of groups is fixed to 4. This operation changes the number of edge feature channels from Projection to the backbone feature consistent.
[0143] S33: Design a channel-space collaborative attention mechanism to generate dynamic weights through feature interaction:
[0144]
[0145]
[0146]
[0147] in represents the Sigmoid function, is the activation function, For channel splicing operation, Indicates taking the average value, Indicates taking the maximum value, Represents the encoded feature map of the main path.
[0148] S34: Achieve weighted feature fusion through a gating mechanism, retaining the semantic information encoded by the main path while enhancing edge details:
[0149]
[0150] Where ⊙ represents element-by-element multiplication, Represents the edge path feature map after dimension matching. This formula establishes a soft attention selection mechanism, which enables the network to adaptively enhance.
[0151] In this embodiment, step S4 includes the following sub-steps:
[0152] S41: Guiding the model to learn refined boundary features through hierarchical edge supervision loss.
[0153] The binary edge labels generated by the Canny edge detection algorithm are average pooled (pooling kernel size , with a step size of 2) is downsampled to six scales (the resolution is halved step by step) as the supervision signal for each layer of the edge encoder.
[0154] S42: Feature layers Convolution + Sigmoid generates probability map , the weighted multi-scale loss calculation formula is as follows:
[0155]
[0156] in Indicates the The height and width of the layer feature map (as the number of layers increases, the size is halved through the pooling operation), Indicates the Layer in position The supervisory signal is composed of the original edge map go through Average pooling generation, the value range is , Indicates the Layer in position The predicted probability of .
[0157] S43: Total loss integration, joint optimization objectives:
[0158]
[0159] in As the main encoder, through multi-scale feature alignment and dynamic weight allocation, the model is guided to learn the hierarchical features of rock fragment boundaries, forming a complementary optimization with the main segmentation task.
[0160] S51: The convolutional layer weights of the main encoding path (encoder1 to encoder6 modules) are initialized using the He normal distribution to ensure stable variance of activation values during forward propagation.
[0161] S52: The dynamic weight generation network in the multi-scale feature enhancement module has its first layer initialized using the kaiming_normal method to match the nonlinear characteristics of the GELU activation function; the second layer is initialized using a zero-mean normal distribution to avoid weight bias in the initial stage.
[0162] S53: Use the Adam optimizer, set the initial learning rate to 1e-4, the weight decay coefficient to 1e-4, the initial learning rate starts from 1e-4, and adopts mixed precision and cosine annealing strategy.
[0163] S61: Fusion features generated by step S34 The feature map is progressively upsampled through bilinear interpolation, and features from each encoder stage are fused using skip connections. The final output is a three-channel probability map (background, debris body, and edge). The segmentation result is generated through an Argmax operation. Argmax is applied to the three channel probabilities at each pixel position, and the channel with the highest probability is selected as the category label for that pixel, generating the final segmentation result map.
[0164] S62: Extract the rock fragment contour based on the segmentation result, calculate the equivalent circle diameter, statistical particle size distribution, etc.
[0165] In summary, the present invention proposes a rock chip microscopic image segmentation method based on multi-scale feature enhancement and edge perception optimization. The multi-scale feature enhancement module dynamically fuses multi-scale features under different receptive fields, designs a learnable edge encoder combined with traditional edge operator kernels and deep learnable convolution, and adopts depth-separable convolution and dynamic group normalization strategy to significantly compress the model parameters. This scheme enhances the model's robustness to complex lighting and noise interference through a multi-scale edge supervision mechanism and dual-path attention gating, providing an efficient and accurate rock chip analysis tool for oil exploration.
[0166] For the sake of simplicity, the aforementioned embodiments are described as a series of actions. However, those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are preferred embodiments, and the actions involved are not necessarily required by this application.
[0167] The above embodiments describe the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions are merely illustrative of the principles of the present invention. Without departing from the spirit and scope of the present invention, modifications and variations made by those skilled in the art without departing from the spirit and scope of the present invention should be within the scope of protection of the appended claims.
Claims
1. A rock chip image segmentation method based on multi-scale feature enhancement and edge-aware gating, characterized by: The following steps are involved: Step S1: Input RGB image and perform preprocessing, load the annotated three-channel semantic segmentation label, convert the RGB label into a single-channel category index matrix, extract edge features to generate binary edge labels, and together with the semantic label constitute the supervision signal; Step S2: The image processed in step S1 is input into the main encoding path. The features extracted in each layer are enhanced by the multi-scale feature extraction module ADP. The input features are preprocessed by the dynamic weight generation network to generate a spatial attention weight map. Finally, the outputs of each branch are weighted fused, and the original features are retained through residual connections. Step S3: Construct an edge encoder based on a deep residual network, initialize the first, third, and fifth convolution kernels as traditional edge operators, fuse the main path and edge path features through the dual-path attention gating module DPAG, enhance the edge features through depthwise separable convolution, generate hybrid weights through channel attention and spatial attention, and finally fuse them to the main path features using residual scaling; Step S4: The annotated binary edge map is average pooled to generate a six-layer multi-scale supervision signal, preserving the edge density distribution of each layer. The output features of each layer of the edge encoder are subjected to 3×3 convolution and Sigmoid activation to generate a probability map. The binary cross entropy loss is calculated layer by layer. The total loss function is composed of the weighted combination of the main segmentation task and the edge supervision loss. Step S5: Combine the main segmentation task and the edge supervision task and use a lightweight strategy to optimize network parameters; Step S6: Each layer of features processed in step S3 is input into the decoder. The decoder gradually restores the feature resolution through bilinear interpolation, combines the features of each stage of the encoder with jump connections, and finally outputs a three-channel probability map. The rock fragment contour is extracted based on the segmentation result to calculate the image index.
2. The rock debris image segmentation method based on multi-scale feature enhancement and edge-aware gating according to claim 1, characterized in that: The step S1 specifically includes the following steps: Step S11: Input a preset pixel image and map the pixel values to the [0, 1] interval using the Min-Max normalization formula, which is expressed as: ; in, is the input image tensor, and are the global minimum and global maximum respectively; Step S12: Convert the RGB labels into a single-channel category index matrix through the color mapping rule, use the edge detection algorithm to extract edge features from the grayscale image, generate binary edge labels, and together with the semantic labels form a supervision signal.
3. The rock debris image segmentation method based on multi-scale feature enhancement and edge-aware gating according to claim 2, characterized in that: The step S2 specifically includes the following sub-steps: Step S21: The image processed in step S1 is input into the main coding path. The features extracted in each layer are enhanced by the multi-scale feature extraction module ADP. The multi-scale feature extraction module ADP adopts a four-level parallel depth-separable dilated convolution structure. The dilation rate is configured in geometric series as follows: ={1,2,4,6}, the effective receptive field calculation formula of a single branch is: ; in, is the dilation rate of the dilated convolution, is the number of convolutional layers; Each branch uses depth-wise separable convolution to reduce computational complexity, and the amount of computation is reduced to: ; in, represents the feature map spatial dimension, Represents the number of input and output channels, Indicates the convolution kernel size; each branch is followed by group normalization and GELU activation function; Step S22: Design a dynamic weight generation mechanism, use depthwise separable convolution to extract local context information, and then use a learnable projection matrix to compress the channel dimension to the number of branches to generate a spatial attention weight map; Step S23: Output for each branch Perform spatial attention weighting, the expression is: ; in, represents element-wise multiplication, is the channel adjustment matrix of 1×1 convolution, Indicates the The attention weight of the branch, B is the batch size, It is the number of input channels multiplied by the area of the convolution kernel; the final output retains the original features through the residual connection: ; in, represents the input features, It is the feature enhanced by the multi-scale feature extraction module ADP.
4. The rock debris image segmentation method based on multi-scale feature enhancement and edge-aware gating according to claim 3, characterized in that: The step S22 specifically includes: Step S221: Input features After depth-wise separable convolution processing, local context information is captured and position-sensitive information is retained. The expression is: ; Among them, the depth-wise separable convolution is 3×3, is the batch size, is the spatial size, activation function , is the cumulative distribution function of the standard normal distribution N(0,1), Represents a depth-wise separable convolution operation, and the kernel function is decomposed into: ; in Indicates that convolution operation is performed on each input channel separately, and each input channel uses a separate The convolution kernel performs convolution, and the number of output channels is the same as the number of input channels; Indicates use The convolution kernel performs convolution on each position of the input feature map; Step S222: Initialize the convolution kernel weight using He normal distribution, the expression is: ; in, It is the number of input channels multiplied by the area of the convolution kernel. After depth-wise separable convolution, the output shape is ; The convolutional features are channel compressed, and the compression layer is passed through a learnable projection matrix Implementation, expressed as: ; Step S223: The projection layer maps the features to the branch number dimension, which is 4; the weight generation is regarded as the mapping of spatial position to scale space, and the expression is: ; in, Corresponding to The projection vector of the branch, Indicates that after compression Positional features; Step S224: After Softmax normalization, probability normalization is performed along the channel dimension to finally generate attention weights , the probability normalization expression is: 。 5. The rock debris image segmentation method based on multi-scale feature enhancement and edge-aware gating according to claim 4, characterized in that: The step S3 specifically includes the following steps: Step S31: Initialize the convolution kernel by integrating the prior knowledge of traditional edge detection operators with the adaptive feature learning ability of deep learning. The first layer of convolution kernel is initialized to Operator Horizontal core, used in the third layer Operator Vertical core, the fifth layer uses The diagonal kernel of the operator will The core expands to , the expressions are: , , ; Through hierarchical feature extraction, the feature calculation at each stage is expressed as: ; ; in, For edge encoder Layer output features, Indicates maximum pooling, kernel size , the step size is 2, is the tensor processed by step S11, represents a depth-wise separable convolution operation; Step S32: Pass Convolution matches the channel dimension of the main encoding path feature map with the edge path feature map, and the expression is: ; in, For group normalization, the number of groups is fixed to 4; Step S33: Design a channel-space collaborative attention mechanism to generate dynamic weights through feature interaction. The expression is: ; ; ; in, represents the Sigmoid function, is the activation function, For channel splicing operation, Indicates taking the average value, Indicates taking the maximum value, The encoded feature map representing the main path; Step S34: The weighted fusion of features is achieved through a gating mechanism, retaining the semantic information encoded by the main path while enhancing edge details. The fusion feature expression is: ; Among them, ⊙ represents element-by-element multiplication, Represents the edge path feature map after dimension matching.
6. The rock debris image segmentation method based on multi-scale feature enhancement and edge-aware gating according to claim 5, characterized in that: The step S4 specifically includes the following steps: Step S41: The model is guided to learn refined boundary features through hierarchical edge supervision loss. The binary edge labels generated by the edge detection algorithm are downsampled to six scales through average pooling and serve as supervision signals for each layer of the edge encoder. Step S42: Each layer of feature Convolution and Sigmoid functions generate probability maps , the weighted multi-scale loss calculation formula is expressed as: ; in, Respectively represent The height and width of the layer feature map, Indicates the Layer in position The supervisory signal is composed of the original edge map go through Average pooling generation, the value range is ; Indicates the Layer in position The predicted probability of Step S43: Integrate the total loss and jointly optimize the target, the expression is: ; in, The loss of the main encoder guides the model to learn the hierarchical features of rock fragment boundaries through multi-scale feature alignment and dynamic weight allocation, forming a complementary optimization with the main segmentation task.
7. The rock debris image segmentation method based on multi-scale feature enhancement and edge-aware gating according to claim 1, characterized in that: The step S5 specifically includes: Step S51: Initialize the convolutional layer weights of the main coding path using the He normal distribution to ensure that the variance of the activation value is stable during forward propagation; Step S52: For the dynamic weight generation network in the multi-scale feature enhancement module, the first layer is initialized using the kaiming_normal method to match the nonlinear characteristics of the GELU activation function; the second layer is initialized using a zero-mean normal distribution to avoid weight bias in the initial stage; Step S53: Use the Adam optimizer, set the initial learning rate to 1e-4, the weight decay coefficient to 1e-4, the initial learning rate starts from 1e-4, and adopts mixed precision and cosine annealing strategy.
8. The rock debris image segmentation method based on multi-scale feature enhancement and edge-aware gating according to claim 5, characterized in that: The step S6 specifically includes: Step S61: Based on the fusion features generated in step S34 , the feature map is gradually upsampled through bilinear interpolation, and the features of each stage of the encoder are fused by skip connection, and finally a three-channel probability map is output; the segmentation result is generated by the Argmax operation, which acts on the three channel probability values of each pixel position, and the channel with the highest probability is selected as the category label of the pixel, thereby generating the final segmentation result map; Step S62: extracting the rock cuttings contour based on the segmentation result, calculating the equivalent circle diameter and statistically analyzing the particle size distribution.
Citation Information
Patent Citations
RGB-D-oriented fusion model and target detection method thereof
CN119963807A
Three-dimensional point-cloud semantic segmentation method based on multi-level boundary enhancement for unstructured environment
WO2024230038A1