Method, system, device and storage medium for detecting changes in cultivated land from non-agricultural use
Through the multi-scale feature extraction and differential attention module combined with Transformer multi-scale feature aggregation, the problem of poor generalization of the detection results in the non-agriculturalization change detection of cultivated land is solved, and higher detection accuracy and robustness are achieved.
Patent Information
- Application Number
- CN202411424355.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2044-10-12
AI Technical Summary
The prior art failed to effectively utilize multi-scale characteristics and differential analysis in the detection of non-agriculturalization changes of cultivated land, resulting in high missed detection and poor generalization of the detection results.
The multi-scale feature extraction module and the differential attention module are used to calibrate the image data, combine the CBAM channel and the Transformer multi-scale feature aggregation module guided by the position attention, and capture and aggregate the context information of different scale features through the Transformer encoder, and finally generate a binary changed image through the classification detection module.
It improves the accuracy of detection of non-agricultural changes in arable land, overcomes interference from factors such as light, time phase and star sources, and enhances the robustness and accuracy of detection.
Smart Images

Figure CN119399624B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cultivated land non-agricultural change detection technology, and in particular to a cultivated land non-agricultural change detection method, system, equipment and storage medium. Background Art
[0002] Arable land is my country's most valuable resource. Non-agriculturalization is a major issue in land resource development and utilization. This primarily refers to the construction of non-agricultural infrastructure and buildings on arable land. Using satellite remote sensing to quickly and promptly detect large-scale non-agriculturalization has become a mainstream method, owing to its large-scale and high-frequency nature. Deep learning has also made significant progress in recent years. Introducing deep learning technology into intelligent non-agricultural identification of remote sensing data can significantly improve the efficiency of automatic change detection, supplementing or replacing traditional methods of manual visual interpretation.
[0003] Currently, the identification of cultivated land non-agriculturalization based on satellite imagery mainly adopts visual interpretation and deep learning-assisted change detection. The rapid development of deep learning technology has provided new solutions for remote sensing image change detection. In particular, convolutional neural networks (CNN) and Transformer have demonstrated powerful capabilities in image processing and feature extraction. The current mainstream deep learning remote sensing change detection algorithms can be roughly divided into three categories: the first is the change detection method based on pure convolutional neural networks (CNNs), such as FC-EF, which performs early fusion of multi-temporal images and uses fully convolutional networks for feature extraction, and UNet, a classic convolutional neural network architecture; the second is the change detection method based on pure Transformer, such as ChangeForme, which uses Transformer to capture long-distance dependency features under the self-attention mechanism, and SwinTransformer, which has a layered visual Transformer structure and captures global contextual information of different scales through a sliding window mechanism; the third is the change detection method that combines CNN and Transformer, such as Swin-UNet, which combines the global modeling capabilities of Swin Transformer and the multi-scale feature fusion capabilities of UNet, and TransUNet, which uses CNN to extract low-level features and Transformer to model long-distance dependencies.
[0004] However, the first pure CNN change detection focuses on capturing local features and ignores global features, resulting in poor generalization effect; the second pure Transformer change detection focuses on capturing global features but ignores local detail features, resulting in a high misrecognition rate; although the third method combines the advantages of the first two methods and can simultaneously obtain local and global features to model and complete the identification of cultivated land non-agriculturalization, it still does not consider how to effectively utilize multi-scale features and how to perform difference analysis between images at different times. As a result, the detection process is easily affected by factors such as lighting, season, and star sources, resulting in a high false detection rate and poor generalization of the detection results. Summary of the Invention
[0005] In view of the shortcomings of the existing technology that do not consider how to effectively utilize multi-scale features and how to perform difference analysis between images at different times, resulting in high false detection rates and poor generalization of detection results, the present invention proposes a method, system, equipment and storage medium for detecting non-agricultural changes of cultivated land, thereby solving the problems existing in the existing technology.
[0006] A method for detecting cultivated land non-agricultural changes comprises the following steps:
[0007] Collecting two phases of image data of a non-agricultural area of cultivated land that includes various geographical environments and various changes; the two phases of image data are image data before and after the changes of the area;
[0008] The farmland non-agriculturalization change detection model was trained using two phases of image data from farmland non-agriculturalization areas.
[0009] Input the two-phase image data of the cultivated land non-agriculturalization area to be detected into the trained cultivated land non-agriculturalization change detection model to obtain the binary change image before and after the change of the area;
[0010] The method of training the farmland non-agriculturalization change detection model using two-phase image data of the farmland non-agriculturalization area specifically includes the following steps:
[0011] The multi-scale features of the two-phase image data are extracted through the multi-scale feature extraction module; the differential attention module is used to calibrate the extracted multi-scale features according to the difference between the image data before and after the change of the region;
[0012] The calibrated feature map is input into the Transformer multi-scale feature aggregation module guided by the CBAM channel and position attention. The contextual information of features of different scales in the calibrated feature map is captured and aggregated through the Transformer encoder. The multi-scale spatial channel features are interacted with the contextual information of features of different scales through the Transformer decoder to obtain low-level spatial information and high-level semantic information of features of different scales. The low-level spatial information and high-level semantic information of features of different scales are then fused to obtain a new feature map.
[0013] The new feature map is input into the classification detection module to obtain the binary change image before and after the change of the area.
[0014] Furthermore, a training data set is used to train the cultivated land non-agricultural change detection model, and obtaining the training data set includes the following steps:
[0015] The image data before and after the change of the area are superimposed and labeled in space. The image data before the change is labeled as cultivated land features, and the image data after the change is labeled as non-cultivated land features, so as to obtain vector labels of cultivated land non-agriculturalization samples with multiple features.
[0016] Convert the vector labels of cultivated land non-agricultural samples into binary raster image labels;
[0017] The image data before the change, the image data after the change and the corresponding raster image labels are clipped according to rules to generate image data for input into the cultivated land non-agricultural change detection model.
[0018] Furthermore, the multi-scale feature extraction module extracts multi-scale features of the two-phase image data, specifically including the following steps:
[0019] The convolution layer with a convolution kernel of 7×7 and a step size of 2 is used to extract features from the input H×W×3 image data, and the obtained Feature map of
[0020] Will The feature map of is input into the maximum pooling layer with a step size of 2, and we get Feature map of
[0021] Will The feature map of is extracted through four residual blocks in sequence. The convolution layer of the residual block has a 3×3 convolution kernel and 32 channels.
[0022] Furthermore, the differential attention module is used to calibrate the extracted multi-scale features according to the difference between the image data before and after the change of the region, specifically comprising the following steps:
[0023] The Euclidean distance is used to calculate the feature maps of the image data before and after the change. The difference is then convolved using a 3×3 convolution layer to obtain the convolved feature map D. represents the set of real numbers, Represents a multidimensional array of N×C×H×W; the feature map D is expressed as:
[0024]
[0025] Among them, the input feature map is and N is the batch size, C is the number of channels, H and W are the image sizes;
[0026] Perform the maximum pooling Maxpool and average pooling Avgpool operations on the feature map D respectively to obtain the feature information of the feature map before and after the change;
[0027] The multi-layer perceptron MLP is used to perform nonlinear transformation on the feature information of the feature maps before and after the change;
[0028] The two feature maps after nonlinear transformation are merged, and then the difference weight is recalculated using the Sigmoid activation function to obtain the feature map D', where σ represents the Sigmoid activation function; the feature map D' is specifically expressed as:
[0029] D'=σ(MLP(MaxPool(D))+MLP(AvgPool(D)))
[0030] The feature map D' is weighted by the dot multiplication method to obtain the calculation result A of the difference attention module. It is expressed as:
[0031] A i =X i ·D'+X i
[0032] Among them, A i represents the i-th input X i The calculation results of the difference attention module, A i is a subset of A, X i Represents the i-th input feature map X .
[0033] Furthermore, the calibrated feature map is input into the CBAM channel and the position attention guided Transformer multi-scale feature aggregation module, and the calibrated feature map is further processed. The feature flattening and direct feature flattening of the 1×1 convolution layer are used to obtain and 3D feature map of
[0034] After F' is weighted normalized using the softmax function, the three-dimensional feature maps of F' and F'' are weighted to obtain the three-dimensional feature map for input to the Transformer encoder. It is expressed as:
[0035]
[0036] Furthermore, the process of capturing and aggregating the contextual information of features of different scales in the calibrated feature map through the Transformer encoder specifically includes the following steps:
[0037] In F token After adding position encoding, LayerNorm is used for normalization, and the global semantic features are obtained through the correlation between different image blocks. The calculation process is expressed as:
[0038] MultiHead(Q,K,V)=Concat(head1,…,head h )W o
[0039]
[0040] Among them, Q, K, and V are query, key, and value matrices respectively, and d k is the dimension of the key;
[0041] The global semantic features are normalized by the LayerNorm layer, subjected to residual connections, MLP, and feedforward networks to obtain the contextual information of features of different scales in the feature map.
[0042] Furthermore, the new feature map is input into the classification detection module to obtain a binary change image of the region before and after the change, specifically by using a Classifier classifier to identify and detect the new feature map to obtain a binary change image of the region before and after the change.
[0043] The present invention also includes a system for detecting changes in cultivated land to non-agricultural conditions, comprising:
[0044] An acquisition module is used to acquire two-phase image data of a non-agricultural area of cultivated land containing various geographical environments and various change forms; the two-phase image data are image data before and after the change of the area;
[0045] The training module is used to train the farmland non-agriculturalization change detection model using two-period image data of the farmland non-agriculturalization area;
[0046] A detection module is used to input two periods of image data of the cultivated land non-agriculturalization area to be detected into the trained cultivated land non-agriculturalization change detection model to detect and obtain a binary change image of the area before and after the change;
[0047] Wherein, the training module includes:
[0048] A feature calibration unit is used to extract multi-scale features of the two-phase image data through a multi-scale feature extraction module; a difference attention module is used to calibrate the extracted multi-scale features based on the difference between the image data before and after the change of the region;
[0049] The feature aggregation unit is used to input the calibrated feature map into the Transformer multi-scale feature aggregation module guided by the CBAM channel and position attention. The context information of features of different scales in the calibrated feature map is captured and aggregated through the Transformer encoder. The multi-scale spatial channel features are interacted with the context information of features of different scales through the Transformer decoder to obtain low-level spatial information and high-level semantic information of features of different scales, and the low-level spatial information and high-level semantic information of features of different scales are fused to obtain a new feature map.
[0050] The detection unit is used to input the new feature map into the classification detection module to obtain a binary change image before and after the change of the area.
[0051] The present invention also includes a computer device for detecting non-agricultural changes in cultivated land, comprising: a memory, a processor, and a computer program stored in the memory. When the processor executes the computer program, the steps of the method for detecting non-agricultural changes in cultivated land are implemented.
[0052] The present invention also includes a readable storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, they are used to execute the steps of the method for detecting non-agricultural changes in cultivated land.
[0053] The present invention provides a method, system, device, and storage medium for detecting changes in cultivated land to non-agricultural status, which have the following beneficial effects:
[0054] The present invention uses a differential attention module to recalibrate the multi-scale features extracted from the two-phase image data of the detection area, thereby enhancing the differential features between the two phases of remote sensing images and effectively overcoming the interference of redundant features such as illumination, phase, and star source; obtains global features through the Transformer multi-scale feature aggregation module, adds multiple connections between codecs at different levels, integrates low-level spatial information and high-level semantic information at different scales, realizes contextual information aggregation, obtains a larger receptive field and stronger context shaping ability, thereby improving the accuracy of change detection of cultivated land non-agriculturalization. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 This is a schematic diagram of the overall process of the method for detecting cultivated land non-agricultural changes in an embodiment of the present invention;
[0056] Figure 2 Schematic diagram of a differential attention module (DAM) in an embodiment of the present invention;
[0057] Figure 3 This is a schematic diagram of the detection results of cultivated land non-agriculturalization in an embodiment of the present invention;
[0058] Figure 4 Schematic diagram of CBAM-guided Transformer multi-scale feature aggregation in an embodiment of the present invention. DETAILED DESCRIPTION
[0059] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0060] The present invention proposes a method for detecting cultivated land non-agricultural changes based on a differential attention mechanism and multi-scale aggregation, which includes the following steps:
[0061] S1. Construction of the cultivated land non-agriculturalization dataset:
[0062] ① Image preparation: Collect 2-meter resolution satellite image data of the same area in the previous and subsequent periods, and select sample images that include various geographical environments and various changes in cultivated land non-agriculturalization. The image storage format is tif, img and other remote sensing image formats, with three bands of red, green and blue, and a bit depth of 8 bits. The coordinate system uses a projected coordinate system, and the pixel unit is meter. The registration error of the two images should not be greater than 2 pixels.
[0063] ② Label collection: The spatial positions of the two sample images are superimposed and labeled. The features of cultivated land are marked on the early image, and the features of non-cultivated land are marked on the later image. In this way, vector labels of cultivated land non-agricultural samples with multiple features are obtained. The vector format is ESRI Shapefile.
[0064] ③Format conversion: convert the sample vector into a binary raster image, and the image storage format is a lossless image format such as tif and png.
[0065] ④ Sample cropping: The sample images from the two phases and the corresponding raster labels are cropped regularly to generate a change detection tile dataset for training deep learning models. The tile dataset can be cropped to pixel sizes such as 256, 512, and 1024, and invalid samples are filtered out.
[0066] ⑤Data partitioning: The cropped change detection dataset is randomly divided into a training dataset and a validation dataset in a ratio of 8:2.
[0067] S2. Training of the model for detecting farmland conversion to non-agricultural land:
[0068] ① Multi-scale feature extraction:
[0069] a. Input the H×W×3 two-stage cropped sample image, use the convolution layer with a convolution kernel of 7×7 and a stride of 2, and the output is feature map.
[0070] b. Then pass through the maximum pooling layer with a step size of 2 to obtain the main features and reduce the number of parameters. The output is feature map.
[0071] c. The feature map output from b passes through four residual blocks in sequence, and the output feature map size is the input size. The output channels are 64, 128, 256, and 512, respectively. In order to obtain multi-scale shallow and deep features, the feature maps of the ResBlosk-1, ResBlosk-3, and ResBlosk-4 residual blocks are respectively passed through the convolution layer with a convolution kernel of 3×3. In order to facilitate calculation, the feature maps with 64, 128, and 512 channels are uniformly processed into 32 channels, that is, Size feature map.
[0072] d. The feature maps of the two phases obtained in c are then used as the input of the difference attention (DAM) module to enhance the difference feature F between the two phases of remote sensing images. 11 、F 12 、F 13 .
[0073] ② Calculation of difference features:
[0074] The Differential Attention Module (DAM) recalibrates the extracted multi-scale features to reduce noise interference and focus on the objects that have actually changed, thereby enhancing the change detection effect. The design of this module combines convolutional layers, pooling layers, and multi-layer perceptrons (MLP) to calculate attention weights and use these weights to reweight the input feature maps, such as Figure 2 As shown, the specific implementation is as follows:
[0075] a. Use Euclidean distance to calculate the difference between the features extracted from the two images, and then use a 3×3 convolution layer to perform convolution calculation. The result is recorded as D. The input feature map is and Where N is the batch size, C is the number of channels, H and W are the image sizes. The calculation method is as follows:
[0076]
[0077] b. Perform Maxpool and Avgpool operations on the output of a to obtain the main features of the changes before and after.
[0078] c. Use multi-layer perceptron MLP to perform nonlinear transformation on the results of b, then merge the two feature maps, and then use Sigmoid activation function to recalculate the difference weight, and record the result as D'. The calculation method is as follows:
[0079] D'=σ(MLP(MaxPool(D))+MLP(AvgPool(D)))
[0080] d. The result of c is finally weighted by the dot multiplication method to obtain the calculation result. In order to prevent the gradient from disappearing and retain the original feature information, the residual connection method is used. The final calculation result of the DAM module is A. The calculation method of this process is as follows:
[0081] A i =X i ·D'+X i
[0082] ③CBAM-guided Transformer multi-scale feature aggregation, three token encoders and three token decoders built based on the Transformer architecture to capture and aggregate multi-scale contextual information from features of three different sizes, such as Figure 3 As shown, the following steps are included:
[0083] a. Transformer encoder stage, feature map The feature flattening and direct feature flattening of the 1×1 convolution layer are used to obtain and The three-dimensional feature map is obtained by normalizing the weights of F' using the softmax function, and then weighting the two three-dimensional feature maps to obtain The three-dimensional feature map suitable for inputting the Transformer encoder is calculated as follows:
[0084]
[0085] b. In F token Positional encoding is added to the model, and then LayerNorm is used for normalization to improve the training stability and convergence speed of the model. Then, the correlation between different image blocks is calculated based on the multi-head attention mechanism to obtain rich global semantic features. The calculation process is expressed as follows:
[0086] MultiHead(Q,K,V)=Concat(head1,…,head h )W o
[0087]
[0088] Among them, Q, K, and V are query, key, and value matrices respectively, and d k The output is normalized by the LayerNorm layer, followed by residual connections, MLP, and a feed-forward network (FFN) to obtain the multi-scale encoding result.
[0089] c. In the Transformer decoder stage, the spatial channel features are used as an input to the Transformer decoder. The CrossAttention mechanism interacts the multi-scale spatial channel features calculated by the CBAM attention mechanism with the encoder output to obtain the feature map F' token .
[0090] d. Feature map F' token After LayerNorm normalization and MLP multi-layer perceptron, the global features are obtained by the Transformer encoder. Then, multiple connections are added between encoders and decoders at different levels to fuse low-level spatial information and high-level semantic information at different scales, realize context information aggregation, and obtain a new feature map, namely Figure 1 F in 21 、F 22 、F 23 .
[0091] ④Classifier calculation prediction results:
[0092] a. Use a multi-scale fusion strategy to stitch the three feature maps together based on the results calculated in step ③.
[0093] b. Apply the Classifier classifier to the result of a to obtain the binary change results of the agricultural land in the two images before and after. The Classifier classifier contains a 3×3 convolution layer, a Batch Normalization layer, a ReLU activation layer and a 3×3 output convolution layer, and finally obtains the H×W×1 prediction result. The structure is as follows Figure 1 shown.
[0094] ⑤Loss calculation and gradient optimization:
[0095] The input training set is used to predict the output image and the corresponding label in step ④ to calculate the loss. The loss is calculated using a hybrid loss function, which includes two parts: cross-entropy loss (Cross-Entropy Loss) and Dice loss (DiceLoss). The calculation process is as follows:
[0096]
[0097] Where N represents the number of samples, y i is the true label of the i-th sample, p i is the predicted probability of the i-th sample, α and β are the weights of the two losses respectively.
[0098] The gradient of the model parameters is calculated based on the loss value, and the Adam optimization algorithm is used to update the model parameters to minimize the loss function.
[0099] S3. Extraction of information on detection of cultivated land non-agricultural change:
[0100] Using the trained farmland non-agricultural change detection model, we perform change detection on the two input satellite images to obtain the farmland non-agricultural change extraction results. The specific implementation steps are as follows:
[0101] ① Input two phases of satellite images of the entire scene or a large area.
[0102] ② The sliding window is moved gradually across the image, and change detection is performed independently on each small block until the entire image is covered to obtain the binary image result of cultivated land non-agriculturalization detection for the entire image.
[0103] ③ Read the coordinate information of the input image and add the coordinate information to the detection result image of cultivated land non-agriculturalization.
[0104] ④ Use geographic information GIS software to convert the detection result image into ESRI Shapefile vector data.
[0105] The present invention uses a method combining CNN and Transformer to realize agricultural land change detection. First, a differential attention (DAM) CNN is designed to hierarchically acquire remote sensing image features, thereby enhancing the differential features between the two phases of remote sensing images and effectively overcoming the interference of redundant features such as illumination, phase, and star source. The acquired features are then passed through a multi-scale feature aggregation Transformer encoder-decoder guided by a designed position and spatial hybrid attention mechanism to obtain a larger receptive field and stronger context shaping ability. Finally, a method based on sliding window inference of large-scale satellite images is designed to facilitate the rapid and large-scale extraction of change patches of agricultural land non-agriculturalization.
[0106] Test verification: Taking a certain area as an example, the image source is mainly domestic satellite images such as ZY3 and GF1 with a resolution of 2 meters. 31723 sets of change detection samples with a size of 512 pixels are produced, and another 2 images are used as test images. The results of the cultivated land non-agriculturalization detection are as follows: Figure 3 shown.
[0107] Based on the same inventive concept, the present invention proposes a system for detecting changes in cultivated land to non-agricultural status, comprising:
[0108] The acquisition module is used to collect two-phase image data of a non-agricultural cultivated land area with various geographical environments and various change forms; the two-phase image data are the image data before and after the changes of the area.
[0109] The training module is used to train the farmland non-agriculturalization change detection model using two-phase image data of farmland non-agriculturalization areas.
[0110] The detection module is used to input two phases of image data of the cultivated land non-agriculturalization area to be detected into the trained cultivated land non-agriculturalization change detection model to detect and obtain the binary change image of the area before and after the change.
[0111] The training modules include:
[0112] The feature calibration unit is used to extract multi-scale features of the two-phase image data through the multi-scale feature extraction module; and the differential attention module is used to calibrate the extracted multi-scale features according to the difference between the image data before and after the change of the region.
[0113] The feature aggregation unit is used to input the calibrated feature map into the Transformer multi-scale feature aggregation module guided by the CBAM channel and position attention, and capture and aggregate the contextual information of features of different scales in the calibrated feature map through the Transformer encoder; through the Transformer decoder, the multi-scale spatial channel features are interacted with the contextual information of features of different scales to obtain low-level spatial information and high-level semantic information of features of different scales, and the low-level spatial information and high-level semantic information of features of different scales are fused to obtain a new feature map.
[0114] The detection unit is used to input the new feature map into the classification detection module to obtain a binary change image before and after the change of the area.
[0115] Based on the same inventive concept, the present invention also proposes a computer device for detecting the non-agricultural conversion of cultivated land, comprising: a memory, a processor, and a computer program stored in the memory. When the processor executes the computer program, the steps of the method for detecting the non-agricultural conversion of cultivated land are implemented.
[0116] Based on the same inventive concept, the present invention also proposes a readable storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, they are used to execute the steps of a method for detecting non-agricultural changes in cultivated land.
[0117] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with the technical field, within the technical scope disclosed by the present invention, who makes equivalent replacements or changes based on the technical solution and inventive concept of the present invention, should be covered by the scope of protection of the present invention.
Claims
1. A method for detecting changes in cultivated land to non-agricultural status, characterized in that: The following steps are involved: Collecting two phases of image data of a non-agricultural area of cultivated land that includes various geographical environments and various changes; the two phases of image data are image data before and after the changes of the area; The farmland non-agriculturalization change detection model was trained using two phases of image data from farmland non-agriculturalization areas. Input the two-phase image data of the cultivated land non-agriculturalization area to be detected into the trained cultivated land non-agriculturalization change detection model to obtain the binary change image before and after the change of the area; The method of training the farmland non-agriculturalization change detection model using two-phase image data of the farmland non-agriculturalization area specifically includes the following steps: The multi-scale features of the two-phase image data are extracted through the multi-scale feature extraction module; the difference attention module is used to calibrate the extracted multi-scale features according to the difference between the image data before and after the change of the region; specifically, the following steps are included: the difference between the feature maps of the image data before and after the change is calculated using the Euclidean distance, and then a 3×3 convolution layer is used to perform convolution to obtain the feature map after convolution. D , , represents the set of real numbers, Indicates a The multidimensional array of D Expressed as: , where the input feature map is and , N is the batch size, C is the number of channels, H and W is the image size; for the feature map D Perform maximum pooling separately Maxpool and mean pooling Avgpool Operation, get the feature information of the feature map before and after the change; use multi-layer perceptron MLP Perform nonlinear transformation on the feature information of the feature maps before and after the change respectively; merge the two feature maps after nonlinear transformation, and then use Sigmoid The activation function recalculates the difference weights to obtain the feature map ,in , Expressed as Sigmoid Activation function; feature map Specifically expressed as: ; The feature map is processed by the dot multiplication method Perform feature weighting to obtain the calculation results of the differential attention module A , , which is expressed as: ,in, A i Indicates the i input X i The calculation results of the difference attention module, A i yes A A subset of Indicates the i Input feature maps X ; The calibrated feature map is input into the Transformer multi-scale feature aggregation module guided by the CBAM channel and position attention. The contextual information of features of different scales in the calibrated feature map is captured and aggregated through the Transformer encoder. The multi-scale spatial channel features are interacted with the contextual information of features of different scales through the Transformer decoder to obtain low-level spatial information and high-level semantic information of features of different scales. The low-level spatial information and high-level semantic information of features of different scales are then fused to obtain a new feature map. The new feature map is input into the classification detection module to obtain the binary change image before and after the change of the area.
2. The method for detecting cultivated land non-agricultural changes according to claim 1, characterized in that: The cultivated land non-agricultural change detection model is trained using a training data set, and obtaining the training data set includes the following steps: The image data before and after the change of the area are superimposed and labeled in space. The image data before the change is labeled as cultivated land features, and the image data after the change is labeled as non-cultivated land features, so as to obtain vector labels of cultivated land non-agriculturalization samples with multiple features. Convert the vector labels of cultivated land non-agricultural samples into binary raster image labels; The image data before the change, the image data after the change and the corresponding raster image labels are clipped according to rules to generate image data for input into the cultivated land non-agricultural change detection model.
3. The method for detecting cultivated land non-agricultural changes according to claim 1, characterized in that: The multi-scale feature extraction module is used to extract the multi-scale features of the two-phase image data, specifically comprising the following steps: The convolution layer with a convolution kernel of 7×7 and a stride of 2 is used to transform the input H × W ×3 image data for feature extraction, and we get Feature map of 4; Will The feature map of 4 is input into the maximum pooling layer with a step size of 2, and we get Feature map of 4; Will The feature map of 4 is extracted through four residual blocks in sequence.
32.
32. 32-size feature map; wherein the convolution layer of the residual block has a 3×3 convolution kernel and 32 channels.
4. The method for detecting cultivated land non-agricultural changes according to claim 1, characterized in that: The calibrated feature map is input into the CBAM channel and the position attention guided Transformer multi-scale feature aggregation module, and the calibrated feature map is also included. The feature flattening and direct feature flattening of the 1×1 convolution layer are used to obtain and 3D feature map of right use softmax After the function is weighted normalized, and The three-dimensional feature map is weighted to obtain the three-dimensional feature map for input to the Transformer encoder , which is expressed as: 。 5. The method for detecting cultivated land non-agricultural changes according to claim 4, characterized in that: The process of capturing and aggregating the contextual information of features of different scales in the calibrated feature map through the Transformer encoder specifically includes the following steps: exist After adding position encoding, LayerNorm is used for normalization, and the global semantic features are obtained through the correlation between different image blocks. The calculation process is expressed as: in, Q 、 K 、 V are query, key, and value matrices respectively, is the dimension of the key; The global semantic features are normalized by the LayerNorm layer, subjected to residual connections, MLP, and feedforward networks to obtain the contextual information of features of different scales in the feature map.
6. The method for detecting cultivated land non-agricultural changes according to claim 1, characterized in that: The new feature map is input into the classification detection module to obtain the binary change image before and after the region changes, specifically using the Classifier classifier to identify and detect the new feature map to obtain the binary change image before and after the region changes.
7. A system for detecting changes in cultivated land to non-agricultural status, characterized in that: include: An acquisition module is used to acquire two-phase image data of a non-agricultural area of cultivated land containing various geographical environments and various change forms; the two-phase image data are image data before and after the change of the area; The training module is used to train the farmland non-agriculturalization change detection model using two-phase image data of farmland non-agriculturalization areas; A detection module is used to input two periods of image data of the cultivated land non-agriculturalization area to be detected into the trained cultivated land non-agriculturalization change detection model to detect and obtain a binary change image of the area before and after the change; Wherein, the training module includes: The feature calibration unit is used to extract the multi-scale features of the two-phase image data through the multi-scale feature extraction module; the difference attention module is used to calibrate the extracted multi-scale features according to the difference between the image data before and after the change of the region; specifically, the following steps are included: using Euclidean distance to calculate the difference between the feature maps of the image data before and after the change, and then using a 3×3 convolution layer to perform convolution to obtain the feature map after convolution. D , , represents the set of real numbers, Indicates a The multidimensional array of D Expressed as: , where the input feature map is and , N is the batch size, C is the number of channels, H and W is the image size; for the feature map D Perform maximum pooling separately Maxpool and mean pooling Avgpool Operation, get the feature information of the feature map before and after the change; use multi-layer perceptron MLP Perform nonlinear transformation on the feature information of the feature maps before and after the change respectively; merge the two feature maps after nonlinear transformation, and then use Sigmoid The activation function recalculates the difference weights to obtain the feature map ,in , Expressed as Sigmoid Activation function; feature map Specifically expressed as: ; The feature map is processed by the dot multiplication method Perform feature weighting to obtain the calculation results of the differential attention module A , , which is expressed as: ,in, A i Indicates the i input X i The calculation results of the difference attention module, A i yes A A subset of Indicates the i Input feature maps X ; The feature aggregation unit is used to input the calibrated feature map into the Transformer multi-scale feature aggregation module guided by the CBAM channel and position attention. The context information of features of different scales in the calibrated feature map is captured and aggregated through the Transformer encoder. The multi-scale spatial channel features are interacted with the context information of features of different scales through the Transformer decoder to obtain low-level spatial information and high-level semantic information of features of different scales, and the low-level spatial information and high-level semantic information of features of different scales are fused to obtain a new feature map. The detection unit is used to input the new feature map into the classification detection module to obtain a binary change image before and after the change of the area.
8. A computer device for detecting changes in cultivated land from non-agricultural use, characterized in that: include: A memory, a processor, and a computer program stored in the memory, wherein when the processor executes the computer program, the steps of the method for detecting non-agricultural changes of cultivated land according to any one of claims 1 to 6 are implemented.
9. A readable storage medium, characterized in that: The readable storage medium stores a computer program, which includes program instructions. When the program instructions are executed by a processor, they are used to execute the steps of the method for detecting non-agricultural changes of cultivated land according to any one of claims 1 to 6.