A method and system for image segmentation of cast thin sections based on dynamic noise filtering and detail enhancement
By employing dynamic noise filtering and detail enhancement methods based on the Segformer model, the problems of noise suppression, edge preservation, and multi-scale feature fusion in the segmentation of pore images of cast thin sheets are solved, achieving high-precision pore recognition and edge localization, and adapting to complex industrial environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-22
- Publication Date
- 2026-04-03
AI Technical Summary
Existing methods for segmenting pore images of cast thin sections have shortcomings in noise suppression, edge preservation, and multi-scale feature fusion, resulting in low segmentation accuracy and failing to meet the needs of efficient reservoir distribution identification in oilfield development.
A dynamic noise filtering and detail enhancement method based on the Segformer model is adopted. Multi-scale feature extraction and detail restoration are performed through a noise-aware dynamic filtering module, an edge enhancement feature extraction module, and a cross-scale attention fusion module. Combined with a multi-scale detail enhancement decoder and a boundary enhancement module, end-to-end image segmentation is achieved.
It significantly improves the recall rate and edge localization accuracy of small pores, enhances the accuracy and stability of pore image segmentation in cast thin sheets, and adapts to the recognition ability of pores of different scales, thus possessing strong practicality and promotional value.
Smart Images

Figure CN121564352B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of image segmentation and petroleum geological exploration technology, and more specifically, to a method, system, and storage medium for segmenting cast thin sections based on dynamic noise filtering and detail enhancement. Background Technology
[0002] Pore images of cast thin sections are crucial for evaluating reservoir properties, and their segmentation accuracy directly affects the accuracy of key parameters such as porosity and permeability. Traditional segmentation methods, such as thresholding and edge detection operators, suffer from the following problems when dealing with cast thin section images: sensitivity to noise, easy breakage in blurred edge regions, and inability to guarantee edge continuity and integrity.
[0003] Deep learning-based image segmentation methods such as U-Net improve segmentation accuracy through an encoder-decoder structure, but they still have shortcomings when processing images of cast thin slabs: multiple downsampling leads to the loss of small pore features, and skip connections only achieve simple feature map stitching, failing to fully consider the semantic relationships between features at multiple scales. SegFormer combines the global modeling capabilities of Transformer with a multi-layer feature pyramid structure, but its direct application to pore segmentation in cast thin slabs still faces challenges: it is sensitive to image noise, lacks a dedicated edge enhancement mechanism, has a relatively simple decoder structure, and has limited adaptability to pores of different scales, especially performing poorly on small pores.
[0004] Therefore, existing technologies lack more accurate and efficient pore image recognition technology for thin sections of oil castings to meet the urgent need for efficient identification of reservoir distribution during oilfield development. Summary of the Invention
[0005] The technical problem to be solved by this invention is:
[0006] Existing methods for segmenting images of pores in cast thin films have shortcomings in terms of noise suppression, edge preservation, and multi-scale feature fusion.
[0007] Therefore, the present invention provides a method, system, and storage medium for image segmentation of cast thin films based on dynamic noise filtering and detail enhancement.
[0008] The technical solution adopted by the present invention to solve the above-mentioned technical problems is as follows:
[0009] This invention provides a method for segmenting images of cast thin sections based on dynamic noise filtering and detail enhancement, comprising the following steps:
[0010] Step 1: Acquire image data of the casting thin sheet and preprocess the image data of the casting thin sheet;
[0011] Step 2: Input the preprocessed cast thin-slice image into an encoder based on the Segformer model for multi-scale feature extraction. The encoder is embedded with a noise-aware dynamic filtering module, an edge enhancement feature extraction module, and a cross-scale attention fusion module. The noise-aware dynamic filtering module is used to estimate the noise probability distribution of the input image and suppress image noise based on the generated dynamic filtering weights. The edge enhancement feature extraction module is used to extract multiple types of edge features and enhance edge features by introducing an attention mechanism. The cross-scale attention fusion module is used to perform feature enhancement interaction fusion based on the cross-scale attention mechanism to obtain fused features.
[0012] Step 3: Input the fused features into the multi-scale detail enhancement decoder to perform detail restoration and upsampling, and obtain a preliminary segmentation map;
[0013] Step 4: Enhance the boundaries of the initial segmentation map through the output optimization layer, and supervise the model training using the loss function to finally output the segmentation result of the cast thin slice image.
[0014] Furthermore, the noise-sensing dynamic filtering module is located at the network input end, and its functional implementation process is as follows:
[0015] The noise probability distribution of the input image is estimated, and a noise confidence map of the same size is output.
[0016] Dynamic filtering weights are generated based on the noise confidence map. :
[0017]
[0018] in Noise confidence plot
[0019] The original features are used to generate smooth features, based on the filtering weights. The original features and smoothed features are fused to obtain the denoised image. :
[0020]
[0021] in
[0022] Furthermore, the noise-aware dynamic filtering module uses a lightweight convolutional network with two 3×3 convolutional layers and one global average pooling layer to estimate the noise probability distribution of the input image and outputs a noise confidence map of the same size.
[0023] Furthermore, the edge enhancement feature extraction module described in step two is located at the input of each Transformer block, and includes a feature extraction unit and an edge prior fusion unit. The edge prior fusion unit uses the Sobel operator to extract the horizontal and vertical edge features of the denoised image, and performs dimensionality reduction fusion after concatenating them with the denoised image channels. The feature extraction unit includes three parallel branches:
[0024] Operator branches: These are used to extract horizontal and vertical edge features from the denoised image by employing fixed Sobel and Scharr operators as convolution kernels, respectively. Combine edge features with denoised images splicing and merging at the channel dimension
[0025] Learning branch: Used to adaptively learn complex edges using 2 layers of 3×3 convolutions and the ReLU activation function.
[0026] Blend branch: Used to combine the outputs of the first two branches.
[0027] The edge enhancement features are obtained by channel calibration through the SE attention module. .
[0028] Furthermore, the cross-scale attention fusion module described in step two is located between the encoder and the decoder. Its functional implementation process is as follows: the resolution and number of channels of the features at each scale output by the encoder are unified by using downsampling and upsampling operations; the self-attention vector representation of the feature at each scale is obtained through the self-attention mechanism; attention is calculated using the self-attention output of the current scale feature as query Q, the self-attention output of other scale features as key K and value V; cross-scale attention interaction features are generated through multi-head attention; and the cross-scale attention interaction features are fused with the original features to obtain the fused features.
[0029] Furthermore, the multi-scale detail enhancement decoder described in step three has three convolutional branches, namely:
[0030] A 1×1 convolutional branch is used to capture global semantic information.
[0031] A 3×3 depthwise convolution branch is used to extract medium-scale features.
[0032] A 5×5 depthwise convolution branch is used to enhance the details of tiny pores.
[0033] The output features of the three branches are concatenated and fused.
[0034]
[0035] Furthermore, the loss function described in step four for:
[0036]
[0037]
[0038]
[0039] in, express The weighting coefficients of the loss, express The weighting coefficients of the loss, TP, FP, and FN, represent the number of correctly predicted pore samples, the number of incorrectly predicted pore samples, and the number of incorrectly predicted background samples, respectively. Represents the target probability. This represents the category balance factor.
[0040] This invention provides a casting thin-slice image segmentation system based on dynamic noise filtering and detail enhancement. The system has a program module corresponding to the steps of any of the above-described technical solutions, and executes the steps in the casting thin-slice image segmentation method based on dynamic noise filtering and detail enhancement during runtime.
[0041] The present invention provides a computer-readable storage medium storing a computer program configured to, when invoked by a processor, implement the steps in the casting thin-slice image segmentation method based on dynamic noise filtering and detail enhancement as described in any of the above technical solutions.
[0042] Compared with the prior art, the beneficial effects of the present invention are:
[0043] This invention employs a noise-aware dynamic filtering module (NADF) to adaptively suppress image noise while preserving aperture edges. It also utilizes an edge prior fusion and edge enhancement feature extraction module (EFE) to strengthen edge information during the initial feature extraction phase and within the encoder. Furthermore, it employs a cross-scale attention fusion module (CSAF) to achieve semantic interaction between multi-scale features, improving the ability to recognize apertures at different scales. Finally, it restores detail information through a multi-scale detail enhancement decoder and further optimizes the segmentation boundary using a boundary enhancement module. This invention significantly improves the recall rate of small apertures and the accuracy of edge localization in the task of segmenting aperture images of cast thin sheets, demonstrating strong practicality and potential for wider application. Attached Figure Description
[0044] Figure 1This is a schematic diagram of the Segformer model architecture in an embodiment of the present invention;
[0045] Figure 2 This is a schematic diagram of the Noise Sensing Dynamic Filtering Module (NADF) in an embodiment of the present invention;
[0046] Figure 3 This is a schematic diagram of the edge enhancement feature extraction module (EFE) in an embodiment of the present invention;
[0047] Figure 4 This is a schematic diagram of the cross-scale attention fusion module (CSAF) structure in an embodiment of the present invention;
[0048] Figure 5 This is a schematic diagram of the multi-scale detail enhancement decoder structure in an embodiment of the present invention;
[0049] Figure 6 This is a schematic diagram illustrating the performance metrics of the baseline model in an embodiment of the present invention;
[0050] Figure 7 This is a schematic diagram of the model performance indicators in an embodiment of the present invention;
[0051] Figure 8 This is a graph showing ablation experiment data from an embodiment of the present invention;
[0052] Figure 9 This is a comparison chart of performance parameters under white noise in the embodiments of the present invention;
[0053] Figure 10 This is a comparison chart of performance parameters under salt-and-pepper noise in the embodiments of the present invention;
[0054] Figure 11 This is a comparison chart of performance parameters under Gaussian noise in the embodiments of the present invention;
[0055] Figure 12 This is a comparison chart of performance parameters under Poisson noise in the embodiments of the present invention;
[0056] Figure 13 This is a comparison chart of loss curves in an embodiment of the present invention;
[0057] Figure 14 This is a segmentation result diagram from an embodiment of the present invention;
[0058] Figure 15 This is a comparison chart of noise test segmentation results in an embodiment of the present invention. Detailed Implementation
[0059] To enable those skilled in the art to better understand the present invention, exemplary embodiments or examples of the present invention will be described below in conjunction with the accompanying drawings. Obviously, the described embodiments or examples are merely some, not all, of the embodiments or examples of the present invention. All other embodiments or examples obtained by those skilled in the art based on the embodiments or examples of the present invention without inventive effort should fall within the scope of protection of the present invention.
[0060] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0061] Specific Implementation Plan 1: Combining Figure 1 As shown, this invention provides a method for segmenting cast thin-section images based on dynamic noise filtering and detail enhancement, comprising the following steps:
[0062] Step 1: Acquire image data of the casting thin sheet and preprocess the image data of the casting thin sheet;
[0063] Step 2: Input the preprocessed cast thin-slice image into an encoder based on the Segformer model for multi-scale feature extraction. The encoder is embedded with a noise-aware dynamic filtering module, an edge enhancement feature extraction module, and a cross-scale attention fusion module. The noise-aware dynamic filtering module is used to estimate the noise probability distribution of the input image and suppress image noise based on the generated dynamic filtering weights. The edge enhancement feature extraction module is used to extract multiple types of edge features and enhance edge features by introducing an attention mechanism. The cross-scale attention fusion module is used to perform feature enhancement interaction fusion based on the cross-scale attention mechanism to obtain fused features.
[0064] Step 3: Input the fused features into the multi-scale detail enhancement decoder to perform detail restoration and upsampling, and obtain a preliminary segmentation map;
[0065] Step 4: Enhance the boundaries of the initial segmentation map through the output optimization layer, and supervise the model training using the loss function to finally output the segmentation result of the cast thin slice image.
[0066] This implementation scheme addresses the core challenge of segmenting pores in cast thin films by constructing an end-to-end processing flow of "noise filtering → edge enhancement → feature fusion → detail optimization → boundary calibration". Compared with traditional methods, this architecture abandons multi-scale central difference convolution and instead adopts a lightweight and efficient modular combination, which ensures segmentation accuracy while reducing computational complexity.
[0067] Specific implementation scheme two: The noise perception dynamic filtering module is located at the network input end, such as... Figure 2As shown, its functional implementation process is as follows:
[0068] A lightweight convolutional network with two 3×3 convolutional layers and one global average pooling layer is used to estimate the noise probability distribution of the input image and output a noise confidence map of the same size.
[0069] Dynamic filtering weights are generated using noise confidence maps. :
[0070]
[0071] in Noise confidence plot
[0072] A 7×7 depthwise separable convolution is used to generate smooth features from the original features, and residual connections are used to fuse the original features and the smooth features to obtain a denoised image. :
[0073]
[0074] in
[0075] This implementation plan is otherwise the same as Specific Implementation Plan 1.
[0076] Specific Implementation Plan Three: (e.g.) Figure 3 As shown, the edge enhancement feature extraction module in step two is located at the input of each Transformer block, including a feature extraction unit and an edge prior fusion unit. The edge prior fusion unit uses the Sobel operator to extract the horizontal and vertical edge features of the denoised image, and performs dimensionality reduction fusion after concatenating them with the denoised image channels. The feature extraction unit includes three parallel branches:
[0077] Operator branches: used to extract the horizontal and vertical components of the denoised image by employing fixed Sobel and Scharr operators as convolution kernels, respectively.
[0078] The Sobel operator is used to extract horizontal and vertical edge features from the denoised image. :
[0079]
[0080] in, Represented as the horizontal kernel of the Sobel operator. It is represented as the vertical kernel of the Sobel operator.
[0081] The Scharr operator is used to extract horizontal and vertical edge features from the denoised image. :
[0082]
[0083] in, Represented as the horizontal kernel of the Scharr operator. This is represented as the vertical kernel of the Scharr operator. This is a convolution operation.
[0084] edge features , Compared with the denoised image The preprocessed feature maps are concatenated and fused along the channel dimension. :
[0085]
[0086]
[0087]
[0088] in .
[0089] Learning branch: Used to adaptively learn complex edges using 2 layers of 3×3 convolutions and the ReLU activation function.
[0090] Hybrid branch: Used to merge the outputs of the first two branches, enhancing edge response. ;
[0091] Will The edge enhancement features are obtained by channel calibration through the SE attention module. :
[0092]
[0093] In this implementation scheme, the SE attention module enhances the response of key edge channels through a "squeeze-excitation" mechanism, thereby improving the structural representation capability of blurred edges. Other aspects of this implementation scheme are the same as in Implementation Scheme Two.
[0094] Specific Implementation Plan Four: (e.g.) Figure 4 As shown, the cross-scale attention fusion module mentioned in step two is located between the encoder and the decoder, and is used to solve the problem of insufficient interaction of feature information at different scales. Its functional implementation process is as follows:
[0095] The encoder outputs four scale features C1, C2, C3, and C4, with resolutions of 1 / 4, 1 / 8, 1 / 16, and 1 / 32, respectively. These features are downsampled using 3×3 convolutions and upsampled using bilinear interpolation and 1×1 convolutions to unify the resolution to 1 / 8 and the number of channels to 256, ensuring consistency in attention calculation. The unified features are then input into a multi-head cross-scale attention sub-network. A self-attention mechanism is used to obtain the self-attention vector representation within each scale feature. Attention is calculated using the self-attention output of the current scale feature as the query Q and the self-attention outputs of other scale features as the key K and value V. This multi-head attention mechanism enables bidirectional interaction between semantic guidance details and detail-supplemented semantics.
[0096] The formula for calculating attention is:
[0097]
[0098] in, is the dimension of the key vector.
[0099] Each attention head focuses on different semantic associations (e.g., head 1 focuses on texture-semantics, head 2 focuses on edge-global structure), achieving a two-way interaction between "semantics guiding details" and "details supplementing semantics".
[0100] By performing residual connections between cross-scale attention interaction features and the original features, fused features are obtained. Combined with LayerNorm and Dropout (probability 0.1) for stable training, compared with multi-scale central difference convolution, CSAF focuses more on the semantic association between features of different scales rather than simple gradient information extraction. Therefore, it can better adapt to the complex structure of pores in cast thin sheets.
[0101] This implementation plan is otherwise the same as Implementation Plan 3.
[0102] The multi-head attention mechanism in this implementation scheme enables the decoder to dynamically allocate weights under features at different scales, breaking through the limitation of a single scale. It can achieve targeted enhancement of detail capture of small targets, improve the processing capability of targets of different sizes, and make the decoder results clearer. Then, the decoder output features are added to the encoder high-resolution features to obtain a preliminary segmentation map. The preliminary segmentation map is then enhanced by an output optimization layer to improve the clarity of the aperture edges.
[0103] Specific Implementation Plan Five: (e.g.) Figure 5 As shown, the multi-scale detail enhancement decoder described in step three has three convolutional branches, namely:
[0104] A 1×1 convolutional branch is used to capture global semantic information and adapt to large apertures.
[0105] A 3×3 depthwise convolution branch is used to extract medium-scale features, adapting to medium-pore sizes.
[0106] A 5×5 depthwise convolution branch is used to enhance details of tiny pores and adapt to small pores.
[0107] The output features of the three branches are concatenated and fused.
[0108]
[0109]
[0110]
[0111] This implementation plan is otherwise the same as Specific Implementation Plan Four.
[0112] Specific implementation plan six: The boundary enhancement of the preliminary segmentation map through the output optimization layer mentioned in step four is as follows:
[0113] The pixels in the initial segmentation image are subjected to center difference to improve the gradient value and enhance its ability to express detailed features, thereby obtaining further optimized segmentation results, eliminating edge burrs, and ensuring the smoothness and continuity of pore boundaries.
[0114] Gradient in the X direction:
[0115]
[0116] Gradient in the Y direction:
[0117]
[0118] Gradient magnitude:
[0119]
[0120] in Indicates the pixel in The grayscale value of the location.
[0121] Image segmentation after central difference is performed using boundary detection:
[0122] Input the image after center difference And by performing a gradient operation with the gradient operator in the x-direction, the gradient response map in the horizontal direction is obtained. :
[0123]
[0124] Input the image after center difference And by performing a gradient operation with the y-direction gradient operator, the gradient response map in the vertical direction is obtained. :
[0125]
[0126] Then, the gradient responses in the two directions are fused, and a minimum value is introduced. To avoid errors caused by the square root being 0, a gradient magnitude map is obtained. :
[0127]
[0128] Finally, the gradient magnitude map Gaussian blurring is performed to obtain a smoothed gradient magnitude map. :
[0129]
[0130] in Oriented gradient operator, Oriented gradient operator, For convolution operations, It is a constant. For the first Standard deviation of noise at scale.
[0131] Using the above gradient magnitude diagram The corresponding attention weights are calculated to further amplify the effective gradient values and obtain feature maps that highlight details.
[0132]
[0133]
[0134]
[0135] After normalization using the softmax activation function, the attention weight map A is obtained:
[0136]
[0137] , , The attention weight matrix is the convolution kernel. For feature dimensions;
[0138] The attention weight map A is optimized using the energy function of a conditional random field to obtain the optimized map. :
[0139]
[0140] in As a single potential energy, For dual potential energy, The segmentation result of a single pixel is shown. Represents adjacent pixel pairs ( Spatial weighting coefficients, This represents the category attribute of the j-th pixel;
[0141] Adaptive fusion is used for boundary fusion, and the final output segmentation result is as follows:
[0142]
[0143] in, This represents the final segmentation result. This represents the initial segmentation diagram. Indicated Adaptive weighting coefficients This represents the enhanced segmentation image. The adaptive weighting coefficients are represented. This represents the smoothed segmentation image. Indicated Adaptive weighting coefficients.
[0144] This implementation plan is otherwise the same as Implementation Plan Five.
[0145] Specific Implementation Plan Seven: The Loss Function Described in Step Four for:
[0146]
[0147]
[0148]
[0149] in, express The weighting coefficients of the loss, express The weighting coefficients of the loss, TP, FP, and FN, represent the number of correctly predicted pore samples, the number of incorrectly predicted pore samples, and the number of incorrectly predicted background samples, respectively. Represents the target probability. This represents the category balance factor.
[0150] This implementation plan is otherwise the same as Specific Implementation Plan Six.
[0151] The image segmentation method (algorithm) for cast thin sections based on dynamic noise filtering and detail enhancement proposed in this invention is the underlying technical core of this invention, and various products can be derived based on the algorithm.
[0152] Based on the method proposed in this invention, a casting thin-section image segmentation system based on dynamic noise filtering and detail enhancement is developed using a programming language. This system has program modules corresponding to the steps of the above-mentioned technical solution, and executes the steps in the above-mentioned casting thin-section image segmentation method based on dynamic noise filtering and detail enhancement when running.
[0153] The developed system (software) computer program is stored on a computer-readable storage medium, and the computer program is configured to implement the steps of the above-described method for segmenting cast thin sections based on dynamic noise filtering and detail enhancement when called by a processor. In other words, the invention is materialized on a carrier, becoming a computer program product.
[0154] Various implementations of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, application-specific integrated circuits (ASICs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0155] The computational programs (also referred to as programs, software, software applications, or code) of this invention include machine instructions of a programmable processor and 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 apparatus (e.g., disk, optical disk, memory, programmable logic device PLD) for providing machine instructions and / or data to a programmable processor, including machine-readable media that receive 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.
[0156] The beneficial effects of the present invention will be described below with reference to specific embodiments.
[0157] Example 1
[0158] Experimental setup: The experiment uses a self-made cast rock thin section dataset, which is sourced from core samples of an oilfield drilling site. It covers three typical reservoir rock types: sandstone, shale, and limestone, and contains a total of 1200 images with a uniform resolution of 1024×1024, which conforms to the mainstream input scale for computer vision semantic segmentation tasks.
[0159] Data augmentation strategies are designed to optimize the generalization of computer vision models:
[0160] Geometric transformations: random rotation (0-180°), horizontal / vertical flip, random cropping (256×256 patches).
[0161] Pixel-level transformations: illumination perturbation (brightness ±10%, contrast ±15%, simulating imaging illumination changes), noise injection (salt-and-pepper noise density 0.01-0.05, Gaussian noise variance 0.01-0.05).
[0162] The augmentation operations are applied simultaneously to the image and the labeled mask, and are integrated into the training data stream in an online augmentation manner, which conforms to the efficient training paradigm of the PyTorch / TensorFlow framework.
[0163] The computer vision characteristics of the dataset are statistically analyzed as follows:
[0164] Category distribution: Foreground (pores) accounts for 3%-20%, and background (rock matrix) accounts for 80%-97%, which is a typical class imbalanced dataset (consistent with common data distribution characteristics in the field of semantic segmentation).
[0165] Scale characteristics: The pore size distribution is 0.01mm-2mm, corresponding to an image pixel scale of 1-200 pixels. Among them, micro pores (<0.1mm, 1-10 pixels) account for 42%, medium pores (0.1mm-1mm, 10-100 pixels) account for 45%, and large pores (>1mm, 100-200 pixels) account for 13%, covering a multi-scale target distribution from fine-grained to coarse-grained.
[0166] Noise characteristics: including salt-and-pepper noise caused by drilling fluid residue, Gaussian noise introduced by imaging equipment, etc. The noise type and intensity are consistent with the typical noise distribution of industrial scene images.
[0167] Data partitioning: The data is partitioned into three layers in a 7:1:2 ratio: 840 images for training, 120 images for validation, and 240 images for test.
[0168] Evaluation metrics: Classic splitting metrics are used to evaluate the model, including IoU, Precision, Recall, ACC, and F1-score, expressed in the following formula:
[0169]
[0170]
[0171]
[0172]
[0173]
[0174]
[0175] Where TP, FP, FN, and TN represent the number of correctly predicted pore samples, the number of incorrectly predicted pore samples, the number of incorrectly predicted background samples, and the number of correctly predicted background samples, respectively. C is the total number of categories in the semantic segmentation task (e.g., in the pore segmentation task). That is, "porosity" is category 1 and "non-porosity" is category 2.
[0176] Training settings: Training parameters: Batch size is 8 (to balance memory usage and training stability), initial learning rate... Using the Adam optimizer Weight decay (To suppress overfitting), the training iterations were performed for 300 epochs. Finally, this embodiment was trained and tested on an NVIDIA 4090 GPU and the PyTorch deep learning framework, with consistent training parameter settings.
[0177] The original baseline model and the model of this invention were used as control groups. The experimental results of the baseline model are as follows: Figure 6 and 13 As shown, the experimental results of the model of this invention are as follows: Figure 7 As shown in the figure. The results show that the model of this invention significantly outperforms the baseline model in all core evaluation indicators, with mIoU improving by 11.32 percentage points, Recall by 19.38 percentage points, and F1 score by 14.84 percentage points. The model also converges faster and performs better. It is evident that the model of this invention significantly outperforms the traditional baseline model in four dimensions: segmentation accuracy, missed detection control, false positive suppression, and global stability, providing a more reliable technical solution for high-precision segmentation of porosity in cast rock thin sections. A schematic diagram of the segmentation effect is shown in the figure. Figure 14 As shown.
[0178] To clarify the technical contributions of each core improvement module in the model of this invention, a progressive ablation experiment was designed: based on the baseline model, NADF, edge enhancement composite mechanism, CSAF, and multi-scale detail enhancement decoder were added sequentially. The impact of each module on performance was quantified using box plots. The ablation experiment results are as follows: Figure 8 As shown in the figure. Experimental results show that the model significantly outperforms the previous model in all core evaluation metrics. After full module integration, the model achieves optimal performance in core metrics such as mIoU, Recall, and F1-score, and its performance stability is significantly better than that of the single-module improvement, proving that the architecture design of the model in this invention is technically reasonable and effective.
[0179] To assess the segmentation performance of the model under different noise intensities, common industrial shooting equipment and transmission noise were simulated and added to the target image. This embodiment uses white noise, Gaussian noise, salt-and-pepper noise, and Poisson noise as examples.
[0180] Gradient-enhanced noise contamination samples were generated as follows: white noise with an initial intensity of 0.005 (industrial camera floor noise level) and incremented by 0.005 each time; Gaussian noise with an initial variance of 0.01 (random interference in signal transmission) and incremented by 0.01 each time; salt-and-pepper noise with an initial probability of 0.01 (pixel fault noise of imaging equipment) and incremented by 0.01 each time; and Poisson noise with an initial value of λ=1 (low-light imaging noise) and incremented by 1 each time. 100 contamination samples with gradient intensities were generated for each type of noise to form a noise test dataset. 100 noise images of each type were used to test the segmentation model.
[0181] Experimental results are as follows Figure 9-12 As shown in the noise test experiment, the parameters such as Acc, mIoU, and mPA do not fluctuate much (0~0.02) compared to the initial image segmentation effect, indicating that the model has good stability under different noise conditions and can adapt to different noise types. The dynamic filtering weights for Gaussian noise and white noise can smooth high-frequency interference and preserve the pore structure features. The noise region discrimination mechanism for salt-and-pepper noise avoids misjudgment of isolated noise points, while the edge enhancement composite mechanism strengthens the gradient of pore edges and reduces the masking effect of Poisson noise on weak edges. At the same time, the end-to-end "denoising-segmentation" collaborative design also avoids the detail loss problem of traditional cascaded schemes. Ultimately, the model can suppress noise interference while ensuring the stability of segmentation accuracy, which is sufficient to meet the needs of complex industrial environments such as downhole imaging and long-distance transmission. The segmentation effect diagram is shown in the figure. Figure 15 As shown.
[0182] While the present invention has been disclosed above, its scope of protection is not limited thereto. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention, and all such changes and modifications will fall within the scope of protection of the present invention.
Claims
1. A method for segmenting images of cast thin sections based on dynamic noise filtering and detail enhancement, characterized in that, Includes the following steps: Step 1: Acquire image data of the casting thin sheet and preprocess the image data of the casting thin sheet; Step 2: Input the preprocessed cast thin-slice image into an encoder based on the Segformer model for multi-scale feature extraction. The encoder is embedded with a noise-aware dynamic filtering module, an edge enhancement feature extraction module, and a cross-scale attention fusion module. The noise-aware dynamic filtering module is used to estimate the noise probability distribution of the input image and suppress image noise based on the generated dynamic filtering weights. The edge enhancement feature extraction module is used to extract multiple types of edge features and enhance edge features by introducing an attention mechanism. The cross-scale attention fusion module is used to perform feature enhancement interaction fusion based on the cross-scale attention mechanism to obtain fused features. Step 3: Input the fused features into the multi-scale detail enhancement decoder to perform detail restoration and upsampling, and obtain a preliminary segmentation map; Step 4: Enhance the boundaries of the preliminary segmentation map through the output optimization layer, and supervise the model training using the loss function to finally output the segmentation result of the cast thin slice image; The noise-sensing dynamic filtering module mentioned in step two is located at the network input end, and its function implementation process is as follows: The noise probability distribution of the input image is estimated, and a noise confidence map of the same size is output. Dynamic filtering weights are generated based on the noise confidence map. : in Noise confidence plot The original features are used to generate smooth features, based on the filtering weights. The original features and smoothed features are fused to obtain the denoised image. : in, .
2. The method according to claim 1, characterized in that, The noise-aware dynamic filtering module described in step two uses a lightweight convolutional network with two 3×3 convolutional layers and one global average pooling layer to estimate the noise probability distribution of the input image and outputs a noise confidence map of the same size.
3. The method according to claim 2, characterized in that, The edge enhancement feature extraction module described in step two is located at the input of each Transformer block and includes a feature extraction unit and an edge prior fusion unit. The edge prior fusion unit uses the Sobel operator to extract the horizontal and vertical edge features of the denoised image and performs dimensionality reduction fusion after concatenating them with the denoised image channels. The feature extraction unit includes three parallel branches: Operator branches: These are used to extract horizontal and vertical edge features from the denoised image by employing fixed Sobel and Scharr operators as convolution kernels, respectively. Combine edge features with denoised images splicing and merging at the channel dimension Learning branch: Used to adaptively learn complex edges using 2 layers of 3×3 convolutions and the ReLU activation function. Blend branch: Used to combine the outputs of the first two branches. The edge enhancement features are obtained by channel calibration through the SE attention module. .
4. The method according to claim 3, characterized in that, The cross-scale attention fusion module described in step two is located between the encoder and the decoder. Its function is implemented as follows: the resolution and number of channels of the features at each scale output by the encoder are unified by downsampling and upsampling operations; the self-attention vector representation of the features at each scale is obtained through the self-attention mechanism; attention is calculated using the self-attention output of the current scale feature as query Q and the self-attention output of other scale features as key K and value V; cross-scale attention interaction features are generated through multi-head attention; and the cross-scale attention interaction features are fused with the original features to obtain the fused features.
5. The method according to claim 4, characterized in that, The multi-scale detail enhancement decoder described in step three has three convolutional branches, namely: A 1×1 convolutional branch is used to capture global semantic information. A 3×3 depthwise convolution branch is used to extract medium-scale features. A 5×5 depthwise convolution branch is used to enhance the details of tiny pores. The output features of the three branches are concatenated and fused. splicing Perform bilinear interpolation upsampling to make its spatial dimensions match the high resolution of the encoder output. to obtain upsampling features , will feature Adding this to the high-resolution features of the encoder yields a preliminary result. .
6. The method according to claim 5, characterized in that, The loss function described in step four for: in, express The weighting coefficients of the loss, express The weighting coefficients of the loss, TP, FP, and FN, represent the number of correctly predicted pore samples, the number of incorrectly predicted pore samples, and the number of incorrectly predicted background samples, respectively. Represents the target probability. This represents the category balance factor.
7. A system for segmenting images of cast thin sections based on dynamic noise filtering and detail enhancement, 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 in the above-described method for segmenting cast thin films based on dynamic noise filtering and detail enhancement when running.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program configured to, when invoked by a processor, implement the steps of the casting thin-slice image segmentation method based on dynamic noise filtering and detail enhancement as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Medical image segmentation method and device based on spatial perception and frequency domain information
CN120298441A
Image forgery positioning method based on double-flow multi-scale feature fusion
CN120580404A