Method, system and equipment for detecting non-agrochemical change of cultivated land and storage medium
By using the differential attention module and the Transformer multi-scale feature aggregation module in the non-agricultural change detection of cultivated land, the problem of insufficient utilization and differential analysis of multi-scale feature in the existing technology is solved, and the accuracy and generalization of the detection are significantly improved. .
Patent Information
- Application Number
- CN202411424355.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2025-02-07
- 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 differential attention module is used to calibrate multi-scale features, and the context information of different scale features is captured and aggregated through the CBAM channel and position attention-guided Transformer multi-scale feature aggregation module to generate more accurate changing images.
Effectively overcome the interference of factors such as light, time phase, star source, etc., and improve the accuracy and generalization ability of non-agricultural changes in arable land.
Smart Images

Figure CN119399624A_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 the most valuable resource in my country. Non-agriculturalization is one of the main problems in the development and utilization of land resources, mainly referring to the construction of non-agricultural infrastructure and buildings on arable land. The use of satellite remote sensing to quickly and timely discover non-agricultural behavior of arable land in a large area has become a mainstream method at present, with the characteristics of large range and high frequency. In recent years, deep learning has also made great progress. Introducing deep learning technology into the intelligent non-agricultural identification of remote sensing data can greatly improve the efficiency of automatic extraction of changes by assisting or replacing traditional methods of manual visual interpretation.
[0003] At present, the identification of cultivated land non-agriculturalization based on satellite images mainly adopts visual interpretation and visual interpretation assisted by deep learning change detection. The rapid development of deep learning technology has provided new solutions for remote sensing image change detection, especially convolutional neural networks (CNN) and Transformer have shown 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 network (CNN), such as FC-EF, which performs early fusion of multi-temporal images and uses a fully convolutional network 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 dependent 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 use 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 prior art that the effective use of multi-scale features and the difference analysis between images at different times are not considered, resulting in a high rate of missed detections and false detections and poor generalization of the detection results, the present invention proposes a method, system, device and storage medium for detecting the non-agricultural changes of cultivated land, thereby solving the problems existing in the prior art.
[0006] A method for detecting changes in cultivated land from agricultural use, comprising the following steps:
[0007] Collecting two phases of image data of a non-agricultural area of cultivated land containing various geographical environments and various change forms; the two phases of image data are image data before the change and image data after the change of the area;
[0008] The farmland non-agriculturalization change detection model is trained using two phases of image data of farmland non-agriculturalization areas.
[0009] Input the two-phase image data of the cultivated land non-agriculturalization detection area into the trained cultivated land non-agriculturalization change detection model, and detect and obtain the binary change image of the area before and after the change;
[0010] The method of training the farmland non-agriculturalization change detection model by 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 by a multi-scale feature extraction module; the extracted multi-scale features are calibrated according to the difference between the image data before and after the change of the region by a difference attention module;
[0012] The calibrated feature map is input 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.
[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 the acquisition of the training data set includes the following steps:
[0015] The image data before and after the change of the region are superimposed and labeled in spatial position. 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-agricultural 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 extracting of multi-scale features of the two-phase image data by the multi-scale feature extraction module specifically includes the following steps:
[0019] A convolutional 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 The 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 The feature map of
[0021] Will The feature map of is extracted through four residual blocks in turn. The convolution layer of the residual block has a 3×3 convolution kernel and 32 channels.
[0022] Furthermore, the use of the difference attention module to calibrate the extracted multi-scale features according to the difference between the image data before the change and the image data after the change of the region specifically includes the following steps:
[0023] The feature map of the image data before and after the change is calculated using Euclidean distance 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 graphs 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, before the calibrated feature map is input into the CBAM channel and the position attention guided Transformer multi-scale feature aggregation module, the calibrated feature map is also included. The feature flattening and direct feature flattening of the 1×1 convolutional 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 into the Transformer encoder. It is expressed as:
[0035]
[0036] Furthermore, the process of capturing and aggregating context information of features of different scales in the calibrated feature map by 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, residual connection, MLP and feedforward network to obtain the contextual information of features of different scales in the feature map.
[0042] Furthermore, the inputting of the new feature map into the classification detection module to obtain the binary change image before and after the region changes is specifically performed by using a Classifier classifier to identify and detect the new feature map to obtain the binary change image before and after the region changes.
[0043] The present invention also includes a system for detecting changes in cultivated land to non-agricultural conditions, comprising:
[0044] The 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 the change and image data after the change of the area;
[0045] A training module is used to train the farmland non-agriculturalization change detection model using two-phase image data of farmland non-agriculturalization areas;
[0046] A 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, and 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; and a 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;
[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, and capture and aggregate the context information of different scale features in the calibrated feature map through the Transformer encoder; the multi-scale spatial channel features are interacted with the context information of different scale features through the Transformer decoder to obtain the low-level spatial information and high-level semantic information of different scale features, and the low-level spatial information and high-level semantic information of different scale features 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 region changes.
[0051] The present invention also includes a computer device for detecting non-agricultural changes of cultivated land, including: a memory, a processor, and a computer program stored in the memory, and the processor implements the steps of the method for detecting non-agricultural changes of cultivated land when executing the computer program.
[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 of cultivated land.
[0053] The present invention provides a method, system, device and storage medium for detecting changes in cultivated land from agricultural use, which have the following beneficial effects:
[0054] The present invention recalibrates the multi-scale features extracted from the two-phase image data of the detection area by adopting a differential attention module, so as to enhance the differential features between the two phases of remote sensing images and effectively overcome 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 of different scales, realizes context 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 It is a schematic diagram of the overall process of the method for detecting the non-agricultural change of cultivated land 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 Transformer multi-scale feature aggregation guided by CBAM in an embodiment of the present invention. DETAILED DESCRIPTION
[0059] The technical solutions in the embodiments of the present invention will be described clearly and completely 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-agriculturalization changes based on a differential attention mechanism and multi-scale aggregation, comprising the following steps:
[0061] S1. Construction of the dataset of cultivated land non-agriculturalization:
[0062] ① Image preparation: Collect 2-meter resolution satellite image data of the same area in the previous and subsequent periods, select sample images that include various geographical environments and various changes in cultivated land non-agriculturalization, and store images in remote sensing image formats such as tif and img. The bands include red, green and blue bands, the bit depth is 8 bits, the coordinate system uses the projection coordinate system, the pixel unit is meter, and the registration error of the previous and subsequent images should not be greater than 2 pixels.
[0063] ② Label collection: The sample images of the previous and subsequent periods are superimposed and labeled in space. The features of cultivated land are marked on the previous 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 clipping: The sample images of the two periods and the corresponding raster labels are clipped regularly to generate a change detection tile dataset for training deep learning models. The tile dataset can be clipped according to pixel sizes such as 256, 512, and 1024, and invalid samples can be screened out.
[0066] ⑤Data division: 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 non-agriculturalization changes:
[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 step size of 2, and the output is feature map.
[0070] b. Then, after passing through the maximum pooling layer with a step size of 2, the main features are obtained and the number of parameters is reduced. 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 in sequence. 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 previous and next phases obtained in c are used as the input of the difference attention (DAM) module to enhance the difference feature F between the previous and next remote sensing images. 11 、F 12 、F 13 .
[0073] ② Calculation of difference features:
[0074] The Differential Attention (DAM) module recalibrates the extracted multi-scale features to reduce noise interference and focus on the objects that have actually changed to enhance 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 of 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 maximum pooling Maxpool and average pooling 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 the Sigmoid activation function to recalculate the difference weight. The result is recorded 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 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 convolutional layer are used to obtain and The three-dimensional feature map is obtained by using the softmax function to normalize the weights of F', and then the two three-dimensional feature maps are weighted to obtain The three-dimensional feature map suitable for inputting the Transformer encoder is expressed as:
[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:
[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 is the dimension of the key. The output is normalized by LayerNorm layer, residual connection, MLP and feed-forward network (FFN) to finally obtain the multi-scale encoding result.
[0089] c. In the Transformer decoder stage, the spatial channel features are used as an input of 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. For feature graph 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 of different scales, realize context information aggregation, and obtain a new feature map, namely Figure 1 F 21 、F 22 、F 23 .
[0091] ④Classifier calculation prediction results:
[0092] a. Use a multi-scale fusion strategy to splice the three feature maps for the results calculated in ③.
[0093] b. Apply the Classifier classifier to the result of a to obtain the binary change results of 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 prediction result of H×W×1. The structure is as follows Figure 1 shown.
[0094] ⑤Loss calculation and gradient optimization:
[0095] The input training set predicts the output image and the corresponding label in step ④ to calculate the loss. The loss is calculated using a mixed 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 ith sample, and α 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, the two input satellite images are processed for change detection to obtain the farmland non-agricultural change extraction results. The specific implementation steps are as follows:
[0101] ① Input the entire scene or large blocks of satellite images from the previous and next periods.
[0102] ② The sliding window is moved gradually on 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 of the entire image.
[0103] ③ Read the coordinate information of the input image and attach the coordinate information to the detection result image of farmland non-agriculturalization.
[0104] ④ Use geographic information GIS software to convert the detection result image into ESRI Shapefile vector data.
[0105] The present invention adopts a method combining CNN and Transformer to realize agricultural land change detection. First, a differential attention (DAM) CNN is designed to hierarchically obtain remote sensing image features, so as to enhance the difference features between the two phases of remote sensing images and effectively overcome the interference of redundant features such as illumination, phase, and star source. Then the acquired features are passed through a multi-scale feature aggregation Transformer encoder-decoder guided by the 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 reasoning of large-format 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 were produced, and another 2 images were used as test images. The results of farmland 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 from agricultural use, comprising:
[0108] The acquisition module is used to collect two-phase image data of non-agricultural areas of cultivated land with various geographical environments and various change forms; the two-phase image data are the image data before the change and the image data after the change 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 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 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 a multi-scale feature extraction module; and 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 area.
[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 the 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 region changes.
[0115] Based on the same inventive concept, the present invention also proposes a computer device for detecting the non-agricultural changes of cultivated land, comprising: a memory, a processor and a computer program stored in the memory, and the processor implements the steps of the method for detecting the non-agricultural changes of cultivated land when executing the computer program.
[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 of cultivated land.
[0117] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A method for detecting changes in cultivated land from agricultural use, characterized in that: The following steps are involved: Collecting two phases of image data of a non-agricultural area of cultivated land containing various geographical environments and various change forms; the two phases of image data are image data before the change and image data after the change of the area; The farmland non-agriculturalization change detection model is trained using two phases of image data of farmland non-agriculturalization areas. Input the two-phase image data of the cultivated land non-agriculturalization detection area into the trained cultivated land non-agriculturalization change detection model, and detect and obtain the binary change image of the area before and after the change; The method of training the farmland non-agriculturalization change detection model by 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 by a multi-scale feature extraction module; the extracted multi-scale features are calibrated according to the difference between the image data before and after the change of the region by a difference attention module; The calibrated feature map is input 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 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 non-agricultural changes of cultivated land according to claim 1, characterized in that: The training data set is used to train the cultivated land non-agricultural change detection model, and the acquisition of the training data set includes the following steps: The image data before and after the change of the region are superimposed and labeled in spatial position. 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-agricultural 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 non-agricultural changes of cultivated land according to claim 2, characterized in that: The method of extracting multi-scale features of the two-phase image data by a multi-scale feature extraction module specifically includes the following steps: A convolutional 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 The feature map of Will The feature map of is input into the maximum pooling layer with a step size of 2, and we get The feature map of Will The feature map of is extracted through four residual blocks in turn. The convolution layer of the residual block has a 3×3 convolution kernel and 32 channels.
4. The method for detecting non-agricultural changes of cultivated land according to claim 3, characterized in that: The method of using the difference attention module to calibrate the extracted multi-scale features according to the difference between the image data before the change and the image data after the change of the region specifically includes the following steps: The feature map of the image data before and after the change is calculated using Euclidean distance 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: 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; 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; The multi-layer perceptron MLP is used to perform nonlinear transformation on the feature information of the feature graphs before and after the change. 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: D'=σ(MLP(MaxPool(D))+MLP(AvgPool(D))) 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: A i =X i ·D′+X i 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 .
5. The method for detecting non-agricultural changes of cultivated land according to claim 4, characterized in that: Before the calibrated feature map is input into the CBAM channel and the position attention guided Transformer multi-scale feature aggregation module, the calibrated feature map is also included. The feature flattening and direct feature flattening of the 1×1 convolutional layer are used to obtain and 3D feature map of 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 into the Transformer encoder. It is expressed as:
6. A method for detecting non-agricultural changes of cultivated land according to claim 5, characterized in that: The process of capturing and aggregating the context information of different scale features in the calibrated feature map through the Transformer encoder specifically includes the following steps: After adding position encoding to Ftoken, 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: MultiHead(Q,K,V)=Concat(head1,…,head h )W o Among them, Q, K, and V are query, key, and value matrices respectively, and d k is the dimension of the key; The global semantic features are normalized by the LayerNorm layer, residual connection, MLP and feedforward network to obtain the contextual information of features of different scales in the feature map.
7. The method for detecting non-agricultural changes of cultivated land 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.
8. A system for detecting changes in cultivated land to non-agricultural status, characterized in that: include: The 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 the change and image data after the change of the area; A training module is used to train a farmland non-agriculturalization change detection model using two-phase image data of farmland non-agriculturalization areas; A detection module is used to input 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 detect and obtain a binary change image of the area before and after the change; Wherein, the training module includes: A feature calibration unit is used to extract multi-scale features of the two-phase image data through a multi-scale feature extraction module; and a 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; 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 context information of different scale features in the calibrated feature map through the Transformer encoder; the multi-scale spatial channel features are interacted with the context information of different scale features through the Transformer decoder to obtain the low-level spatial information and high-level semantic information of different scale features, and the low-level spatial information and high-level semantic information of different scale features 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 region changes.
9. A computer device for detecting changes in cultivated land from 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 7 are implemented.
10. 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 as described in any one of claims 1-7.
Citation Information
Patent Citations
High-resolution image change detection method based on CIM-T architecture
CN116030361A
Multi-scale feature fusion cultivated land change detection method and system
CN116704367A
Cultivated land change detection method and system based on dynamic sparse hierarchical attention network
CN118470555A
Training method for training a change detection system, training set generating method therefor, and change detection system
WO2023007198A1
Cited By
Method, device and equipment for detecting building change and readable storage medium
CN120853007A