Unsupervised Color Geological Image Segmentation Method and System Based on Attention Mechanism
Through the unsupervised color geological image segmentation method based on graph clustering algorithm and attention mechanism, mathematical morphological preprocessing and SE-UNet neural network, combined with SE attention mechanism and jump connection, the problem of inapplicable manual intervention and supervised learning in geological image segmentation is solved, and automated and effective color geological image segmentation is realized.
Patent Information
- Application Number
- CN202310870642.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-14
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2043-07-14
AI Technical Summary
The existing image segmentation method requires manual intervention, supervised learning is not applicable and unsupervised learning is poor in the field of geological images, and it is difficult to effectively extract information from complex geological images.
Unsupervised color geological image segmentation method based on graph clustering algorithm and attention mechanism is adopted, and color geological image segmentation without labels is achieved through mathematical morphological preprocessing, SE-UNet neural network and Felz clustering algorithm, combined with SE attention mechanism and jump connection.
There is no need for manual annotation, and the automatic segmentation ability is strong, which improves the quality and segmentability of geological images, enhances the ability to judge clustering feature information of color geological images, and improves the perception and representation ability of image segmentation.
Smart Images

Figure CN117173193B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer application technology and the field of image segmentation technology, and relates to an unsupervised color image segmentation method and system, and specifically relates to an unsupervised color geological image segmentation method and system based on a graph clustering algorithm and an attention mechanism. Background Art
[0002] With the continuous development of technology, the importance of image segmentation in the field of computer vision has become increasingly prominent. Image segmentation refers to the process of dividing an image into multiple sub-regions or pixel sets, such that the pixels within each sub-region have similar features or semantic information. Its main purpose is to extract the semantic information in the image and segment the image into regions with independent semantics, thereby achieving the understanding and interpretation of the image. Image segmentation plays an important role in many application fields, including autonomous driving, medical image analysis, etc. Through image segmentation, the accurate extraction and positioning of objects, boundaries, and structures in the image can be achieved, providing a basis for subsequent image processing and analysis tasks.
[0003] Currently, image segmentation methods can be divided into three categories: rule-based, machine learning, and deep learning methods. Rule-based methods use predefined rules and pattern matching for image segmentation, usually relying on manually designed rules and thresholds to divide pixels into different regions. Machine learning methods can automatically learn the patterns and features of image segmentation, rely on training data for learning, and then segment new images according to the learned model. Deep learning methods use deep neural networks to learn higher-level feature representations from the original pixel level of the image, thereby achieving more accurate segmentation results.
[0004] In the field of image segmentation, a large amount of research is dedicated to extracting information from unstructured images. Although these efforts have achieved certain results, the existing image segmentation methods still have limitations in the field of geological images. Rule-based segmentation methods often require manual intervention, use manually labeled feature rules for segmentation, and process using visual surface features such as the texture and color of the image and external structural features, and the performance and robustness of the features are limited. Due to the complexity and diversity of geological images, supervised machine learning and deep learning algorithms are not suitable for geological image segmentation scenarios. There are still certain limitations in semi-supervised and unsupervised deep learning segmentation methods for extracting information from highly heterogeneous and complex geological images. Summary of the Invention
[0005] To solve the above technical problems, the present invention provides an unsupervised color geological image segmentation method and system based on a graph clustering algorithm and an attention mechanism.
[0006] The technical solution adopted by the method of the present invention is as follows: An unsupervised color geological image segmentation method based on an attention mechanism, comprising the following steps:
[0007] Step 1: Perform mathematical morphological preprocessing on the color geological image to obtain a preprocessed image;
[0008] Step 2: Use the SE-UNet neural network and the Felz clustering algorithm on the preprocessed image respectively to obtain a coarsely segmented image and a superpixel segmentation map;
[0009] The SE-UNet neural network consists of an encoder, a decoder, and skip connections;
[0010] The encoder consists of a convolutional layer, a ReLU rectified linear unit, and a pooling layer connected in sequence; the convolutional layer applies a sliding window to different regions of the input source image through a convolution kernel to extract a local feature matrix of the image; the ReLU rectified linear unit performs a non-linear mapping on the features extracted by the convolutional layer to make the features more distinguishable; the pooling layer divides the output features processed by the ReLU rectified linear unit into blocks according to the specified pooling size;
[0011] The skip connection splices the feature maps in the encoder and the corresponding feature maps in the decoder by channels as the input of the decoder; wherein, an SE attention mechanism is added to the skip connection;
[0012] The decoder consists of a convolutional layer, a ReLU rectified linear unit, and a transposed convolution connected in sequence; the transposed convolution restores the position information of the image by upsampling the feature map, and combines it with the low-level features corresponding to the encoder to output a segmentation result;
[0013] Step 3: Use the superpixel segmentation map as a "pseudo-label", optimize the coarsely segmented image based on the superpixel segmentation map, and forward propagate to output a predicted segmentation result, realizing the segmentation of unlabeled color geological images.
[0014] The technical solution adopted by the system of the present invention is as follows: An unsupervised color geological image segmentation system based on an attention mechanism, comprising:
[0015] One or more processors;
[0016] A storage device for storing one or more programs, which when executed by the one or more processors, cause the one or more processors to implement the unsupervised color geological image segmentation method based on an attention mechanism.
[0017] The present invention has the following beneficial effects:
[0018] 1. The present invention performs mathematical morphology preprocessing on the image to be segmented, reduces the influence of irrelevant factors such as noise on segmentation, better preserves the structural information and edge information of the image, and improves the quality and segmentability of geological images.
[0019] 2. The present invention adopts the Felz clustering algorithm. For the similarity determination part of pixels in the image, the edge weight value is obtained by the weighted sum of color similarity and texture similarity, enhancing the clustering feature information judgment ability of the algorithm for color geological images.
[0020] 3. The present invention proposes an SE-UNet multimodal information extraction module, embedding the SE attention mechanism into the skip connection part of the encoder and decoder of UNet, enabling the SE attention mechanism to adaptively learn and adjust the feature weights in geological images, effectively extracting and strengthening important geological features, and improving the perception ability and representation ability of image segmentation.
[0021] 4. The present invention proposes a segmentation model based on graph clustering algorithm and attention mechanism to segment color geological images, without any manual annotation and with strong automatic segmentation ability. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The following uses examples and specific implementation manners to further illustrate the technical solutions of this article. In addition, some drawings are also used in the process of illustrating the technical solutions. For those skilled in the art, without creative efforts, other drawings and the intention of the present invention can also be obtained according to these drawings.
[0023] Figure 1 is the flowchart of the method in the embodiment of the present invention.
[0024] Figure 2 is the schematic diagram of the color geological image in the embodiment of the present invention.
[0025] Figure 3 is the schematic diagram of the preprocessing of the color geological image in the embodiment of the present invention.
[0026] Figure 4 is the structural diagram of the SE-UNet neural network in the embodiment of the present invention.
[0027] Figure 5 is the schematic diagram of the superpixel segmentation result in the embodiment of the present invention.
[0028] Figure 6 is the schematic diagram of the final segmentation result obtained in the embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0029] To facilitate the understanding and implementation of the present invention by those of ordinary skill in the art, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0030] Please refer to Figure 1 , a method for unsupervised color geological image segmentation based on an attention mechanism provided by the present invention includes the following steps:
[0031] Step 1: Perform mathematical morphological preprocessing on the color geological image to obtain a preprocessed image;
[0032] In one embodiment, the mathematical morphological preprocessing is a closing operation, where the closing operation is a process of first performing a dilation operation on the image and then an erosion operation.
[0033] In one embodiment, for the dilation operation, the input source image is denoted as A and the structuring element is denoted as B. The expression for the structuring element B to perform a dilation operation on the input source image A is:
[0034]
[0035] Where represents the dilation operation, represents the mapping of the structuring element B with respect to the origin, represents translating by σ displacements. The above formula indicates that the result of dilating the source image A with the structuring element B is the set of the origin positions of B when the mapping of the structuring element B with respect to the origin is translated by σ displacements and intersects with A at least one non-zero element.
[0036] In one embodiment, for the erosion operation, the expression for the structuring element B to perform an erosion operation on the input source image A is:
[0037]
[0038] Where Θ represents the erosion operation, and (B) σ represents the structuring element B translated by σ displacements. The above formula represents that the result of eroding the source image A with the structuring element B is the set of all σ values that satisfy the condition that after translating B, B is still completely contained in A.
[0039] In summary, the processing of the input source image through the mathematical morphological closing operation can be expressed as:
[0040]
[0041] First, perform a dilation operation on the input source image, and then perform an erosion operation to obtain the preprocessed source image x.
[0042] Please refer toFigure 2 , the color geological image adopted in this embodiment can be seen in Figure 3 , which is the effect diagram of the preprocessed color geological image in this embodiment.
[0043] Step 2: Respectively use the SE-UNet neural network and the Felz clustering algorithm on the preprocessed image to obtain a rough segmentation image and a superpixel segmentation map;
[0044] Can be seen in Figure 4 , the SE-UNet neural network in this embodiment is composed of multiple encoder modules, multiple decoder modules, and an attention mechanism-skip connection module;
[0045] In one implementation, the multiple encoder modules include four encoder blocks arranged in series. Each encoder block is composed of a convolutional layer, a batch normalization layer, and a ReLU layer. The convolutional kernel size in the convolutional layer is 3, the stride is 1, and the padding is 1. After each convolutional layer of the encoder block, a batch normalization layer and an activation layer are sequentially added, and the encoder blocks are connected by a downsampling layer. The downsampling layer specifically refers to the max pooling operation, and the pooling kernel size in the max pooling operation is 2, and the stride is 2. The input image first enters the first encoder block, passes through a convolutional layer with a convolutional kernel size of 3, and then uses the batch normalization layer and the ReLU layer for non-linear transformation. This processing operation is repeated once, that is, two convolutional, batch normalization, and ReLU operations are performed to obtain the output feature F1 of the encoder block. Then, a max pooling operation with a pooling kernel size of 2 and a stride of 2 is performed on the feature F1 to obtain the downsampled output feature G1. The input of the second encoder block of the encoder module is the feature G1 obtained by the output feature F1 of the first encoder block of the encoder module through the downsampling layer, and the corresponding encoder block output feature is F2. The inputs of the subsequent third and fourth encoders are the output features of the previous adjacent encoder block obtained through the downsampling operation. Then, the input features of the third and fourth encoders can be obtained as G2 and G3 respectively, and the corresponding encoder block outputs are F3 and F4.
[0046] In one embodiment, the attention mechanism - skip connection module is used to perform global average pooling on the output features F1, F2, and F3 of the first three encoder blocks in the multi - layer encoder module in the spatial dimension to obtain the channel - dimension features C1, C2, and C3. The channel - dimension features C1, C2, and C3 are input into two fully - connected layers to obtain the channel attention weights W1, W2, and W3. A ReLU non - linear activation function is added after the first fully - connected layer, and a Sigmoid non - linear activation function is added after the second fully - connected layer. Then, the channel attention weights W1, W2, and W3 are multiplied with the output features F1, F2, and F3 of the encoder blocks channel - by - channel to obtain the attention - fused features S1, S2, and S3.
[0047] In one embodiment, the multi - layer decoder module is composed of three decoder blocks. Each decoder block is composed of a convolutional layer, a batch normalization layer, and a ReLU layer, which is similar to the encoder block structure, but the output channel number is opposite to that of the encoder block. The decoder blocks are all connected by an up - sampling layer, where the up - sampling layer specifically refers to a transposed convolution with a kernel size of 2 and a stride of 2. It is used to perform up - sampling operations on the output feature of the bottom encoder block of the encoder module and the output features of each decoder block of the decoder module. The input of the first decoder block of the multi - layer decoder module is the multi - scale feature T1 obtained by concatenating the transposed convolution value of the output feature F4 of the fourth encoder block of the multi - layer encoder module and the attention - fused feature S3. The concatenation operation is to concatenate the transposed convolution value of the encoder block feature F...
[0048] The encoder is responsible for extracting the feature information of the input image and abstracting it for fine segmentation in the decoder. Each module of the encoder consists of a convolutional layer, a ReLU (Rectified Linear Unit) activation function, and a pooling layer. The convolutional layer applies a sliding window to different regions of the input source image through a convolutional kernel, extracting the local feature matrix of the image. The expression of the convolutional layer is:
[0049]
[0050] where x represents the preprocessed source image, ω represents the convolutional kernel, b represents the bias term, M and N represent, ω m,n represents the size of the convolutional kernel with m rows and n columns, and x (i+m),(j+n) represents the feature value at the position (i,j) of the source image when offset by (m,n). This is actually multiplying the value at the corresponding position (m,n) of the convolutional kernel with the corresponding position after offset by (m,n) at the position (i,j) of the input image.
[0051] The ReLU activation function performs a non-linear mapping on the features extracted by the convolutional layer, making the features more distinguishable. The expression of ReLU is:
[0052] y = max(0, z);
[0053] where y represents the feature map after being processed by the ReLU unit, and max() represents the maximum value function.
[0054] The output feature map after being processed by the ReLU unit is divided into blocks according to the specified pooling size, and only the strongest features in the local region are retained, which can effectively reduce the dimension and size of the feature map, reduce the computational amount, and prevent overfitting. The expression of the max-pooling layer is:
[0055]
[0056] where y represents the image after being processed by the ReLU unit, l represents the output feature map, and (i,j) represents the position index of the output feature map.
[0057] The skip connection concatenates the feature maps in the encoder and the corresponding feature maps in the decoder by channel as the input of the decoder. Among them, an SE (Squeeze-and-Excitation) attention mechanism is added to the skip connection;
[0058] Geological images usually have complex spatial structures and texture distributions. Adding an SE attention mechanism to the skip connection can adaptively learn and select the key features in the image, ignore the interference of irrelevant feature information, and improve the sensitivity of the network to the target. The SE attention mechanism consists of Squeeze operation, Excitation operation, and Reweight operation.
[0059] In one embodiment, the Squeeze operation compresses and encodes the spatial information on each channel into global features through global average pooling.
[0060]
[0061] Where F sq () represents the definition of the Squeeze operation, C, H, and W respectively represent the number of channels, height, and width of the feature map, l c represents the feature map of the c-th channel, and i, j represent pixel positions.
[0062] In one embodiment, the Excitation operation passes the global features obtained by the Squeeze operation into two fully connected layers, and through an assignment operation, assigns each of the two fully connected layers a weight to construct the dependence between different channels.
[0063] s = F ex (z, W) = φ[g(z, W)] = φ[W2ρ(W1, z)];
[0064] Where F ex () is the definition of the Excitation operation, z is the output of the Squeeze operation, W1 and W2 are channel weights, φ() is the Sigmoid normalization function, and ρ() is the ReLU activation function.
[0065] In one embodiment, the Reweight operation weights the weights s obtained by the Excitation operation to the original input features, obtains the output and uses it as the input of the next level.
[0066]
[0067] Where F scale () is the definition of the Reweight operation, s c is the output matrix channel weight value of the Excitation operation.
[0068] The decoder consists of a convolutional layer, a ReLU rectified linear unit, and a transposed convolution connected in sequence; the transposed convolution restores the position information of the image by upsampling the feature map, and at the same time combines with the low-level features corresponding to the encoder to output the segmentation result. The expression is:
[0069]
[0070] Where is the transposed convolution kernel, l represents the output feature map of the encoder, represents the output feature map of the skip connection combined with the SE attention mechanism, Indicates the splicing operation, p represents the bias term, k and l represent the sizes of the transposed convolution kernel in the horizontal and vertical directions, and x and y represent the position indices of the output feature map.
[0071] The clustering algorithm uses the Felz clustering algorithm. The geological objects are clustered by the Felz clustering algorithm to obtain the superpixel segmentation map. The Felz clustering algorithm performs region merging according to the judgment criteria of the inter-region spacing and the intra-region spacing dissimilarity, adaptively adjusts the threshold according to the local features of the image data, and uses greedy selection to perform image segmentation.
[0072] In one implementation, the specific implementation of the Felz clustering algorithm includes the following sub-steps:
[0073] Step 2.1: Construct an undirected graph;
[0074] Use the undirected graph G to abstractly represent the geological image, where G = (V, E), which consists of the vertex set V and the edge set E. v i ∈V, (v i , v j ) ∈ E represents the edge connecting adjacent vertices (v i , v j ) between, ω ij = (v i , v j ) represents the weight of each connected edge (v i , v j ), R = (C1,..., C r ) represents the non-overlapping regions after segmentation. In the initial state, the regions in R are all vertices. The judgment criteria for defining the boundaries between image regions are composed of the inter-region spacing and the intra-region spacing;
[0075] Step 2.2: Calculate the weights between edges according to the relationship between the nodes of the undirected graph. For each edge belonging to e n ∈E, let the vertices it connects be (v i , v j ), and n is the serial number of the edge; considering the characteristics of the color geological image, the color similarity and texture similarity are used for weighted summation to obtain the weight of the edge; the expression of the weight of this edge is: [[ID=G]]
[0076] ω ij = ω c *euc_dis(v i , v j ) + ω t *ssim_dis(v i , v j );
[0077] Among them, ω c and ωt is the weight of color similarity and texture similarity, used to adjust the contribution in the weights; euc_dis(v i , v j ) is a color similarity metric, used to measure the distance in the color space, and the expression is: euc_dis(v i , v j ) = and respectively represent the RGB values of v i and v j ; ssim_dis(v i , v j ) is a texture similarity metric, and the expression is: cvi and cvj represent the gray values of the corresponding pixels, lum(cvi, cvj) is the luminance similarity, is the contrast similarity, is the structure similarity, and α is a weighting coefficient, used to balance the importance of luminance, contrast, and structure similarity; the expression of the luminance similarity is: and are the average luminance values of the corresponding pixels, and their average luminance values are obtained from the average gray value. a is a constant, used to stabilize the calculation and prevent the denominator from being zero; the expression of the contrast similarity is: and are the standard deviations of the luminance of the corresponding pixels, and their standard deviations of the luminance are obtained from the standard deviation of the gray value. b is a constant, used to stabilize the calculation and prevent the denominator from being zero; the expression of the structure similarity is: is and 's luminance covariance, and its luminance covariance is obtained from the gray covariance. c is a constant, used to stabilize the calculation and prevent the denominator from being zero;
[0078] Step 2.3: Sort the edge set E in non-descending order of dissimilarity, that is, the weight ω ij of the edge, to obtain
[0079] The dissimilarity refers to the difference between two pixels in the geological image. In this invention, the geological image is abstracted as an undirected graph, so the dissimilarity actually refers to the weight ω ij of the edge. Because the weight of the edge is calculated through the vertices connected by the edge, when the weight corresponding to the edge is larger, it means that the difference between the two vertices connected by the edge is larger, that is, the dissimilarity is higher. When the weight corresponding to the edge is smaller, it means that the difference between the two vertices connected by the edge is smaller, that is, the dissimilarity is lower.
[0080] Step 2.4: For the currently selected edge e nPerform a merging judgment. Assume the vertices it connects are (v i , v j ). When the vertices corresponding to the edge e n do not belong to the same region, that is, area_id(v i ) ≠ area_id(v j ), and the distance between the regions C i to which v i belongs and the region C j to which v j belongs is not greater than the minimum of the intra-region distances of the two, perform region merging and execute step 2.5;
[0081] Among them, the region merging determination expression is: Dif(C i , C j ) ≤ Min_Int_dis(C i , C j ). Dif(C i , C j ) represents the inter-region distance, and Min_Int_dis(C i , C j ) represents the minimum of the intra-region distances of the two;
[0082] The intra-region distance refers to the maximum weight in the minimum spanning tree (MST) of the divided region C i (1 ≤ i ≤ r), that is, the weight of the edge with the largest dissimilarity in the corresponding region, which is represented by Int_dis(C i ), and the expression is: max() is the maximum value function; ω(e) refers to the weight of an edge in the region; e ∈ refers to the edge e belonging to the edge set i corresponding to the minimum spanning tree of the region C ;
[0083] The inter-region distance refers to the minimum weight value among the pairs of points that belong to two regions and are connected by an edge to each other, that is, the weight of the edge with the smallest dissimilarity between the two regions, which is represented by dif(C i , C j ), where i ≠ j, and the expression is: min() is the minimum value function;
[0084] The minimum of the intra-region distances of the two is the minimum internal difference within the region, which is represented by Min_Int_dis(C i , C j ), and the expression is: Min_Int_dis(C i , Cj ) = min(Int_dis(C i ) + λ(C i ), Int_dis(C j ) + λ(C j ))), where λ is a threshold function based on the region size to prevent over-segmentation when each region is a single pixel value at the beginning of segmentation; λ(C) = α / num C , num C is the number of pixel points contained in region C, and α is a fixed parameter used to control the size of the formed region. When α = 0, each pixel point in the figure is an independent region, and when α = +∞, the whole figure becomes one region;
[0085] Step 2.5: Unify the class label area_id(v i ) of the region to which v belongs with the region class label area_id(v i ), and adjust the dissimilarity threshold of this region to Int_dis(C j ) + C j ) + λ(C i ) + C i + C j ) + λ(C i + C j );
[0086] Step 2.6: If n ≤ m, then select the next edge in the arrangement order in Step 2.3 and continue to execute Step 2.4 until the final superpixel segmentation map is output at the end. See Figure 5 , which is the schematic diagram of the superpixel segmentation result of this embodiment of the present invention.
[0087] Step 3: Use the superpixel segmentation map as a "pseudo-label" to optimize the coarsely segmented image, and output the predicted segmentation result through forward propagation to achieve the segmentation of unlabeled color geological images.
[0088] In one embodiment, the cross-entropy loss function (CrossEntropy Loss) is used to optimize the coarsely segmented image, and the expression is:
[0089]
[0090] where y represents the "pseudo-label" obtained from the superpixel segmentation map, p represents the label of the coarsely segmented map obtained from the segmentation model, and n is the maximum number of clusters set according to the experiment.
[0091] The SE-UNet neural network in this embodiment is a trained network; its training process includes the following steps:
[0092] (1) Obtain color geological images by retrieving published literature in the geological field and geological data websites, and construct a training dataset of color geological images;
[0093] (2) Perform mathematical morphology preprocessing on the input source image to obtain the preprocessed source image;
[0094] (3) Use the preprocessed source image as input and input it into the SE-UNet neural network to obtain a rough segmentation image;
[0095] Use the preprocessed source image as input and input it into the Felz clustering algorithm to obtain a superpixel segmentation map;
[0096] (4) Use the superpixel segmentation map as a "pseudo-label", optimize the rough segmentation result based on the superpixel segmentation map, and output the predicted segmentation result through forward propagation to achieve the segmentation of color geological images without labels;
[0097] (5) Evaluate the segmentation result using common evaluation metrics in the field of image segmentation;
[0098] If the evaluation is qualified, the training ends;
[0099] If it is unqualified, the following operations will be taken:
[0100] (1) Hyperparameter tuning: Adjust the hyperparameters of the network, such as learning rate, batch size, weight decay, etc. The best combination of hyperparameters can be found through cross-validation or automatic hyperparameter tuning methods based on performance metrics.
[0101] (2) Model structure optimization: Try to change the network structure of SE-UNet, such as increasing or decreasing the number of encoder and decoder layers, adjusting the size of the convolutional kernel, enhancing the feature fusion ability of the attention-jumping connection module, etc., to adapt to the characteristics of geological images.
[0102] (3) Clustering algorithm optimization: Adjust the number of clusters and related parameters in the clustering algorithm, and control factors affecting segmentation performance such as the size of the smallest merging region in the superpixel segmentation map.
[0103] In one embodiment, in order to better reflect the quality of the algorithm performance and more comprehensively and intuitively compare the performance differences of geological image segmentation in cases based on different models or clustering algorithms, etc., pixel accuracy (PA), mean intersection over union (MIoU), frequency weighted intersection over union (FWIoU), and Dice coefficient are used to evaluate the performance differences of the algorithm's color segmentation. PA represents the proportion of correctly segmented pixels in the total pixels. MIoU is used to calculate the ratio of the intersection to the union of the predicted results and the true values of the segmentation algorithm for each category, and then divided by the total number of its categories, which is used to evaluate the overlap degree of the segmentation. FWIoU is an improved formula for MIoU, and corresponding weights can be set according to the frequency of each category for calculation. Dice is used to calculate the similarity between the segmentation result and the true result.
[0104] Figure 6 It is a schematic diagram of the final segmentation result obtained in the embodiment of the present invention, from which it can be seen that:
[0105] (1) Region segmentation: This method can segment the color geological image into different regions, and each region represents a part of the geological entity. The segmentation result can provide the regional division of different geological entities in the geological image, helping to further analyze and understand the geological structure.
[0106] (2) Boundary extraction: The segmentation result can effectively extract the boundaries between geological entities, such as the boundary line between rock layers. These boundary information can be used to identify the boundaries of different geological units, conduct geological structure analysis and modeling, etc.
[0107] (3) Region attributes: The segmentation result can also provide the attribute information of each segmented region, such as color features, texture features, shape features, etc. These attribute information can be used to further analyze and study the characteristics of geological entities and their relationships with other geological elements.
[0108] It should be understood that the above description of the preferred embodiment is relatively detailed, and it should not be considered as a limitation to the protection scope of the patent of the present invention. Under the inspiration of the present invention, those of ordinary skill in the art can also make substitutions or deformations without departing from the protection scope defined by the claims of the present invention, and all fall within the protection scope of the present invention. The scope of the present invention claimed should be subject to the appended claims.
Claims
1. An unsupervised color geological image segmentation method based on attention mechanism, characterized in that: The following steps are involved: Step 1: Perform mathematical morphological preprocessing on the color geological image to obtain a preprocessed image; Step 2: The preprocessed image is processed using the SE-UNet neural network and the Felz clustering algorithm to obtain the coarse segmentation image and superpixel segmentation map; The SE-UNet neural network consists of an encoder, a decoder, and skip connections; The encoder is composed of a sequentially connected convolution layer, a ReLU rectified linear unit, and a pooling layer; the convolution layer applies a sliding window to different regions of the input source image through the convolution kernel to extract the local feature matrix of the image; the ReLU rectified linear unit performs nonlinear mapping on the features extracted by the convolution layer to make the features easier to distinguish; the pooling layer divides the output features processed by the ReLU rectified linear unit into blocks according to a specified pooling size; The skip connection concatenates the feature map in the encoder and the feature map in the corresponding decoder by channel as the input of the decoder; wherein, the SE attention mechanism is added to the skip connection; The decoder is composed of sequentially connected convolutional layers, ReLU rectified linear units, and transposed convolutions. The transposed convolutions recover the image's position information by upsampling the feature map and combine it with the low-level features corresponding to the encoder to output the segmentation result. Step 3: Use the superpixel segmentation map as a "pseudo-label" to optimize the coarse segmentation image based on the superpixel segmentation map, and forward propagate the output of the predicted segmentation result to achieve label-free color geological image segmentation; The training process of the SE-UNet neural network includes the following steps: (1) Obtain color geological images by searching published geological literature and geological data websites, and construct a color geological image training dataset; (2) Perform mathematical morphology preprocessing on the input source image to obtain the preprocessed source image; (3) The preprocessed source image is input into the SE-UNet neural network to obtain a coarse segmentation image; The preprocessed source image is used as input to the Felz clustering algorithm to obtain a superpixel segmentation map; (4) Using the superpixel segmentation map as a "pseudo-label", the coarse segmentation results are optimized based on the superpixel segmentation map, and the predicted segmentation results are output through forward propagation to achieve label-free color geological image segmentation; (5) Use common evaluation indicators in the field of image segmentation to evaluate the segmentation results; if the evaluation is qualified, the training ends; If you fail to meet the requirements, the following actions will be taken: 1) Hyperparameter tuning: Adjust the network's hyperparameters and find the optimal hyperparameter combination through cross-validation or automatic parameter tuning based on performance indicators; 2) Model structure optimization: The network structure of SE-UNet was changed, the number of encoder and decoder layers was increased or decreased, the size of the convolution kernel was adjusted, and the feature fusion capability of the attention-skip connection module was enhanced to adapt to the characteristics of geological images; 3) Clustering algorithm optimization: The number of clusters and related parameters in the clustering algorithm are adjusted to control the factors affecting the segmentation performance in the superpixel segmentation map.
2. The unsupervised color geological image segmentation method based on the attention mechanism according to claim 1 is characterized in that: The mathematical morphology preprocessing described in step 1 first performs an expansion operation on the color geological image, and then performs an erosion operation to obtain the preprocessed image. ; The dilation operation is performed by recording the input source image as , the structural element is recorded as ; Structural element For the input source image The expression for the expansion operation is: in, represents the dilation operation, Represents a structural element Mapping about the origin, express Pan displacement; The corrosion operation, the structural element The expression for the erosion operation on the input source image A is: in, represents the erosion operation, Represents a structural element Pan A displacement.
3. The unsupervised color geological image segmentation method based on the attention mechanism according to claim 1 is characterized in that: In step 2, the SE-UNet neural network consists of a multi-layer encoder module, a multi-layer decoder module, and an attention mechanism-jump connection module; The multi-layer encoder module includes four encoder blocks arranged in series, each of which is composed of a convolution layer, a batch normalization layer, and a ReLU layer. The encoder blocks are connected by a downsampling layer, wherein the downsampling layer specifically refers to a maximum pooling operation. The input image first enters the first encoder block, and is subjected to two convolution, batch normalization, and ReLU operations to obtain the encoder block output feature F1. The feature F1 is then subjected to a maximum pooling operation to obtain the downsampled output feature G1. The input of the second encoder block of the encoder module is the feature G1 obtained by downsampling the output feature F1 of the first encoder block of the encoder module, and the corresponding encoder block output feature is F2; The inputs of the subsequent third and fourth encoders are obtained by downsampling the output features of the previous adjacent encoder block. The input features of the third and fourth encoders are G2 and G3 respectively, and the corresponding encoder block outputs are F3 and F4; The attention mechanism-jump connection module is used to output features F1, F2, and F3 of the first three encoder blocks in the multi-layer encoder module, and obtain channel dimension features C1, C2, and C3 by performing global average pooling on the encoder block output features F1, F2, and F3 in the spatial dimension; the channel dimension features C1, C2, and C3 are input into two fully connected layers to obtain channel attention weights W1, W2, and W3, wherein a ReLU nonlinear activation function is added after the first fully connected layer, and a Sigmoid nonlinear activation function is added after the second fully connected layer, and then the channel attention weights W1, W2, and W3 are multiplied channel by channel with the encoder block output features F1, F2, and F3 respectively to obtain attention fusion features S1, S2, and S3; The multi-layer decoder module is composed of three decoder blocks, each of which is composed of a convolution layer, a batch normalization layer and a ReLU layer. The decoder blocks are connected by upsampling layers, wherein the upsampling layer specifically refers to a transposed convolution, which is used to upsample the output features of the bottom encoder block of the encoder module and the output features of each decoder block of the decoder module; the input of the first decoder block of the multi-layer decoder module is a multi-scale feature T1 obtained by splicing the transposed convolution value of the output feature F4 of the fourth encoder block of the multi-layer encoder module and the attention fusion feature S3, wherein the splicing operation is to splice the transposed convolution value of the encoder block feature F4 with the attention fusion feature S3 in the channel dimension, and the number of channels of the obtained multi-scale feature T1 is twice the number of channels of the attention fusion feature S3, and the size is consistent with S3; The input of the second decoder block of the multi-layer decoder module is the multi-scale input feature T1 of the previous decoder module. After being processed by the first decoder block, the output feature of the transposed convolution and the attention fusion feature S2 of the attention mechanism-jump module are spliced on the spatial channel to obtain the multi-scale input feature T2, wherein the number of channels of feature T2 is twice the number of channels of attention fusion feature S2, and the size is consistent with S2; the input of the third decoder block of the multi-layer decoder module is the multi-scale input feature T2 of the previous decoder block. After being processed by the second decoder block, the output feature of the transposed convolution and the attention fusion feature S1 of the attention mechanism-jump module are spliced on the spatial channel to obtain the multi-scale input feature T3, wherein the number of channels of feature T3 is twice the number of channels of attention fusion feature S1, and the size is consistent with S1; the output feature M of the third decoder block is subjected to a spatial channel adjustment convolution layer to obtain a coarse segmentation feature map.
4. The unsupervised color geological image segmentation method based on the attention mechanism according to claim 1, characterized in that: In step 2, the SE attention mechanism consists of Squeeze operation, Excitation operation, and Reweight operation; The Squeeze operation compresses the spatial information on each channel into global features through global average pooling. ; in, Indicates the definition of the Squeeze operation, , , Respectively represent the number of channels, height, and width of the feature map, represents the feature map of the c-th channel, Indicates pixel position; The Excitation operation passes the global features obtained by the Squeeze operation into two fully connected layers. Through the assignment operation, a weight is given to each of the two fully connected layers to build the dependency between different channels. ; in, Defined for the Excitation operation, Output for the Squeeze operation, and is the channel weight, is the Sigmoid normalization function, is the ReLU activation function; The Reweight operation is to reweight the weight obtained by the Excitation operation. Weighted to the original input features, the output is obtained and used as the input of the next level; in, Defined for the Reweight operation, The output matrix channel weight value of the Excitation operation.
5. The unsupervised color geological image segmentation method based on the attention mechanism according to claim 1 is characterized in that: The Felz clustering algorithm described in step 2 is specifically implemented by the following sub-steps: Step 2.1: Construct an undirected graph; Using an undirected graph Abstract representation of geological images, where , by the vertex set and edge sets composition, , Represents adjacent vertices The edges connecting Represents each connected edge With weight, Indicates the non-overlapping areas after segmentation. In the initial state, The regions in are all vertices, ;The judgment criteria for defining the boundaries between image regions are composed of the spacing between regions and the spacing within regions; Step 2.2: Calculate the weights between edges based on the relationships between nodes in the undirected graph. For each edge of , let the vertex it connects be , n is the sequence number of the edge; Taking into account the characteristics of color geological images, the weight of the edge is obtained by weighted summation of color similarity and texture similarity; the weight expression of the edge is: in, and is the weight of color similarity and texture similarity, which is used to adjust the contribution in the weight; is a color similarity metric used to measure the distance in color space. The expression is: , and Respectively and RGB value; is the texture similarity measure, and its expression is: , and Represents the grayscale value of the corresponding pixel, is the brightness similarity, is the comparative similarity, is the structural similarity, is a weighting coefficient used to balance the importance of brightness, contrast, and structural similarity; the expression of brightness similarity is: , and is the average brightness of the corresponding pixel, and its average brightness is obtained by the average grayscale. is a constant used to stabilize the calculation and prevent the denominator from being zero; the expression of contrast similarity is: , and is the brightness standard deviation of the corresponding pixel, and its brightness standard deviation is obtained by the grayscale standard deviation. is a constant used to stabilize the calculation and prevent the denominator from being zero; the expression of structural similarity is: , yes and The brightness covariance of , the brightness covariance is obtained by the grayscale covariance, is a constant used to stabilize the calculation and prevent the denominator from being zero; Step 2.3: Edge Set According to the dissimilarity, that is, the weight of the edge , sorted in non-descending weight order ; Step 2.4: For the currently selected edge Make a merge judgment and set the connected vertices to be , when the side When the corresponding vertices do not belong to the same region, that is, ,and Region and Region When the distance between the two regions is not greater than the minimum distance between the two regions, the regions are merged and step 2.5 is executed; The region merging judgment expression is: , Indicates the distance between regions, Indicates the minimum value of the distance between the two areas; The intra-region spacing refers to the area after segmentation The maximum weight in the minimum spanning tree is the weight of the edge with the largest dissimilarity in the corresponding region, which is applicable Indicates that the expression is: , is the maximum value function; Refers to the area The corresponding minimum spanning tree MST, where the parameters It indicates the area All edge sets contained in It refers to the weight of an edge in the region; Refers to the region The edge set in the corresponding minimum spanning tree Edge ; The distance between regions refers to the minimum weight value among the point pairs that belong to two regions and are connected by edges, that is, the weight of an edge with the minimum dissimilarity between the two regions. Indicates that , the expression is: , is the minimum function; The minimum value of the distance between the two regions is the minimum internal difference within the region, and the value is calculated using Indicates that the expression is: , It is a threshold function based on the size of the region, in order to prevent the problem of over-segmentation when each region has a single pixel value at the beginning of segmentation; , For the region Contains the number of pixels, is a fixed parameter used to control the size of the formed area. When , each pixel in the image is an independent area, and when , the entire image will become an area; Step 2.5: The class label of the area to which it belongs and Regional class number Unified , and the dissimilarity threshold of the region is adjusted to ; Step 2.6: If , then according to the arrangement order in step 2.3, select the next edge and continue to execute step 2.4 until the final superpixel segmentation map is output.
6. The unsupervised color geological image segmentation method based on the attention mechanism according to claim 1, characterized in that: In step 3, the superpixel segmentation map is used as a "pseudo-label" to optimize the coarse segmentation result based on the superpixel segmentation map. The cross entropy loss function is used to optimize the coarse segmentation image. The expression is: in, represents the "pseudo-label" obtained by the superpixel segmentation map, represents the coarse segmentation map label obtained by the segmentation model, is the maximum number of clusters set according to the experiment.
7. The unsupervised color geological image segmentation method based on the attention mechanism according to claim 1, characterized in that: Pixel accuracy PA, mean intersection over union (MIoU), frequency-weighted intersection over union (FWIoU), and Dice coefficient are used to evaluate the performance differences of the color segmentation algorithms.
8. An unsupervised color geological image segmentation system based on attention mechanism, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the unsupervised color geological image segmentation method based on the attention mechanism as described in any one of claims 1 to 6.
Citation Information
Patent Citations
CT image segmentation method based on improved AU-Net network
CN112927240A