A method and system for identifying black soil erosion gullies, an electronic device and a storage medium
By fusing local and global features through a multi-scale feature fusion network, the problems of poor continuity in the extraction of long gullies and low accuracy in the identification of short gullies in black soil erosion gully identification are solved, achieving efficient and accurate erosion gully extraction and segmentation.
Patent Information
- Application Number
- CN202511196588.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-26
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-08-26
AI Technical Summary
Existing technologies for identifying erosion gullies in black soil suffer from problems such as poor continuity in extracting long gullies, low accuracy in identifying short gullies, and low computational efficiency, especially in high-resolution remote sensing images where the degree of automation is not high.
A multi-scale feature fusion network is adopted, which combines a local feature extraction module (CNN) and a global feature extraction module (Transformer). Through the layer-by-layer transfer mechanism of the feature fusion module (EGFM), local texture features and global structural information are fused to improve the accuracy of erosion groove extraction.
It significantly improves the accuracy and computational efficiency of erosion trench extraction, reduces misclassification and omissions, enhances the segmentation accuracy and stability of the model in complex scenes, adapts to remote sensing images of different resolutions, and reduces computational costs.
Smart Images

Figure CN120726494B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of soil erosion gully information detection technology, and particularly relates to a method, system, electronic device and storage medium for identifying erosion gullies in black soil. Background Technology
[0002] Accurate extraction of gullies is a crucial prerequisite for soil erosion control and a key step in monitoring black soil degradation. Currently, remote sensing technology is widely used in gully identification. However, due to the long, narrow, and complex morphological types of gullies in black soil regions, their vegetation cover, and their tendency to be confused with farm roads and forest belts, remote sensing extraction of gullies requires high image spatial resolution, and the automation level of identification methods is low, relying heavily on manual visual interpretation. In recent years, methods for gully extraction based on high-resolution remote sensing imagery combined with object-oriented, machine learning, and deep learning approaches have emerged. Current technologies have two main drawbacks: first, a lack of continuity in the extraction of long gullies and low accuracy in identifying short gullies; second, the computational efficiency for gully information identification is currently low.
[0003] Therefore, there is an urgent need to study an intelligent identification method for black soil erosion gullies with high extraction efficiency and high identification accuracy. Summary of the Invention
[0004] In view of this, the present invention aims to provide a method, system, electronic device and storage medium for identifying erosion gullies in black soil. By performing layer-by-layer feature fusion on the local and global features of the erosion gullies, it takes into account the extraction of both local texture features and global structural information of the erosion gullies. Through the layer-by-layer transmission mechanism of the feature fusion module (EGFM), it significantly improves the accuracy and richness of information in the extraction of erosion gullies, and solves the problems of poor continuity in the extraction of long gullies, low accuracy in the identification of short gullies and low identification computation efficiency in traditional schemes.
[0005] To achieve the above objectives, the technical solution created by this invention is implemented as follows:
[0006] This invention provides a method for identifying erosion gullies in black soil, comprising:
[0007] Construct a multi-scale feature fusion network, which includes:
[0008] The system includes a local feature extraction module and a global feature extraction module. The local feature extraction module consists of N cascaded CNN encoder layers, which are used to downsample and extract local features from the input image layer by layer.
[0009] The global feature extraction module includes N Transformer encoder layers. The first Transformer encoder layer reduces the feature dimension of the input image through spatial pooling to obtain global features, while non-first Transformer encoder layers extract global features through an efficient self-attention mechanism.
[0010] A feature fusion module is set up between the CNN encoder layer and the Transformer encoder layer of the same order. The feature fusion module fuses the local and global features output by the CNN encoder layer and the Transformer encoder layer of the same order to generate an erosion groove feature map, and uses the erosion groove feature map as the input of the next Transformer encoder layer.
[0011] The erosion groove feature map output by the N-layer feature fusion module is decoded to obtain the erosion groove.
[0012] Preferably, the CNN encoder layer includes a series of depthwise separable convolutional layers and a convolutional attention module. The depthwise separable convolutional layers are used to downsample the input image to reduce the feature dimension, and the convolutional attention module dynamically weights the features of the erosion grooves in the input image through channel attention mechanism and spatial attention mechanism.
[0013] Preferably, N=4, and the feature dimension of the first CNN encoder layer is... The feature dimension of the second CNN encoder layer is The feature dimension of the third CNN encoder layer is The feature dimension of the fourth CNN encoder layer is H represents the number of feature dimensions in the direction of the input image, and W represents the number of feature dimensions in the width direction of the input image.
[0014] Preferably, the feedforward network of the Transformer encoder layer includes two 1×1 convolutions and two parallel depth-separable convolutional layers between the two 1×1 convolutions.
[0015] Preferably, the convolution kernels of the two depth-separable convolutional layers connected in parallel between the two 1×1 convolutions are different.
[0016] Preferably, an overlapping patch merging method is used in the multi-scale feature fusion network to introduce image feature location encoding information.
[0017] Preferably, the first Transformer encoder layer includes an overlapping patch merging layer, a spatial pooling layer, and a feedforward network; the non-first Transformer encoder layer includes an overlapping patch merging layer, an efficient self-attention mechanism layer, and a feedforward network.
[0018] Preferably, the efficient self-attention mechanism layer adopts an efficient self-attention mechanism based on the PVT sequence reduction method, which sets a reduction ratio to reduce the length of the input sequence of the Transformer encoder layer and reduce computational complexity.
[0019] Preferably, the feature fusion module includes an interactive fusion module, a feature enhancement module, a channel attention module, and a feature fusion module. The interactive fusion module includes: using global average pooling to convert the local features output by the CNN encoder layer and the global features output by the Transformer encoder layer of the same order into two feature vectors of the same size, cross-connecting these two feature vectors to generate two two-dimensional feature maps, inputting the two two-dimensional feature maps into two Transformer Block modules respectively for feature fusion, and using 1×1 convolution to generate a cross-domain fusion feature map.
[0020] The feature enhancement module performs dimension matching between the local features output by the CNN encoder layer and the global features output by the Transformer encoder layer of the same order, and then performs point-by-point multiplication between the dimension-matched global features and local features to generate a fused correlation feature map.
[0021] The channel attention module combines an efficient self-attention mechanism and an ECA attention mechanism to generate a hybrid attention feature map by combining the local features output by the CNN encoder layer of the same order and the global features output by the Transformer encoder layer.
[0022] The feature fusion module stitches together the cross-domain fused feature map, the fused correlation feature map, and the hybrid attention feature map to generate the erosion trench feature map.
[0023] Preferably, the SegFormer decoder is used to decode the erosion trench feature map output by the N-layer feature fusion module.
[0024] This invention provides an electronic device, comprising:
[0025] At least one processor;
[0026] as well as
[0027] Memory that is communicatively connected to at least one processor;
[0028] The memory stores instructions that can be executed by at least one processor. When the instructions are executed by at least one processor, the processor performs the black soil erosion gully identification method.
[0029] This invention provides a storage medium storing computer instructions, which, when executed by a processor, cause the processor to perform the aforementioned method for identifying erosion gullies in black soil.
[0030] This invention provides a black soil erosion gully identification system, comprising:
[0031] A device for storing, building, or running multi-scale feature fusion networks, including:
[0032] The system includes a local feature extraction module and a global feature extraction module. The local feature extraction module consists of N cascaded CNN encoder layers, which are used to downsample and extract local features from the input image layer by layer.
[0033] The global feature extraction module includes N Transformer encoder layers. The first Transformer encoder layer reduces the feature dimension of the input image through spatial pooling to obtain global features, while non-first Transformer encoder layers extract global features through an efficient self-attention mechanism.
[0034] A feature fusion module is set up between the CNN encoder layer and the Transformer encoder layer of the same order. The feature fusion module fuses the local and global features output by the CNN encoder layer and the Transformer encoder layer of the same order to generate an erosion groove feature map, and uses the erosion groove feature map as the input of the next Transformer encoder layer; the erosion groove is obtained by decoding the erosion groove feature map output by the N-layer feature fusion module.
[0035] Compared with the prior art, the present invention can achieve the following beneficial effects:
[0036] This invention addresses the challenge of extracting erosion gullies in black soil by designing a lightweight multi-scale feature fusion network. It integrates a local feature extraction module (CCN) and a global feature extraction module (Transformer). Both modules employ a multi-layer stacked design, and a feature fusion module (EGFM) performs layer-by-layer fusion of local and global features. This approach not only considers local texture features such as the edges, width, and morphological variations of the erosion gullies, but also global structural information such as their distribution, direction, and adjacency relationships. Furthermore, the layer-by-layer propagation mechanism of EGFM significantly improves the accuracy and richness of information in erosion gully extraction. Compared to traditional methods, this invention effectively reduces misclassification, omissions, and poor connectivity of segmentation results, significantly enhancing the model's advantages in the collaborative capture of erosion gully shape and detailed features. Especially for small-scale erosion gullies with low background contrast, this invention demonstrates a substantial improvement in extraction accuracy.
[0037] This invention effectively reduces the computational complexity of feature extraction and enhances the ability to extract detailed features by stacking multiple feature extraction modules and using separable convolutional modules for downsampling. This invention also uses an overlapping patch merging method to replace fixed-resolution position encoding to introduce position information, avoiding the reduction in model accuracy caused by position encoding interpolation when the test resolution is different from the training resolution, so as to achieve the adaptability of the model to remote sensing images of different resolutions.
[0038] This invention improves the feedforward network of the Transformer encoder layer by replacing the fully connected layer of the feedforward network with a 1×1 convolution and inserting two parallel depth-separable convolutional layers to improve the modeling ability of the edge and texture features of the erosion groove.
[0039] This invention surpasses current mainstream technologies in both the segmentation accuracy and the continuity of extraction results for black soil erosion gullies. It not only improves extraction accuracy but also enhances model stability, enabling it to adapt to different environmental requirements and reducing computational costs. It breaks through the application of high-resolution remote sensing images such as high-resolution satellites. Furthermore, by integrating auxiliary environmental data such as high-resolution DEMs, radar data, and soil databases, it can enhance the model's adaptability to different environmental conditions and improve the model's scalability in large-scale automated monitoring. Attached Figure Description
[0040] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments and descriptions of the invention are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings:
[0041] Figure 1 This is a schematic diagram of automated intelligent identification of black soil erosion gullies using a multi-scale feature fusion network according to an embodiment of the present invention;
[0042] Figure 2 This is a schematic diagram of the architecture of the first Transformer encoder layer and the non-first Transformer encoder layer provided according to an embodiment of the present invention;
[0043] Figure 3 This is a schematic diagram of an improved feedforward network provided according to an embodiment of the present invention;
[0044] Figure 4 This is a schematic diagram of the architecture of a feature fusion module provided according to an embodiment of the present invention;
[0045] Figure 5 This is a schematic diagram of image data from a multi-scale feature fusion network provided in an embodiment of the present invention;
[0046] Figure 6This is a flowchart of the training process of a multi-scale feature fusion network provided according to an embodiment of the present invention;
[0047] Figure 7 This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only for explaining the invention and do not constitute a limitation thereof. Similar elements in different embodiments are referred to by associated similar element reference numerals. In the following embodiments, many details are described to facilitate a better understanding of the invention. However, those skilled in the art will readily recognize that some features may be omitted in different situations, or may be replaced by other elements, materials, or methods. In some cases, some operations related to the invention are not shown or described in the specification. This is to avoid obscuring the core parts of the invention with excessive description. For those skilled in the art, detailed description of these related operations is not necessary; they can fully understand the related operations based on the description in the specification and general technical knowledge in the art.
[0049] It should be noted that, unless otherwise specified, the embodiments and features described in this invention can be combined to form various implementations. Furthermore, the order of the steps or actions in the method description can be changed or adjusted in a manner readily apparent to those skilled in the art. Therefore, the various orders in the specification and drawings are merely for the clear description of a particular embodiment and do not imply a mandatory order, unless otherwise stated that a particular order must be followed.
[0050] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," and "counterclockwise," etc., indicating orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on this invention. Furthermore, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, features defined with "first," "second," etc., may explicitly or implicitly include one or more of that feature. In the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0051] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art will understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0052] The invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0053] Please see Figure 1 In one embodiment of the present invention, a method for identifying erosion gullies in black soil is provided. A lightweight multi-scale feature fusion network (ECTFNet) is designed and used for erosion gully identification and extraction. Specifically, firstly, a multi-scale feature fusion network is constructed, which includes a local feature extraction module, a global feature extraction module, and a feature fusion module. The local feature extraction module (CNN) and the global feature extraction module (Transformer) are combined, and the feature maps are fused and transmitted layer by layer through the feature fusion module (EGFM) to achieve efficient feature coupling, thereby enhancing the capture of details, edges, and structures of erosion gullies in black soil.
[0054] The local feature extraction module comprises four cascaded CNN encoder layers. The input to the first CNN encoder layer is the original image of the erosion trench to be identified. The inputs to the second, third, and fourth CNN encoder layers are the local features output from the previous CNN encoder layer. The CNN encoder layers are used to extract local details of the erosion trench from the image or feature map, especially texture and edge information, such as the edges, width, and morphological variations of the erosion trench.
[0055] The global feature extraction module consists of four Transformer encoder layers. The Transformer encoder layers are mainly responsible for extracting global semantic information and capturing the overall structure and layout of the erosion trenches, such as the distribution, direction and adjacency relationships of the erosion trenches.
[0056] A feature fusion module is set between CNN encoder layers and Transformer encoder layers of the same sequence. Within the same layer, the local features output by the CNN encoder layer and the global features output by the Transformer encoder layer are used as input to the feature fusion module. This module performs cross-domain fusion of local and global features to generate an erosion gully feature map, which is then used as input to the next Transformer encoder layer. The next Transformer encoder layer, after extracting global features from the erosion gully feature map, continues to use its output global features as input to the feature fusion module of the same sequence. This iterative optimization of feature selection improves the accuracy of erosion gully identification in black soil, addressing the problems of poor continuity in long gully extraction and low accuracy in short gully identification in traditional methods. Specifically, the input to the first Transformer encoder layer is the original image of the erosion gully to be identified, while the inputs to the second, third, and fourth Transformer encoder layers are the erosion gully feature maps output by the feature fusion module of the previous layer. Furthermore, the outputs of the four-layer feature fusion module are combined and used as the final erosion groove feature map as input to the Transformer Decoder for decoding, identifying and acquiring the erosion grooves in the original image. In this embodiment of the invention, the Transformer Decoder specifically uses the SegFormer decoder to decode the erosion groove feature map output by the fourth-layer feature fusion module. The SegFormer decoder employs a lightweight multilayer perceptron (MLP) decoder, which significantly reduces the number of parameters and computational cost compared to traditional decoders, and can aggregate multi-scale features from the output.
[0057] Each CNN encoder layer includes depthwise separable convolutional layers (DW Layers) and a convolutional attention module (CBAM), where the output of the DW Layers serves as the input to the CBAM. The separable convolutional module decomposes standard convolution into two independent steps: depthwise convolution and pointwise convolution, significantly reducing computation and parameter count while maintaining feature extraction capabilities. This embodiment of the invention uses depthwise separable convolutional layers to perform depthwise and pointwise convolution on the input image, achieving downsampling of the input image, gradually reducing the image spatial size and decreasing the feature dimension. It is important to note that the input image here, for the first CNN encoder layer, is the original image, and for the remaining CNN encoder layers, it is the feature map output from the previous CNN encoder layer. For example, suppose the original dimension of the original image is... Where H represents the feature dimension in the height direction of the original image, and W represents the feature dimension in the width direction of the original image, then the feature dimension of the local features output by the first CNN encoder layer is: The feature dimension of the second CNN encoder layer is The feature dimension of the third CNN encoder layer is The feature dimension of the fourth CNN encoder layer is This not only reduces the computational complexity of feature extraction, but also enables the model to capture features at different scales, thereby enhancing its ability to extract detailed features.
[0058] The convolutional attention module enhances the expressive power of feature maps through channel attention and spatial attention mechanisms. Specifically, it dynamically weights the features of erosion grooves using these mechanisms, optimizing the feature map's performance. This approach allows the model to focus more on the key features of the erosion grooves while suppressing background or low-similarity features, thereby improving the model's ability to identify erosion grooves. This is particularly effective in complex scenes (such as those with low background contrast and short erosion grooves), significantly improving segmentation accuracy and robustness.
[0059] The global feature extraction module includes four Transformer encoder layers. The first Transformer encoder layer reduces the feature dimension of the input image through spatial pooling to obtain initial global features, while the remaining non-first Transformer encoder layers extract global features through an efficient self-attention mechanism. Specifically, each Transformer encoder layer includes an input embedding layer, a token mixer, and a feedforward network (FFN). To incorporate image feature location encoding information, this embodiment employs an overlapping patch merging method in the multi-scale feature fusion network, specifically, as shown... Figure 2As shown, the input embedding layer specifically employs an Overlap Patch Embeddings layer. This layer divides the input image into patches with some overlap and embeds these patches into a high-dimensional space to retain more local information and improve adaptability to different resolutions. This embodiment of the invention uses an overlap patch merging method instead of fixed-resolution location encoding to introduce location information, avoiding the reduction in model accuracy caused by location encoding interpolation when the test resolution differs from the training resolution, thus achieving model adaptability to remote sensing images at different resolutions. For the label mixing module, the first Transformer encoder layer is as follows... Figure 2 As shown in (a), the feature map output from the overlapping patch merging layer is first fed into a normalization layer (Norm) for feature normalization. Then it is fed into a pooling layer for downsampling pooling, reducing the size of the feature map, thereby reducing computational complexity and extracting higher-level features. The output of the pooling layer is then fed into another normalization layer (Norm) for feature normalization. After normalization, it is fed into a feedforward network (FFN). The non-first Transformer encoder layers are as follows... Figure 2 As shown in (b), the rest of the design is the same as the first Transformer encoder layer, except that the pooling layer is replaced with an efficient self-attention mechanism layer. The efficient self-attention mechanism is an improved self-attention mechanism used to efficiently capture the dependencies between different positions in a sequence. It introduces an efficient self-attention mechanism (HP) based on the PVT (Pyramid Vision Transformer) sequence reduction method to replace the preset self-attention of the traditional Transformer encoder. By setting a reduction ratio R to reduce the length of the input sequence of the Transformer encoder layer, the spatial dimension sequence length is reduced to N / R² (N is the length of the input sequence, i.e., the number of image pixels), optimizing the computational complexity to O(N² / R²). This solves the computational bottleneck of high-resolution images and significantly reduces the computational complexity compared to the traditional self-attention mechanism O(N²).
[0060] like Figure 3As shown, the feedforward network is the core unit of the Transformer encoder layer, mainly used for feature enhancement. Traditional Transformer encoder feedforward networks are all fully connected (FC) layers. In this embodiment, the fully connected layers are replaced with two 1×1 convolutions, and two parallel depthwise separable convolutional layers are inserted between them, with kernel sizes of 3×3 and 5×5 respectively. The two depthwise separable convolutional layers are designed in parallel, using convolutional kernels of different sizes (3×3 and 5×5) to capture multi-scale local features, while utilizing depthwise separable convolutions to reduce computational complexity. The 1×1 convolutions are used for channel fusion and dimensionality reduction, and the connection operations are used to fuse multi-scale features. The final output feature map contains rich details and contextual information. This design effectively improves the modeling ability of erosion groove edges and texture features. Furthermore, the feedforward network also includes an input feature module and an output feature module.
[0061] like Figure 4 As shown, each feature fusion module includes four sub-modules, where module a is an interactive fusion module that fuses and enhances features from different domains of the Transformer encoder and CNN encoder. The specific cross-domain fusion process is as follows: First, Global Average Pooling (GAP) is applied to the feature map input from the Transformer encoder. and the feature map input to the CNN encoder This is transformed into two feature vectors of size (1×1)×C, where C represents the number of channels. Figure 1 In , , and For the two input feature maps output by the Transformer and CNN encoders. and Global average pooling is applied to each feature map, transforming it into a one-dimensional vector of size 1×1×C, thus reducing the spatial dimension of the feature maps. These two feature vectors are then cross-concatenated to generate two two-dimensional (2D) feature maps. The vector resulting from global average pooling is then concatenated with the original feature map to generate a new feature vector. and The feature vector has a size of (h×w)×C, where h represents the height of the feature map and w represents the width of the feature map. Then the feature vector... and The features are fed into two separate Transformer modules for feature fusion, and after processing by the Transformer modules, a new vector is generated. and And reshape both into a three-dimensional feature map. and This further enhances the feature representation capability for long-range dependencies. Finally, a cross-domain fusion feature map will be generated using 1×1 convolution. This enables cross-encoder feature fusion.
[0062] Module b is the Feature Enhancement Block, used to model the cross-domain correlation between the Transformer and CNN encoder domains. First, the 2D global feature map output from the Transformer encoder layer is reshaped into a 3D global feature map to match the dimension of the local feature map output from the CNN encoder layer. Then, they are multiplied point-by-point to generate a fused correlation feature map. This module enables feature adaptation. It can quickly capture and focus on salient features while suppressing background or low-similarity features. This mechanism can extract mutually salient features from CNN and Transformer branches to further improve accuracy and enhance the model's segmentation accuracy in complex scenes.
[0063] Module c is the Channel Attention Block, which processes the feature map input to the Transformer module. Global average pooling is performed, and then combined with ECA attention mechanism and efficient self-attention mechanism to generate hybrid attention feature map. This enables Transformer feature enhancement, improving the correlation between channels and the contextual understanding of feature maps.
[0064] Module d is the Feature Fusion Block, which fuses feature maps across domains. fusion correlation feature map and hybrid attention feature maps The data is then stitched together, and the channel dimensions are compressed. A reshaping operation is then used to generate the stitched feature map. The feature fusion module enables efficient interaction and fusion of features from each CNN and Transformer layer. While ensuring good collaboration between local and global features, it maintains the model's lightweight and efficiency, reduces the probability of missing small-scale erosion grooves, and guarantees the coherence and completeness of the erosion groove extraction results. This results in the acquisition of a stitched feature map. Then, feature fusion is performed using the CBR module (convolution-batch normalization-ReLU module) to generate a fused feature map. The CBR module includes 1×1 convolutions (1×1 Conv), batch normalization (BN), and the ReLU activation function. The 1×1 convolution adjusts the channel dimension of the concatenated feature map, reducing the number of channels while preserving important features. Batch normalization is then applied to the convolutional feature map, and the ReLU activation function introduces non-linearity, enabling the network to learn complex feature representations and obtain a fused feature map. Finally, the fused feature map output by the CBR module is... Perform a reshaping operation to generate the final feature map. The purpose of the reshaping operation is to adjust the shape of the feature map to meet the input requirements of subsequent network layers.
[0065] After the multi-scale feature fusion network is constructed, it needs to be trained. The multi-scale feature fusion network adopts the Dice loss function, which performs significantly better than cross-entropy loss in complex scene segmentation. Taking erosion trench extraction as an example, erosion trenches usually occupy only a very small proportion of the total image area. Traditional pixel-level loss functions (such as cross-entropy) focus too much on background pixels and are difficult to effectively learn the discriminative features of small target regions. Dice loss focuses on the regional overlap of foreground targets by directly optimizing the intersection-over-union (IoU) ratio between the predicted mask and the ground truth label, thus significantly alleviating the class imbalance problem. More importantly, its set similarity-based optimization mechanism can effectively suppress boundary blurring, achieving high-precision drawing of erosion boundaries, preservation of the integrity of morphological and structural features, and accurate identification of multi-dimensional attributes in the task of fine-grained erosion trench segmentation.
[0066] During training, considering the complexity of erosion gullies, they were categorized into three main types based on morphological differences: transient erosion gullies, permanent erosion gullies, and erosion gullies in complex environments (i.e., erosion gullies located in complex background areas). Specifically... Figure 5 As shown in (a), transient erosion gullies are typically narrow and shallow, usually elongated with gentle edges and high background contrast. Incisional erosion gullies are deeper, with steeper edges and greater depth, often creating a significant difference in elevation from the surrounding terrain. Erosion gullies in complex environments are often mixed with farmland, forest belts, etc., resulting in a complex background that is easily disturbed by other structures (such as farm roads). They are irregular in shape, smaller in size, and have low background contrast.
[0067] 1894 images of erosion trenches were collected and used as a training dataset. All images were normalized to 512×512 pixels, and the erosion trenches were masked and annotated. Figure 5As shown in (b), in order to enhance the diversity of the dataset, spatial enhancement (rotation, flipping) and pixel-level enhancement (blurring, noise addition, contrast adjustment) were applied to process the initial 1894 erosion trench images to expand the training dataset. A total of 7060 valid images were generated after image processing for training, validation and testing.
[0068] like Figure 6 As shown, the 7060 valid images generated are first labeled. According to the erosion gully classification plan, different regions are written with different labels, namely temporary erosion gullies, permanent erosion gullies, erosion gullies with complex environments, and no erosion gullies. Each image is then segmented to ensure that each sub-image contains only one label.
[0069] 70% of the total number of sub-images obtained after image processing are used as the training set, and the remainder as the validation set. The sub-image data of the training set are input into a multi-scale feature fusion network for training. The local feature extraction module (CNN) extracts detailed features (texture and edge information) from the image, while the global feature extraction module (Transformer) extracts global semantic information. Then, the erosion gully feature fusion module (EGFM) efficiently fuses the features of the two layer by layer, ensuring the complete capture of detailed and structural information. Finally, the output of each layer of the erosion gully feature fusion module (EGFM) generates an erosion gully mask through the SegFormer decoder, realizing automated intelligent recognition of erosion gullies in black soil. During training, the loss is calculated through forward propagation, and the network model parameters are optimized through backpropagation. In this embodiment, the Dice loss function is used for result judgment to improve the accurate capture of erosion gully details and boundaries.
[0070] After the multi-scale feature fusion network is trained, the model is evaluated using sub-image data from the validation set to determine the training effect. The network model is considered trained when the erosion gully identification accuracy meets the requirements. The remote sensing image of the erosion gully to be identified can be input into the multi-scale feature fusion network, which can then automatically identify and output the black soil erosion gullies in the image.
[0071] Accordingly, according to embodiments of the present invention, the present invention also provides a computer device, a storage medium, and a black soil erosion gully identification system.
[0072] Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. Figure 7 A block diagram of an exemplary computer device suitable for implementing embodiments of the present invention is shown. Figure 7 The computer device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of the present invention.
[0073] like Figure 7 As shown, computer device 12 is represented in the form of a general-purpose computing device. Computer device 12 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0074] The components of the computer device 12 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and bus 18 connecting different system components (including system memory 28 and processing unit 16).
[0075] Bus 18 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0076] Computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by computer device 12, including volatile and non-volatile media, removable and non-removable media.
[0077] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (…). Figure 7 Not shown; usually referred to as a "hard drive"). Although Figure 7Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0078] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of the present invention.
[0079] Computer device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with computer device 12, and / or with any device that enables computer device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 22. Furthermore, computer device 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with other modules of computer device 12 via bus 18. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with computer device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0080] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the black soil erosion gully identification method provided in the embodiments of the present invention.
[0081] This invention also provides a non-transitory computer-readable storage medium storing computer instructions, on which a computer program is stored, wherein the program, when executed by a processor, is the black soil erosion gully identification method provided in all embodiments of this application.
[0082] The computer storage medium of this invention can be any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. More specific examples (a non-exhaustive list) of computer-readable storage media include: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0083] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0084] The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof. The computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0085] This invention also provides a black soil erosion gully identification system. This system includes a device for storing, constructing, or running the aforementioned multi-scale feature fusion network, which includes:
[0086] The system includes a local feature extraction module and a global feature extraction module. The local feature extraction module consists of N cascaded CNN encoder layers, which are used to downsample and extract local features from the input image layer by layer.
[0087] The global feature extraction module includes N Transformer encoder layers. The first Transformer encoder layer reduces the feature dimension of the input image through spatial pooling to obtain global features, while non-first Transformer encoder layers extract global features through an efficient self-attention mechanism.
[0088] A feature fusion module is set up between the CNN encoder layer and the Transformer encoder layer of the same order. The feature fusion module fuses the local and global features output by the CNN encoder layer and the Transformer encoder layer of the same order to generate an erosion groove feature map, and uses the erosion groove feature map as the input of the next Transformer encoder layer; the erosion groove is obtained by decoding the erosion groove feature map output by the N-layer feature fusion module.
[0089] In summary, the above description is merely a preferred embodiment of this specification and is not intended to limit the scope of protection of this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of protection of this specification.
[0090] The systems, apparatuses, modules, or units described in one or more of the above embodiments may be implemented by a computer chip or entity, or by a product having a certain function. A typical implementation device is a computer. Specifically, a computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.
[0091] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0092] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
Claims
1. A method for identifying erosion gullies in black soil, characterized in that, include: Construct a multi-scale feature fusion network, wherein the multi-scale feature fusion network includes: The system includes a local feature extraction module and a global feature extraction module. The local feature extraction module comprises N cascaded CNN encoder layers, which downsample and extract local features from the input image layer by layer. The CNN encoder layers comprise cascaded depthwise separable convolutional layers and a convolutional attention module. The depthwise separable convolutional layers are used to downsample the input image to reduce the feature dimension, and the convolutional attention module dynamically weights the erosion groove features in the input image through channel attention and spatial attention mechanisms. The global feature extraction module includes N Transformer encoder layers, wherein the first Transformer encoder layer reduces the feature dimension of the input image through spatial pooling to obtain global features, and the non-first Transformer encoder layers extract global features through an efficient self-attention mechanism; the feedforward network of the Transformer encoder layer includes two 1×1 convolutions, and two parallel depthwise separable convolutional layers are provided between the two 1×1 convolutions. The first Transformer encoder layer includes an overlapping patch merging layer, a spatial pooling layer, and a feedforward network; the non-first Transformer encoder layer includes an overlapping patch merging layer, an efficient self-attention mechanism layer, and a feedforward network. A feature fusion module is set up between the CNN encoder layer and the Transformer encoder layer of the same order. The feature fusion module fuses the local features and global features output by the CNN encoder layer and the Transformer encoder layer of the same order to generate an erosion groove feature map, and uses the erosion groove feature map as the input of the next Transformer encoder layer. The erosion groove feature map output by the N-layer feature fusion module is decoded to obtain the erosion groove.
2. The method for identifying erosion gullies in black soil according to claim 1, characterized in that, N=4, the feature dimension of the first CNN encoder layer is... The feature dimension of the second CNN encoder layer is The feature dimension of the third CNN encoder layer is The feature dimension of the fourth CNN encoder layer is H represents the number of feature dimensions in the height direction of the input image, and W represents the number of feature dimensions in the width direction of the input image.
3. The method for identifying erosion gullies in black soil according to claim 1, characterized in that, The convolution kernels of the two depthwise separable convolutional layers connected in parallel between the two 1×1 convolutions are different.
4. The method for identifying erosion gullies in black soil according to claim 1, characterized in that, The multi-scale feature fusion network employs an overlapping patch merging method to introduce image feature location encoding information.
5. The method for identifying erosion gullies in black soil according to claim 1, characterized in that, The efficient self-attention mechanism layer adopts an efficient self-attention mechanism based on the PVT sequence reduction method. The reduction ratio is set to reduce the length of the input sequence of the Transformer encoder layer and reduce the computational complexity.
6. The method for identifying erosion gullies in black soil according to claim 1, characterized in that, The feature fusion module includes an interactive fusion module, a feature enhancement module, a channel attention module, and a feature fusion module. The interactive fusion module includes: using global average pooling to convert the local features output by the CNN encoder layer and the global features output by the Transformer encoder layer of the same order into two feature vectors of the same size, and cross-connecting these two feature vectors to generate two two-dimensional feature maps. The two two-dimensional feature maps are then input into two Transformer Block modules for feature fusion, and a cross-domain fusion feature map is generated using 1×1 convolution. The feature enhancement module performs dimension matching between the local features output by the CNN encoder layer and the global features output by the Transformer encoder layer of the same order, and then performs point-by-point multiplication between the dimension-matched global features and local features to generate a fused correlation feature map. The channel attention module combines an efficient self-attention mechanism and an ECA attention mechanism to generate a hybrid attention feature map by combining the local features output by the CNN encoder layer of the same order and the global features output by the Transformer encoder layer. The feature fusion module stitches together the cross-domain fused feature map, the fused correlation feature map, and the hybrid attention feature map to generate an erosion trench feature map.
7. The method for identifying erosion gullies in black soil according to claim 1, characterized in that, The SegFormer decoder is used to decode the erosion trench feature map output by the N-layer feature fusion module.
8. An electronic device, characterized in that, include: At least one processor; as well as A memory that is communicatively connected to the at least one processor; The memory stores instructions that can be executed by the at least one processor. When the instructions are executed by the at least one processor, the at least one processor performs the black soil erosion gully identification method according to any one of claims 1-7.
9. A storage medium storing computer instructions, characterized in that, When the computer instructions are executed by the processor, the processor performs the black soil erosion gully identification method according to any one of claims 1-7.
10. A black soil erosion gully identification system, characterized in that, include: A means for storing, building, or running a multi-scale feature fusion network, the multi-scale feature fusion network comprising: The system includes a local feature extraction module and a global feature extraction module. The local feature extraction module comprises N cascaded CNN encoder layers, which downsample and extract local features from the input image layer by layer. The CNN encoder layers comprise cascaded depthwise separable convolutional layers and a convolutional attention module. The depthwise separable convolutional layers are used to downsample the input image to reduce the feature dimension, and the convolutional attention module dynamically weights the erosion groove features in the input image through channel attention and spatial attention mechanisms. The global feature extraction module includes N Transformer encoder layers, wherein the first Transformer encoder layer reduces the feature dimension of the input image through spatial pooling to obtain global features, and the non-first Transformer encoder layers extract global features through an efficient self-attention mechanism; the feedforward network of the Transformer encoder layer includes two 1×1 convolutions, and two parallel depthwise separable convolutional layers are provided between the two 1×1 convolutions. The first Transformer encoder layer includes an overlapping patch merging layer, a spatial pooling layer, and a feedforward network; the non-first Transformer encoder layer includes an overlapping patch merging layer, an efficient self-attention mechanism layer, and a feedforward network. A feature fusion module is set up between the CNN encoder layer and the Transformer encoder layer of the same order. The feature fusion module fuses the local and global features output by the CNN encoder layer and the Transformer encoder layer of the same order to generate an erosion groove feature map, and uses the erosion groove feature map as the input of the next Transformer encoder layer; the erosion groove is obtained by decoding the erosion groove feature map output by the N-layer feature fusion module.
Citation Information
Patent Citations
Medical image segmentation method based on feature interaction
CN118134952A
Remote sensing image building segmentation method based on neural network model and related equipment
CN118887669A