Deep learning method for identifying soil macropores based on improved U-Net model
By improving the U-Net model and combining attention gates and residual learning units, the problems of incomplete capture of slender pores and fragmented network intersection segmentation in soil macropore identification are solved, achieving high-precision soil macropore identification, adapting to the complex characteristics of Loess Plateau soil, and improving the prediction accuracy of hydrological models.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-08
- Publication Date
- 2026-04-07
AI Technical Summary
In existing technologies, traditional CT image segmentation methods and deep learning methods suffer from insufficient resolution in identifying macropores in soil. This leads to technical problems that are difficult to solve in existing technologies. These problems include incomplete capture of elongated pores, fragmented segmentation of network intersections, and vanishing gradients in deep networks. Consequently, the quantification accuracy of macropore structures is insufficient, affecting the prediction accuracy of hydrological models.
An improved U-Net model was adopted, and Attention-U-Net and Res-Attention-U-Net models were constructed by adding attention gates and residual learning units to the U-Net model. Combined with adaptive contrast enhancement and morphological operations, deep learning recognition of soil macropores was carried out.
It improves the segmentation accuracy and adaptability of soil macropores, solves the problems of segmentation fracture of slender pores and discontinuity of network intersection segmentation, realizes high-precision soil macropore identification, adapts to the complex characteristics of Loess Plateau soil, and improves the prediction accuracy of hydrological models.
Smart Images

Figure CN121811236A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of soil pore identification, in particular to a deep learning method for identifying soil macropores based on an improved U-Net model. BACKGROUND
[0002] Soil macropores are the main channels of preferential flow, and their characteristic parameters directly affect the water infiltration and solute transport processes, and are the core basis for hydrological model optimization. The soil in the Loess Plateau has the characteristics of loose, strong biological disturbance, high pore heterogeneity and fuzzy boundary, which brings great challenges to the accurate identification of macropores.
[0003] In the prior art, the identification methods of soil macropores mainly include traditional CT image segmentation methods and deep learning methods. The traditional CT image segmentation methods such as threshold method and morphological algorithm rely on artificial subjective judgment to set parameters, and the segmentation results obtained by different operators can differ by up to 3 times, which cannot adapt to the complex characteristics of soil macropores in the Loess Plateau. The existing deep learning models such as U-Net and Attention-U-Net are rarely specifically applied to soil macropore identification, and only a few studies involve soil pore processing in the Loess Plateau, and there are generally problems such as incomplete capture of slender pores, segmentation fracture at network intersections, and gradient disappearance in deep network.
[0004] In addition, there is currently a lack of special identification methods for the soil characteristics in the Loess Plateau, resulting in insufficient quantification accuracy of macropore structures such as macroporosity, connectivity and equivalent diameter, which seriously affects the prediction accuracy of hydrological models. SUMMARY
[0005] In view of the above technical problems, the present application provides a deep learning method for identifying soil macropores based on an improved U-Net model, which is used to solve the problems of incomplete capture of slender pores, segmentation fracture at network intersections, and gradient disappearance in deep network when the existing deep learning models identify soil macropores.
[0006] In order to achieve the above purpose, the technical scheme of the present application is as follows: A deep learning method for identifying soil macropores based on an improved U-Net model, comprising the following steps: A, soil sample collection: collect undisturbed soil in the Loess Plateau region as a sample for sealed preservation; B, CT image acquisition and reconstruction: place the sealed soil sample in a CT scanning system to obtain a two-dimensional projection sequence, and then reconstruct a 3D volume data through a three-dimensional voxel reconstruction tool, and correct metal artifacts and cup-shaped artifacts; C, image preprocessing: C1, 3D body data is divided into 2D transverse slices by voxel, the central square effective area is extracted, and 1600 middle slices are reserved after removing the boundary slices at both ends; C2, using adaptive contrast enhancement, median filtering and morphological operation to remove noise and preserve the overall structure of large pores; C3, adjusting the pixel threshold by piecewise linear transformation to improve the contrast between target and background; C4, using a quantitative image tool to manually label the large pore area to generate a binary mask, dividing the 1301x1301 pixel slice into 320x320 pixel sub-images, and selecting 500 high porosity sub-images to construct the training set; D, model construction: D1, using U-Net model as the basic architecture; D2, Attention-U-Net model construction: adding attention gate at the jump connection of U-Net model, dynamically adjusting the spatial weight of features in the encoder jump connection through soft attention, suppressing the interference of irrelevant background area, and highlighting the local features related to the segmentation target to enhance the focusing ability of the model on the target area; D3, Res-Attention-U-Net model construction: introducing residual learning unit based on Attention-U-Net model, combining residual connection with attention mechanism to further optimize the traditional Attention-U-Net, introducing residual learning unit in each convolution block of the encoder and decoder, each residual block consists of a main path composed of two 3x3 convolution layers and a shortcut path composed of a 1x1 convolution; E, training the model constructed in step D3: dividing the training set, validation set and test set in the ratio of 7:1.5:1.5, using Adam optimizer (learning rate 1x10⁻ 4 ) and cross-entropy loss function for model training, verifying every 10 rounds, and early stopping when the verification loss does not improve for 5 consecutive rounds; F, segmentation post-processing: using Res-Attention-U-Net model to segment the preprocessed two-dimensional slices, and sequentially performing morphological dilation-erosion, adaptive median filtering, and multi-scale opening-closing operation on the output results of the model to fill holes and connect broken edges; G, stacking: stacking the two-dimensional images processed in step F to obtain a large pore three-dimensional image.
[0007] Further, in step A, the undisturbed soil with a depth of 0.1±0.025m in the Loess Plateau region is collected by a ring knife.
[0008] Further, the CT scanning system in step B is a nanoVoxel 2600 high-low temperature environment stereoscopic scanning imaging system, and scanning parameters are as follows: voltage 130.00 kV, current 165.00 muA, exposure time 1.9 s, distance from the X-ray source to the sample 238.58 mm, distance from the X-ray source to the detector 1010.69 mm, and pixel size 23.6057 mu m; and the three-dimensional voxel reconstruction tool is VoxelStudioRecon software.
[0009] Further, the segmented linear transformation in step C3 is specifically setting the black color in the soil slice gray scale as 0 and the white color as 1, the lighter the color, the larger the gray scale value and the closer to 1, the darker the color, the smaller the gray scale value and the closer to 0, the gray scale value less than 0.15 is identified as a low threshold, the threshold in the threshold range is set as 0.05, the gray scale value greater than 0.25 is identified as a high threshold, and the high threshold is set as 0.9, the matrix and the pore are distinguished by manually adjusting the threshold, and the contrast is increased.
[0010] Further, the quantitative image tool in step C4 is ImageJ software, and the screening method of the high-porosity sub-image is that the large-porosity of the slice is calculated, then the large-porosity is sorted from high to low, and the first 500 high-large-porosity sub-images are selected to construct a training set.
[0011] Further, the U-Net model in step D includes: a symmetrical encoder-decoder, the encoder contains 4 layers, the initial filter number is 32, each layer is subjected to 2 times of 3*3 convolution (ReLU activation) and 2*2 maximum pooling (channel number doubling); the decoder is subjected to transposed convolution upsampling (channel number halving) and feature splicing with the encoder; the final output layer adopts 1*1 convolution to map the features to two categories of background and pore, and finally, a Resize operation is used to unify the resolution to 320*320 pixels through bilinear interpolation.
[0012] Further, in the morphological dilation-erosion in step F, the morphological operation kernel size is 3*3, and the multi-scale opening-closing operation is specifically setting the scale as 5*5 pixels, which is used for removing noise and separating small particles, the opening operation is performed for 2 iterations, and the closing operation is performed for 2 iterations, so that the features are not excessively contracted and the pores are not excessively filled.
[0013] Further, a ring knife with an inner diameter of 5 cm and a height of 5 cm is used for packaging and sealing preservation.
[0014] Further, the geographical coordinate range of the loess plateau region is 33.72°-41.27°N and 100.90°-114.55°E.
[0015] Compared with the prior art, the present application has the following beneficial effects: 1. High Segmentation Accuracy: Traditional image processing methods and basic deep learning models suffer from shortcomings when dealing with complex structures in soil CT images, such as poor segmentation of blurred pores and reliance on manual parameter adjustment. This invention, however, effectively overcomes these bottlenecks by improving a specific model that combines attention gating and residual connections. Figure 4 As can be seen, the Res-Attention-U-Net model has the highest fit with the real contour of large pores in its segmentation results. Its segmentation integrity and accuracy are significantly better than other models. Moreover, the evaluation indicators such as mIoU, Dice coefficient, and accuracy of the Res-Attention-U-Net model are all above 94.5%, which is a significant improvement over the traditional U-Net model. It effectively solves the problems of segmentation breakage of slender pores and discontinuous segmentation of network intersections. 2. High adaptability: Specifically designed for the identification of large pores in Loess Plateau soil, it is suitable for complex scenarios with loose soil, strong biological disturbance, and high pore heterogeneity. The quantitative indicators cover multiple dimensions of 2D and 3D to meet different application needs. 3. High degree of automation: The entire segmentation process requires no manual intervention, which greatly improves processing efficiency compared to manual annotation, while avoiding subjective human error and ensuring the consistency of recognition results; 4. Wide applicability: The quantified macropore characteristic parameters can be directly used for hydrological model parameterization, and a technological leap from two-dimensional to three-dimensional has been achieved, which greatly improves the depth and accuracy of soil porosity research and provides accurate data support for ecological restoration, water resource management and soil and water conservation in semi-arid regions. Attached Figure Description
[0016] Figure 1 This is a flowchart of the process operation of the present invention; Figure 2 The diagram shows the U-Net model and its variants of this invention, where a) is the model architecture diagram; b) is the U-Net model; c) is the Attention-U-Net model; d) is the CBAM (Convolutional Block Attention Module)-U-Net model; and e) is the Res-Attention-U-Net model. Figure 3 This is a diagram of soil macropore image processing and analysis according to the present invention, wherein a) is the original two-dimensional slice; b) is the effective square region; c) is the preprocessed image; and d) is the hand-drawn binary mask image. Figure 4 These are the segmentation effect diagrams of the four models of this invention; Figure 5 This is a three-dimensional visualization of the macropores in soil according to the present invention. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments. It should be understood that these descriptions are merely exemplary and not intended to limit the scope of the invention. Furthermore, descriptions of well-known structures and technologies are omitted in the following description to avoid unnecessarily obscuring the concepts of the invention.
[0018] Example 1 A deep learning method for identifying soil macroporosity based on an improved U-Net model includes the following steps: A. Soil sample collection: Uncirculated soil samples were collected from the Loess Plateau region at a depth of 0.075m using a ring cutter with an inner diameter of 5cm and a height of 5cm. The samples were then encapsulated and sealed for preservation. The geographical coordinates of the Loess Plateau region are: southeastern sampling point 4: 35.2°N, 110.8°E. B. CT Image Acquisition and Reconstruction: The sealed soil sample was scanned by the nanoVoxel2600 high and low temperature environment stereoscopic scanning imaging system to obtain a two-dimensional projection sequence. The scanning parameters were: voltage 130.00kV, current 165.00µA, exposure time 1.9s, distance from X-ray source to sample 238.58mm, distance from X-ray source to detector 1010.69mm, and pixel size 23.6057µm. Subsequently, the 3D volume data was reconstructed using the three-dimensional voxel reconstruction tool VoxelStudioRecon software, and metal artifacts and cup artifacts were corrected. C. Image preprocessing: C1. Divide the 3D volumetric data into 2D horizontal slices based on voxels, and extract the effective area of the central square, such as... Figure 3 As shown in Figure a, after removing the boundary slices at both ends, 1600 intermediate slices are retained, such as... Figure 3 As shown in b; C2. Noise is removed using adaptive contrast enhancement, median filtering, and morphological operations while preserving the overall structure of large pores, such as... Figure 3 As shown in c, by enhancing contrast and denoising, the distinction between macropores and soil matrix is greatly improved. C3. Adjust the pixel threshold through piecewise linear transformation to improve the contrast between the target and the background. Specifically, the piecewise linear transformation sets black to 0 and white to 1 in the grayscale of the soil slice. The lighter the color, the larger the grayscale value and the closer it is to 1. The darker the color, the smaller the grayscale value and the closer it is to 0. The threshold is continuously adjusted according to the soil slice. When the grayscale value is less than 0.15, it is considered a low threshold. The threshold within this range is set to 0.05. When the grayscale value is greater than 0.25, it is considered a high threshold. It is set to 0.9. By manually adjusting the threshold, the matrix and pores are distinguished, thereby increasing the contrast. C4. Manually annotate large pore regions using the quantization-based image tool ImageJ to generate binary masks, such as... Figure 3 As shown in d, the outline of the large pores is delineated to ensure the high quality of the labeled true values. The 1301×1301 pixel slice is divided into 320×320 pixel sub-images. The large porosity of the slice is calculated. Then, the large porosity is sorted from high to low, and the top 500 high porosity sub-images are selected to construct the training set. D. Model Building: D1. The U-Net model is used as the basic architecture. The U-Net model consists of a symmetric encoder-decoder. The encoder has 4 layers with an initial number of 32 filters. Each layer undergoes two 3×3 convolutions (ReLU activation) and 2×2 max pooling (doubling the number of channels). The decoder is upsampled by transposed convolution (halving the number of channels) and concatenated with the encoder features. The final output layer uses a 1×1 convolution to map the features to two categories: background and aperture. Finally, a resize operation is used to unify the resolution to 320×320 pixels through bilinear interpolation. D2. Attention-U-Net Model Construction: Attention gates are added to the skip connections of the U-Net model. Soft attention is used to dynamically adjust the spatial weights of features in the skip connections of the encoder, suppressing interference from irrelevant background regions and highlighting local features related to the segmentation target to enhance the model's ability to focus on the target region. D3, Res-Attention-U-Net Model Construction: Based on the Attention-U-Net model, a residual learning unit is introduced, which integrates residual connections with the attention mechanism to further optimize the traditional Attention-U-Net. A residual learning unit is introduced in each convolutional block of the encoder and decoder. Each residual block consists of a main path composed of two 3×3 convolutional layers and a shortcut path composed of a 1×1 convolution. E. Train the model constructed in step D3: Divide the training set, validation set, and test set into a 7:1.5:1.5 ratio, and use the Adam optimizer (learning rate 1×10⁻⁻⁶). 4 The model is trained using the cross-entropy loss function and validated every 10 rounds. If the loss does not improve after 5 consecutive rounds of validation, the training is stopped early. F. Post-segmentation processing: The Res-Attention-U-Net model is used to segment the preprocessed 2D slices. Figure 4The image shows a comparison of the segmentation performance of this model with three other models: U-Net, CBAM-U-Net, and Attention-U-Net. The original slices are preprocessed images after C2 operation. The comparison results clearly show that the segmentation results of the Res-Attention-U-Net model have the highest fit with the real contours of large pores, and the segmentation integrity and accuracy are significantly better than other models. The output results of the model are subjected to morphological dilation-erosion in sequence, with a morphological operation kernel size of 3×3, adaptive median filtering, and multi-scale opening-closing operation. The multi-scale opening-closing operation is specifically set to a scale of 5×5 pixels to remove noise and separate small particles. The opening operation is performed twice and the closing operation is performed twice to ensure that the features are not over-shrinked or over-filled with pores, and to fill holes and connect broken edges. G. Stacking: The two-dimensional images processed in step F are stacked to obtain a three-dimensional image with large pores, such as... Figure 5 This study showcases the 3D structure of macropores from seven samples. The 3D images are reconstructed by stacking nearly 1600 two-dimensional slices segmented by the Res-Attention-U-Net model for each sample. This overcomes the limitations of incomplete information in two-dimensional slices, fully demonstrating the true morphology, curvature, branching, and interconnections of macropores in 3D space, achieving a significant leap from "two-dimensional plane" to "three-dimensional solid." The 3D macropore density (…) is obtained through quantitative calculations. θ Macro-3d =5%), effective 3D large porosity ( θ Macro_eff-3d =4.87%), three-dimensional equivalent maximum diameter ( D eq,Macro-3d =1.07cm), connectivity ( ζ Macro-3d =39.27%), interconnected macropore density ( C Macro-3d =18.45 Nc / cm³), the quantitative parameters calculated based on this 3D model are key data that cannot be accurately obtained through 2D analysis. This advances soil porosity research from indirect, speculative 2D image analysis to a direct, precise 3D visualization and quantitative analysis stage. Verification showed that the segmentation results in this embodiment matched manually labeled data with a 95.3% accuracy rate, adapting to complex scenarios such as loose soil and biological disturbance. The quantitative results can be directly used for hydrological model parameterization, providing data support for ecological restoration and water resource management in semi-arid regions.
[0019] Example 2 A deep learning method for identifying soil macroporosity based on an improved U-Net model includes the following steps: A. Soil sample collection: Uncirculated soil samples were collected from the Loess Plateau region at a depth of 0.1m using a ring cutter with an inner diameter of 5cm and a height of 5cm. The samples were then encapsulated and sealed for preservation. The geographical coordinates of the Loess Plateau region are: southeastern sampling point 7: 36.5°N, 111.2°E. B. CT Image Acquisition and Reconstruction: The sealed soil sample was scanned by the nanoVoxel2600 high and low temperature environment stereoscopic scanning imaging system to obtain a two-dimensional projection sequence. The scanning parameters were: voltage 130.00kV, current 165.00µA, exposure time 1.9s, distance from X-ray source to sample 238.58mm, distance from X-ray source to detector 1010.69mm, and pixel size 23.6057µm. Subsequently, the 3D volume data was reconstructed using the three-dimensional voxel reconstruction tool VoxelStudioRecon software, and metal artifacts and cup artifacts were corrected. C. Image preprocessing: C1. Divide the 3D volumetric data into 2D horizontal slices based on voxels, and extract the effective area of the central square, such as... Figure 3 As shown in Figure a, after removing the boundary slices at both ends, 1600 intermediate slices are retained, such as... Figure 3 As shown in b; C2. Noise is removed using adaptive contrast enhancement, median filtering, and morphological operations while preserving the overall structure of large pores, such as... Figure 3 As shown in c, by enhancing contrast and denoising, the distinction between macropores and soil matrix is greatly improved. C3. Adjust the pixel threshold through piecewise linear transformation to improve the contrast between the target and the background. Specifically, the piecewise linear transformation sets black to 0 and white to 1 in the grayscale of the soil slice. The lighter the color, the larger the grayscale value and the closer it is to 1. The darker the color, the smaller the grayscale value and the closer it is to 0. The threshold is continuously adjusted according to the soil slice. When the grayscale value is less than 0.15, it is considered a low threshold. The threshold within this range is set to 0.05. When the grayscale value is greater than 0.25, it is considered a high threshold. It is set to 0.9. By manually adjusting the threshold, the matrix and pores are distinguished, thereby increasing the contrast. C4. Manually annotate large pore regions using the quantization-based image tool ImageJ to generate binary masks, such as... Figure 3 As shown in d, the outline of the large pores is delineated to ensure the high quality of the labeled true values. The 1301×1301 pixel slice is divided into 320×320 pixel sub-images. The large porosity of the slice is calculated. Then, the large porosity is sorted from high to low, and the top 500 high porosity sub-images are selected to construct the training set. D. Model Building: D1. Using the U-Net model as the basic architecture: The U-Net model consists of a symmetric encoder-decoder. The encoder has 4 layers with an initial number of 32 filters. Each layer undergoes two 3×3 convolutions (ReLU activation) and 2×2 max pooling (doubling the number of channels). The decoder is upsampled by transposed convolution (halving the number of channels) and concatenated with the encoder features. The final output layer uses a 1×1 convolution to map the features to two categories: background and aperture. Finally, a resize operation is used to unify the resolution to 320×320 pixels through bilinear interpolation. D2. Attention-U-Net Model Construction: Attention gates are added to the skip connections of the U-Net model. Through soft attention, the spatial weights of features in the skip connections of the encoder are dynamically adjusted to suppress the interference of irrelevant background regions and highlight the local features related to the segmentation target to enhance the model's ability to focus on the target region. D3, Res-Attention-U-Net Model Construction: Based on the Attention-U-Net model, a residual learning unit is introduced, which integrates residual connections with the attention mechanism to further optimize the traditional Attention-U-Net. A residual learning unit is introduced in each convolutional block of the encoder and decoder. Each residual block consists of a main path composed of two 3×3 convolutional layers and a shortcut path composed of a 1×1 convolution. E. Train the model constructed in step D3: Divide the training set, validation set, and test set into a 7:1.5:1.5 ratio, and use the Adam optimizer (learning rate 1×10⁻⁻⁶). 4 The model is trained using the cross-entropy loss function and validated every 10 rounds. If the loss does not improve after 5 consecutive rounds of validation, the training is stopped early. F. Post-segmentation processing: The Res-Attention-U-Net model is used to segment the preprocessed 2D slices, such as... Figure 4 The comparison of segmentation results shows that this model performs best in handling complex soil pore structures. It can accurately capture large and slender pores with blurred boundaries. The output of the model is subjected to morphological dilation-erosion in sequence. The morphological operation kernel size is 3×3, adaptive median filtering, and multi-scale opening-closing operation. The multi-scale opening-closing operation is specifically set to a scale of 5×5 pixels to remove noise and separate fine particles. The opening operation is iterated twice and the closing operation is iterated twice to ensure that the features are not over-shrinked or over-filled with pores, and to fill the pores and connect the broken edges. G. Stacking: The two-dimensional images processed in step F are stacked to obtain a three-dimensional image with large pores, such as... Figure 5 As shown, the three-dimensional reconstruction model completely restores the spatial distribution and connectivity of macropores in the soil, and the 3D macroporosity is obtained by calculating and quantifying the index. θ Macro-3d=8.53%), effective 3D large porosity ( θ Macro_eff-3d =8.42%), three-dimensional equivalent maximum diameter ( D eq,Macro-3d =1.65cm), connectivity ( ζ Macro-3d =85.92%), interconnected macropore density ( C Macro-3d =14.30 Nc / cm³), and parameters such as connectivity and three-dimensional equivalent maximum diameter calculated based on this model accurately reflect the hydrological functional characteristics of macropores. Verification showed that the segmentation results in this embodiment matched the manual annotations by 96.1%, and the quantification results can be directly used for hydrological model parameterization, providing accurate data support for ecological restoration and water resource management in semi-arid regions.
[0020] Example 3 A deep learning method for identifying soil macroporosity based on an improved U-Net model includes the following steps: A. Soil sample collection: Uncirculated soil samples were collected from the Loess Plateau region at a depth of 0.125m using a ring cutter with an inner diameter of 5cm and a height of 5cm. The samples were then encapsulated and sealed for preservation. The geographical coordinates of the Loess Plateau region are: southeastern sampling point 11: 37.1°N, 112.5°E. B. CT Image Acquisition and Reconstruction: The sealed soil sample was scanned by the nanoVoxel2600 high and low temperature environment stereoscopic scanning imaging system to obtain a two-dimensional projection sequence. The scanning parameters were: voltage 130.00kV, current 165.00µA, exposure time 1.9s, distance from X-ray source to sample 238.58mm, distance from X-ray source to detector 1010.69mm, and pixel size 23.6057µm. Subsequently, the 3D volume data was reconstructed using the three-dimensional voxel reconstruction tool VoxelStudioRecon software, and metal artifacts and cup artifacts were corrected. C. Image preprocessing: C1. Divide the 3D volumetric data into 2D horizontal slices based on voxels, and extract the effective area of the central square, such as... Figure 3 As shown in Figure a, after removing the boundary slices at both ends, 1600 intermediate slices are retained, such as... Figure 3 As shown in b; C2. Noise is removed using adaptive contrast enhancement, median filtering, and morphological operations while preserving the overall structure of large pores, such as... Figure 3 As shown in c, by enhancing contrast and denoising, the distinction between macropores and soil matrix is greatly improved. C3. Adjust the pixel threshold through piecewise linear transformation to improve the contrast between the target and the background. Specifically, the piecewise linear transformation sets black to 0 and white to 1 in the grayscale of the soil slice. The lighter the color, the larger the grayscale value and the closer it is to 1. The darker the color, the smaller the grayscale value and the closer it is to 0. The threshold is continuously adjusted according to the soil slice. When the grayscale value is less than 0.15, it is considered a low threshold. The threshold within this range is set to 0.05. When the grayscale value is greater than 0.25, it is considered a high threshold. It is set to 0.9. By manually adjusting the threshold, the matrix and pores are distinguished, thereby increasing the contrast. C4. Manually annotate large pore regions using the quantization-based image tool ImageJ to generate binary masks, such as... Figure 3 As shown in d, the outline of the large pores is delineated to ensure the high quality of the labeled true values. The 1301×1301 pixel slice is divided into 320×320 pixel sub-images. The large porosity of the slice is calculated. Then, the large porosity is sorted from high to low, and the top 500 high porosity sub-images are selected to construct the training set. D. Model Building: D1. Using the U-Net model as the basic architecture: symmetric encoder-decoder. The encoder has 4 layers with an initial number of 32 filters. Each layer undergoes two 3×3 convolutions (ReLU activation) and 2×2 max pooling (doubling the number of channels). The decoder is upsampled by transposed convolution (halving the number of channels) and concatenated with the encoder features. The final output layer uses a 1×1 convolution to map the features to two categories: background and aperture. Finally, a resize operation is used to unify the resolution to 320×320 pixels through bilinear interpolation. D2. Attention-U-Net Model Construction: Attention gates are added to the skip connections of the U-Net model. Through soft attention, the spatial weights of features in the skip connections of the encoder are dynamically adjusted to suppress the interference of irrelevant background regions and highlight the local features related to the segmentation target to enhance the model's ability to focus on the target region. D3, Res-Attention-U-Net Model Construction: Based on the Attention-U-Net model, a residual learning unit is introduced, which integrates residual connections with the attention mechanism to further optimize the traditional Attention-U-Net. A residual learning unit is introduced in each convolutional block of the encoder and decoder. Each residual block consists of a main path composed of two 3×3 convolutional layers and a shortcut path composed of a 1×1 convolution. E. Train the model constructed in step D3: Divide the training set, validation set, and test set into a 7:1.5:1.5 ratio, and use the Adam optimizer (learning rate 1×10⁻⁻⁶). 4 The model is trained using the cross-entropy loss function and validated every 10 rounds. If the loss does not improve after 5 consecutive rounds of validation, the training is stopped early. F. Post-segmentation processing: The Res-Attention-U-Net model is used to segment the preprocessed 2D slices, such as... Figure 4 The comparison results show that the large pore edges segmented by this model are smoother and more complete, effectively avoiding the segmentation breakage and missed detection problems existing in other models. The output results of the model are subjected to morphological dilation-erosion in sequence, with a morphological operation kernel size of 3×3, adaptive median filtering, and multi-scale opening-closing operation. The multi-scale opening-closing operation is specifically set to a scale of 5×5 pixels to remove noise and separate fine particles. The opening operation is performed twice and the closing operation is performed twice to ensure that the features are not over-shrinked or over-filled with pores, and to fill holes and connect broken edges. G. Stacking: The two-dimensional images processed in step F are stacked to obtain a three-dimensional image with large pores, such as... Figure 5 As shown, the 3D reconstruction model clearly demonstrates the complex spatial structure of the macropores in this sample, including the degree of tortuosity, branching, and connectivity of the pores. Macropore feature quantification and 3D reconstruction: 3D macroporosity is obtained by calculating quantification indicators. θ Macro-3d =13.90%), effective 3D macroporosity ( θ Macro_eff-3d =13.86%), three-dimensional equivalent maximum diameter ( D eq,Macro-3d =1.90cm), connectivity ( ζ Macro-3d =79.97%), interconnected macropore density ( C Macro-3d =10.90Nc / cm³), the quantitative parameters obtained based on this model have high accuracy, providing a reliable basis for in-depth research on soil moisture infiltration and solute migration processes. Verification showed that the segmentation results in this embodiment matched manually labeled data with a 95.8% accuracy rate, adapting to complex scenarios such as loose soil and biological disturbance. The quantitative results can be directly used for hydrological model parameterization, providing data support for ecological restoration and water resource management in semi-arid regions.
[0021] It should be understood that the specific embodiments described above are merely illustrative or explanatory of the principles of the invention and do not constitute a limitation thereof. Therefore, any modifications, equivalent substitutions, improvements, etc., made without departing from the spirit and scope of the invention should be included within the protection scope of the invention. Furthermore, the appended claims are intended to cover all variations and modifications falling within the scope and boundaries of the appended claims, or equivalent forms of such scope and boundaries.
Claims
1. A deep learning method for identifying soil macroporosity based on an improved U-Net model, characterized in that, Includes the following steps: A. Soil sample collection: Untouched soil samples were collected from the Loess Plateau region and sealed for preservation. B. CT Image Acquisition and Reconstruction: After the sealed and preserved soil sample is scanned by the CT scanning system, a two-dimensional projection sequence is obtained. Then, the 3D volume data is reconstructed by the three-dimensional voxel reconstruction tool, and metal artifacts and cup artifacts are corrected. C. Image preprocessing: C1. Divide the 3D volume data into 2D horizontal slices by voxels, extract the effective area of the central square, remove the slices at both ends, and retain 1600 middle slices. C2. Adaptive contrast enhancement, median filtering and morphological operations are used to remove noise while preserving the overall structure of large pores; C3. Adjust the pixel threshold through piecewise linear transformation to improve the contrast between the target and the background; C4. Use a quantization image tool to manually annotate the large porosity region to generate a binary mask. Divide the 1301×1301 pixel slice into 320×320 pixel sub-images and select 500 high porosity sub-images to construct a training set. Model building: D1. Use the U-Net model as the basic architecture; D2. Attention-U-Net Model Construction: Attention gates are added to the skip connections of the U-Net model. Soft attention is used to dynamically adjust the spatial weights of features in the skip connections of the encoder, suppressing interference from irrelevant background regions and highlighting local features related to the segmentation target to enhance the model's ability to focus on the target region. D3, Res-Attention-U-Net Model Construction: Based on the Attention-U-Net model, a residual learning unit is introduced, which integrates the residual connection with the attention mechanism. A residual learning unit is introduced in each convolutional block of the encoder and decoder. Each residual block consists of a main path composed of two 3×3 convolutional layers and a shortcut path of a 1×1 convolution. E. Train the model constructed in step D3: Divide the training set, validation set, and test set into a 7:1.5:1.5 ratio, and use the Adam optimizer (learning rate 1×10⁻⁻⁶). 4 The model is trained using the cross-entropy loss function and validated every 10 rounds. If the loss does not improve after 5 consecutive rounds of validation, the training is stopped early. F. Post-segmentation processing: The Res-Attention-U-Net model is used to segment the two-dimensional slices after the preprocessing in step C. The output of the model is then subjected to morphological dilation-erosion, adaptive median filtering, multi-scale opening-closing operation, filling holes, and connecting broken edges. G. Stacking: Stack the two-dimensional images processed in step F to obtain a three-dimensional image with large pores.
2. The deep learning method for identifying soil macroporosity based on an improved U-Net model according to claim 1, characterized in that, In step A, undisturbed soil samples were collected from the Loess Plateau region at a depth of 0.1 ± 0.025 m using a ring cutter, encapsulated, and sealed for preservation.
3. The deep learning method for identifying soil macroporosity based on an improved U-Net model according to claim 1, characterized in that, The CT scanning system in step B is the nanoVoxel2600 high and low temperature environment stereoscopic scanning imaging system. The scanning parameters are: voltage 130.00kV, current 165.00µA, exposure time 1.9s, distance from X-ray source to sample 238.58mm, distance from X-ray source to detector 1010.69mm, and pixel size 23.6057µm. The three-dimensional voxel reconstruction tool is VoxelStudioRecon software.
4. The deep learning method for identifying soil macroporosity based on an improved U-Net model according to claim 1, characterized in that, In step C3, the piecewise linear transformation specifically sets black to 0 and white to 1 in the grayscale of the soil slice. The lighter the color, the larger the grayscale value and the closer it is to 1; the darker the color, the smaller the grayscale value and the closer it is to 0. Grayscale values less than 0.15 are considered low thresholds, and the threshold within this range is set to 0.
05. Grayscale values greater than 0.25 are considered high thresholds, and they are set to 0.
9. By manually adjusting the thresholds, the matrix and pores are distinguished, thereby increasing the contrast.
5. The deep learning method for identifying soil macroporosity based on an improved U-Net model according to claim 1, characterized in that, In step C4, the quantization image tool is ImageJ software. The method for selecting the high porosity sub-images is to calculate the macroporosity of the slices, then sort the macroporosity from high to low, and select the top 500 high macroporosity sub-images to construct a training set.
6. The deep learning method for identifying soil macroporosity based on an improved U-Net model according to claim 1, characterized in that, In step D, the U-Net model includes a symmetric encoder-decoder. The encoder has 4 layers with an initial number of 32 filters. Each layer undergoes two 3×3 convolutions (ReLU activation) and 2×2 max pooling (doubling the number of channels). The decoder is upsampled by transposed convolution (halving the number of channels) and concatenated with the encoder features. The final output layer uses a 1×1 convolution to map the features to two categories: background and aperture. Finally, a resize operation is used to unify the resolution to 320×320 pixels through bilinear interpolation.
7. The deep learning method for identifying soil macroporosity based on an improved U-Net model according to claim 1, characterized in that, In step F, during morphological dilation-erosion, the morphological operation kernel size is 3×3. The multi-scale opening-closing operation is specifically set to a scale of 5×5 pixels, with the opening operation performed twice and the closing operation performed twice.
8. The deep learning method for identifying soil macroporosity based on an improved U-Net model according to claim 2, characterized in that, The inner diameter of the ring cutter is 5cm and the height is 5cm.
9. A deep learning method for identifying soil macroporosity based on an improved U-Net model according to claim 2, characterized in that, The geographical coordinates of the Loess Plateau region range from 33.72° to 41.27°N and from 100.90° to 114.55°E.