Rock pore segmentation method and system based on Refinenet network model, and storage medium
By adopting the Refinenet network model in rock pore segmentation, using multi-layer small convolution kernel and coordinate attention mechanism, the accuracy and efficiency of complex pore structure segmentation in the existing technology is solved, and the accuracy of rock pore segmentation is significantly improved. and robustness.
Patent Information
- Application Number
- CN202411151592.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-11-22
AI Technical Summary
The existing rock pore segmentation methods are limited by the inherent local characteristics of convolution, making it difficult to accurately and efficiently segment complex and subtle pore structures.
The rock pore segmentation method based on the Refinenet network model is adopted, and a large convolution kernel is replaced by a multi-layer small convolution kernel, and the coordinate attention mechanism and adaptive weight adjustment mechanism are introduced to enhance the model's perception of image texture features, and mixed losses are used. Functions are trained.
It significantly improves the accuracy and robustness of rock pore segmentation, can extract local details and global features in the image more accurately, improves analysis efficiency, and adapts to detailed information at different scales.
Smart Images

Figure CN119006823A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of rock structure measurement, and in particular to a rock pore segmentation method, system and storage medium based on a Refinenet network model. Background Art
[0002] In the field of geological exploration and petroleum engineering, accurate analysis of the pore structure of underground rock reservoirs is the key to evaluating the potential of oil and gas resources and formulating production strategies. Traditional rock pore analysis methods mainly rely on laboratory tests and indirect geological interpretations, which are often time-consuming and costly, and it is difficult to achieve direct observation and quantitative analysis of the internal microstructure of rocks.
[0003] With the development of computed tomography (CT) technology, researchers can obtain high-resolution three-dimensional images of rock samples, thereby directly observing the pore structure inside the rock. However, accurately extracting pore information from these complex three-dimensional images still faces many challenges, such as image noise, low contrast between pores and rock matrix, and the diversity and complexity of pore structure.
[0004] To solve these problems, researchers began to explore the application of computer vision and image processing technology for rock pore segmentation. Early methods were mainly based on the texture, shape and statistical characteristics of images, and pore identification was performed through traditional image processing algorithms such as threshold segmentation, edge detection and region growing. Although these methods can extract pore features to a certain extent, their accuracy and efficiency still need to be improved for complex and subtle pore structures.
[0005] Chinese patent document with publication number CN117191838A discloses a multi-scale digital rock nuclear magnetic resonance response spectrum simulation method, and Chinese patent document with publication number CN115688590A discloses a multi-mineral phase core permeability prediction method based on deep learning. These research methods are limited by the local characteristics inherent in convolution, and cannot accurately segment complex and subtle pore structures, and cannot achieve high-precision and efficient segmentation of rock thin section images. Summary of the invention
[0006] The technical problems to be solved by the present invention are:
[0007] Existing methods are limited by the inherent local characteristics of convolution and cannot accurately and efficiently segment complex and subtle rock pore structures.
[0008] The present invention adopts the following technical solutions to solve the above technical problems:
[0009] The present invention provides a rock pore segmentation method based on the Refinenet network model, comprising the following steps:
[0010] Step 1: Slice the rock sample, collect CT scan image data of the rock sample slice, pre-process the image data, and randomly divide the image data into a training set and a test set;
[0011] Step 2: Build an image segmentation model based on RefineNet. The model uses multiple small convolution cascades to replace large convolutions, and introduces a coordinate attention mechanism after each block of the encoder. The coordinate attention mechanism enhances the model's perception of image texture features through spatial position and channel weighting. At the same time, an adaptive weight adjustment mechanism is introduced. During the weight generation process of the coordinate attention mechanism, global information is extracted from the generated intermediate feature map, and the attention weight is dynamically adjusted according to the characteristics of the image to improve the segmentation accuracy and adaptability of the network model.
[0012] Step 3: training the image segmentation model based on the training set, and testing the model performance based on the test set;
[0013] Step 4: Segment the rock pores based on the trained image segmentation model.
[0014] Furthermore, the image data is preprocessed as described in step one, specifically including: performing distortion correction and image enhancement on the image, the image enhancement including contrast enhancement, brightness adjustment and filtering processing, and expanding the data through random cropping, flipping and mirror expansion operations.
[0015] Furthermore, in step one, a histogram equalization method is used to perform contrast enhancement processing on the image.
[0016] Furthermore, the image segmentation model in step 2 uses three 3x3 convolution cascades instead of 7x7 convolution.
[0017] Furthermore, the functional implementation process of the coordinate attention mechanism described in step 2 is:
[0018] a. Define coordinate encoding for each pixel position of the feature map, normalize the position information to generate a coordinate encoding matrix, perform pooling operations on the feature maps in the horizontal and vertical directions respectively, and generate a pair of feature maps with two-directional perception capabilities;
[0019] b. Connect the obtained feature maps with two-directional perception capabilities along the spatial dimension to form a fused feature map, generate an intermediate feature map through a nonlinear activation function, and generate attention weights through a Sigmoid function, including: horizontal attention weight A h and vertical attention weight A w ;
[0020] c. Set the horizontal attention weight A hand vertical attention weight A w Applied to the corresponding direction of the original feature map, the weighted feature map is finally output.
[0021] Furthermore, in step 3, a hybrid loss function based on BCE loss and Dice loss is adopted in the training process of the image segmentation model.
[0022] A rock pore segmentation system based on a Refinenet network model, the system having a program module corresponding to the steps of the method described in any one of the above technical solutions, and executing the steps of the rock pore segmentation method based on the Refinenet network model during operation.
[0023] A computer-readable storage medium stores a computer program, wherein the computer program is configured to implement the steps of the rock pore segmentation method based on the Refinenet network model described in any one of the above technical solutions when called by a processor.
[0024] Compared with the prior art, the present invention has the following beneficial effects:
[0025] The present invention discloses a rock pore segmentation method based on the Refinenet network model, which uses multi-layer small convolution kernels to replace large kernel convolution, reduces parameters and deepens the network depth, thereby improving network capacity and complexity, and realizing the idea of multiplication and stratification; a coordinate attention mechanism is introduced after each block of the encoder, so that the model can more accurately extract local details and global features of the image. In addition, after each coordinate attention mechanism, an adaptive weight adjustment mechanism is introduced, and the model can flexibly adjust the attention mechanism according to the different characteristics of the input image, thereby more accurately extracting key features in the image, and significantly improving the overall accuracy and robustness of the rock pore segmentation task.
[0026] The network model of the present invention can effectively handle the problem of grain size recognition with blurred boundaries after sufficient training of the mixed loss function, adapt to the detailed information of different scales, and significantly improve the efficiency of analysis. This technology provides a solid technical support for accurately characterizing the grain size, sorting, rounding and other structural characteristics of debris particles in rock slices. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 This is a structural diagram of an image segmentation model of an improved RefineNet in an embodiment of the present invention;
[0028] Figure 2 : is a structural diagram of a coordinate attention mechanism in an embodiment of the present invention;
[0029] Figure 3The RefineNet network model with a coordinate attention mechanism added in an embodiment of the present invention;
[0030] Figure 4 This is a comparison diagram of pore segmentation of rock images in an embodiment of the present invention. DETAILED DESCRIPTION
[0031] In order to enable those skilled in the art to better understand the scheme of the present invention, exemplary implementations or embodiments of the present invention will be described below in conjunction with the accompanying drawings. Obviously, the described implementations or embodiments are only implementations or embodiments of a part of the present invention, not all of them. Based on the implementations or embodiments of the present invention, all other implementations or embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present invention.
[0032] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0033] like Figure 1 As shown, the present invention provides a rock pore segmentation method based on the Refinenet network model, comprising the following steps:
[0034] Step 1: Slice the rock sample, collect CT scan image data of the rock sample slices, preprocess the image data, and randomly divide the image data into a training set and a test set.
[0035] The image data is preprocessed, specifically including: performing distortion correction and image enhancement on the image, the image enhancement includes contrast enhancement, brightness adjustment and filtering processing, the contrast enhancement uses histogram equalization to process the image, labelme is used to annotate the pores of the preprocessed rock image, and the rock image is divided into two parts: pores and background; the data is expanded by random cropping, flipping, and mirror expansion operations,
[0036] Step 2: Build Figure 1 and Figure 3 The image segmentation model based on RefineNet shown in the figure uses three 3x3 convolution cascades to replace 7x7 convolutions, and introduces a coordinate attention mechanism after each block of the encoder. The coordinate attention mechanism introduces the weighting of spatial position and channel to enhance the model's perception of image texture features. At the same time, an adaptive weight adjustment mechanism is introduced. During the weight generation process of the coordinate attention mechanism, global information is extracted from the generated intermediate feature map, and the attention weight is dynamically adjusted according to the characteristics of the image to improve the segmentation accuracy and adaptability of the network model.
[0037] like Figure 2 As shown in the figure, the functional implementation process of the coordinate attention mechanism and the adaptive weight adjustment mechanism is as follows:
[0038] a. For feature maps Where C is the number of channels, H and W are the height and width respectively; the coordinate encoding is defined for each pixel position (i, j) of the feature map, and the normalized position information is
[0039] For a given input F, the feature map is pooled along the horizontal X and vertical Y directions using the two spatial ranges of the pooling kernel (H, 1) or (1, W) to capture direction-aware feature information;
[0040] b. Encoding F for the height direction h and the width-wise encoding F w : The output of each channel C at height h aggregates features horizontally through a pooling operation, expressed as:
[0041] F h (c,h)=Poolhorizontal(F(c,h,:))
[0042] The output of each channel C at width w aggregates features along the vertical direction through a pooling operation, which is expressed as feature map fusion: h and F w Connect along the spatial dimension to form a fusion feature map F fusion , the formula is:
[0043] F fusion =[F h ; F w ]
[0044] 1×1 convolution transformation: F is transformed through a 1×1 convolution layer F1. fusion Transform and apply nonlinear activation function σ to obtain the intermediate feature map F mid , that is, F mid =σ(F1(F fusion )).
[0045] Feature map decomposition and transformation: F mid Divide into two parts and And pass through two 1×1 convolutional layers respectively and Transform, and then generate attention weight through Sigmoid function: horizontal attention weight A h , vertical attention weight A w .
[0046]
[0047]
[0048] c. Application of attention weight: Apply the attention weight A h and A w Apply it to the original feature map F to produce the final weighted output. Apply the attention weights to the corresponding directions of the original feature map, and finally output the weighted feature map F′, that is:
[0049] F′=A h ⊙F+A w ⊙F
[0050] Where ⊙ represents element-by-element multiplication. The network model with coordinate attention mechanism is as follows Figure 3 shown.
[0051] For the generated intermediate feature map F mid , by calculating the average value of its global statistical characteristics μ m and variance σ m To extract the global information of the image. The formula is as follows:
[0052]
[0053] Using the above global information, a small neural network multilayer perceptron MLP is constructed to generate the adaptive weight factor α. The specific generation process is as follows:
[0054]
[0055] Among them, α is the weight factor vector output by MLP.
[0056] Apply the generated adaptive weight factor α to the original attention weight A h and A w , and obtain the final weight after dynamic adjustment and The specific formula is as follows:
[0057]
[0058] Finally, the dynamically adjusted weights and Applied to the original feature map F, the final output weighted feature map is obtained:
[0059]
[0060] The parameter calculation formula of the convolution layer is:
[0061] params=C0*(k w *kh *C i +1)
[0062] Where C0 represents the number of output channels, C i Indicates the number of input channels, k w represents the convolution kernel width, k h Indicates the height of the convolution kernel; k w *k h *C i What is calculated is the total number of weights within a convolution kernel, +1 represents the bias term, the brackets represent the number of parameters of a convolution kernel, and C0 represents the number of convolution kernels contained in this layer.
[0063] The convolution kernel in this implementation is square, i.e., k w =k h =k, then the above formula becomes:
[0064] params=C0*(k 2 *C i +1)
[0065] Therefore, the amount of computation for each convolutional layer is:
[0066] PLOPs = [(k w *k h *C i )+(k w *k h *C i -1)+1]*C0*W*H
[0067] The value in the brackets indicates the amount of computation (multiplication and addition) required for the convolution operation to calculate a point in the feature map. w *k h *C i represents the number of multiplication operations in a convolution operation, k w *k h *C i -1 represents the amount of addition operations in a convolution operation, W and H represent the length and width of the feature map respectively, and C0*W*H represents the number of all elements in the feature map.
[0068] If the convolution kernel is square, that is, k w =k h =k, then the above formula becomes:
[0069] PLOPs = 2*C i *k 2 *C0*W*H
[0070] Therefore, for the above improvements, the convolution kernel parameters before and after the improvement are:
[0071] params first =C0*(7 2 *C i +1)=C0*(49C i +1)
[0072] params last =3*C0*(3 2 *C i +1)=C0*(27C i +3)
[0073] It can be seen that the improved network model has fewer parameters.
[0074] Step three: train the image segmentation model based on the training set, and test the model performance based on the test set.
[0075] A hybrid loss function based on BCE loss and Dice loss is used during the training process to optimize the model's accuracy in pixel-level classification and the coverage of the predicted area and the true area.
[0076] The mathematical expression of BCE loss is:
[0077]
[0078] Among them, p i is the probability that the model predicts that the i-th pixel is a positive class, y i is the true label (0 or 1) of the th pixel, and N is the total number of pixels.
[0079] The Dice coefficient is defined as:
[0080]
[0081] Among them, X is the predicted positive sample set, Y is the real positive sample set, and |·| represents the number of elements in the set. The value of the Dice coefficient ranges from 0 to 1. The larger the value, the higher the overlap between the two sets, that is, the more accurate the segmentation result. Since the loss function needs to be minimized during the training process, and the Dice coefficient is an indicator that needs to be maximized, 1 minus the Dice coefficient is usually used as the loss function, that is, Dice loss (DL):
[0082]
[0083] To facilitate the calculation of deep learning models, Dice loss is implemented by operating on the predicted probability and the true label in the form of:
[0084]
[0085] This implementation combines BCE loss and Dice loss to simultaneously optimize the model's accuracy for pixel-level classification and the coverage of the predicted area with the true area, all features of the details, thereby promoting a more stable training process and higher rock image pore segmentation accuracy.
[0086] Step 4: Segment the rock pores based on the trained image segmentation model. Figure 4 shown.
[0087] The segmentation effect of the model is evaluated using indicators such as Mean IoU, Precision, Recall, F1-Score and Accuracy.
[0088] Specifically, for the segmentation of pores in CT scanned rock images, the pore part of the rock is set as the positive class and the non-pore part is set as the negative class. TP represents true positive (the model correctly classifies pore pixels as positive), TN represents true negative (the model correctly classifies non-pore pixels as negative), FP represents false positive (the model incorrectly classifies non-pore pixels as positive), and FN represents false negative (the model incorrectly classifies pore pixels as negative). Therefore, the following indicators are used to evaluate the segmentation accuracy of pores in CT rock images.
[0089] The mean intersection over union (Mean IoU) is used to measure the overlap between the model prediction result and the true label. The purpose of this invention is to achieve the segmentation of pores and non-pores. For each category, the IoU of the category is calculated first, and then the IoU value of each category is added and divided by the number of two categories to obtain the MIoU value:
[0090]
[0091] Therefore, the MIoU calculation formula for the two categories is:
[0092]
[0093] Precision measures how many of the samples predicted as positive are actually positive, that is, how many of the samples predicted as pores are actually pores; the calculation formula is as follows:
[0094]
[0095] Recall measures the proportion of pore samples successfully identified by the model in the actual pore samples; the calculation formula is as follows:
[0096]
[0097] The F1 score is the harmonic mean of precision and recall, which combines the accuracy and coverage of the classifier; the calculation formula is as follows:
[0098]
[0099] Accuracy (Acc) is used to measure the proportion of pixels correctly classified by the model to the total number of pixels. For image segmentation problems, the calculation formula for accuracy is:
[0100]
[0101] Average Accuracy (aAcc) takes into account the accuracy of each category and averages them to better reflect the classification performance of the model for each category. The calculation formula is as follows:
[0102]
[0103] Where: N is the total number of categories; TP i , T.N. i , FP i , FN i are the true positives, true negatives, false positives, and false negatives for the i-th class, respectively.
[0104] The performance of the existing Refinenet model is compared with the improved Refinenet model of the present invention, and the results are shown in Tables 1 and 2.
[0105] Table 1 Performance comparison of rock image pore and background segmentation methods
[0106]
[0107] Table 2 Comparison of average pore properties of rock images
[0108]
[0109] As can be seen from Table 1, although the improved RefineNet model has a small improvement in the background (Back) part, multiple performance indicators have been improved in the pore segmentation (Pore) part, with significant improvements in both precision and recall, especially in precision, which has increased from 78.47% to 79.04%, indicating that the improved model can identify pores more accurately during segmentation.
[0110] From the data comparison in Table 2, it can be seen that the improved RefineNet model has improved results in the five evaluation indicators of Acc, mIoU, mRecall, mPrecision and mF1-score. The improved RefineNet model has improved its average accuracy from 98.29% to 98.38%, showing its stable performance improvement. In terms of average intersection over union (mIoU), the improved model has improved from 84.95% to 85.75%, significantly enhancing the overlap between the predicted results and the true labels. In terms of recall, the improved model has improved slightly, reaching 90.83%, which is 0.1% higher than the original model's 90.73%. In terms of precision, it has increased from 88.81% to 89.10%, reflecting that the model is more accurate in predicting positive samples. The improved model has reached 89.93% in F1-Score, which is 89.73% of the original model, further improving the model's performance in balancing accuracy and coverage.
[0111] In the rock images scanned by CT, the background pixels other than the rock pores account for a large proportion of all the pixels in the image, and the change in the number of mis-segmented pixels is not obvious in the background, so the segmentation results are slightly different. However, as can be seen from Table 2, the average accuracy of the improved Refinenet segmentation is still improved by an average of 0.2% compared with the average accuracy of the original Refinenet.
[0112] The present invention provides a rock pore segmentation method (algorithm) based on the Refinenet network model, which is the underlying technical core of the present invention. Various products can be derived based on the algorithm.
[0113] Based on the method proposed in the present invention, a rock pore segmentation system based on the Refinenet network model is developed using a programming language. The system has program modules corresponding to the steps of the above technical solution, and executes the steps in the above rock pore segmentation method based on the Refinenet network model during operation.
[0114] The computer program of the developed system (software) is stored on a computer-readable storage medium, and the computer program is configured to implement the steps of the rock pore segmentation method based on the Refinenet network model when called by a processor, that is, the present invention is materialized on a carrier to become a computer program product.
[0115] Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0116] The computer programs (also referred to as programs, software, software applications, or codes) of the present invention include machine instructions for programmable processors, and these computer programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or device (e.g., disk, optical disk, memory, programmable logic device PLD) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0117] Although the present invention is disclosed as above, the protection scope of the present invention is not limited thereto. Those skilled in the art may make various changes and modifications without departing from the spirit and scope of the present invention, and these changes and modifications will fall within the protection scope of the present invention.
Claims
1. A rock pore segmentation method based on Refinenet network model, characterized in that: The steps include: Step 1: Slice the rock sample, collect CT scan image data of the rock sample slice, pre-process the image data, and randomly divide the image data into a training set and a test set; Step 2: Build an image segmentation model based on RefineNet. The model uses multiple small convolution cascades to replace large convolutions, and introduces a coordinate attention mechanism after each block of the encoder. The coordinate attention mechanism enhances the model's perception of image texture features through spatial position and channel weighting. At the same time, an adaptive weight adjustment mechanism is introduced. During the weight generation process of the coordinate attention mechanism, global information is extracted from the generated intermediate feature map, and the attention weight is dynamically adjusted according to the characteristics of the image to improve the segmentation accuracy and adaptability of the network model. Step 3: training the image segmentation model based on the training set, and testing the model performance based on the test set; Step 4: Segment the rock pores based on the trained image segmentation model.
2. The rock pore segmentation method based on the Refinenet network model according to claim 1 is characterized in that: The image data is preprocessed as described in step 1, specifically including: performing distortion correction and image enhancement on the image, the image enhancement includes contrast enhancement, brightness adjustment and filtering processing, and expanding the data through random cropping, flipping, and mirror expansion operations.
3. The rock pore segmentation method based on the Refinenet network model according to claim 2 is characterized in that: In step 1, the histogram equalization method is used to enhance the contrast of the image.
4. The rock pore segmentation method based on the Refinenet network model according to claim 1, characterized in that: The image segmentation model described in step 2 uses three 3x3 convolution cascades instead of 7x7 convolution.
5. The rock pore segmentation method based on the Refinenet network model according to claim 4 is characterized in that: The functional implementation process of the coordinate attention mechanism described in step 2 is: a. Define coordinate encoding for each pixel position of the feature map, normalize the position information to generate a coordinate encoding matrix, perform pooling operations on the feature maps in the horizontal and vertical directions respectively, and generate a pair of feature maps with two-directional perception capabilities; b. Connect the obtained feature maps with two-directional perception capabilities along the spatial dimension to form a fused feature map, generate an intermediate feature map through a nonlinear activation function, and generate attention weights through a Sigmoid function, including: horizontal attention weight A h and vertical attention weight A w ; c. Set the horizontal attention weight A h and vertical attention weight A w Applied to the corresponding direction of the original feature map, the weighted feature map is finally output.
6. The rock pore segmentation method based on the Refinenet network model according to claim 1, characterized in that: In step 3, a hybrid loss function based on BCE loss and Dice loss is used in the training process of the image segmentation model.
7. A rock pore segmentation system based on Refinenet network model, characterized in that: The system has a program module corresponding to the steps of the method described in any one of claims 1 to 6, and executes the steps of the rock pore segmentation method based on the Refinenet network model when running.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is configured to implement the steps in the rock pore segmentation method based on the Refinenet network model described in any one of claims 1 to 6 when called by a processor.
Citation Information
Cited By
Structural member damage identification method and system based on attention mechanism optimization network
CN116310580A
Mars surface rock classification system and method based on element attention mechanism
CN119540646A
A mars surface rock classification system and method based on meta-attention mechanism
CN119540646B
Lightweight network-based Mars surface stone extraction method and system
CN119625501A
Rock joint and bedding segmentation method based on frequency-space learning
CN120807539A
