Farmland identification method and device, equipment and storage medium
By constructing a farmland identification model based on a spatial attention mechanism and utilizing multi-task identification technology, the problem of inaccurate farmland identification caused by roadside tree occlusion was solved, achieving higher accuracy in farmland range and boundary identification.
Patent Information
- Application Number
- CN202210937606.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-05
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2042-08-05
AI Technical Summary
The accuracy of farmland identification is low due to the obstruction of roadside trees and the difficulty in visually distinguishing between field roads and roadside trees by vegetation information.
A farmland identification model based on spatial attention mechanism is adopted. Through multi-task identification technology, the encoding module, decoding module and spatial attention module are used to extract and optimize features from the image data to be identified. Combined with a multi-task pixel classification module, the farmland range and boundary are identified.
It has improved the ability to identify farmland boundaries, increased the ability to identify roadside trees and field roads, and improved the accuracy of farmland area identification.
Smart Images

Figure CN115439740B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of arable land application, and in particular to an arable land identification method, device, equipment and storage medium. BACKGROUND
[0002] Arable land resources are the basis for ensuring food security. China has a vast area of arable land, and it is necessary to accurately identify arable land for monitoring the non-agriculturalization, non-foodization, abandonment and fallow of arable land.
[0003] However, arable land agricultural landscapes are complex and diverse, with small and fragmented plots, the presence of field roads and avenue trees greatly increasing the difficulty of arable land identification. In recent years, with the widespread use of medium and high resolution images, it is possible to visually distinguish arable land, field roads and avenue trees using medium and high resolution images. However, due to the shading of avenue trees and the vegetation information presented by the avenue trees themselves, it is difficult to accurately distinguish field roads and avenue trees from arable land patches visually, resulting in low accuracy of arable land identification. SUMMARY
[0004] The present application provides an arable land identification method, device, equipment and storage medium to solve the problem that due to the shading of avenue trees and the vegetation information presented by the avenue trees themselves, it is difficult to accurately distinguish field roads and avenue trees from arable land patches in the prior art, aiming to improve the accuracy of arable land identification.
[0005] The present application provides an arable land identification method, device, equipment and storage medium to solve the problem that due to the shading of avenue trees and the vegetation information presented by the avenue trees themselves, it is difficult to accurately distinguish field roads and avenue trees from arable land patches in the prior art, aiming to improve the accuracy of arable land identification.
[0006] Obtaining image data to be identified;
[0007] Inputting the image data to be identified into an arable land identification model to perform multi-task identification on the image data to be identified using the arable land identification model, and outputting arable land range results and arable land boundary identification results;
[0008] The arable land identification model is obtained based on pre-collected training remote sensing images, arable land range result labels and arable land boundary identification result labels corresponding to the training remote sensing images, and multi-task training of a spatial attention mechanism.
[0009] Optionally, according to the arable land identification provided by the present application, the arable land identification model includes an encoding module, a decoding module, a spatial attention module and a multi-task pixel classification module, wherein:
[0010] The encoding module includes a plurality of series of encoding units, each encoding unit includes a residual block and a max pooling layer except the last encoding unit, and the last encoding unit includes a residual block.
[0011] The decoding module comprises a plurality of decoding units connected in series, each decoding unit comprising an up-sampling layer, a feature connection layer and a residual block;
[0012] The output of the residual block in each encoding unit is input into the corresponding decoding unit after being processed by the spatial attention module;
[0013] The output of the residual block of the last decoding unit is taken as the input of the multi-task pixel classification module.
[0014] Optionally, according to the cultivated land recognition provided by the present application, the pre-trained cultivated land recognition model is used to perform multi-task recognition on the to-be-recognized image data, and the cultivated land range and the cultivated land boundary corresponding to the to-be-recognized image data are obtained, comprising:
[0015] The to-be-recognized image data is subjected to feature extraction by the residual block in the first encoding unit, and the encoding feature map output by the residual block in the first encoding unit is obtained;
[0016] The encoding feature map is subjected to pooling processing by the maximum pooling layer in the first encoding unit, and the pooling processing feature map is obtained, and the pooling processing feature map is taken as the input of the next encoding unit until the encoding feature map output by the residual block in the last encoding unit is obtained;
[0017] The first target encoding feature map matching the encoding feature map of the last encoding unit is selected from the encoding feature maps output by each encoding unit except the last encoding unit;
[0018] The first target encoding feature map and the encoding feature map of the last encoding unit are subjected to feature optimization by the spatial attention module, and the first optimized feature map is obtained;
[0019] The encoding feature map of the last encoding unit is subjected to up-sampling processing by the up-sampling layer in the first decoding unit, and the first up-sampling feature map is obtained;
[0020] The first optimized feature map and the first up-sampling feature map are subjected to feature connection by the feature connection layer, and the first target connection feature map is obtained;
[0021] The first target connection feature map is subjected to decoding by the residual block in the first decoding unit, and the decoding feature map output by the current decoding unit is obtained;
[0022] Based on the encoding feature maps output by each encoding unit and the decoding feature map output by the current decoding unit, the input feature map of the residual block in the next decoding unit is determined until the decoding feature map output by the last encoding unit is obtained;
[0023] Input the decoded feature map output by the last decoding unit into the multi-task pixel classification module to obtain the cultivated land range result and the cultivated land boundary identification result.
[0024] Optionally, according to the cultivated land identification provided by the present application, the input feature map of the residual block in the next decoding unit is determined based on the encoded feature map output by each encoding unit and the decoded feature map output by the current decoding unit until the decoded feature map output by the last encoding unit is obtained, comprising:
[0025] Based on the encoded feature map output by the residual block in each encoding unit, a second target encoded feature map matching the decoded feature map of the current decoding unit is screened out;
[0026] The second target encoded feature map and the decoded feature map are optimized in feature by the spatial attention module to obtain a second optimized feature map;
[0027] The decoded feature map output by the current decoding unit is up-sampled by the up-sampling layer in the next decoding unit of the current decoding unit to obtain a second up-sampled feature map;
[0028] The second optimized feature map and the second up-sampled feature map are connected in feature by the feature connection layer in the next decoding unit to obtain a second target connection feature map, and the second target connection feature map is taken as the input of the residual block in the next decoding unit to obtain the decoded feature map of the next decoding unit;
[0029] Return to execute the step of screening out the second target encoded feature map matching the decoded feature map of the current decoding unit based on the encoded feature map output by the residual block in each encoding unit until the decoded feature map output by the last decoding unit is obtained.
[0030] Optionally, according to the cultivated land identification provided by the present application, the spatial attention module comprises a first convolution layer, a second convolution layer, a third convolution layer, a filter and a first up-sampling layer, and the second optimized feature map is obtained by optimizing the second target encoded feature map and the decoded feature map in feature by the spatial attention module, comprising:
[0031] The second target encoded feature map is convoluted by the first convolution layer to obtain a first feature map;
[0032] The decoded feature map is convoluted by the second convolution layer to obtain a second feature map;
[0033] The first feature map and the second feature map are convoluted by the third convolution layer and the filter to obtain a third feature map;
[0034] performing up-sampling processing on the third feature map through the first up-sampling layer to obtain a fourth feature map;
[0035] performing update processing on the second target coding feature map based on the fourth feature map to obtain the second optimized feature map.
[0036] Optionally, according to the cultivated land recognition provided by the present application, the cultivated land recognition model is obtained based on the following steps:
[0037] obtaining a to-be-trained remote sensing image;
[0038] inputting the to-be-trained remote sensing image into a to-be-trained cultivated land recognition model to output a training cultivated land range result and a training cultivated land boundary result;
[0039] calculating a target loss value based on the training cultivated land range result, the training cultivated land boundary result, a cultivated land range result label corresponding to the to-be-trained remote sensing image, and a cultivated land boundary recognition result label;
[0040] performing multi-task iterative training on the to-be-trained cultivated land recognition model based on the target loss value to obtain the cultivated land recognition model.
[0041] Optionally, according to the cultivated land recognition provided by the present application, the target loss value is calculated based on the training cultivated land range result, the training cultivated land boundary result, the cultivated land range result label corresponding to the to-be-trained remote sensing image, and the cultivated land boundary recognition result label through a pre-set target loss function, which includes:
[0042] calculating a first loss value between the training cultivated land range result and the cultivated land range result label and a second loss value between the training cultivated land boundary result and the cultivated land boundary recognition result label through the pre-set target loss function;
[0043] calculating the target loss value based on the first loss value, the second loss value, and a weight between the first loss value and the second loss value.
[0044] The present application also provides a cultivated land recognition device, which comprises:
[0045] an acquisition module configured to acquire to-be-recognized image data;
[0046] a multi-task recognition module configured to input the to-be-recognized image data into a cultivated land recognition model to perform multi-task recognition on the to-be-recognized image data by using the cultivated land recognition model and output a cultivated land range result and a cultivated land boundary recognition result;
[0047] The cultivated land recognition model is obtained through multi-task training based on a pre-collected training remote sensing image and corresponding cultivated land range result labels and cultivated land boundary recognition result labels.
[0048] The application further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the cultivated land recognition method according to any one of the above when executing the program.
[0049] The application further provides a non-transitory computer readable storage medium, which stores a computer program, and the computer program is executable on a processor to implement the cultivated land recognition method according to any one of the above.
[0050] The application further provides a computer program product, which includes a computer program, and the computer program is executable on a processor to implement the cultivated land recognition method according to any one of the above.
[0051] The cultivated land recognition method, device, equipment and storage medium provided by the application, by acquiring the to-be-recognized image data; inputting the to-be-recognized image data into a cultivated land recognition model, to utilize the cultivated land recognition model to perform multi-task recognition on the to-be-recognized image data, and output cultivated land range results and cultivated land boundary recognition results; wherein the cultivated land recognition model is obtained through multi-task training based on a pre-collected training remote sensing image and corresponding cultivated land range result labels and cultivated land boundary recognition result labels, and a spatial attention mechanism, realizing the construction of a cultivated land recognition model based on a spatial attention mechanism and double-task learning, to simultaneously perform cultivated land range recognition and cultivated land boundary recognition, and through learning the task of cultivated land boundary, improving the boundary recognition capability of cultivated land, thereby increasing the recognition capability of roadside trees and field roads, and additionally, through the spatial attention mechanism, highlighting the key features and detailed information, so that the cultivated land region recognition is more accurate. BRIEF DESCRIPTION OF DRAWINGS
[0052] In order to more clearly illustrate the technical solutions of the present application or the prior art, the following will briefly introduce the drawings needed in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.
[0053] Figure 1 is one of the flowcharts of the cultivated land recognition method provided by the application;
[0054] Figure 2 is a structural schematic diagram of a residual block in the cultivated land recognition method provided by the application;
[0055] Figure 3 A result schematic diagram of the spatial attention module in the cultivated land identification method provided by the present application is shown in the figure;
[0056] Figure 4 A second flow schematic diagram of the cultivated land identification method provided by the present application is shown in the figure;
[0057] Figure 5 A structure schematic diagram of the cultivated land identification device provided by the present application is shown in the figure;
[0058] Figure 6 A structure schematic diagram of the electronic device provided by the present application is shown in the figure. DETAILED DESCRIPTION
[0059] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely below in combination with the drawings in the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0060] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms "a", "said" and "the" used in one or more embodiments of the present application are also intended to include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of the present application means and includes any or all possible combinations of one or more associated listed items.
[0061] It should be understood that although the terms first, second, etc. may be employed in one or more embodiments of the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of one or more embodiments of the present application, first can also be called second, and similarly, second can also be called first. Depending on the context, the word "if" as used herein can be interpreted as "when" or "upon determining" or "in response to determining".
[0062] The following will be described in combination with Figures 1-6 The example embodiments of the present application are described in detail.
[0063] As Figure 1 shown is a flowchart of a cultivated land identification method according to an embodiment of the present application. As Figure 1 shown, the cultivated land identification method includes:
[0064] Step S10, obtain image data to be identified;
[0065] It should be noted that the image data to be identified includes remote sensing image data corresponding to the width, height and channel number of the image. Remote sensing images can be obtained from a public remote sensing image data set, crawled from an existing geographic information system, or obtained through other online collection methods. The image data to be identified includes information such as the height, width and channel number of the image. For example, 256x256x4 image data to be identified is obtained, i.e., the height is 256, the width is 256, and the channel number is 4. The channels can include red, green, blue and near-infrared 4 channels.
[0066] Step S20, input the image data to be identified into the cultivated land recognition model to perform multi-task recognition on the image data to be identified using the cultivated land recognition model, and output cultivated land range results and cultivated land boundary recognition results. The cultivated land recognition model is obtained based on pre-collected training remote sensing images and corresponding cultivated land range result labels and cultivated land boundary recognition result labels, and is trained by a spatial attention mechanism.
[0067] It should be noted that the cultivated land recognition model includes an encoding module, a decoding module, a spatial attention module and a multi-task pixel classification module. The encoding module includes a plurality of series of encoding units. Each encoding unit includes a residual block and a max pooling layer, except for the last encoding unit. The last encoding unit includes a residual block. The output of the max pooling layer in the previous encoding unit is the input of the residual block in the next encoding unit.
[0068] It should be further noted that the decoding module includes a plurality of series of decoding units. Each decoding unit includes an up-sampling layer, a feature connection layer and a residual block. The input feature map of the residual block in each decoding unit is the feature map obtained by processing the decoding feature map output by the previous decoding unit and the feature map at the same level as the decoding feature map after down-sampling (or max pooling processing) in the encoding module, and then performing feature connection on the feature map obtained by up-sampling the decoding feature map output by the previous decoding unit. Furthermore, the output of the residual block of each encoding unit is input into the corresponding decoding unit after optimization processing by the spatial attention module. The output of the residual block of the last decoding unit is input into the multi-task pixel classification module. The multi-task includes cultivated land range recognition and cultivated land boundary recognition, which can simultaneously recognize cultivated land range and cultivated land boundary, and improve the ability of cultivated land boundary recognition.
[0069] As an implementable manner, the to-be-identified image data is input into an encoding module in the pre-trained cultivated land identification model for encoding processing. Specifically, the to-be-identified image data is subjected to convolution processing by a residual block in a first encoding unit to obtain an encoding feature map output by the residual block in the current encoding unit, and then the encoding feature map is subjected to maximum pooling processing by a maximum pooling layer to reduce the height and width of the encoding feature map, thereby obtaining a pooling processing feature map output by the current maximum pooling layer, and then the pooling processing feature map is taken as the input of a next encoding unit, and the process is repeated until an encoding feature map output by a residual block in a last encoding unit is obtained. For example, refer to Table 1, wherein the first encoding unit residual block outputs an encoding feature map with a size of 256x256x32, and the encoding feature map with a size of 256x256x32 is subjected to maximum pooling processing to obtain a feature map with a size of 128x128x32, which is taken as the input of a residual block of a next encoding unit.
[0070] Further, after obtaining the encoded feature map output by the last encoding unit, the decoding stage is entered. At this time, the encoded feature map output by the last encoding unit enters the first decoding unit in the decoding module. Then, based on the feature size of the encoded feature map output by the last encoding unit, the first target encoded feature map matching the encoded feature map of the last encoding unit is searched in the encoded feature maps output by each encoding unit except the last encoding unit. Then, the spatial attention module is used to perform feature optimization processing on the first target encoded feature map and the encoded feature map output by the last encoding unit. The up-sampling layer of the current decoding unit is used to perform up-sampling processing on the encoded feature map output by the last encoding unit. Then, the feature connection layer is used to connect the feature map obtained by up-sampling processing and the feature map obtained by feature optimization processing, so as to take the target connection feature map obtained by feature connection as the input of the residual block in the first decoding unit. Further, the residual block in the first decoding unit is used to perform residual processing on the target connection feature map, so as to obtain the decoded feature map output by the residual block in the current decoding unit. Then, based on the decoded feature map, the target encoded feature map matching the decoded feature map is determined in the encoded feature maps output by each encoding unit. The input of the residual block in the next decoding unit is determined based on the decoded feature map and the target encoded feature map. The specific process of determining the input of the residual block in the next decoding unit is basically the same as that of determining the input of the residual block in the first decoding unit, which will not be described here again. Until the decoded feature map output by the residual block in the last decoding unit is obtained. The convolution layer in the multi-task pixel classification module is used to perform convolution processing on the decoded feature map output by the last decoding unit. Since the arable land range and the arable land boundary multi-task recognition are performed in this embodiment, the number of convolution layers is at least 2, so as to obtain the arable land range feature map and the arable land boundary feature map. Based on the arable land range feature map and the arable land boundary feature map, the arable land range result or the arable land boundary recognition result corresponding to each pixel point in the feature map is recognized.
[0071] For example, refer to Figure 1 The decoded feature map output by the last decoding unit residual block is of the size of 256x256x32. After the 256x256x32 decoded feature map is processed by two convolution layers with a convolution kernel of 1x1, two feature maps with the size of 256x256x1 are obtained.
[0072] Table 1
[0073]
[0074] The embodiment of the present application also has the above scheme, that is, obtaining to-be-recognized image data; inputting the to-be-recognized image data into a cultivated land recognition model to perform multi-task recognition on the to-be-recognized image data by using the cultivated land recognition model, and outputting cultivated land range results and cultivated land boundary recognition results; wherein the cultivated land recognition model is obtained by performing multi-task training of a spatial attention mechanism based on pre-collected to-be-trained remote sensing images and cultivated land range result labels and cultivated land boundary recognition result labels corresponding to the to-be-trained remote sensing images, realizing the cultivated land recognition model based on the dual-task learning of the spatial attention mechanism, so as to simultaneously perform cultivated land range recognition and cultivated land boundary recognition, and improving the boundary recognition capability of cultivated land by learning the task of cultivated land boundary, thereby increasing the recognition capability of walkway trees and field roads. In addition, by increasing the spatial attention mechanism, the key features and detailed information can be highlighted, so that the cultivated land region recognition accuracy is higher.
[0075] Based on the first embodiment, in another embodiment of the present application, in the above step S20: performing multi-task recognition on the to-be-recognized image data by using the pre-trained cultivated land recognition model to obtain the cultivated land range and the cultivated land boundary corresponding to the to-be-recognized image data, comprising:
[0076] Step S21: performing feature extraction on the to-be-recognized image data by using the residual block in the first encoding unit to obtain the encoding feature map output by the residual block in the first encoding unit;
[0077] It should be noted that the residual block includes a plurality of convolution layers, wherein each convolution layer is accompanied by a batch normalization layer and a dropout layer.
[0078] As an implementable manner, specifically, the to-be-recognized image data is input into the residual block in the first encoding unit to extract the features in the to-be-recognized image data, and the processing formula is as follows:
[0079] y l =h(x l )+F(x l ,θ l )
[0080] Wherein, x l represents the input of the residual block (the to-be-recognized image data in the embodiment), y l represents the output of the residual block (the encoding feature map in the embodiment), F(x l ,θ l ) represents the residual part. In combination with Figure 2 , Figure 2 is a structural diagram of the residual block in the cultivated land recognition method provided by the present application, This represents a convolutional layer with a kernel size of 1×1. It can increase or decrease the number of channels in the feature layer to make it consistent with F(x). l ,θ l The outputs of F(x) are consistent with those of F(x). l ,θ l The algorithm consists of two 3×3 convolutional layers, followed by a batch normalization layer and a dropout layer. Same padding is used to ensure the width and height of the output features match the input. The number of convolutional kernels is the same as the number of channels in the input feature layer. The dropout layer assigns random values of 0 to random cells to prevent overfitting.
[0081] Step S22: The encoded feature map is pooled through the max pooling layer in the first encoding unit to obtain a pooled feature map, and the pooled feature map is used as the input of the next encoding unit until the encoded feature map output by the residual block in the last encoding unit is obtained.
[0082] As one possible implementation, the encoded feature map is input into the max pooling layer in the first encoding unit to perform max pooling on the encoded feature map, thereby outputting the maximum value of the 2×2 region, obtaining the pooled feature map output by the current encoding unit, and using the pooled feature map as the input to the next encoding unit to perform corresponding processing through the residual block and the max pooling layer of the next encoding unit, until the encoded feature map output by the residual block in the last encoding unit is obtained.
[0083] Understandably, referring to Table 1 above, the size of the input image data to be recognized is 256×256×4. The size of the feature map obtained after processing the residual block in the first coding unit is 256×256×32. Then, it is pooled through the max pooling layer in the first coding unit, reducing the height and width, and the size of the resulting feature map is 128×128×32. The 128×128×32 feature map is then used as the input of the residual block in the next coding unit, and so on, until the coded feature map output by the last coding unit is obtained.
[0084] Step S23: Select the first target coding feature map that matches the coding feature map of the last coding unit from the coding feature maps output by each coding unit except the last coding unit.
[0085] Step S24, feature optimization is performed on the first target encoding feature map and the encoding feature map of the last encoding unit by the spatial attention module, to obtain a first optimized feature map;
[0086] In this embodiment, after the encoding stage is completed, the decoding stage is entered, at this time, the encoding feature map output by the last encoding unit enters the first decoding unit in the decoding module, and then based on the feature size of the encoding feature map output by the last encoding unit, the first target encoding feature map matching the encoding feature map of the last encoding unit is determined from the encoding feature maps output by the remaining encoding units. It should be noted that the feature size of the first target encoding feature map is twice that of the encoding feature map output by the last encoding unit.
[0087] Further, the first target encoding feature map and the encoding feature map output by the last encoding unit are respectively subjected to convolution processing by the convolution layers in the spatial attention module. Specifically, the spatial attention module includes a first convolution layer, a second convolution layer, a third convolution layer, a filter, and a first upsampling layer. The first target encoding feature map is subjected to convolution processing by the first convolution layer, wherein the first convolution layer is a convolution layer with kernel convolution kernel = 2x2, stride convolution step = 2x2, and same padding. Thus, the height and width of the first target encoding feature map are reduced, and then the encoding feature map output by the last encoding unit is subjected to convolution processing by the second convolution layer, wherein the second convolution layer is a 1x1-based convolution layer, which is used to adjust the channel number of the encoding feature map output by the last encoding unit. Thus, the feature size of the first target encoding feature map and the encoding feature map output by the last encoding unit after convolution processing is the same. Further, the first target encoding feature map and the encoding feature map output by the last encoding unit after convolution processing are processed by the third convolution layer and the filter, wherein the third convolution layer is a 1x1-based convolution layer, and then the processed feature map is upsampled by the first upsampling layer. Finally, the feature map obtained by upsampling is updated as the first target encoding feature map, to obtain the first optimized feature map.
[0088] It can be understood that, for example: for the first decoding unit of the decoding module, the encoded feature map output by the last encoding unit has a size of 16x16x512, and based on the feature size corresponding to the encoded feature map output by each of the remaining encoding units, the encoded feature map corresponding to the feature size of 32x32x256 is determined as the first target encoded feature map, both of which are subjected to convolution processing to become a feature map with a size of 16x16x256, and then are converted into a feature map with a size of 16x16x1 through a convolution layer and a 1x1 filter processing. Next, the learned features will be up-sampled to obtain a feature map with a size of 32x32x1. Finally, this value will be used to update the first target encoded feature map, and the size of the output first optimized feature map is 32x32x256.
[0089] In step S25, the encoded feature map of the last encoding unit is subjected to up-sampling processing by the up-sampling layer in the first decoding unit to obtain a first up-sampled feature map.
[0090] In step S26, the first optimized feature map and the first up-sampled feature map are subjected to feature connection by the feature connection layer to obtain a first target connected feature map.
[0091] In this embodiment, specifically, the encoded feature map of the last encoding unit is input into the up-sampling layer in the first decoding unit to be subjected to up-sampling processing to obtain a first up-sampled feature map, and then the first optimized feature map and the first up-sampled feature map are subjected to feature connection by the feature connection layer to obtain a first target connected feature map.
[0092] Using the example in the above step S24, the size of the first optimized feature map is 32x32x256, the encoded feature map of the last encoding unit is subjected to up-sampling processing to obtain a size of 32x32x512, and then the first target connected feature map with a size of 32x32x(512+256) is obtained after feature splicing.
[0093] In step S27, the first target connected feature map is decoded by the residual block in the first decoding unit to obtain a decoded feature map output by the current decoding unit.
[0094] In this embodiment, specifically, the first target connected feature map is input into the residual block in the decoding unit, so that the first target connected feature map is subjected to decoding processing to obtain a decoded feature map output by the current decoding unit.
[0095] Step S28, determining an input feature map of a residual block in a next decoding unit based on the encoding feature maps output by the encoding units and the decoding feature map output by the current decoding unit, until obtaining the decoding feature map output by the last encoding unit;
[0096] The determining the input feature map of the residual block in the next decoding unit based on the encoding feature maps output by the encoding units and the decoding feature map output by the current decoding unit, until obtaining the decoding feature map output by the last encoding unit includes:
[0097] Step S281, screening a second target encoding feature map matched with the decoding feature map of the current decoding unit based on the encoding feature maps output by the residual blocks in the encoding units;
[0098] In this embodiment, specifically, based on the feature size of the decoding feature map of the current decoding unit, a second target encoding feature map matched with the decoding feature map of the current decoding unit is screened from the encoding feature maps output by the encoding units. It should be noted that the feature size of the second target encoding feature map is usually twice that of the decoding feature map of the current decoding unit. The process of determining the second target encoding feature map in this embodiment is basically the same as the process of determining the first target encoding feature map in step S24, and will not be described here.
[0099] Step S282, performing feature optimization on the second target encoding feature map and the decoding feature map through the spatial attention module to obtain a second optimized feature map;
[0100] The performing feature optimization on the second target encoding feature map and the decoding feature map through the spatial attention module to obtain a second optimized feature map includes:
[0101] Step S2821, performing convolution processing on the second target encoding feature map through the first convolution layer to obtain a first feature map;
[0102] Step S2822, performing convolution processing on the decoding feature map through the second convolution layer to obtain a second feature map;
[0103] Step S2823, performing convolution processing on the first feature map and the second feature map through the third convolution layer and the filter to obtain a third feature map;
[0104] Step S2824, performing up-sampling processing on the third feature map through the first up-sampling layer to obtain a fourth feature map;
[0105] Step S2825, based on the fourth feature map, the second target encoding feature map is updated to obtain the second optimized feature map.
[0106] In this embodiment, the second target encoding feature map and the decoding feature map are respectively subjected to convolution processing through the convolution layers in the spatial attention module. Specifically, the convolution processing is combined with Figure 3 , Figure 3 The result diagram of the spatial attention module in the farmland recognition method provided by the present application is shown in the figure. The second target encoding feature map is subjected to convolution processing through the first convolution layer. The first convolution layer is a convolution layer with a kernel of 2x2, a stride of 2x2, and same padding. Then the decoding feature map is subjected to convolution processing through the second convolution layer. The second convolution layer is a convolution layer with a kernel of 1x1, which is used to adjust the channel number of the decoding feature map, so that the feature size of the second target encoding feature map and the decoding feature map after convolution processing is the same. Further, the second target encoding feature map and the decoding feature map after convolution processing are processed through the third convolution layer and the filter. The third convolution layer is a convolution layer with a kernel of 1x1, and the filter is a filter of 1x1. The processed feature map is up-sampled through the first up-sampling layer. Finally, the feature map obtained by up-sampling is used to update the second target encoding feature map to obtain the second optimized feature map.
[0107] For example, referring to Table 1, for the eighth decoding unit of the decoding module, the size of the residual block output decoding feature map is 128x128x64. Among the encoding feature maps output by the residual blocks of each encoding unit, the encoding feature map corresponding to the feature size of 256x256x32 is the second target encoding feature map. After convolution processing, both of them become 128x128x32, and then after processing through a convolution layer with a kernel of 1x1 and a filter of 1x1, a feature map with a size of 128x128x1 is obtained. Next, the learned feature will be up-sampled to form a feature map with a size of 256x256x1. Finally, this value will be used to update the first target encoding feature map, and the size of the output second optimized feature map is 256x256x32. In this embodiment, the feature optimization process is basically the same as the feature optimization process in step S24 described above, and will not be described here again. The feature optimization formula is as follows:
[0108]
[0109]
[0110] wherein x lx represents the encoded feature map output by the residual block of the coding unit. h This represents the decoded feature map output by the residual block of the decoding unit or the encoded feature map output by the residual block of the last coding unit. For example, referring to Table 1, when the encoded feature map output by the residual block of the last coding unit enters the first decoding unit, x... h This represents the encoded feature map output by the residual block of the last coding unit. This represents a convolutional layer with a 1×1 kernel, primarily used to adjust the feature map x. h The number of channels, This represents a convolutional layer with a 1×1 kernel, followed by a sigmoid activation function layer, g(x l ,x h The output will be a feature layer of size w × h × 1, where w represents the width of the feature map and h represents the height of the feature map. x represents l By multiplying by g(x) l ,x h To implement the update.
[0111] Step S283: Upsample the decoded feature map output by the current decoding unit through the upsampling layer in the next decoding unit to obtain the second upsampled feature map;
[0112] Step S284: Perform feature concatenation on the second optimized feature map and the second upsampled feature map through the feature concatenation layer in the next decoding unit to obtain a second target concatenation feature map. Use the second target concatenation feature map as the input of the residual block in the next decoding unit to obtain the decoding feature map of the next decoding unit. Return to the step of filtering the encoding feature maps based on the output of the residual blocks in each encoding unit to obtain a second target encoding feature map that matches the decoding feature map of the current decoding unit, until the decoding feature map output by the last decoding unit is obtained.
[0113] In this embodiment, specifically, the decoded feature map output by the previous decoding unit is input into the upsampling layer of the next decoding unit to perform upsampling processing on the decoded feature map output by the previous decoding unit, thereby obtaining a second upsampled feature map. Then, the second optimized feature map and the second upsampled feature map are feature-connected through the feature connection layer to obtain a second target connection feature map. The process of determining the target connection feature map in this embodiment is basically the same as the process of determining the target connection feature map in steps A25 to A26 above, and will not be described again here.
[0114] Further, the second target connection feature map is taken as an input feature map of a residual block in the next decoding unit to obtain a decoding feature map of the next decoding unit; thereby returning to perform the step of screening a second target encoding feature map matched with the decoding feature map of the current decoding unit based on the encoding feature map output by the residual block in each encoding unit until a decoding feature map output by a last decoding unit is obtained.
[0115] In step S29, the decoding feature map output by the last decoding unit is input into the multi-task pixel classification module to obtain the cultivated land range result and the cultivated land boundary recognition result.
[0116] In this embodiment, specifically, the decoding feature map output by the last decoding unit is input into the multi-task pixel classification module, and the decoding feature map output by the last decoding unit is processed by a convolution layer in the multi-task pixel classification module, wherein, since the cultivated land range and cultivated land boundary multi-task recognition is performed in this embodiment, the number of convolution layers is at least 2, and the convolution kernel of each convolution layer is 1x1, so as to obtain a cultivated land range feature map and a cultivated land boundary feature map, and based on the cultivated land range feature map and the cultivated land boundary feature map, a cultivated land range result or a cultivated land boundary recognition result corresponding to each pixel point in the feature map is recognized, so as to realize end-to-end pixel-level classification.
[0117] Referring to Table 1, the size of the decoding feature map output by the residual block of the last decoding unit is 256x256x32, the multi-task pixel classification module includes 2 convolution layers, and the convolution kernel is 1x1. In each convolution layer, for the cultivated land range and the cultivated land boundary, the decoding feature map with the size of 256x256x32 is reduced to two feature maps with the size of 256x256x1, and the cultivated land range result and the cultivated land boundary recognition result corresponding to each pixel point are output.
[0118] The embodiment of the present application realizes the encoding feature map of the to-be-recognized image data processed by the series of encoding units, and then processes the encoding feature map of each encoding unit and the feature map output by the last residual block through the spatial attention module to obtain the input of each decoding unit residual block, so that the model can learn the spatial range features of the cultivated land, and based on the cultivated land range and cultivated land boundary dual-task recognition, the recognition ability of the driveway tree and the field road is increased, so as to accurately distinguish the field road and the driveway tree from the cultivated land patch, and effectively improve the precision of cultivated land recognition.
[0119] Referring to Figure 4 Based on the first embodiment, in another embodiment of the present application, the cultivated land recognition model is obtained based on the following steps:
[0120] Step A10, obtaining a to-be-trained remote sensing image;
[0121] It should be noted that the to-be-trained remote sensing image includes a plurality of remote sensing images with label information, and the label information is information for marking whether a pixel point in the remote sensing image belongs to the cultivated land boundary or the cultivated land range, for example, a pixel point corresponding to the cultivated land boundary is marked as 1, and a pixel point not corresponding to the cultivated land boundary is 0.
[0122] Step A20, inputting the to-be-trained remote sensing image into the to-be-trained cultivated land recognition model to output a training cultivated land range result and a training cultivated land boundary result;
[0123] Step A30, based on the training cultivated land range result, the training cultivated land boundary result, the cultivated land range result label and the cultivated land boundary recognition result label corresponding to the to-be-trained remote sensing image, a target loss value is calculated;
[0124] Step A40, based on the target loss value, performing multi-task iterative training on the to-be-trained cultivated land recognition model based on the spatial attention mechanism to obtain the cultivated land recognition model.
[0125] The above step A30: based on the training cultivated land range result, the training cultivated land boundary result, the cultivated land range result label and the cultivated land boundary recognition result label corresponding to the to-be-trained remote sensing image, a target loss value is calculated, comprising:
[0126] Step A31, calculating a first loss value between the training cultivated land range result and the cultivated land range result label, and calculating a second loss value between the training cultivated land boundary result and the cultivated land boundary recognition result label by a pre-set target loss function;
[0127] Step A32, based on the first loss value, the second loss value and the weight between the first loss value and the second loss value, the target loss value is calculated.
[0128] It should be noted that the to-be-trained cultivated land recognition model is a segmentation model based on the encoder-decoder architecture coupling of the U-net model, and in this embodiment, a spatial attention mechanism module is also added, so as to better extract the spatial range of the cultivated land.
[0129] As an implementable manner, the to-be-trained remote sensing image is input into the to-be-trained cultivated land recognition model to perform category prediction on the to-be-trained remote sensing image, and a predicted category label is obtained. Specifically, the to-be-trained remote sensing image is input into the to-be-trained cultivated land recognition model, and data processing is performed on an encoding module in the to-be-trained cultivated land recognition model, wherein the encoding module comprises a plurality of serially connected encoding units, each encoding unit comprises a residual block and a max-pooling layer connected in sequence except for a last encoding unit, the last encoding unit comprises a residual block, the output of the max-pooling layer in the previous encoding unit is the input of the residual block in the next encoding unit, and thus an encoding feature map output by each encoding unit is obtained. The residual block can solve the problems of gradient explosion or disappearance.
[0130] Further, after obtaining the encoding feature map output by the last encoding unit, a decoding stage is entered. A decoding module in the to-be-trained cultivated land recognition model comprises a plurality of serially connected decoding units, each decoding unit comprises an up-sampling layer, a feature connection layer and a residual block, wherein the input of the residual block in the decoding unit is a result of feature connection of a feature map obtained by up-sampling the feature map output by the previous residual block and the encoding feature map output at the corresponding position of the encoding module, the determination of the input of the residual block in the decoding unit is basically the same as the process of step S20, and thus the decoding feature map output by the residual block of the last decoding unit is obtained, and then a convolution operation is performed on the decoding feature map output by the residual block of the last decoding unit to obtain a cultivated land range feature map and a cultivated land boundary feature map, so as to output the recognition results corresponding to the cultivated land range feature map and the cultivated land boundary feature map respectively, wherein the recognition results comprise a training cultivated land range result and a training cultivated land boundary result.
[0131] A first loss value between the training cultivated land range result and the cultivated land range result label and a second loss value between the training cultivated land boundary result and the cultivated land boundary recognition result label are calculated through a pre-set target loss function, wherein the target loss function comprises a Dice loss function, a Hinge loss function and a cross-entropy loss function, and preferably the Dice loss function is selected, and the formula is as follows:
[0132]
[0133] Wherein, A represents the recognition result, B represents the label information of the to-be-trained remote sensing image, and smooth is a smoothing factor, which is set to 1.
[0134] Further, a target loss value is calculated based on the first loss value, the second loss value and the weight therebetween, and the calculation formula is as follows:
[0135] Ltotal =a1L Dice1 +a2L Dice2
[0136] Among them, L total L represents the loss of the target model. Dice1 L represents the first loss value. Dice2 Let a1 and a2 represent the weights corresponding to the first loss value and the second loss value, respectively, and let a1 + a2 = 1. Preferably, a1 = a2 = 0.5.
[0137] Furthermore, based on the target loss value, the parameters of the farmland identification model to be trained are iteratively updated, and then it is determined whether the updated farmland identification model to be trained meets the preset training termination condition. If it does, the updated farmland identification model to be trained is used as the farmland identification model. If it does not, the step of obtaining the remote sensing image to be trained is returned to continue iteratively training the model. The preset training termination condition includes loss convergence and reaching the maximum number of iterations threshold.
[0138] The embodiments of the present invention, through the above-described scheme, realize multi-task model training based on remote sensing images to be trained, thereby enabling the model to identify the scope and boundaries of cultivated land, increase the ability to identify roadside trees and field roads, and accurately distinguish field roads and roadside trees from cultivated land patches. Furthermore, a spatial attention mechanism is added, enabling the model to learn the spatial range characteristics of cultivated land, thereby improving the accuracy of cultivated land identification.
[0139] The farmland identification device provided by the present invention is described below. The farmland identification device described below and the farmland identification method described above can be referred to in correspondence.
[0140] like Figure 5 As shown, an embodiment of the present invention provides a farmland identification device, which includes:
[0141] The acquisition module 10 is used to acquire the image data to be identified;
[0142] The multi-task recognition module 20 is used to input the image data to be recognized into the farmland recognition model, so as to use the farmland recognition model to perform multi-task recognition on the image data to be recognized and output the farmland range result and farmland boundary recognition result.
[0143] The farmland identification model is obtained through multi-task training using a spatial attention mechanism based on pre-collected remote sensing images to be trained and the corresponding farmland range and farmland boundary identification labels.
[0144] Optionally, the multi-task identification module 20 is further configured to:
[0145] extracting features of the to-be-identified image data through a residual block in a first encoding unit to obtain an encoding feature map output by the residual block in the first encoding unit;
[0146] performing pooling processing on the encoding feature map through a max-pooling layer in the first encoding unit to obtain a pooling processing feature map, and taking the pooling processing feature map as an input of a next encoding unit until an encoding feature map output by a residual block in a last encoding unit is obtained;
[0147] screening, from the encoding feature maps output by each of the encoding units except the last encoding unit, a first target encoding feature map matching the encoding feature map of the last encoding unit;
[0148] optimizing features of the first target encoding feature map and the encoding feature map of the last encoding unit through the spatial attention module to obtain a first optimized feature map;
[0149] performing up-sampling processing on the encoding feature map of the last encoding unit through an up-sampling layer in a first decoding unit to obtain a first up-sampling feature map;
[0150] connecting features of the first optimized feature map and the first up-sampling feature map through the feature connection layer to obtain a first target connection feature map;
[0151] decoding the first target connection feature map through a residual block in the first decoding unit to obtain a decoding feature map output by a current decoding unit;
[0152] determining an input feature map of a residual block in a next decoding unit based on the encoding feature maps output by each of the encoding units and the decoding feature map output by the current decoding unit until a decoding feature map output by the last encoding unit is obtained;
[0153] inputting the decoding feature map output by the last decoding unit into the multi-task pixel classification module to obtain the cultivated land range result and the cultivated land boundary identification result.
[0154] Optionally, the multi-task identification module 20 is further configured to:
[0155] screening, based on the encoding feature maps output by the residual blocks in each of the encoding units, a second target encoding feature map matching the decoding feature map of the current decoding unit;
[0156] optimizing features of the second target encoding feature map and the decoding feature map through the spatial attention module to obtain a second optimized feature map;
[0157] The decoding feature map output by the current decoding unit is up-sampled by an up-sampling layer in a next decoding unit of the current decoding unit to obtain a second up-sampled feature map;
[0158] The second up-sampled feature map and the second optimized feature map are connected by a feature connection layer in the next decoding unit to obtain a second target connection feature map, and the second target connection feature map is taken as an input of a residual block in the next decoding unit to obtain a decoding feature map of the next decoding unit;
[0159] The step of filtering the second target encoding feature map matched with the decoding feature map of the current decoding unit based on the encoding feature map output by the residual block in each encoding unit is returned to be executed until the decoding feature map output by the last decoding unit is obtained.
[0160] Optionally, the multi-task identification module 20 is further used to:
[0161] The second target encoding feature map is convoluted by the first convolutional layer to obtain a first feature map;
[0162] The decoding feature map is convoluted by the second convolutional layer to obtain a second feature map;
[0163] The first feature map and the second feature map are convoluted by the third convolutional layer and the filter to obtain a third feature map;
[0164] The third feature map is up-sampled by the first up-sampling layer to obtain a fourth feature map;
[0165] Based on the fourth feature map, the second target encoding feature map is updated to obtain the second optimized feature map.
[0166] Optionally, the cultivated land identification device further comprises:
[0167] Obtain a to-be-trained remote sensing image;
[0168] Input the to-be-trained remote sensing image into a to-be-trained cultivated land identification model to output a training cultivated land range result and a training cultivated land boundary result;
[0169] Based on the training cultivated land range result, the training cultivated land boundary result, a cultivated land range result label corresponding to the to-be-trained remote sensing image, and a cultivated land boundary identification result label, a target loss value is calculated;
[0170] Based on the target loss value, the to-be-trained cultivated land identification model is subjected to multi-task iterative training of a spatial attention mechanism to obtain the cultivated land identification model.
[0171] Optionally, the cultivated land recognition device further comprises:
[0172] The first loss value between the training cultivated land range result and the cultivated land range result label is calculated through a preset target loss function, and the second loss value between the training cultivated land boundary result and the cultivated land boundary recognition result label is calculated.
[0173] The target loss value is calculated based on the first loss value, the second loss value and the weight between the first loss value and the second loss value.
[0174] It should be noted that the above device provided by the embodiments of the present application can realize all the method steps achieved by the method embodiments and achieve the same technical effects. Therefore, the same parts and beneficial effects of the method embodiments will not be described in detail.
[0175] Figure 6 An example of an entity structure diagram of an electronic device is shown, which can include a processor 610, a memory 620, a communication interface 630 and a communication bus 640, wherein the processor 610, the memory 620 and the communication interface 630 complete mutual communication through the communication bus 640. The processor 610 can call the logical instructions in the memory 620 to execute the cultivated land recognition method, which includes: acquiring to-be-recognized image data; inputting the to-be-recognized image data into a cultivated land recognition model to perform multi-task recognition on the to-be-recognized image data by using the cultivated land recognition model, and outputting a cultivated land range result and a cultivated land boundary recognition result; wherein the cultivated land recognition model is obtained through multi-task training based on a pre-collected to-be-trained remote sensing image and a cultivated land range result label and a cultivated land boundary recognition result label corresponding to the to-be-trained remote sensing image.
[0176] Further, the logic instructions in the memory 620 described above can be implemented in the form of software functional units and sold or used as standalone products, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that make contributions to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0177] In another aspect, the present application also provides a non-transitory computer readable storage medium having stored thereon a computer program, which, when executed by a processor, implements the cultivated land identification method provided by the above-mentioned methods. The method includes: acquiring to-be-identified image data; inputting the to-be-identified image data into a cultivated land identification model to perform multi-task identification on the to-be-identified image data by using the cultivated land identification model, and outputting cultivated land range results and cultivated land boundary identification results; wherein the cultivated land identification model is obtained based on pre-collected to-be-trained remote sensing images and corresponding cultivated land range result labels and cultivated land boundary identification result labels of the to-be-trained remote sensing images, and multi-task training of a spatial attention mechanism.
[0178] In another aspect, the present application also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer readable storage medium. When the computer program is executed by a processor, a computer can execute the cultivated land identification method provided by the above-mentioned methods. The method includes: acquiring to-be-identified image data; inputting the to-be-identified image data into a cultivated land identification model to perform multi-task identification on the to-be-identified image data by using the cultivated land identification model, and outputting cultivated land range results and cultivated land boundary identification results; wherein the cultivated land identification model is obtained based on pre-collected to-be-trained remote sensing images and corresponding cultivated land range result labels and cultivated land boundary identification result labels of the to-be-trained remote sensing images, and multi-task training of a spatial attention mechanism.
[0179] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed to multiple network units. Part or all of the modules can be selected to achieve the purposes of the embodiments according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0180] Through the description of the above embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software and the necessary general hardware platform, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
[0181] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for identifying arable land, characterized in that, include: Acquire the image data to be identified; The image data to be identified is input into the farmland identification model, so that the farmland identification model can be used to perform multi-task identification on the image data to be identified, and output the farmland range result and farmland boundary identification result. The farmland identification model is obtained through multi-task training using a spatial attention mechanism based on pre-collected remote sensing images to be trained and the farmland range result labels and farmland boundary identification result labels corresponding to the remote sensing images to be trained. The farmland identification model includes an encoding module, a decoding module, a spatial attention module, and a multi-task pixel classification module, wherein: The encoding module includes several cascaded encoding units. Except for the last encoding unit, each encoding unit includes a residual block and a max pooling layer. The last encoding unit includes a residual block. The decoding module includes several decoder units connected in series, and each decoder unit includes an upsampling layer, a feature connection layer and a residual block; The output of the residual block in each encoding unit is optimized by the spatial attention module and then input to the corresponding decoding unit; The output of the residual block of the last decoding unit is used as the input of the multi-task pixel classification module. The process of using the farmland identification model to perform multi-task identification on the image data to be identified, and outputting farmland extent results and farmland boundary identification results, includes: Feature extraction is performed on the image data to be identified using the residual block in the first coding unit to obtain the coded feature map output by the residual block in the first coding unit; The encoded feature map is pooled by the max pooling layer in the first coding unit to obtain a pooled feature map, and the pooled feature map is used as the input of the next coding unit until the encoded feature map output by the residual block in the last coding unit is obtained. The first target coding feature map that matches the coding feature map of the last coding unit is obtained by filtering the coding feature maps output by each coding unit except the last coding unit. The spatial attention module optimizes the first target coding feature map and the coding feature map of the last coding unit to obtain a first optimized feature map. The encoding feature map of the last encoding unit is upsampled by the upsampling layer in the first decoding unit to obtain the first upsampled feature map; The first optimized feature map and the first upsampled feature map are connected by the feature connection layer to obtain the first target connection feature map; The first target connection feature map is decoded by the residual block in the first decoding unit to obtain the decoded feature map output by the current decoding unit; Based on the coding feature map output by each coding unit and the decoding feature map output by the current decoding unit, the input feature map of the residual block in the next decoding unit is determined until the decoding feature map output by the last coding unit is obtained. The decoded feature map output by the last decoding unit is input into the multi-task pixel classification module to obtain the farmland range result and the farmland boundary recognition result.
2. The method for identifying arable land according to claim 1, characterized in that, The process of determining the input feature map of the residual block in the next decoding unit based on the encoded feature map output by each of the encoding units and the decoded feature map output by the current decoding unit, until the decoded feature map output by the last encoding unit is obtained, includes: Based on the coding feature maps output by the residual blocks in each coding unit, a second target coding feature map that matches the decoding feature map of the current decoding unit is obtained. The spatial attention module is used to optimize the second target encoded feature map and the decoded feature map to obtain a second optimized feature map. The decoded feature map output by the current decoding unit is upsampled by the upsampling layer in the next decoding unit to obtain the second upsampled feature map. The second optimized feature map and the second upsampled feature map are connected by the feature connection layer in the next decoding unit to obtain the second target connection feature map. The second target connection feature map is then used as the input of the residual block in the next decoding unit to obtain the decoding feature map of the next decoding unit. Return to the step of performing the step of filtering the coding feature maps based on the residual block outputs of each coding unit to obtain a second target coding feature map that matches the decoding feature map of the current decoding unit, until the decoding feature map output by the last decoding unit is obtained.
3. The method for identifying arable land according to claim 2, characterized in that, The spatial attention module includes a first convolutional layer, a second convolutional layer, a third convolutional layer, a filter, and a first upsampling layer. The step of optimizing the second target encoded feature map and the decoded feature map using the spatial attention module to obtain a second optimized feature map includes: The first feature map is obtained by convolving the second target encoded feature map through the first convolutional layer. The decoded feature map is convolved by the second convolutional layer to obtain the second feature map; The first feature map and the second feature map are convolved by the third convolutional layer and the filter to obtain the third feature map; The third feature map is upsampled using the first upsampling layer to obtain the fourth feature map; Based on the fourth feature map, the second target encoding feature map is updated to obtain the second optimized feature map.
4. The method for identifying arable land according to claim 1, characterized in that, The farmland identification model is trained based on the following steps: Acquire the remote sensing images to be trained; The remote sensing image to be trained is input into the cultivated land recognition model to be trained, and the training cultivated land range result and training cultivated land boundary result are output. Based on the training farmland range results, training farmland boundary results, farmland range result labels and farmland boundary recognition result labels corresponding to the remote sensing image to be trained, the target loss value is calculated. Based on the target loss value, the farmland identification model to be trained is subjected to multi-task iterative training using a spatial attention mechanism to obtain the farmland identification model.
5. The method for identifying arable land according to claim 4, characterized in that, Based on the training farmland extent results, training farmland boundary results, farmland extent result labels corresponding to the remote sensing image to be trained, and farmland boundary recognition result labels, the target loss value is calculated through a pre-set target loss function, including: Using a pre-set target loss function, a first loss value is calculated between the training farmland range result and the farmland range result label, and a second loss value is calculated between the training farmland boundary result and the farmland boundary recognition result label. The target loss value is calculated based on the first loss value, the second loss value, and the weight between the first loss value and the second loss value.
6. A farmland identification device, characterized in that, include: The acquisition module is used to acquire the image data to be identified; The multi-task recognition module is used to input the image data to be recognized into the farmland recognition model, so as to use the farmland recognition model to perform multi-task recognition on the image data to be recognized, and output the farmland range result and farmland boundary recognition result. The farmland identification model is obtained through multi-task training using a spatial attention mechanism based on pre-collected remote sensing images to be trained and the farmland range result labels and farmland boundary identification result labels corresponding to the remote sensing images to be trained. The farmland identification model includes an encoding module, a decoding module, a spatial attention module, and a multi-task pixel classification module, wherein: The encoding module includes several cascaded encoding units. Except for the last encoding unit, each encoding unit includes a residual block and a max pooling layer. The last encoding unit includes a residual block. The decoding module includes several decoder units connected in series, and each decoder unit includes an upsampling layer, a feature connection layer and a residual block; The output of the residual block in each encoding unit is optimized by the spatial attention module and then input to the corresponding decoding unit; The output of the residual block of the last decoding unit is used as the input of the multi-task pixel classification module. The process of using the farmland identification model to perform multi-task identification on the image data to be identified, and outputting farmland extent results and farmland boundary identification results, includes: Feature extraction is performed on the image data to be identified using the residual block in the first coding unit to obtain the coded feature map output by the residual block in the first coding unit; The encoded feature map is pooled by the max pooling layer in the first coding unit to obtain a pooled feature map, and the pooled feature map is used as the input of the next coding unit until the encoded feature map output by the residual block in the last coding unit is obtained. The first target coding feature map that matches the coding feature map of the last coding unit is obtained by filtering the coding feature maps output by each coding unit except the last coding unit. The spatial attention module optimizes the first target coding feature map and the coding feature map of the last coding unit to obtain a first optimized feature map. The encoding feature map of the last encoding unit is upsampled by the upsampling layer in the first decoding unit to obtain the first upsampled feature map; The first optimized feature map and the first upsampled feature map are connected by the feature connection layer to obtain the first target connection feature map; The first target connection feature map is decoded by the residual block in the first decoding unit to obtain the decoded feature map output by the current decoding unit; Based on the coding feature map output by each coding unit and the decoding feature map output by the current decoding unit, the input feature map of the residual block in the next decoding unit is determined until the decoding feature map output by the last coding unit is obtained. The decoded feature map output by the last decoding unit is input into the multi-task pixel classification module to obtain the farmland range result and the farmland boundary recognition result.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the farmland identification method as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the farmland identification method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Lymph node classification method, system and device based on multi-view semi-supervision
CN112529878A
High-resolution remote sensing image surface feature extraction method based on multi-task attention mechanism
CN113887470A