Dense mangrove forest counting method based on improved U2Net model
Through the improved U2Net model, the multi-scale features are extracted and features at different levels are fused through the improved U2Net model, and the problem of low recognition accuracy of mangrove trees in the prior art is solved, achieving higher recognition accuracy and robustness.
Patent Information
- Application Number
- CN202411659761.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-11-20
AI Technical Summary
The prior art is difficult to effectively improve the accuracy of dense mangrove trees recognition in optical images and improve the generalization ability of the model, especially when mangroves are densely distributed and canopy morphology is complex.
The improved U2Net model is adopted, which includes an encoder, dense jump connection module, decoder and significant feature map fusion module. Through these modules, multi-scale features are extracted and features at different levels are fused to improve the model's ability to extract mangrove canopy dark valley feature data and understand the context information of the mangrove area feature.
It improves the accuracy and robustness of mangrove tree recognition, enhances the model's sensitivity to details and overall performance, and is suitable for high-precision mangrove number detection tasks.
Smart Images

Figure CN119600466A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a method for density detection and counting of mangrove images, and in particular to a method for dense mangrove counting based on an improved U2Net model. Background Art
[0002] Mangroves, as important wetland ecosystems on the coast, play an important role in maintaining ecological balance, carbon fixation, and carbon storage. Tree density, as an important structural parameter of mangrove forests, plays a significant role in calculating mangrove biomass and other fields. However, mangroves are of various types, with complex ecological structures and high growth densities. They grow in the intertidal zone by the sea, and the tides periodically submerge mangroves. Field surveys of mangrove growth density are time-consuming and laborious. Remote sensing technology has a unique advantage in monitoring mangrove parameters. High-resolution remote sensing images have become the main information source for estimating forest and tree parameters, which can reduce the cost of mangrove monitoring. However, traditional detection algorithms, such as the watershed algorithm, have low accuracy in detecting the density distribution of mangroves due to their high canopy closure and complex spatial structure. It has always been a challenge to effectively estimate the number of mangroves at multiple scales using remote sensing technology.
[0003] UAV-based Lidar has the characteristics of high accuracy and the ability to extract three-dimensional structural information. It provides a variety of methods for detecting trees and can efficiently invert the density of mangroves in the area. However, due to its high cost and difficulty in collecting data, it is difficult to implement it widely in reality. Therefore, methods based on high-resolution optical images are still widely used in tree detection.
[0004] With the development and application of deep learning, more and more neural network models have been widely used in the field of tree detection. In the prior art, the method of calculating the number of trees by using the instance segmentation method based on deep learning is not easy to directly act on mangroves, because mangroves are usually densely distributed, the canopy morphology is more complex, the gaps between the canopies are not obvious, and the variability between the canopies in a single forest patch is higher. The use of a density regression method based on a deep learning network can reduce the difficulty of model training and is widely used in scenes such as crowd counting, fish counting, and crop counting. This method uses a Gaussian density map to characterize the distribution of objects, and derives the number of objects while realizing the density segmentation of objects. In dense counting scenes, the performance is good, but when dealing with scenes with rich features, the recognition effect still needs to be further improved. The canopy size of mangroves varies greatly. When using a similar counting network structure to count mangroves, more attention should be paid to multi-scale feature extraction. Therefore, according to the existing technical problems, there is an urgent need for a method to effectively improve the tree recognition accuracy of dense mangroves in optical images and improve the generalization ability of the model. Summary of the invention
[0005] In view of the above-mentioned deficiencies in the prior art, the present invention provides a dense mangrove counting method based on an improved U2Net model.
[0006] In order to achieve the above-mentioned object of the invention, the technical solution adopted by the present invention is:
[0007] A dense mangrove counting method based on an improved U2Net model includes the following steps:
[0008] Collect UAV lidar data in mangrove growth areas and construct a UAV visible light remote sensing image dataset;
[0009] Constructing an improved U2Net model; the improved U2Net model includes an encoder, a dense skip connection module, a decoder and a salient feature map fusion module;
[0010] The encoder is used to extract mangrove canopy feature maps containing different levels of semantic information from the UAV visible light remote sensing image dataset.
[0011] The dense skip connection module is used to adjust the mangrove canopy feature map extracted by the encoder to be semantically consistent with the mangrove canopy feature map restored by the corresponding decoder and then passed to the decoder;
[0012] The decoder is used to fuse the mangrove canopy feature map transmitted by the dense skip connection module with the mangrove canopy feature map output by the encoder and then output to the salient feature map fusion module;
[0013] The mangrove crown feature maps of different scales output by the decoder are fused using the salient feature map fusion module to generate a saliency probability map and obtain the mangrove counting result.
[0014] Furthermore, the collecting of UAV lidar data of mangrove growth areas and the construction of UAV visible light remote sensing image data sets include:
[0015] Collecting drone lidar data in mangrove growing areas;
[0016] The two-dimensional orthophoto image is reconstructed from the UAV lidar data to build a UAV visible light remote sensing image dataset.
[0017] Furthermore, the encoder comprises:
[0018] The first encoder, the second encoder, the third encoder, the fourth encoder, the fifth encoder and the sixth encoder are arranged in sequence from top to bottom; the input end of the first encoder serves as the input end of the encoder, and its output end is connected to the input end of the second encoder; the output end of the second encoder is connected to the input end of the third encoder; the output end of the third encoder is connected to the input end of the fourth encoder; the output end of the fourth encoder is connected to the input end of the fifth encoder; the output end of the fifth encoder is connected to the input end of the sixth encoder; the output end of the sixth encoder serves as the output end of the encoder.
[0019] Furthermore, the decoder comprises:
[0020] The first decoder, the second decoder, the third decoder, the fourth decoder and the fifth decoder are arranged in sequence from bottom to top; the output end of the sixth encoder is spliced with the output end of the fifth encoder, and then connected to the input end of the fifth decoder; the output end of the fifth decoder is spliced with the output end of the fourth encoder, and then connected to the input end of the fourth decoder; the output end of the fourth decoder is spliced with the output end of the third encoder, and then connected to the input end of the third decoder; the output end of the third decoder is spliced with the output end of the second encoder, and then connected to the input end of the second decoder; the output end of the second decoder is spliced with the output end of the first encoder, and then connected to the input end of the first decoder; the output end of the first decoder serves as the output end of the decoder.
[0021] Further, the first encoder, the second encoder, the third encoder and the fourth encoder, and the first decoder, the second decoder, the third decoder and the fourth decoder all include an RSU-L module; the RSU-L module adopts a symmetric encoder-decoder structure with a depth of a positive integer L;
[0022] The RSU-L module includes L+1 encoder units and L-1 decoder units, the input end of the first encoder unit is used as the input end of the RSU-L module, the output end of the first encoder unit is connected to the input end of the second encoder unit, the output end of the second encoder unit is connected to the input end of the third encoder unit, the output end of the third encoder unit is connected to the input end of the next-level encoder unit, and is connected in series to the input end of the L+1th encoder unit, the output feature map of the L+1th encoder unit is combined with the output feature map of the previous-level encoder, and is connected to the input end of the L-1th decoder unit, the output of the L-1th decoder unit is spliced with the output of the same-level encoder unit and connected to the input end of the previous-level decoder unit until the input end of the second decoder unit is connected, the output feature map of the second decoder unit is spliced with the output feature map of the second encoder unit and connected to the input end of the first decoder unit, and the output end of the first decoder unit is used as the output end of the RSU-L module;
[0023] The first encoder unit and the second encoder unit of the RSU-L module are composed of an RSU residual block composed of a Conv2d convolution layer, a BatchNorm2d normalization processing layer and a ReLU activation function layer, and the remaining encoder units further increase the downsampling operation; the L-1th decoder unit at the bottom of the RSU-L module is composed of an RSU residual block composed of a Conv2d convolution layer, a BatchNorm2d normalization processing layer and a ReLU activation function layer, and the remaining decoder units further increase the upsampling operation.
[0024] Further, the fifth encoder, the sixth encoder and the fifth decoder all include a multi-scale dilated residual module, and the multi-scale dilated residual module adopts a multi-scale dilated convolution structure and a dense connection structure;
[0025] The multi-scale dilated residual module includes a first dilated convolution unit, a second dilated convolution unit, a third dilated convolution unit, a fused convolution unit and a residual unit; each dilated convolution unit is composed of a first Conv2d convolution layer, a first ReLU activation function layer, a second Conv2d dilated convolution layer and a second ReLU activation function layer, the output end of the first convolution layer is connected to the input end of the first activation function layer, the output end of the first activation function layer is connected to the input end of the second convolution layer, the second convolution layer adopts dilated convolution with dilation ratios of 1, 2, and 3, and its output end is connected to the second The input end of the activation function layer is connected; the first, second and third dilated convolution units fuse the feature maps at different scales together by cascading splicing, and are connected to the input end of the fused convolution unit; the fused convolution unit is composed of a 3*3 convolution layer, which fuses the output feature map of the dilated convolution unit and changes the number of channels, and its output end is connected to the input end of the residual unit; the residual unit includes a 1*1 convolution layer and an adder, which adds the input feature map to the output of the fused convolution unit through a residual connection, and the output end of the residual unit is used as the output end of the multi-scale dilated residual module.
[0026] Furthermore, the RSU-L module and the multi-scale dilated residual module each further include an EMCAM multi-scale convolutional attention module, and the EMCAM multi-scale convolutional attention module includes a channel attention block, a spatial attention block and a multi-scale convolutional block arranged in sequence;
[0027] The channel attention block includes an average pooling layer, a maximum pooling layer, a convolution layer and a Sigmoid function, and its input end is a multi-channel image feature map. The average pooling and maximum pooling results of the input feature map are calculated as the input of the convolution layer, and then the two pooling results are respectively applied with 1*1 convolution, ReLU activation function and 1*1 convolution, and then added and the final attention weight is obtained by the Sigmoid function. Finally, the final attention weight is multiplied with the input feature map to obtain the channel attention feature map;
[0028] The spatial attention block includes an average pooling layer, a maximum pooling layer, a convolution layer and a Sigmoid function, which receives the channel attention feature map output by the channel attention block as input, connects the input ends of the average pooling layer and the maximum pooling layer respectively, calculates the average pooling result and the maximum pooling result of the input feature map, wherein the pooling operation is performed along the channel dimension, and the outputs of the average pooling layer and the maximum pooling layer are spliced along the channel dimension to form a new feature map; after applying convolution to the spliced feature map, a spatial attention weight is obtained by the Sigmoid function, and finally the spatial attention weight is multiplied by the input feature map to obtain the spatial attention feature map;
[0029] The multi-scale convolution block receives the output of the spatial attention block as input, first performs channel expansion through a 1*1 point convolution layer, then uses multi-scale deep convolution with convolution kernel sizes of 1*1, 3*3, and 5*5 to process the expanded feature map, adds the processed feature maps of different scales, and finally adjusts the number of channels of the feature map to the number of channels of the input feature map of the multi-scale convolution block through a 1*1 point convolution layer, and its output is used as the output of the EMCAM multi-scale convolution attention module.
[0030] Furthermore, the dense skip connection module includes:
[0031] a first bridge, a second bridge, a third bridge, a fourth bridge, a fifth bridge, and a sixth bridge;
[0032] The input end of the first bridge is connected to the output ends of the first encoder and the second encoder as the input end of the dense skip connection module, and the output end thereof is connected to the input end of the second decoder and the second bridge respectively; the input end of the second bridge is connected to the output ends of the first bridge and the fourth bridge respectively, and the output end thereof is connected to the input end of the second decoder and the third bridge respectively; the input end of the third bridge is connected to the output ends of the second bridge and the fifth bridge respectively, and the output end thereof is connected to the input end of the second decoder; the input end of the fourth bridge is connected to the output ends of the third encoder and the fourth encoder respectively, and the output end thereof is connected to the input ends of the fifth bridge, the third decoder and the second bridge respectively; the input end of the fifth bridge is connected to the output ends of the fourth bridge and the sixth bridge respectively, and the output end thereof is connected to the input end of the third bridge and the third decoder respectively; the input end of the sixth bridge is connected to the output ends of the fourth encoder and the fifth encoder respectively, and the output end thereof is connected to the input end of the fifth bridge and the fourth decoder respectively;
[0033] The first bridge, the second bridge, the third bridge, the fourth bridge, the fifth bridge and the sixth bridge each include a multi-scale dilated residual module.
[0034] Furthermore, the salient feature map fusion module receives the output feature maps from the first decoder, the second decoder, the third decoder, the fourth decoder, the fifth decoder and the sixth encoder as its input, processes them through a convolution kernel of size 3*3 as the input of the bilinear interpolation method, and upsamples the processed feature maps using the bilinear interpolation method to obtain an output saliency probability map; then the output saliency probability map is subjected to a feature map splicing operation according to the channel dimension, and the spliced saliency probability map is processed through a 1*1 convolution layer and a Sigmoid activation function to obtain a final saliency probability map.
[0035] Furthermore, the loss function of the C-U2Net model is:
[0036] L=L e +λL c
[0037]
[0038] Among them, L is the loss function of the C-U2Net model, L e is the Euclidean distance loss function, L c is the multi-scale density level consistency loss function, λ is the coefficient for adjusting the relative weights of the two component losses, N is the number of images, i is the image sequence number, G(X i ; θ) is the image X i The predicted density map of is the true density map, S is the number of scale levels, j is the scale level serial number, P ave is the average pooling operation, k j Set output size for average pooling.
[0039] The present invention has the following beneficial effects:
[0040] The present invention constructs an improved U2Net network model, which can effectively extract multi-scale features, enhance the ability to capture key features, and fuse features of different levels through the feature map fusion layer to improve the model's sensitivity to details and overall performance. This structure enhances the mangrove crown dark valley feature data on drone images, increases the network model's ability to extract feature context information of mangrove areas, and can improve the accuracy and robustness of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 A flowchart of a dense mangrove counting method based on the improved U2Net model;
[0042] Figure 2 It is a schematic diagram of the structure of the C-U2Net model;
[0043] Figure 3 It is a schematic diagram of the structure of the RSU-7 module;
[0044] Figure 4 It is a schematic diagram of the structure of the MDRB module;
[0045] Figure 5 Schematic diagram of the structure of EMCAM multi-scale convolutional attention module;
[0046] Figure 6 It is a structural diagram of the feature fusion module;
[0047] Figure 7 This is a schematic diagram of the structure of the C-U2Net-lite model;
[0048] Figure 8 Schematic diagram of the dataset production process;
[0049] Fig. 9 This is a comparison chart of the effects of C-U2Net and mainstream network models;
[0050] Fig.10 It is a prediction schematic diagram of 256*256 size of the present invention. DETAILED DESCRIPTION
[0051] The specific implementation modes of the present invention are described below to facilitate those skilled in the art to understand the present invention. However, it should be clear that the present invention is not limited to the scope of the specific implementation modes. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations utilizing the concept of the present invention are protected.
[0052] like Figure 1 As shown, a dense mangrove counting method based on an improved U2Net model provided by an embodiment of the present invention includes the following steps S1 to S6:
[0053] S1, collect UAV lidar data of mangrove growth areas and construct UAV visible light remote sensing image dataset;
[0054] S2. Construct an improved U2Net model; the improved U2Net model includes an encoder, a dense skip connection module, a decoder and a salient feature map fusion module;
[0055] S3, using the encoder to extract mangrove canopy feature maps containing different levels of semantic information from the UAV visible light remote sensing image dataset;
[0056] S4, using a dense skip connection module to adjust the mangrove canopy feature map extracted by the encoder to be semantically consistent with the mangrove canopy feature map restored by the corresponding decoder, and then passing it to the decoder;
[0057] S5, using the decoder to fuse the mangrove canopy feature map transmitted by the dense skip connection module with the mangrove canopy feature map output by the encoder, and then output the result to the salient feature map fusion module;
[0058] S6. Use the significant feature map fusion module to fuse the mangrove crown feature maps of different scales output by the decoder to generate a significant probability map and obtain the mangrove counting result.
[0059] The present invention constructs an improved U2Net model, denoted as C-U2Net network model, which can effectively extract multi-scale features, enhance the ability to capture key features, and fuse features of different levels through the feature map fusion layer to improve the model's sensitivity to details and overall performance. This structure enhances the mangrove crown dark valley feature data on drone images, increases the network model's ability to extract feature context information of mangrove areas, and can improve the accuracy and robustness of the model.
[0060] In an optional embodiment of the present invention, the step of collecting UAV laser radar data of mangrove growth areas and constructing a UAV visible light remote sensing image data set includes:
[0061] Collecting drone lidar data in mangrove growing areas;
[0062] The two-dimensional orthophoto image is reconstructed from the UAV lidar data to build a UAV visible light remote sensing image dataset.
[0063] In an optional embodiment of the present invention, the encoder comprises:
[0064] The first encoder, the second encoder, the third encoder, the fourth encoder, the fifth encoder and the sixth encoder are arranged in sequence from top to bottom; the input end of the first encoder serves as the input end of the encoder, and its output end is connected to the input end of the second encoder; the output end of the second encoder is connected to the input end of the third encoder; the output end of the third encoder is connected to the input end of the fourth encoder; the output end of the fourth encoder is connected to the input end of the fifth encoder; the output end of the fifth encoder is connected to the input end of the sixth encoder; the output end of the sixth encoder serves as the output end of the encoder.
[0065] The decoder comprises:
[0066] The first decoder, the second decoder, the third decoder, the fourth decoder and the fifth decoder are arranged in sequence from bottom to top; the output end of the sixth encoder is spliced with the output end of the fifth encoder, and then connected to the input end of the fifth decoder; the output end of the fifth decoder is spliced with the output end of the fourth encoder, and then connected to the input end of the fourth decoder; the output end of the fourth decoder is spliced with the output end of the third encoder, and then connected to the input end of the third decoder; the output end of the third decoder is spliced with the output end of the second encoder, and then connected to the input end of the second decoder; the output end of the second decoder is spliced with the output end of the first encoder, and then connected to the input end of the first decoder; the output end of the first decoder serves as the output end of the decoder.
[0067] The first encoder, the second encoder, the third encoder and the fourth encoder, and the first decoder, the second decoder, the third decoder and the fourth decoder all include an RSU-L module; the RSU-L module adopts a symmetric encoder-decoder structure with a depth of a positive integer L;
[0068] The RSU-L module includes L+1 encoder units and L-1 decoder units, the input end of the first encoder unit is used as the input end of the RSU-L module, the output end of the first encoder unit is connected to the input end of the second encoder unit, the output end of the second encoder unit is connected to the input end of the third encoder unit, the output end of the third encoder unit is connected to the input end of the next-level encoder unit, and is connected in series to the input end of the L+1th encoder unit, the output feature map of the L+1th encoder unit is combined with the output feature map of the previous-level encoder, and is connected to the input end of the L-1th decoder unit, the output of the L-1th decoder unit is spliced with the output of the same-level encoder unit and connected to the input end of the previous-level decoder unit until the input end of the second decoder unit is connected, the output feature map of the second decoder unit is spliced with the output feature map of the second encoder unit and connected to the input end of the first decoder unit, and the output end of the first decoder unit is used as the output end of the RSU-L module;
[0069] The first encoder unit and the second encoder unit of the RSU-L module are composed of an RSU residual block composed of a Conv2d convolution layer, a BatchNorm2d normalization processing layer and a ReLU activation function layer, and the remaining encoder units further increase the downsampling operation; the L-1th decoder unit at the bottom of the RSU-L module is composed of an RSU residual block composed of a Conv2d convolution layer, a BatchNorm2d normalization processing layer and a ReLU activation function layer, and the remaining decoder units further increase the upsampling operation.
[0070] The fifth encoder, the sixth encoder and the fifth decoder all include an MDRB multi-scale dilated residual module, which uses multi-scale dilated convolution and dense connection to capture feature information at different scales; the MDRB multi-scale dilated residual module includes a first dilated convolution unit, a second dilated convolution unit, a third dilated convolution unit, a fused convolution unit and a residual unit, which are arranged in sequence from top to bottom; each dilated convolution unit is composed of a first Conv2d convolution layer, a first ReLU activation function layer, a second Conv2d dilated convolution layer and a second ReLU activation function layer, the output end of the first convolution layer is connected to the input end of the first activation function layer, and the first activation function layer is connected to the input end of the first activation function layer. The output end of the activation function layer is connected to the input end of the second convolution layer. The second convolution layer adopts dilated convolution with dilation ratios of 1, 2, and 3, and its output end is connected to the input end of the second activation function layer; the first, second, and third dilated convolution units fuse feature maps at different scales together by cascading splicing, and are connected to the input end of the fused convolution unit; the fused convolution unit is composed of a 3*3 convolution layer, which fuses the output feature map of the dilated convolution unit, and its output end is connected to the input end of the residual unit; the residual unit includes a 1*1 convolution layer and an adder, and the input feature map is added to the output of the fused convolution unit through a residual connection, and the output end of the residual unit is used as the output end of the MDRB module.
[0071] like Figure 2As shown, the C-U2Net model constructed in this embodiment adopts a U-shaped network structure. The input end of the U-shaped network structure serves as the input end of the C-U2Net model, which includes six encoders and six decoders in sequence; the first encoder Encoder1 is composed of an RSU-7 module, and its output end is connected to the input end of the second encoder; the second encoder Encoder2 is composed of an RSU-6 module, and its output end is connected to the input end of the third encoder; the third encoder Encoder3 is composed of an RSU-5 module, and its output end is connected to the input end of the fourth encoder; the fourth encoder Encoder4 is composed of an RSU-4 module, and its output end is connected to the input end of the fifth encoder; the fifth encoder Encoder5 is composed of an MDRB module, and its output end is connected to the input end of the sixth encoder; the sixth encoder Encoder6 is composed of an MDRB module, and its output end is spliced with the output end of the fifth encoder and connected to the input end of the fifth decoder. The fifth decoder Decoder5 is composed of the MDRB module, and its output end is spliced with the output end of the fourth encoder and connected to the input end of the fourth decoder; the fourth decoder Decoder4 is composed of the RSU-4 module, and its output end is spliced with the output end of the third encoder and connected to the input end of the third decoder; the third decoder Decoder3 is composed of the RSU-5 module, and its output end is spliced with the output end of the second encoder and connected to the input end of the second decoder; the second decoder Decoder2 is composed of the RSU-6 module, and its output end is spliced with the output end of the first encoder and connected to the input end of the first decoder; the first decoder Decoder1 is composed of the RSU-7 module, and its output end and the second output end of the other decoders and the second output end of the sixth encoder are respectively connected to the input end of the significant feature fusion module, and its output end serves as the output end of the C-U2Net model.
[0072] The U-shaped network structure adopted in this embodiment can effectively improve the extraction capability of mangrove crown width features and the accuracy of mangrove number detection through RSU-L module and MDRB multi-scale dilation residual module, combined with jump connection and splicing operation, and is suitable for high-precision mangrove number detection tasks. And the jump connection can directly transfer high-level features to the low-level decoder. This connection method can effectively restore detail information, which has a certain improvement in restoring the boundaries of mangrove crown width and helps to improve the accuracy and robustness of detection.
[0073] The C-U2Net model constructed in this embodiment includes two types of modules: RSU (ReSidual U-block) module and multi-scale dilated residual module;
[0074] like Figure 3As shown, the RSU-L module adopts a symmetric encoder-decoder structure with a depth of L, where L is a positive integer. In the improved U2Net model, the values of L are 4, 5, 6, and 7 respectively. Each RSU-L module contains L+1 encoders and L-1 decoders. In the encoder part, the feature map is processed by the encoder in sequence as input. The two encoders at the top are composed of RSU residual blocks composed of Conv2d convolution layer, BatchNorm2d normalization processing layer and ReLU activation function layer, and the remaining encoders add downsampling operations on this basis, and perform 2 times maxpool downsampling each time after passing a module. In the decoder part, each decoder receives the output of the same-level encoder and the output of the previous-level decoder as input. The structure of the bottom decoder corresponds to the encoder, and is composed of RSU residual blocks composed of Conv2d convolution layer, BatchNorm2d normalization processing layer and ReLU activation function layer, and the remaining decoders add upsampling operations on this basis, and perform 2 times bilinear upsampling each time before passing a module.
[0075] like Figure 4 As shown in the figure, the MDRB module adopts a multi-scale dilated convolution structure and a dense connection structure; the MDRB module includes a first dilated convolution unit, a second dilated convolution unit, a third dilated convolution unit, a fused convolution unit and a residual unit; each dilated convolution unit is composed of a first Conv2d convolution layer, a first ReLU activation function layer, a second Conv2d dilated convolution layer and a second ReLU activation function layer, the output end of the first convolution layer is connected to the input end of the first activation function layer, the output end of the first activation function layer is connected to the input end of the second convolution layer, and the second convolution layer adopts a dilation ratio of 1, 2, 3, and its output end is connected to the input end of the second activation function layer; the first, second and third dilated convolution units are cascaded and spliced to fuse the feature maps at different scales together, and are connected to the input end of the fused convolution unit; the fused convolution unit is composed of a 3*3 convolution layer, which fuses the output feature map of the dilated convolution unit and changes the number of channels, and its output end is connected to the input end of the residual unit; the residual unit includes a 1*1 convolution layer and an adder, which adds the input feature map to the output of the fused convolution unit through a residual connection, and the output end of the residual unit serves as the output end of the MDRB module.
[0076] The different depths of the RSU-L module in this embodiment can capture features at different scales, which is crucial for the identification of mangrove crowns, because the crowns of mangroves vary in size, shape and density, and multi-scale feature extraction capabilities are required to distinguish different types of crowns; the MDRB module replaces downsampling and upsampling operations with dilated convolutions of different scales, thereby increasing the receptive field and enhancing the ability to capture information at different scales. It can keep the size of the feature map unchanged while extracting features, which plays a role in maintaining the fine structure of the mangrove crown and helps the model better identify the edge and internal structure of the crown.
[0077] In an optional embodiment of the present invention, the RSU-L module and the MDRB module each further include an EMCAM multi-scale convolution attention module, and the EMCAM multi-scale convolution attention module includes a channel attention block, a spatial attention block and a multi-scale convolution block arranged in sequence;
[0078] The channel attention block includes an average pooling layer, a maximum pooling layer, a convolution layer and a Sigmoid function, and its input end is a multi-channel image feature map. The average pooling and maximum pooling results of the input feature map are calculated as the input of the convolution layer, and then the two pooling results are respectively applied with 1*1 convolution, ReLU activation function and 1*1 convolution, and then added and the final attention weight is obtained by the Sigmoid function. Finally, the final attention weight is multiplied with the input feature map to obtain the channel attention feature map;
[0079] The spatial attention block includes an average pooling layer, a maximum pooling layer, a convolution layer and a Sigmoid function, which receives the channel attention feature map output by the channel attention block as input, connects the input ends of the average pooling layer and the maximum pooling layer respectively, calculates the average pooling result and the maximum pooling result of the input feature map, wherein the pooling operation is performed along the channel dimension, and the outputs of the average pooling layer and the maximum pooling layer are spliced along the channel dimension to form a new feature map; after applying convolution to the spliced feature map, a spatial attention weight is obtained by the Sigmoid function, and finally the spatial attention weight is multiplied by the input feature map to obtain the spatial attention feature map;
[0080] The multi-scale convolution block receives the output of the spatial attention block as input, first performs channel expansion through a 1*1 point convolution layer, then uses multi-scale deep convolution with convolution kernel sizes of 1*1, 3*3, and 5*5 to process the expanded feature map, adds the processed feature maps of different scales, and finally adjusts the number of channels of the feature map to the number of channels of the input feature map of the multi-scale convolution block through a 1*1 point convolution layer, and its output is used as the output of the EMCAM multi-scale convolution attention module.
[0081] like Figure 5As shown in the figure, the EMCAM multi-scale convolutional attention module can effectively enhance the model's ability to capture the characteristics of mangrove crown width and improve the accuracy of mangrove number detection through the combination of channel attention block (CAB), spatial attention block (SAB) and multi-scale convolution block (MSCB). CAB generates channel attention weights by average pooling and maximum pooling of multi-channel image feature maps, and applies convolution and activation functions to highlight important features. SAB further enhances attention in the spatial dimension by concatenating the average pooling and maximum pooling results and applying convolution and sigmoid functions to generate spatial attention weights. MSCB fuses feature information of different scales through multi-scale convolution, improving the model's sensitivity to crowns of different sizes and shapes. This multi-scale attention mechanism helps to retain the detailed information of mangrove crown width.
[0082] In an optional embodiment of the present invention, the dense skip connection module includes:
[0083] a first bridge, a second bridge, a third bridge, a fourth bridge, a fifth bridge, and a sixth bridge;
[0084] The input end of the first bridge is connected to the output ends of the first encoder and the second encoder as the input end of the dense skip connection module, and the output end thereof is connected to the input end of the second decoder and the second bridge respectively; the input end of the second bridge is connected to the output ends of the first bridge and the fourth bridge respectively, and the output end thereof is connected to the input end of the second decoder and the third bridge respectively; the input end of the third bridge is connected to the output ends of the second bridge and the fifth bridge respectively, and the output end thereof is connected to the input end of the second decoder; the input end of the fourth bridge is connected to the output ends of the third encoder and the fourth encoder respectively, and the output end thereof is connected to the input ends of the fifth bridge, the third decoder and the second bridge respectively; the input end of the fifth bridge is connected to the output ends of the fourth bridge and the sixth bridge respectively, and the output end thereof is connected to the input end of the third bridge and the third decoder respectively; the input end of the sixth bridge is connected to the output ends of the fourth encoder and the fifth encoder respectively, and the output end thereof is connected to the input end of the fifth bridge and the fourth decoder respectively;
[0085] The first bridge, the second bridge, the third bridge, the fourth bridge, the fifth bridge and the sixth bridge all include MDRB modules. In this embodiment, a dense skip connection module is added starting from the second layer encoder of the U-shaped network structure. SkipBlock1 is respectively connected to the output ends of Encoder2 and Encoder3 of the U-shaped network, and its output end is respectively connected to the input end of Decoder2 and SkipBlock2; the input end of SkipBlock2 is respectively connected to the output ends of SkipBlock1 and SkipBlock4, and its output end is respectively connected to Decoder2 and SkipBlock3; the input end of SkipBlock3 is respectively connected to the output ends of SkipBlock2 and SkipBlock5, and its output end is respectively connected to Decoder2 and SkipBlock3. oder2; the input end of the SkipBlock4 is respectively connected to the output ends of Encoder3 and Encoder4, and its output end is respectively connected to SkipBlock5, Decoder3 and SkipBlock2; the input end of the SkipBlock5 is respectively connected to the output ends of SkipBlock4 and SkipBlock6, and its output end is respectively connected to SkipBlock3 and Decoder3; the input end of the SkipBlock6 is respectively connected to the output ends of Encoder4 and Encoder5, and its output end is respectively connected to SkipBlock5 and Decoder4.
[0086] In the traditional U-shaped structure, the skip connection directly connects the feature maps between the encoder and the decoder, which may lead to the fusion of semantically dissimilar feature maps. Adding a redesigned skip path can make up for the semantic differences between the encoder and decoder subpaths. At the same time, adding a skip module only on the small-scale feature path can not only refine the small-scale feature maps, but also effectively reduce the number of parameters and training difficulty. In addition, all convolutional layers on the skip path use a kernel of size 3*3 to enhance the local relevance and semantic consistency of the features.
[0087] In an optional embodiment of the present invention, Figure 6As shown, the salient feature map fusion module receives the output feature maps from the first decoder, the second decoder, the third decoder, the fourth decoder, the fifth decoder and the sixth encoder as its input, processes them through a convolution kernel of size 3*3 as the input of the bilinear interpolation method, and upsamples the processed feature maps using the bilinear interpolation method to obtain an output saliency probability map; then the output saliency probability map is subjected to a feature map splicing operation according to the channel dimension, and the spliced saliency probability map is processed through a 1*1 convolution layer and a Sigmoid activation function to obtain a final saliency probability map.
[0088] The salient feature map fusion module constructed in this embodiment can effectively integrate multi-scale information, restore spatial resolution through convolution operations and bilinear interpolation, and finally generate a high-quality saliency probability map through feature map splicing, 1x1 convolution and Sigmoid activation function. This is particularly useful for mangrove crown feature extraction and number detection tasks. Using this module can improve detection accuracy, retain details and suppress noise, thereby improving overall performance.
[0089] In an optional embodiment of the present invention, Figure 7 As shown, the C-U2Net-lite model is a lightweight version of the C-U2Net model. C-U2Net-lite reduces one encoder and one decoder to reduce the number of parameters. The encoder of the C-U2Net-lite includes a first encoder, a second encoder, a third encoder, a fourth encoder and a fifth encoder. The decoder includes a first decoder, a second decoder, a third decoder and a fourth decoder. The first encoder, the second encoder, the third encoder and the fourth encoder and the first decoder, the second decoder, the third decoder and the fourth decoder all include an RSU-L module. The fifth encoder, the first bridge, the second bridge, the third bridge, the fourth bridge, the fifth bridge and the sixth bridge of the C-U2Net-lite all include an MDRB module.
[0090] The C-U2Net-lite model constructed in this embodiment can effectively reduce the number of parameters, and effectively reduce the size of the model while maintaining the performance of the C-U2Net model as much as possible, thereby achieving a faster training cycle and response speed to meet different needs in some scenarios and improve the versatility of the model.
[0091] In an optional embodiment of the present invention, the loss function of the C-U2Net model is:
[0092] L=L e +λL c
[0093]
[0094] Among them, L is the loss function of the improved U2Net model, L e is the Euclidean distance loss function, L c is the multi-scale density level consistency loss function, λ is the coefficient for adjusting the relative weights of the two component losses, N is the number of images, i is the image sequence number, G(X i ; θ) is the image X i The predicted density map of is the true density map, S is the number of scale levels, j is the scale level serial number, P ave is the average pooling operation, k j Set output size for average pooling.
[0095] The loss function of the C-U2Net network constructed in this embodiment adopts a hybrid function of a multi-scale density level consistency loss function and a Euclidean distance loss function as the loss function.
[0096] The multi-scale density level consistency loss function sets three pooling windows of different sizes to calculate the average pooling loss. The pooling window sizes are 1×1, 2×2, and 4×4, respectively. The first scale-level window with an output size of 1×1 captures the global features of the density level, while the other two scale-level windows represent the local density levels of the image blocks. For each pooling window size, the average pooling loss between the input and target values is calculated and accumulated.
[0097] The Euclidean distance loss function is used as the loss function for general density distribution tasks, but the Euclidean loss function only focuses on pixel-level errors and does not take into account the structural correlation between the predicted density map and the true density map. There is a certain spatial structure between tree density maps. By combining the Euclidean loss function and the multi-scale density level consistency loss function, the total loss L is obtained. The weight between the two is adjusted by the hyperparameter e to obtain the final total loss.
[0098] The hybrid loss function used in this embodiment combines multi-scale density level consistency loss and Euclidean distance loss, and captures global and local density features through pooling windows of different sizes. This multi-scale approach helps the network better understand the structure and distribution pattern of mangroves. By adjusting the hyperparameter e to balance the weights of the two losses, the consistency between the predicted density map and the true density map can be more accurately evaluated while maintaining the integrity of the mangrove details.
[0099] like Figure 8As shown in the figure, the UAV Lidar data is used to construct a mangrove density distribution dataset for training the C-U2Net network. The steps include but are not limited to point cloud denoising, ground point classification, point cloud normalization, construction of DEM digital elevation model, construction of DSM digital surface model, construction of CHM canopy height model, CHM canopy segmentation, generation of seed points, manual correction, canopy feature mapping, and Gaussian kernel function to produce density distribution map.
[0100] First, the high-resolution UAV LiDAR data is denoised to remove noise points caused by high-order errors (such as interference from flying objects) and low-order errors (abnormal points in the measurement process); the denoised point cloud data is classified using the Improved Progressive TIN Densification (IPTD) filter algorithm to distinguish ground points from non-ground points; then the Digital Elevation Model (DEM) is constructed using the irregular triangulation interpolation method, and the Digital Surface Model (DSM) is generated using the Kriging interpolation technique; after obtaining the DEM and DSM models, the canopy height model (CanopyHeight Model, CHM); Next, for mangrove plants with a height of more than 0.5m, the watershed algorithm is used to segment individual trees. This algorithm regards the high points on the CHM as peaks and the low points as valleys. Barriers are set where the water flows converge. The dividing lines corresponding to these barriers form the boundaries of the crown, thereby achieving the segmentation of individual trees; According to the CHM individual tree segmentation based on Lidar data, the center point of each individual tree, that is, the canopy center point, can be obtained. However, CHM segmentation may cause over-segmentation or under-segmentation of mangrove point cloud data, affecting the estimation accuracy of individual tree parameters such as tree height and crown width. Therefore, it is necessary to optimize the seed points through manual visual interpretation to meet the standards of the data set. After the crown marking is completed manually, the seed points are further vectorized to obtain the corresponding seed point files. These seed point files record the spatial distribution of mangroves, which not only contain the relative coordinate information of each seed point, but also reflect the crown width and tree height of the mangroves. Then, the geometric relationship between the gridded image and the seed points is constructed, and the resolution of these point grids is reconstructed to the same spatial resolution as the visible light image to be trained. Then, according to the crown area size and tree height, C is used to represent the crown, and three scale levels C are set. l , C m and C h Represent small, medium, and large tree crowns, respectively. For each scale, different Gaussian kernels are applied to reflect the blur effect of the tree crown at that scale to construct a density distribution map. Assume that the marked tree is located at pixel p i, expressed as the indicator function δ{pp i}, where p represents the index of any pixel, indicating that the function is i If the value is 1 at the position and 0 at other positions, the grid tree distribution H(p) of N trees can be expressed as:
[0101]
[0102] In order to convert it into a density function, a discrete Gaussian blur kernel is convolved with the tree distribution map, and the density distribution can be expressed as:
[0103]
[0104] The Gaussian function contains two key parameters: the standard deviation σ and the size of the Gaussian blur kernel. These two parameters determine the size and integral value of a single marker in the density map, and have a significant impact on the estimation of the tree density map. Where j∈{l,m,h}, j depends on the scale level C to which the i-th tree belongs. j , and once the corresponding density map is available, the task of tree counting is converted to a function F, such that D = F(I), where I represents the remote sensing image. Then, the total number of trees N in the density map is calculated as follows:
[0105]
[0106] Where subscript i represents the row, subscript j represents the column, H represents the height of the density map, and W represents the width of the density map. Finally, the gridded Gaussian density map and visible light map are cut into 256x256 pixel images to make two datasets of different densities, GaoQiaoMangrove_A and GaoQiaoMangrove_B; the samples in GaoQiaoMangrove_A are randomly divided into 1700 training subsets and 300 test subsets, and the samples in GaoQiaoMangrove_B are randomly divided into 2402 training subsets and 300 test subsets; each image in the GaoQiaoMangrove_A and GaoQiaoMangrove_B datasets has an average of 632 and 236 trees marked, and a maximum of 3005 and 1535 trees marked, with a total of about 1.9 million marked trees; compared with the B dataset, the A dataset has a higher mangrove density and more complex scene characteristics, while the mangrove density of the B dataset is lower and the scene is relatively simple.
[0107] Table 1 GaoQiaoMangrove dataset
[0108]
[0109] The experimental platform used in the present invention is equipped with a 13th Gen Intel Core i9-13900K processor, 128G running memory, a GPU of NVIDIARTX 4090D graphics card, 24G video memory, and a window11 operating system. The PyTorch open source framework of Cuda 12.3 is used, and data processing is performed through Python 3.8. During the training process of the model, the parameters of the network model are optimized using the Adam optimizer, the initial learning rate is set to 0.0001, and the hyperparameters of the model parameter update speed are controlled by the learning rate to achieve a better convergence speed; the input image size is set to 256x256 pixels, and the maximum epoch is set to 200 rounds; BatchSize is set to 16, and 16 images are processed simultaneously each time the parameters of the model are updated; during the training process, the data set is divided into a training set, a validation set, and a test set. The training set is used to train the model, the validation data set is used to supervise the training results to prevent overfitting, and the test data set is used for independent model performance evaluation; during the training process, the training parameters with the lowest loss value during the training process are saved as the final prediction model;
[0110] The present invention uses four evaluation indicators, including MAE mean absolute error (the average of the absolute difference between each predicted value and the actual value), RMSE root mean square error (the square root of the average of the square of the prediction error), rMAE relative mean absolute error and rRMSE relative root mean square error for quantitative evaluation. The expressions of the indicators used are as follows:
[0111]
[0112] Where S represents the number of samples, the subscript i represents the index of the sample, and N net Indicates the number of trees estimated by the network, N obs Indicates the number of observed trees. Generally speaking, lower MAE, rMAE, RMSE, and rRMSE values indicate better counting accuracy.
[0113] As shown in Table 2, the C-U2Net model of the present invention is compared with the five mainstream network models of MCNN, CRSNet, SANet, DSNet, and TreeCountNet on the test set, and the comparison results are obtained with MAE and RMSE as the main evaluation indicators, and a comparison table of evaluation results is made; on the GaoQiaoMangrove_A subset, C-U2Net has the best effect, with MAE and RMSE reaching the lowest 160.79 and 231.80, and the improvement effect is significant. Compared with the classic multi-column network MCNN, the MAE and RMSE of C-U2Net are reduced by 15.3% and 15.2%, respectively. The C-U2Net-lite lightweight model performs second, with MAE and RMSE reaching 163.23 and 235.07, and the MAE and RMSE of C-U2Net without attention mechanism reach 169.98 and 239.16, respectively, which proves the effectiveness of MDRB and RSU modules; in the case of relatively sparse tree density Ga On the oQiaoMangrove_B subset, C-U2Net ranked among the top three with good results, with MAE and RMSE reaching 34.48 and 60.53. The above comparative experimental results verify the effectiveness of the C-U2Net model in counting dense mangroves on drone images.
[0114] Table 2 Comparison of evaluation results of different models on the dataset
[0115]
[0116]
[0117] like Fig. 9 As shown, the C-U2Net model and the C-U2Net-lite model of the present invention perform regression analysis on the GaoQiaoMangrove_A dataset, calculate the MAE, RMSE, RMAE, rRMSE indicators and the least squares linear fitting equation, and draw a visual scatter plot;
[0118] like Fig.10 As shown in the figure, the prediction results of the C-U2Net model are visualized. The first column shows the original images in the dataset, the second column shows the label density map corresponding to these original images, and the third column shows the prediction density map generated by the C-U2Net model training. Four test set samples a, b, c, and d are extracted for analysis, and the prediction effect comparison table is shown in Table 3.
[0119] As shown in Table 3, in areas where mangroves are sparsely distributed, the C-U2Net model can distinguish plants with finer granularity and roughly estimate the tree distribution of mangroves. When there are fewer mangroves and they are sparsely distributed, the prediction effect is better and the error is smaller. For scenes where mangroves are densely distributed, the samples can also be effectively predicted, and the error is controlled within a certain range. The network prediction results are close to the actual tree distribution.
[0120] Table 3 Comparison of prediction results
[0121]
[0122] As shown in Table 4, in order to evaluate the effectiveness of various optimizations in network design, the C-U2Net model was subjected to multiple ablation experiments based on the GaoQiaoMangrove_A dataset, and six variant structures were selected for performance comparison. The experimental results are shown in Table 4. Model A represents the removal of the MDRB module, with a lower MAE but the largest number of parameters; Model B represents the removal of the RSU-L module; Model C represents C-U2Net-lite with the EMCAM attention mechanism removed; Model D represents C-U2Net with the EMCAM attention mechanism removed; Model E represents the complete C-U2Net-lite model; and Model F represents the complete C-U2Net model. Since the benchmark model is responsible for mapping the extracted feature map to regress the density map, it cannot be removed. From the experimental results, it can be seen that combining the jump connection structure with the RSU-L and EMCAM modules simultaneously can obtain the best MAE and RMSE indicators, which significantly improves the model performance.
[0123] Table 4 Ablation experiment results
[0124]
[0125]
[0126] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0127] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0128] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0129] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
[0130] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and should be understood that the protection scope of the present invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific variations and combinations that do not deviate from the essence of the present invention based on the technical revelations disclosed by the present invention, and these variations and combinations are still within the protection scope of the present invention.
Claims
1. A dense mangrove counting method based on an improved U2Net model, characterized in that: The following steps are involved: Collect UAV lidar data in mangrove growth areas and construct a UAV visible light remote sensing image dataset; Constructing an improved U2Net model; the improved U2Net model includes an encoder, a dense skip connection module, a decoder and a salient feature map fusion module; The encoder is used to extract mangrove canopy feature maps containing different levels of semantic information from the UAV visible light remote sensing image dataset. The dense skip connection module is used to adjust the mangrove canopy feature map extracted by the encoder to be semantically consistent with the mangrove canopy feature map restored by the corresponding decoder and then passed to the decoder; The decoder is used to fuse the mangrove canopy feature map transmitted by the dense skip connection module with the mangrove canopy feature map output by the encoder and then output to the salient feature map fusion module; The mangrove crown feature maps of different scales output by the decoder are fused using the salient feature map fusion module to generate a saliency probability map and obtain the mangrove counting result.
2. According to claim 1, a dense mangrove counting method based on an improved U2Net model is characterized in that: The method of collecting UAV lidar data of mangrove growth areas and constructing a UAV visible light remote sensing image dataset includes: Collecting drone lidar data in mangrove growing areas; The two-dimensional orthophoto image is reconstructed from the UAV lidar data to build a UAV visible light remote sensing image dataset.
3. The dense mangrove counting method based on the improved U2Net model according to claim 1 is characterized in that: The encoder comprises: The first encoder, the second encoder, the third encoder, the fourth encoder, the fifth encoder and the sixth encoder are arranged in sequence from top to bottom; the input end of the first encoder serves as the input end of the encoder, and its output end is connected to the input end of the second encoder; the output end of the second encoder is connected to the input end of the third encoder; the output end of the third encoder is connected to the input end of the fourth encoder; the output end of the fourth encoder is connected to the input end of the fifth encoder; the output end of the fifth encoder is connected to the input end of the sixth encoder; the output end of the sixth encoder serves as the output end of the encoder.
4. The dense mangrove counting method based on the improved U2Net model according to claim 3 is characterized in that: The decoder comprises: The first decoder, the second decoder, the third decoder, the fourth decoder and the fifth decoder are arranged in sequence from bottom to top; the output end of the sixth encoder is spliced with the output end of the fifth encoder, and then connected to the input end of the fifth decoder; the output end of the fifth decoder is spliced with the output end of the fourth encoder, and then connected to the input end of the fourth decoder; the output end of the fourth decoder is spliced with the output end of the third encoder, and then connected to the input end of the third decoder; the output end of the third decoder is spliced with the output end of the second encoder, and then connected to the input end of the second decoder; the output end of the second decoder is spliced with the output end of the first encoder, and then connected to the input end of the first decoder; the output end of the first decoder serves as the output end of the decoder.
5. The dense mangrove counting method based on the improved U2Net model according to claim 4 is characterized in that: The first encoder, the second encoder, the third encoder and the fourth encoder, and the first decoder, the second decoder, the third decoder and the fourth decoder all include an RSU-L module; the RSU-L module adopts a symmetric encoder-decoder structure with a depth of a positive integer L; The RSU-L module includes L+1 encoder units and L-1 decoder units, the input end of the first encoder unit is used as the input end of the RSU-L module, the output end of the first encoder unit is connected to the input end of the second encoder unit, the output end of the second encoder unit is connected to the input end of the third encoder unit, the output end of the third encoder unit is connected to the input end of the next-level encoder unit, and is connected in series to the input end of the L+1th encoder unit, the output feature map of the L+1th encoder unit is combined with the output feature map of the previous-level encoder, and is connected to the input end of the L-1th decoder unit, the output of the L-1th decoder unit is spliced with the output of the same-level encoder unit and connected to the input end of the previous-level decoder unit until the input end of the second decoder unit is connected, the output feature map of the second decoder unit is spliced with the output feature map of the second encoder unit and connected to the input end of the first decoder unit, and the output end of the first decoder unit is used as the output end of the RSU-L module; The first encoder unit and the second encoder unit of the RSU-L module are composed of an RSU residual block composed of a Conv2d convolution layer, a BatchNorm2d normalization processing layer and a ReLU activation function layer, and the remaining encoder units further increase the downsampling operation; the L-1th decoder unit at the bottom of the RSU-L module is composed of an RSU residual block composed of a Conv2d convolution layer, a BatchNorm2d normalization processing layer and a ReLU activation function layer, and the remaining decoder units further increase the upsampling operation.
6. The dense mangrove counting method based on the improved U2Net model according to claim 5 is characterized in that: The fifth encoder, the sixth encoder and the fifth decoder all include a multi-scale dilated residual module, and the multi-scale dilated residual module uses multi-scale dilated convolution and dense connection to capture feature information at different scales; The multi-scale dilated residual module includes a first dilated convolution unit, a second dilated convolution unit, a third dilated convolution unit, a fused convolution unit and a residual unit arranged in sequence from top to bottom; each dilated convolution unit is composed of a first Conv2d convolution layer, a first ReLU activation function layer, a second Conv2d dilated convolution layer and a second ReLU activation function layer, the output end of the first convolution layer is connected to the input end of the first activation function layer, the output end of the first activation function layer is connected to the input end of the second convolution layer, and the second convolution layer adopts dilated convolution with dilation ratios of 1, 2, and 3 , whose output end is connected to the input end of the second activation function layer; the first, second and third expansion convolution units fuse the feature maps at different scales together by cascading splicing, and are connected to the input end of the fusion convolution unit; the fusion convolution unit is composed of a 3*3 convolution layer, which fuses the output feature map of the expansion convolution unit, and its output end is connected to the input end of the residual unit; the residual unit includes a 1*1 convolution layer and an adder, which adds the input feature map to the output of the fusion convolution unit through a residual connection, and the output end of the residual unit is used as the output end of the multi-scale expansion residual module.
7. The dense mangrove counting method based on the improved U2Net model according to claim 6 is characterized in that: The RSU-L module and the multi-scale dilated residual module each further include an EMCAM multi-scale convolutional attention module, wherein the EMCAM multi-scale convolutional attention module includes a channel attention block, a spatial attention block and a multi-scale convolutional block arranged in sequence; The channel attention block includes an average pooling layer, a maximum pooling layer, a convolution layer and a Sigmoid function, and its input end is a multi-channel image feature map. The average pooling and maximum pooling results of the input feature map are calculated as the input of the convolution layer, and then the two pooling results are respectively applied with 1*1 convolution, ReLU activation function and 1*1 convolution, and then added and the final attention weight is obtained by the Sigmoid function. Finally, the final attention weight is multiplied with the input feature map to obtain the channel attention feature map; The spatial attention block includes an average pooling layer, a maximum pooling layer, a convolution layer and a Sigmoid function, which receives the channel attention feature map output by the channel attention block as input, connects the input ends of the average pooling layer and the maximum pooling layer respectively, and calculates the average pooling result and the maximum pooling result of the input feature map, wherein the pooling operation is performed along the channel dimension, and the outputs of the average pooling layer and the maximum pooling layer are spliced along the channel dimension respectively to form a new feature map; Apply convolution to the concatenated feature map and then use the Sigmoid function to get the spatial attention weight. Finally, multiply the spatial attention weight with the input feature map to get the spatial attention feature map. The multi-scale convolution block receives the output of the spatial attention block as input, first performs channel expansion through a 1*1 point convolution layer, then uses multi-scale deep convolution with convolution kernel sizes of 1*1, 3*3, and 5*5 to process the expanded feature map, adds the processed feature maps of different scales, and finally adjusts the number of channels of the feature map to the number of channels of the input feature map of the multi-scale convolution block through a 1*1 point convolution layer, and its output is used as the output of the EMCAM multi-scale convolution attention module.
8. The dense mangrove counting method based on the improved U2Net model according to claim 7 is characterized in that: The dense skip connection module comprises: a first bridge, a second bridge, a third bridge, a fourth bridge, a fifth bridge, and a sixth bridge; The input end of the first bridge is connected to the output ends of the first encoder and the second encoder as the input end of the dense skip connection module, and the output end thereof is connected to the input end of the second decoder and the second bridge respectively; the input end of the second bridge is connected to the output ends of the first bridge and the fourth bridge respectively, and the output end thereof is connected to the input end of the second decoder and the third bridge respectively; the input end of the third bridge is connected to the output ends of the second bridge and the fifth bridge respectively, and the output end thereof is connected to the input end of the second decoder; the input end of the fourth bridge is connected to the output ends of the third encoder and the fourth encoder respectively, and the output end thereof is connected to the input ends of the fifth bridge, the third decoder and the second bridge respectively; the input end of the fifth bridge is connected to the output ends of the fourth bridge and the sixth bridge respectively, and the output end thereof is connected to the input end of the third bridge and the third decoder respectively; the input end of the sixth bridge is connected to the output ends of the fourth encoder and the fifth encoder respectively, and the output end thereof is connected to the input end of the fifth bridge and the fourth decoder respectively; The first bridge, the second bridge, the third bridge, the fourth bridge, the fifth bridge and the sixth bridge each include a multi-scale dilated residual module.
9. The dense mangrove counting method based on the improved U2Net model according to claim 1 is characterized in that: The salient feature map fusion module receives the output feature maps from the first decoder, the second decoder, the third decoder, the fourth decoder, the fifth decoder and the sixth encoder as its input, processes them through a convolution kernel of size 3*3 as the input of the bilinear interpolation method, and upsamples the processed feature maps using the bilinear interpolation method to obtain an output saliency probability map; then the output saliency probability map is subjected to a feature map splicing operation according to the channel dimension, and the spliced saliency probability map is processed through a 1*1 convolution layer and a Sigmoid activation function to obtain a final saliency probability map.
10. The dense mangrove counting method based on the improved U2Net model according to claim 1 is characterized in that: The loss function of the improved U2Net model is: L=L e +λL c Among them, L is the loss function of the improved U2Net model, L e is the Euclidean distance loss function, L c is the multi-scale density level consistency loss function, λ is the coefficient for adjusting the relative weights of the two component losses, N is the number of images, i is the image sequence number, G(X i ; θ) is the image X i The predicted density map of is the true density map, S is the number of scale levels, j is the scale level serial number, P ave is the average pooling operation, k j Set output size for average pooling.
Citation Information
Patent Citations
Intestinal tract lesion segmentation method combining multi-scale U-shaped residual encoder and overall reverse attention mechanism
CN112712528A
Reservoir water body extraction method based on remote sensing image
CN114821295A
Bacterial colony image automatic counting method based on U2-Net and Resnet50
CN116503853A
Semantic segmentation method, system and equipment for multi-scale group crop image
CN117315252A
Cited By
Tree height and biomass collaborative inversion method, system and device based on codec double focusing and medium
CN120522692A