A controllable generation method of high-resolution farmland pseudo samples guided by texture information
Through the conditional diffusion model guided by texture information, high-quality and controllable cultivated land pseudo-samples are generated, which solves the problems of small data volume and sample imbalance in the cultivated land plot data set in the existing technology, and significantly improves the semantic segmentation of cultivated land plots. accuracy.
Patent Information
- Application Number
- CN202410065681.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-17
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-01-17
AI Technical Summary
The existing deep learning-based pseudo-sample generation method for cultivated land plots in remote sensing images fails to effectively utilize the cultivated land texture information in high-resolution remote sensing images, resulting in low quality and uncontrollable pseudo samples, making it difficult to alleviate the problem of cultivated land plot data sets. Problems with small quantities and unbalanced samples.
Using a conditional diffusion model guided by texture information, by constructing a high-resolution cultivated land parcel semantic segmentation data set and a prompt word data set, combined with the encoder, decoder, conditional control unit and U-Net network, the decoupled cross-attention is used Calculate the loss function and train the conditional diffusion model to generate high-quality and controllable cultivated land pseudo-samples.
It directly captures the texture characteristics of cultivated land and avoids foreign object interference. The generated pseudo samples are rich in details and real, which significantly improves the accuracy of semantic segmentation of cultivated land plots and solves the problems of small data volume and unbalanced samples.
Smart Images

Figure CN117975195B
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of remote sensing images, and in particular to a controllable generation method of high-resolution farmland pseudo samples guided by texture information. Background Art
[0002] Cultivated land is the material basis for human survival and development. The quantity and quality of cultivated land are the decisive factors to ensure the sustainable development of agriculture and have a direct impact on the development of the national economy. The rich information contained in high-resolution remote sensing images provides important data support for the development of many fields such as land conversion monitoring, natural disaster monitoring, geographic data acquisition, resource survey, precision agriculture, etc. Large-capacity and high-quality cultivated land datasets are a prerequisite for the application of deep learning in the field of cultivated land. At present, the biggest limitation of deep learning in precision agriculture is the lack of datasets. In addition to giving the model stronger feature extraction capabilities, the quality of the cultivated land dataset itself also determines the accuracy level that the deep learning model can achieve. However, since most of the current mainstream cultivated land plot datasets are tailored for specific tasks, there are differences in the number of images, spatial resolution, and image types of different datasets. For different landforms and terrain conditions, there is still a sample imbalance problem in cultivated land plot data. There are very few high-resolution public datasets suitable for extracting cultivated land plots using deep learning methods, and the method of generating pseudo samples is very effective when the data volume is small. Therefore, using the cultivated land texture information in the existing public cultivated land plot datasets to controllably generate cultivated land plot pseudo samples is of great significance to alleviating the small data volume and imbalance between samples of cultivated land plot datasets, as well as improving the accuracy, quality and application value of automatic vectorization.
[0003] The existing methods for generating pseudo samples of cultivated land plots in remote sensing images based on deep learning mainly include pseudo sample generation methods of cultivated land plots based on generative adversarial networks and pseudo sample generation methods of cultivated land plots based on variational autoencoders. However, the above methods require the careful design of network structures for different task objectives, and there are difficulties in training, poor controllability, and the generated pseudo samples are fuzzy and of low quality. The pseudo sample generation method of cultivated land plots based on conventional diffusion models does not take into account the rich cultivated land texture information in high-resolution remote sensing images, lacks a control module that uses the texture features of cultivated land plots, and is difficult to effectively reconstruct high-quality and controllable cultivated land plot pseudo samples. There is currently no good solution for how to obtain the control information required to generate pseudo samples in the case of a small number of existing cultivated land plot data sets, and make full use of the cultivated land texture information therein to controllably generate cultivated land plot pseudo samples. Summary of the invention
[0004] In view of the defects of the prior art method for generating pseudo samples of cultivated land plots using diffusion models, which does not take into account the rich cultivated land texture information in high-resolution remote sensing images, lacks a control module that uses the texture features of cultivated land plots, and is difficult to effectively reconstruct high-quality and controllable cultivated land plot pseudo samples, the present invention provides a controllable method for generating high-resolution cultivated land pseudo samples guided by texture information to improve the accuracy of cultivated land plot segmentation in remote sensing images. The technical solution adopted by the present invention to overcome its technical problems is:
[0005] A controllable generation method of high-resolution farmland pseudo samples based on texture information guidance comprises the following steps:
[0006] (a) Constructing a large-scale, high-resolution remote sensing imagery semantic segmentation dataset D for cultivated land plots 1-b , construct a small-size high-resolution remote sensing image farmland semantic segmentation dataset D 1-s ;
[0007] (b) The semantic segmentation dataset D of cultivated land plots in large-scale high-resolution remote sensing images 1-b Divide into training set and test set;
[0008] (c) Using small-size high-resolution remote sensing imagery to segment cultivated land plots 1-s Construct a high-resolution remote sensing image farmland plot prompt word dataset D2;
[0009] (d) Establishing a conditional diffusion model, which consists of an encoder, a decoder, a conditional control unit, a decoupled cross attention, and a U-Net network;
[0010] (e) Input the remote sensing images in the training set into the encoder of the conditional diffusion model to obtain a low-dimensional latent representation feature map F image ;
[0011] (f) The remote sensing images, binary farmland plot semantic segmentation labels, and farmland prompt words in the remote sensing images in the training set are input into the conditional control unit of the conditional diffusion model, and the output image embedding decomposition feature F is obtained. Sp-I , feature map embedding decomposition features Text embedding decomposition feature F Sp-Text ;
[0012] (g) The feature map F image Input into the U-Net network of the conditional diffusion model, and output the feature F unet , the feature F unet Input into the Linear layer, and output the shared query vector query of the conditional diffusion model with decoupled cross attention, embedding the image into the decomposed feature F Sp-I , feature map embedding decomposition features Text embedding decomposition feature F Sp-Text Input into the decoupled cross attention of the conditional diffusion model, and output the decoupled cross attention Z;
[0013] (h) The loss function L is calculated using the decoupled cross attention Z loss ;
[0014] (i) Using the AdamW optimizer with the loss function L loss Training the conditional diffusion model to obtain an optimized conditional diffusion model;
[0015] (j) The remote sensing images in the training set are input into the optimized conditional diffusion model, and the pseudo-plot samples of cultivated land are output.
[0016] Further, step (a) comprises the following steps:
[0017] (a-1) The i-th remote sensing image P in the public dataset of the High-resolution Remote Sensing Image Farmland Extraction Challenge i The corresponding original cultivated land plot vector data is obtained by using the RasterizeLayer function in the Python GDAL library with the i-th remote sensing image P i The pixel size is used as the benchmark to transform into a binary semantic segmentation label L for farmland plots i , i∈{1,2,...,n}, n is the number of remote sensing images in the public dataset of the High-Resolution Remote Sensing Imagery Cultivated Land Extraction Challenge;
[0018] (a-2) Use the Warp function in the Python GDAL library to convert the i-th remote sensing image P i According to the boundary range vector file in the public dataset of the High-Resolution Remote Sensing Image Farmland Extraction Challenge, the cropped i-th remote sensing image P is obtained. i ′, use the Warp function in the Python GDAL library to convert the binary farmland plot semantic segmentation label L i According to the boundary range vector file in the public dataset of the High-Resolution Remote Sensing Image Farmland Extraction Challenge, the cropped binary farmland plot semantic segmentation label L is obtained. i ′; (a-3) if side% setpix D = 0, then the i-th remote sensing image P after clipping is not i ′ is used to expand the size, where side is the i-th remote sensing image P after cropping i 'The number of pixels of the side length, setpix D is the maximum cropping size set, % is the modulo operation, if side% setpix D ≠0, then the cropped i-th remote sensing image Pi ′ is extended to nside by the number of pixels D , Where overlap is the overlap ratio, ceil(·) is the rounding operation; then the i-th remote sensing image P after the expansion size is i 'The extended position of nside D The pixel value of the pixel point is filled with 0, and the i-th remote sensing image P after the expansion size is i ′ corresponds to the clipped binary farmland plot semantic segmentation label L i Fill the corresponding position in ' with 0;
[0019] (a-4) The i-th remote sensing image P after the size expansion operation in step (a-3) is i ′ Perform sliding window cropping operation to obtain the cropped i-th remote sensing image P i B , the i-th remote sensing image P after expansion i ′ corresponds to the clipped binary farmland plot semantic segmentation label L i ′Perform sliding window clipping operation to obtain the clipped binary farmland plot semantic segmentation label Then we get a large-scale, high-resolution remote sensing image farmland semantic segmentation dataset D 1-b ,
[0020] (a-5) if side% setpix X = 0, then the i-th remote sensing image P after clipping is not i 'Perform expansion size operation, where setpix X To set the small crop size, if side% setpix X ≠0, then the cropped i-th remote sensing image P i ′ is extended to nside by the number of pixels X , Where overlap is the overlap ratio, Then, the i-th remote sensing image P after the expansion i 'The extended position of nside X The pixel value of the pixel point is filled with 0, and the i-th remote sensing image P after the expansion size is i ′ corresponds to the clipped binary farmland plot semantic segmentation label L i ′; (a-6) the i-th remote sensing image P after the size expansion operation in step (a-5) is i ′ Perform sliding window cropping operation to obtain the cropped i-th remote sensing image P i S, the i-th remote sensing image P after expansion i ′ corresponds to the clipped binary farmland plot semantic segmentation label L i ′Perform sliding window clipping operation to obtain the clipped binary farmland plot semantic segmentation label Get the small-size high-resolution remote sensing image farmland semantic segmentation dataset D 1-s , Preferably, set the maximum crop size setpix D Greater than or equal to 256 pixels and less than or equal to 512 pixels, set the small crop size setpix X The pixel size is greater than or equal to 128 pixels and less than or equal to 256 pixels, and the overlap ratio is greater than or equal to 0 and less than or equal to 1.
[0021] Preferably, a large-scale high-resolution remote sensing imagery cultivated land semantic segmentation dataset D 1-b The dataset is divided into training set and test set in a ratio of 4:1.
[0022] Further, step (c) comprises the following steps:
[0023] (c-1) The cropped i-th remote sensing image P i S Input into the CLIP model to get the text description of the i-th remote sensing image Get the text description set of n remote sensing images
[0024] (c-2) Use the natural language processing toolkit NLTK in Python to describe the text of the i-th remote sensing image Perform part-of-speech analysis on the text description set The article, preposition, pronoun and modal particle are filtered to extract the combination of noun, adjective plus noun, and noun plus noun, and the cultivated land prompt word Pro of the i-th remote sensing image is obtained. i ;
[0025] (c-3) Count the cultivated land prompt words Pro in the i-th remote sensing image i In the text description set Text image The frequency of occurrence in Fre i , we screen out nt cultivated land prompt words with a frequency greater than 100 and their corresponding frequencies, and then sort them from high to low according to the frequency value, and obtain the high-resolution remote sensing image cultivated land plot prompt word dataset D2, D2 = {Pro1: Fre1, Pro2: Fre2, ..., Pro i :Fre i ,...,Pro nt :Fre nt}. Further, step (e) comprises the following steps:
[0026] (e-1) Use the PIL library Image class to read the cropped i-th remote sensing image P in the training set i B , get the training image matrix X′ train-I , use the PIL library Image class to read the cropped binary farmland plot semantic segmentation labels in the training set Get the training label matrix X′ train-L ;
[0027] (e-2) Use the ToTensor() function in PyTorch to convert the training image matrix X′ train-I Convert to tensor X train-I , X train-I ∈R C×W×H , R is the real number space, C is the i-th remote sensing image P after cropping i B The number of channels, W is the i-th remote sensing image P after cropping i B The width of H is the cropped i-th remote sensing image P i B The height of the training label matrix X′ is obtained by using the ToTensor() function in PyTorch. train-L Convert to tensor X train-L , X train-I ∈R LC×W×H , LC is the cropped binary farmland plot semantic segmentation label The number of channels;
[0028] (e-3) The encoder of the conditional diffusion model is the encoder of the pre-trained AutoEncoderKL, which converts the tensor X train-I Input into the encoder of the conditional diffusion model to obtain the low-dimensional potential representation feature map F of the image image , ZC is the number of channels of the low-dimensional latent representation feature map.
[0029] Further, step (f) comprises the following steps:
[0030] (f-1) The conditional control unit in the conditional diffusion model is composed of an image control module, an image and label control module, and a cultivated land prompt word control module;
[0031] (f-2) The image control module consists of a pre-trained CLIP image encoder and a projection network. train-I Input into the pre-trained CLIP image encoder and output the image embedding The projection network of the image control module consists of a Linear layer and a LayerNorm layer to embed the image Input into the Linear layer of the projection network and output the feature The characteristics Input into the LayerNorm layer of the projection network, and output the image embedding decomposition feature F Sp-I ;
[0032] (f-3) The image and label control module consists of a farmland texture feature enhancement module, a pre-trained CLIP image encoder, and a projection network. train-L Input into the farmland texture feature enhancement module, and output the enhanced farmland texture feature map M 1′ , the enhanced farmland texture feature map M 1′ Input to the pre-trained CLIP image encoder of the image and label control module, and output the feature map embedding The projection network of the image and label control module consists of a Linear layer and a LayerNorm layer, which embeds the feature map into Input to the Linear layer of the projection network of the image and label control module, and output the feature The characteristics Input to the LayerNorm layer of the projection network of the image and label control module, and output the feature map to embed the decomposition feature
[0033] (f-4) The farmland prompt word control module is composed of a pre-trained CLIP text encoder, which converts the farmland prompt word Pro of the i-th remote sensing image into i Input into the pre-trained CLIP text encoder, and output the embedded decomposition feature F of this article Sp-Text , F Sp-Text ∈R K×text_embeddings_dim , where K is the maximum text encoding length and text_embeddings_dim is the text embedding size.
[0034] Furthermore, the tensor X train-L Input into the farmland texture feature enhancement module, and output the enhanced farmland texture feature map M 1′ The method is:
[0035] (f-31) The farmland texture feature enhancement module is composed of a farmland texture capture unit and a farmland texture extraction unit;
[0036] (f-32) The farmland texture capture unit consists of the first average pooling layer, the second average pooling layer, the 2D convolution layer, and the LeakyReLU function. train-LInput to the first average pooling layer of the farmland texture capture unit, and output the feature The characteristics Input to the second average pooling layer of the farmland texture capture unit, and output the farmland spatial position attention map Map1 with smooth edge transition. train-I Input to the 2D convolution layer of the farmland texture capture unit, and output the feature The characteristics Input into the LeakyReLU function of the farmland texture capture unit, and output the image feature tensor F1, F1∈[0,1] C′×W×H , C′ is the number of channels of the image feature tensor F1. The farmland spatial position attention map Map1 with smooth edge transition is stacked C′ times in the channel dimension and then multiplied element by element with the image feature tensor F1 to obtain the accurate spatial feature information map M1 of the farmland plot, M1∈[0,1] 1×W×H ;
[0037] (f-33) The farmland texture extraction unit is composed of a first residual convolution block, a first convolution block, a second residual convolution block, and a Softmax function;
[0038] (f-34) The first residual convolution block of the farmland texture extraction unit is composed of a 2D convolution layer, a BatchNormalization layer, and a LeakyReLU function. The accurate spatial feature information map M1 of the farmland plot is input into the 2D convolution layer of the first residual convolution block, and the feature is output. The characteristics Input to the BatchNormalization layer of the first residual convolution block, and output the feature The characteristics Input into the LeakyReLU function of the first residual convolution block, and output the feature The accurate spatial feature information map M1 of the cultivated land plot is combined with the feature Perform addition operation to obtain the feature
[0039] (f-35) The first convolution block of the farmland texture extraction unit consists of a 2D convolution layer, a BatchNormalization layer, and a LeakyReLU function. Input into the 2D convolution layer of the first convolution block, and output the feature The characteristics Input to the BatchNormalization layer of the first convolutional block, and output the feature The characteristics Input to the LeakyReLU function of the first convolutional block, and output the feature
[0040] (f-36) The second residual convolution block of the farmland texture extraction unit consists of a 2D convolution layer, a BatchNormalization layer, and a LeakyReLU function. Input to the 2D convolution layer of the second residual convolution block, and output the feature The characteristics Input to the BatchNormalization layer of the second residual convolution block, and output the feature The characteristics Input into the LeakyReLU function of the second residual convolution block, and output the feature The characteristics With features Perform addition operation to obtain the feature
[0041] (F-37) will feature Input into the Softmax function of the farmland texture extraction unit, and output the farmland texture weight matrix Map2, Map2∈[0,1] C′×W×H ;
[0042] (f-38) Multiply the farmland texture weight matrix Map2 and the image feature tensor F1 element by element to obtain the enhanced farmland texture feature map M 1′ .
[0043] Preferably, in step (f-32), the convolution kernel size of the 2D convolution layer of the cultivated land texture capture unit is 1, the step size is 2, and the padding is 32; in step (f-34), the convolution kernel size of the 2D convolution layer of the first residual convolution block of the cultivated land texture extraction unit is 7, the step size is 1, and the padding is 3; in step (f-35), the convolution kernel size of the 2D convolution layer of the first convolution block of the cultivated land texture extraction unit is 1, the step size is 2, and the padding is 32; in step (f-36), the convolution kernel size of the 2D convolution layer of the second residual convolution block of the cultivated land texture extraction unit is 7, the step size is 1, and the padding is 3; in step (f-4), the maximum text encoding length K is 77, and the text embedding size is 768. Further, step (g) comprises the following steps:
[0044] (g-1) The decoupled cross attention of the conditional diffusion model is composed of the image embedding decomposition feature cross attention, the feature map embedding decomposition feature cross attention, and the text embedding decomposition feature cross attention;
[0045] (g-2) The low-dimensional potential representation feature map F image Input into the U-Net network of the conditional diffusion model, and output the feature F unet , F unet∈{F dowm1 ,F dowm2 ,F dowm3 ,F up1 ,F up2 ,F up3}, F dowm1 ,F dowm2 ,F dowm3 is the feature of the three downsampling processes of the U-Net network, F up1 ,F up2 ,F up3 It is the feature of the three upsampling processes of the U-Net network;
[0046] (g-3) Decoupled Cross-Attention Image Embedding Decomposition Feature Cross-Attention consists of the first Linear layer, the second Linear layer, and the third Linear layer, and the output image is embedded in the decomposition feature F Sp-I Input to the first Linear layer of the image embedding decomposition feature cross attention, and output the key vector key of the image embedding decomposition feature cross attention Sp-I , embed the output image into the decomposition feature F Sp-I Input it into the second Linear layer of the image embedding decomposition feature cross attention, and output the value vector value of the image embedding decomposition feature cross attention Sp-I , the feature F unet Input it into the third Linear layer of the image embedding decomposition feature cross attention, and output the query vector query of the image embedding decomposition feature cross attention, and convert the query vector query and key vector key of the image embedding decomposition feature cross attention into Sp-I 、value vector value Sp-I Input into the torch.nn.functional.scaled_dot_product_attention() function of the pytorch library, and output the feature F catt-I ;
[0047] (g-4) Decoupling the feature map of cross attention and embedding the decomposed feature cross attention consists of the first linear layer, the second linear layer, and the third linear layer. The feature map is embedded in the decomposed feature Input to the first Linear layer of the feature map embedding decomposition feature cross attention, and output the key vector of the feature map embedding decomposition feature cross attention Embed feature maps into decomposed features Input to the second Linear layer of the feature map embedding decomposition feature cross attention, and output the value vector of the feature map embedding decomposition feature cross attention The feature F unet Input to the third Linear layer of the feature map embedding decomposition feature cross attention, output the query vector query of the feature map embedding decomposition feature cross attention, embed the query vector query of the feature map embedding decomposition feature cross attention, key vector Value vector Input into the torch.nn.functional.scaled_dot_product_attention() function of the pytorch library and output the feature
[0048] (g-5) Decoupled Cross-Attention Text Embedding Decomposition Feature Cross-Attention consists of the first Linear layer, the second Linear layer, and the third Linear layer, which embeds the text into the decomposition feature F Sp-Text Input into the first Linear layer of the text embedding decomposition feature cross attention, and output the key vector key of the text embedding decomposition feature cross attention Sp-Text , embed the text into decomposition features F Sp-Text Input to the second Linear layer of the text embedding decomposition feature cross attention, and output the value vector value of the text embedding decomposition feature cross attention Sp-Text , the feature F unet Input into the third Linear layer of the text embedding decomposition feature cross attention, and output the query vector query of the text embedding decomposition feature cross attention, and convert the query vector query and key vector key of the text embedding decomposition feature cross attention into Sp-Text 、value vector value Sp-Text Input into the torch.nn.functional.scaled_dot_product_attention() function of the pytorch library, and output the feature F catt-Text ;
[0049] (g-6) The feature F catt-I ,feature Feature F catt-Text Perform the addition operation to obtain the decoupled cross attention Z.
[0050] Further, step (h) comprises the following steps:
[0051] (h-1) Use the torch.randn_like() function to convert the low-dimensional potential representation feature map F image Generate random noise of uniform size;
[0052] (h-2) Combine random noise Noise with low-dimensional potential representation feature map F image Perform the addition operation to obtain the feature F noise-image ,
[0053] (h-3) The feature F noise-image Input into the U-Net model after integrating the decoupled cross attention Z and the U-Net network in the conditional diffusion model, and the output is the estimated noise Noise θ ;
[0054] (h-4) Calculate random noise and estimated noise θ The mean square error is used as the loss function L loss .
[0055] Preferably, when training the conditional diffusion model in step (i), the initial learning rate is set to 0.001, the batch size is set to 4, and the epoch is set to 64.
[0056] Further, step (j) comprises the steps of:
[0057] (j-1) The i-th cropped remote sensing image P in the training set i B Input into the encoder of the optimized conditional diffusion model, and output the low-dimensional potential representation feature map F′ image ;
[0058] (j-2) The i-th cropped remote sensing image P in the training set i B Input it into the conditional control unit of the optimized conditional diffusion model, and output the output image embedding decomposition feature F′ Sp-I , feature map embedding decomposition features Text embedding decomposition feature F′ Sp-Text ;
[0059] (j-3) The feature map F′ image Input into the U-Net network of the optimized conditional diffusion model, and output the feature F′ unet , the feature F′ unet Input into the Linear layer, and output the shared query vector query of the conditional diffusion model with decoupled cross attention, embedding the image into the decomposition feature F′ Sp-I , feature map embedding decomposition features Text embedding decomposition feature F′ Sp-Text Input into the decoupled cross attention of the optimized conditional diffusion model, and output the decoupled cross attention Z′;
[0060] (j-4) Use the torch.randn_like() function to convert the low-dimensional potential representation feature map F′ image Generates random noise of uniform size randn , The random noise randn Input into the U-Net model after integrating the decoupled cross attention Z′ and the U-Net network in the conditional diffusion model for 40 iterations, and the output is the estimated noise Noise estimate ,
[0061] (j-5) The decoder of the conditional diffusion model is the decoder of the pre-trained AutoEncoderKL, which estimates the noise estimate Input into the decoder of the optimized conditional diffusion model, and output the pseudo sample image I of the cultivated land plot f ∈R 3×W×H , all pseudo sample images of cultivated land plots in the training set constitute the pseudo cultivated land plot samples.
[0062] The beneficial effects of the present invention are: directly using existing cultivated land plot labels to capture the texture features of cultivated land plots, eliminating the features of non-cultivated land areas, directly avoiding the common problem of heterogeneous objects with the same spectrum in high-resolution remote sensing images, and the control unit can only learn the texture features of the cultivated land itself, avoiding the interference of other objects, and providing more accurate information guidance for generating high-quality cultivated land images, generating more detailed and more realistic high-resolution cultivated land remote sensing images. Data expansion of cultivated land remote sensing images suitable for deep learning focuses on solving the problems of small data volume and imbalance between samples in cultivated land plot data sets, so that the generated images meet the diversity and richness of samples required for the semantic segmentation task of remote sensing image cultivated land plots, and improve the accuracy of remote sensing image cultivated land plot segmentation. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 is a flow chart of the training phase method of the present invention;
[0064] Figure 2 A flow chart of the method for constructing a semantic segmentation dataset of the present invention;
[0065] Figure 3 It is a structural diagram of a cultivated land texture feature enhancement module in a control unit of the present invention;
[0066] Figure 4 This is a flow chart of the method for generating pseudo-samples of cultivated land in the inference phase of the present invention. DETAILED DESCRIPTION
[0067] The following is combined with Figure 1 To Attachment Figure 4 The present invention is further described.
[0068] A controllable generation method of high-resolution farmland pseudo samples based on texture information guidance comprises the following steps:
[0069] (a) Constructing a large-scale, high-resolution remote sensing imagery semantic segmentation dataset D for cultivated land plots 1-b , construct a small-size high-resolution remote sensing image farmland semantic segmentation dataset D 1-s .
[0070] (b) The semantic segmentation dataset D of cultivated land plots in large-scale high-resolution remote sensing images 1-b Divide into training set and test set.
[0071] (c) Using small-size high-resolution remote sensing imagery to segment cultivated land plots 1-s Construct a high-resolution remote sensing image farmland plot prompt word dataset D2.
[0072] (d) Establish a conditional diffusion model, which consists of an encoder, a decoder, a conditional control unit, decoupled cross attention, and a U-Net network.
[0073] (e) Input the remote sensing images in the training set into the encoder of the conditional diffusion model to obtain a low-dimensional latent representation feature map F image .
[0074] (f) The remote sensing images, binary farmland plot semantic segmentation labels, and farmland prompt words in the remote sensing images in the training set are input into the conditional control unit of the conditional diffusion model, and the output image embedding decomposition feature F is obtained. Sp-I , feature map embedding decomposition features Text embedding decomposition feature F Sp-Text .
[0075] (g) The feature map F image Input into the U-Net network of the conditional diffusion model, and output the feature F unet , the feature F unet Input into the Linear layer, and output the shared query vector query of the conditional diffusion model with decoupled cross attention, embedding the image into the decomposed feature F Sp-I , feature map embedding decomposition features Text embedding decomposition feature F Sp-Text Input into the decoupled cross attention of the conditional diffusion model, and output the decoupled cross attention Z.
[0076] (h) The loss function L is calculated using the decoupled cross attention Z loss .
[0077] (i) Using the AdamW optimizer with the loss function L loss The conditional diffusion model is trained to obtain an optimized conditional diffusion model.
[0078] (j) The remote sensing images in the training set are input into the optimized conditional diffusion model, and the pseudo-plot samples of cultivated land are output.
[0079] Experiments have shown that the present invention can effectively reconstruct high-quality and controllable pseudo samples of cultivated land plots, and the semantic segmentation accuracy of cultivated land plots is significantly improved after using the pseudo samples.
[0080] The MAP-Net model is used as the semantic segmentation model of cultivated land plots, and the method of the present invention is used to generate a large-scale high-resolution remote sensing image cultivated land plot semantic segmentation dataset D 1-b 80% of the cultivated land plots in the training set are pseudo samples, the original data set is expanded, and 20% of the validation set remains unchanged. The MAP-Net model is used to train the datasets before and after expansion, and then the accuracy is evaluated on the same validation set. The results of MAP-Net using the dataset before expansion are: Accuracy 0.8269, Precision 0.6803, F1Score 0.6698, mIou 0.6575, Kappa0.5477, and the results of MAP-Net using the dataset after expansion are: Accuracy 0.8574, Precision 0.6916, F1Score 0.6860, mIou 0.6828, Kappa 0.5722. The experimental results show that the present invention can effectively reconstruct high-quality and controllable pseudo samples of cultivated land plots, and the semantic segmentation accuracy of cultivated land plots is significantly improved after using pseudo samples.
[0081] In one embodiment of the present invention, step (a) comprises the following steps:
[0082] (a-1) The i-th remote sensing image P in the public dataset of the High-resolution Remote Sensing Image Farmland Extraction Challenge i The corresponding original cultivated land plot vector data is obtained by using the RasterizeLayer function in the Python GDAL library with the i-th remote sensing image P i The pixel size is used as the benchmark to transform into a binary semantic segmentation label L for farmland plots i , i∈{1,2,...,n}, n is the number of remote sensing images in the public dataset of the High-Resolution Remote Sensing Imagery Cultivated Land Extraction Challenge.
[0083] (a-2) Use the Warp function in the Python GDAL library to convert the i-th remote sensing image P iAccording to the boundary range vector file in the public dataset of the High-Resolution Remote Sensing Image Farmland Extraction Challenge, the cropped i-th remote sensing image P is obtained. i ′, use the Warp function in the Python GDAL library to convert the binary farmland plot semantic segmentation label L i According to the boundary range vector file in the public dataset of the High-Resolution Remote Sensing Image Farmland Extraction Challenge, the cropped binary farmland plot semantic segmentation label L is obtained. i ′. (a-3) If side%setpix D = 0, then the i-th remote sensing image P after clipping is not i ′ is used to expand the size, where side is the i-th remote sensing image P after cropping i 'The number of pixels of the side length, setpix D is the maximum cropping size set, % is the modulo operation, if side% setpix D ≠0, then the cropped i-th remote sensing image P i ′ is extended to nside by the number of pixels D , Where overlap is the overlap ratio, ceil(·) is the rounding operation; then the i-th remote sensing image P after the expansion size is i 'The extended position of nside D The pixel value of the pixel point is filled with 0, and the i-th remote sensing image P after the expansion size is i ′ corresponds to the clipped binary farmland plot semantic segmentation label L i Fill the corresponding position in ' with 0.
[0084] (a-4) The i-th remote sensing image P after the size expansion operation in step (a-3) is i ′ Perform sliding window cropping operation to obtain the cropped i-th remote sensing image P i B , the i-th remote sensing image P after expansion i ′ corresponds to the clipped binary farmland plot semantic segmentation label L i ′Perform sliding window clipping operation to obtain the clipped binary farmland plot semantic segmentation label Then we get a large-scale, high-resolution remote sensing image farmland semantic segmentation dataset D 1-b ,
[0085] (a-5) if side% setpix X = 0, then the i-th remote sensing image P after clipping is not i'Perform expansion size operation, where setpix X To set the small crop size, if side% setpix X ≠0, then the cropped i-th remote sensing image P i ′ is extended to nside by the number of pixels X , Where overlap is the overlap ratio, Then, the i-th remote sensing image P after the expansion i 'The extended position of nside X The pixel value of the pixel point is filled with 0, and the i-th remote sensing image P after the expansion size is i ′ corresponds to the clipped binary farmland plot semantic segmentation label L i (a-6) The i-th remote sensing image P after the size expansion operation in step (a-5) is i ′ Perform sliding window cropping operation to obtain the cropped i-th remote sensing image P i S , the i-th remote sensing image P after expansion i ′ corresponds to the clipped binary farmland plot semantic segmentation label L i ′Perform sliding window clipping operation to obtain the clipped binary farmland plot semantic segmentation label Get the small-size high-resolution remote sensing image farmland semantic segmentation dataset D 1-s , In this example, the maximum crop size is setpix D Greater than or equal to 256 pixels and less than or equal to 512 pixels, set the small crop size setpix X Greater than or equal to 128 pixels and less than or equal to 256 pixels (set to half of the large cropping size), the overlap ratio overlap is greater than or equal to 0 and less than or equal to 1.
[0086] In one embodiment of the present invention, a large-scale high-resolution remote sensing image farmland plot semantic segmentation dataset D 1-b The data is divided into training set and test set in a ratio of 4:1. 80% of the data is used for training and 20% of the data is used to test the performance after training.
[0087] In one embodiment of the present invention, step (c) comprises the following steps:
[0088] (c-1) The cropped i-th remote sensing image P i S Input into the CLIP model to get the text description of the i-th remote sensing image Get the text description set of n remote sensing images
[0089] (c-2) Use the natural language processing toolkit NLTK in Python to describe the text of the i-th remote sensing image Perform part-of-speech analysis on the text description set The article, preposition, pronoun and modal particle are filtered to extract the combination of noun, adjective plus noun, and noun plus noun, and the cultivated land prompt word Pro of the i-th remote sensing image is obtained. i .
[0090] (c-3) Count the cultivated land prompt words Pro in the i-th remote sensing image i In the text description set Text image The frequency of occurrence in Fre i , we screen out nt cultivated land prompt words with a frequency greater than 100 and their corresponding frequencies, and then sort them from high to low according to the frequency value, and obtain the high-resolution remote sensing image cultivated land plot prompt word dataset D2, D2 = {Pro1: Fre1, Pro2: Fre2, ..., Pro i :Fre i ,...,Pro nt :Fre nt In one embodiment of the present invention, step (e) comprises the following steps:
[0091] (e-1) Use the PIL library Image class to read the cropped i-th remote sensing image P in the training set i B , get the training image matrix X′ train-I , use the PIL library Image class to read the cropped binary farmland plot semantic segmentation labels in the training set Get the training label matrix X′ train-L .
[0092] (e-2) Use the ToTensor() function in PyTorch to convert the training image matrix X t ' rain-I Convert to tensor X train-I , X train-I ∈R C×W×H , R is the real number space, C is the i-th remote sensing image P after cropping i B The number of channels, W is the i-th remote sensing image P after cropping i B The width of H is the cropped i-th remote sensing image P i B The height of the training label matrix X is obtained by using the ToTensor() function in PyTorch. t ' rain-L Convert to tensor Xtrain-L , X train-I ∈R LC×W×H , LC is the cropped binary farmland plot semantic segmentation label The number of channels.
[0093] (e-3) The encoder of the conditional diffusion model is the encoder of the pre-trained AutoEncoderKL, which converts the tensor X train-I The input is fed into the encoder of the conditional diffusion model for downsampling and significant size reduction to obtain a low-dimensional potential representation feature map F of the image. image , ZC is the number of channels of the low-dimensional potential representation feature map, and the value of ZC is 4.
[0094] In one embodiment of the present invention, step (f) comprises the following steps:
[0095] (f-1) The conditional control unit in the conditional diffusion model consists of an image control module, an image and label control module, and a farmland prompt word control module.
[0096] (f-2) The image control module consists of a pre-trained CLIP image encoder and a projection network. train-I Input into the pre-trained CLIP image encoder for global image embedding, and output the image embedding The projection network of the image control module consists of a Linear layer and a LayerNorm layer to embed the image Input into the Linear layer of the projection network and output the feature The characteristics Input into the LayerNorm layer of the projection network, and output the image embedding decomposition feature F Sp-I The input size of the Linear layer is: clip_embeddings_dim, and the output size is cross_attention_dim×Num context , where cross_attention_dim is the dimension of cross attention, Num context is the projection length, which is a positive integer greater than 0. The value of cross_attention_dim is 768, Num context The value is 4.
[0097] (f-3) The image and label control module consists of a farmland texture feature enhancement module, a pre-trained CLIP image encoder, and a projection network. train-L Input into the farmland texture feature enhancement module, and output the enhanced farmland texture feature map M 1′ , the enhanced farmland texture feature map M1′ Input to the pre-trained CLIP image encoder of the image and label control module, and output the feature map embedding The projection network of the image and label control module consists of a Linear layer and a LayerNorm layer, which embeds the feature map into Input to the Linear layer of the projection network of the image and label control module, and output the feature The characteristics Input to the LayerNorm layer of the projection network of the image and label control module, and output the feature map to embed the decomposition feature The input size of the Linear layer is: clip_embeddings_dim, and the output size is cross_attention_dim×Num context .
[0098] (f-4) The farmland prompt word control module is composed of a pre-trained CLIP text encoder, which converts the farmland prompt word Pro of the i-th remote sensing image into i Input into the pre-trained CLIP text encoder, and output the embedded decomposition feature F of this article Sp-Text , F Sp-Text ∈R K×text_embeddings_dim , where K is the maximum text encoding length and text_embeddings_dim is the text embedding size. The preferred K value is 77 and text_embeddings_dim is 768.
[0099] In this example, the tensor X train-L Input into the farmland texture feature enhancement module, and output the enhanced farmland texture feature map M 1′ The method is:
[0100] (f-31) The farmland texture feature enhancement module consists of a farmland texture capture unit and a farmland texture extraction unit.
[0101] (f-32) The farmland texture capture unit consists of the first average pooling layer, the second average pooling layer, the 2D convolution layer, and the LeakyReLU function. train-L Input to the first average pooling layer of the farmland texture capture unit, and output the feature The characteristics Input to the second average pooling layer of the farmland texture capture unit, and output the farmland spatial position attention map Map1 with smooth edge transition. train-I Input to the 2D convolution layer of the farmland texture capture unit, and output the feature The characteristics Input into the LeakyReLU function of the farmland texture capture unit, and output the image feature tensor F1, F1∈[0,1] C′×W×H , C′ is the number of channels of the image feature tensor F1. The farmland spatial position attention map Map1 with smooth edge transition is stacked C′ times in the channel dimension and then multiplied element by element with the image feature tensor F1 to obtain the accurate spatial feature information map M1 of the farmland plot, M1∈[0,1] 1×W×H .
[0102] (f-33) The farmland texture extraction unit is composed of a first residual convolution block, a first convolution block, a second residual convolution block, and a Softmax function.
[0103] (f-34) The first residual convolution block of the farmland texture extraction unit is composed of a 2D convolution layer, a BatchNormalization layer, and a LeakyReLU function. The accurate spatial feature information map M1 of the farmland plot is input into the 2D convolution layer of the first residual convolution block, and the feature is output. The characteristics Input to the BatchNormalization layer of the first residual convolution block, and output the feature The characteristics Input into the LeakyReLU function of the first residual convolution block, and output the feature The accurate spatial feature information map M1 of the cultivated land plot is combined with the feature Perform addition operation to obtain the feature
[0104] (f-35) The first convolution block of the farmland texture extraction unit consists of a 2D convolution layer, a BatchNormalization layer, and a LeakyReLU function. Input into the 2D convolution layer of the first convolution block, and output the feature The characteristics Input to the BatchNormalization layer of the first convolutional block, and output the feature The characteristics Input to the LeakyReLU function of the first convolutional block, and output the feature
[0105] (f-36) The second residual convolution block of the farmland texture extraction unit consists of a 2D convolution layer, a BatchNormalization layer, and a LeakyReLU function. Input to the 2D convolution layer of the second residual convolution block, and output the feature The characteristics Input to the BatchNormalization layer of the second residual convolution block, and output the feature The characteristics Input into the LeakyReLU function of the second residual convolution block, and output the feature The characteristics With features Perform addition operation to obtain the feature
[0106] (F-37) will feature Input into the Softmax function of the farmland texture extraction unit, and output the farmland texture weight matrix Map2, Map2∈[0,1] C′×W×H .
[0107] (f-38) Multiply the farmland texture weight matrix Map2 and the image feature tensor F1 element by element to obtain the enhanced farmland texture feature map M 1′ .
[0108] In this embodiment, preferably, in step (f-32), the convolution kernel size of the 2D convolution layer of the cultivated land texture capture unit is 1, the step size is 2, and the padding is 32; in step (f-34), the convolution kernel size of the 2D convolution layer of the first residual convolution block of the cultivated land texture extraction unit is 7, the step size is 1, and the padding is 3; in step (f-35), the convolution kernel size of the 2D convolution layer of the first convolution block of the cultivated land texture extraction unit is 1, the step size is 2, and the padding is 32; in step (f-36), the second residual convolution block of the cultivated land texture extraction unit consists of a 2D convolution layer with a convolution kernel size of 7, a step size of 1, and a padding of 3; in step (f-4), the maximum text encoding length K is 77, and the text embedding size is 768.
[0109] In one embodiment of the present invention, step (g) comprises the following steps:
[0110] (g-1) The decoupled cross-attention of the conditional diffusion model is composed of the image embedding decomposition feature cross-attention, the feature map embedding decomposition feature cross-attention, and the text embedding decomposition feature cross-attention.
[0111] (g-2) The low-dimensional potential representation feature map F image Input into the U-Net network of the conditional diffusion model, and output the feature F unet , F unet ∈{F dowm1 ,F dowm2 ,F dowm3 ,F up1 ,F up2 ,F up3}, F dowm1 ,Fdowm2 ,F dowm3 is the feature of the three downsampling processes of the U-Net network, F up1 ,F up2 ,F up3 These are the features of the three upsampling processes of the U-Net network.
[0112] (g-3) Decoupled Cross-Attention Image Embedding Decomposition Feature Cross-Attention consists of the first Linear layer, the second Linear layer, and the third Linear layer, and the output image is embedded in the decomposition feature F Sp-I Input to the first Linear layer of the image embedding decomposition feature cross attention, and output the key vector key of the image embedding decomposition feature cross attention Sp-I , embed the output image into the decomposition feature F Sp-I Input it into the second Linear layer of the image embedding decomposition feature cross attention, and output the value vector value of the image embedding decomposition feature cross attention Sp-I , the feature F unet Input it into the third Linear layer of the image embedding decomposition feature cross attention, and output the query vector query of the image embedding decomposition feature cross attention, and convert the query vector query and key vector key of the image embedding decomposition feature cross attention into Sp-I 、value vector value Sp-I Input into the torch.nn.functional.scaled_dot_product_attention() function of the pytorch library, and output the feature F catt-I .
[0113] (g-4) Decoupling the feature map of cross attention and embedding the decomposed feature cross attention consists of the first linear layer, the second linear layer, and the third linear layer. The feature map is embedded in the decomposed feature Input to the first Linear layer of the feature map embedding decomposition feature cross attention, and output the key vector of the feature map embedding decomposition feature cross attention Embed feature maps into decomposed features Input to the second Linear layer of the feature map embedding decomposition feature cross attention, and output the value vector of the feature map embedding decomposition feature cross attention The feature F unet Input to the third Linear layer of the feature map embedding decomposition feature cross attention, output the query vector query of the feature map embedding decomposition feature cross attention, embed the query vector query of the feature map embedding decomposition feature cross attention, key vector Value vector Input into the torch.nn.functional.scaled_dot_product_attention() function of the pytorch library and output the feature
[0114] (g-5) Decoupled Cross-Attention Text Embedding Decomposition Feature Cross-Attention consists of the first Linear layer, the second Linear layer, and the third Linear layer, which embeds the text into the decomposition feature F Sp-Text Input into the first Linear layer of the text embedding decomposition feature cross attention, and output the key vector key of the text embedding decomposition feature cross attention Sp-Text , embed the text into decomposition features F Sp-Text Input to the second Linear layer of the text embedding decomposition feature cross attention, and output the value vector value of the text embedding decomposition feature cross attention Sp-Text , the feature F unet Input into the third Linear layer of the text embedding decomposition feature cross attention, and output the query vector query of the text embedding decomposition feature cross attention, and convert the query vector query and key vector key of the text embedding decomposition feature cross attention into Sp-Text 、value vector value Sp-Text Input into the torch.nn.functional.scaled_dot_product_attention() function of the pytorch library, and output the feature F catt-Text .
[0115] (g-6) The feature F catt-I ,feature Feature F catt-Text Perform the addition operation to obtain the decoupled cross attention Z.
[0116] In one embodiment of the present invention, step (h) comprises the following steps:
[0117] (h-1) Use the torch.randn_like() function to convert the low-dimensional potential representation feature map F image Generates random noise of uniform size.
[0118] (h-2) Combine random noise Noise with low-dimensional potential representation feature map F image Perform the addition operation to obtain the feature F noise-image ,
[0119] (h-3) The feature Fnoise-image Input into the U-Net model after integrating the decoupled cross attention Z and the U-Net network in the conditional diffusion model, and the output is the estimated noise Noise θ .
[0120] (h-4) Calculate random noise and estimated noise θ The mean square error is used as the loss function L loss .
[0121] In one embodiment of the present invention, when training the conditional diffusion model in step (i), the initial learning rate is set to 0.001, the batch size is set to 4, and the epoch is set to 64.
[0122] In one embodiment of the present invention, step (j) comprises the steps of:
[0123] (j-1) The i-th cropped remote sensing image P in the training set i B Input into the encoder of the optimized conditional diffusion model, and output the low-dimensional potential representation feature map F′ image .
[0124] (j-2) The i-th cropped remote sensing image P in the training set i B Input it into the conditional control unit of the optimized conditional diffusion model, and output the output image embedding decomposition feature F′ Sp-I , feature map embedding decomposition features Text embedding decomposition feature F′ Sp-Text .
[0125] (j-3) The feature map F′ image Input into the U-Net network of the optimized conditional diffusion model, and output the feature F′ unet , the feature F′ unet Input into the Linear layer, and output the shared query vector query of the conditional diffusion model with decoupled cross attention, embedding the image into the decomposition feature F′ Sp-I , feature map embedding decomposition features Text embedding decomposition feature F′ Sp-Text It is input into the decoupled cross attention of the optimized conditional diffusion model, and the decoupled cross attention Z′ is output.
[0126] (j-4) Use the torch.randn_like() function to convert the low-dimensional potential representation feature map F′ image Generates random noise of uniform size randn , The random noise randn Input into the U-Net model after integrating the decoupled cross attention Z′ and the U-Net network in the conditional diffusion model for 40 iterations, and the output is the estimated noise Noise estimate ,
[0127] (j-5) The decoder of the conditional diffusion model is the decoder of the pre-trained AutoEncoderKL, which estimates the noise estimate Input into the decoder of the optimized conditional diffusion model, and output the pseudo sample image I of the cultivated land plot f ∈R 3×W×H , all pseudo sample images of cultivated land plots in the training set constitute the pseudo cultivated land plot samples.
[0128] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A controllable generation method of high-resolution pseudo-cultivated land samples based on texture information. It is characterized in that The steps include: (a) Constructing a large-scale, high-resolution remote sensing imagery semantic segmentation dataset D for cultivated land plots 1-b , construct a small-size high-resolution remote sensing image farmland semantic segmentation dataset D 1-s ; (b) The semantic segmentation dataset D of cultivated land plots in large-scale high-resolution remote sensing images 1-b Divide into training set and test set; (c) Using small-size high-resolution remote sensing imagery to segment cultivated land plots 1-s Constructing a high-resolution remote sensing image farmland plot prompt word dataset D 2 ; (d) Establishing a conditional diffusion model, which consists of an encoder, a decoder, a conditional control unit, a decoupled cross attention, and a U-Net network; (e) Input the remote sensing images in the training set into the encoder of the conditional diffusion model to obtain a low-dimensional latent representation feature map F image ; (f) The remote sensing images, binary farmland plot semantic segmentation labels, and farmland prompt words in the remote sensing images in the training set are input into the conditional control unit of the conditional diffusion model, and the output image embedding decomposition feature F is obtained. Sp-I , feature map embedding decomposition features Text embedding decomposition feature F Sp-Text ; (g) The feature map F image Input into the U-Net network of the conditional diffusion model, and output the feature F unet , the feature F unet Input into the Linear layer, and output the shared query vector query of the conditional diffusion model with decoupled cross attention, embedding the image into the decomposed feature F Sp-I , feature map embedding decomposition features Text embedding decomposition feature F Sp-Text Input into the decoupled cross attention of the conditional diffusion model, and output the decoupled cross attention Z; (h) The loss function L is calculated using the decoupled cross attention Z loss ; (i) Using the AdamW optimizer with the loss function L loss Training the conditional diffusion model to obtain an optimized conditional diffusion model; (j) Inputting the remote sensing images in the training set into the optimized conditional diffusion model, and outputting the pseudo-plot samples of cultivated land; Step e) comprises the following steps: (e-1) Use the PIL library Image class to read the cropped i-th remote sensing image P in the training set i B , get the training image matrix X′ train-I , use the PIL library Image class to read the cropped binary farmland plot semantic segmentation labels in the training set Get the training label matrix X′ train-L ; (e-2) Use the ToTensor() function in PyTorch to convert the training image matrix X′ train-I Convert to tensor X train-I , X train-I ∈R C×W×H , R is the real number space, C is the i-th remote sensing image P after cropping i B The number of channels, W is the i-th remote sensing image P after cropping i B The width of H is the cropped i-th remote sensing image P i B The height of the training label matrix X′ is obtained by using the ToTensor() function in PyTorch. train-L Convert to tensor X train-L , X train-I ∈R LC×W×H , LC is the cropped binary farmland plot semantic segmentation label The number of channels; (e-3) The encoder of the conditional diffusion model is the encoder of the pre-trained AutoEncoderKL, which converts the tensor X train-I Input into the encoder of the conditional diffusion model to obtain the low-dimensional potential representation feature map F of the image image , ZC is the number of channels of the low-dimensional potential representation feature map; Step f) comprises the following steps: (f-1) The conditional control unit in the conditional diffusion model is composed of an image control module, an image and label control module, and a cultivated land prompt word control module; (f-2) The image control module consists of a pre-trained CLIP image encoder and a projection network. train-I Input into the pre-trained CLIP image encoder and output the image embedding The projection network of the image control module consists of a Linear layer and a LayerNorm layer to embed the image Input into the Linear layer of the projection network and output the feature The characteristics Input into the LayerNorm layer of the projection network, and output the image embedding decomposition feature F Sp-I ; (f-3) The image and label control module consists of a farmland texture feature enhancement module, a pre-trained CLIP image encoder, and a projection network. train-L Input into the farmland texture feature enhancement module, and output the enhanced farmland texture feature map M 1 ′, the enhanced farmland texture feature map M 1 ′ is input into the pre-trained CLIP image encoder of the image and label control module, and the output is the feature map embedding The projection network of the image and label control module consists of a Linear layer and a LayerNorm layer, which embeds the feature map into Input to the Linear layer of the projection network of the image and label control module, and output the feature The characteristics Input to the LayerNorm layer of the projection network of the image and label control module, and output the feature map to embed the decomposition feature (f-4) The farmland prompt word control module is composed of a pre-trained CLIP text encoder, which converts the farmland prompt word Pro of the i-th remote sensing image into i Input into the pre-trained CLIP text encoder, and output the embedded decomposition feature F of this article Sp-Text , F Sp-Text ∈R K×text_embeddings_dim , where K is the maximum text encoding length, and text_embeddings_dim is the text embedding size; The tensor X train-L Input into the farmland texture feature enhancement module, and output the enhanced farmland texture feature map M 1 The method of ' is: (f-31) The farmland texture feature enhancement module is composed of a farmland texture capture unit and a farmland texture extraction unit; (f-32) The farmland texture capture unit is composed of a first average pooling layer, a second average pooling layer, a 2D convolution layer, and a LeakyReLU function. train-L Input to the first average pooling layer of the farmland texture capture unit, and output the feature The characteristics Input to the second average pooling layer of the farmland texture capture unit, and output the farmland spatial position attention map with smooth edge transition. 1 , the tensor X train-I Input to the 2D convolution layer of the farmland texture capture unit, and output the feature The characteristics Input into the LeakyReLU function of the farmland texture capture unit, and output the image feature tensor F 1 , F 1 ∈[0,1] C′×W×H , C′ is the image feature tensor F 1 The number of channels is the spatial position attention map of the cultivated land with smooth edge transitions. 1 After stacking C′ times in the channel dimension, it is combined with the image feature tensor F 1 Perform element-by-element multiplication to obtain the accurate spatial feature information map M of the cultivated land plot 1 , M 1 ∈[0,1] 1×W×H ; (f-33) The farmland texture extraction unit is composed of a first residual convolution block, a first convolution block, a second residual convolution block, and a Softmax function; (f-34) The first residual convolution block of the farmland texture extraction unit consists of a 2D convolution layer, a BatchNormalization layer, and a LeakyReLU function, which accurately maps the spatial feature information of the farmland plot to M 1 Input into the 2D convolution layer of the first residual convolution block, and output the feature F I 2-1 , the feature F I 2-1 Input to the BatchNormalization layer of the first residual convolution block, and output the feature F I 2-2 , the feature F I 2-2 Input into the LeakyReLU function of the first residual convolution block, and output the feature F I 2-3 , accurately map the spatial characteristics of cultivated land plots 1 With feature F I 2-3 Perform the addition operation to obtain the feature F I 2 ; (f-35) The first convolutional block of the farmland texture extraction unit consists of a 2D convolutional layer, a BatchNormalization layer, and a LeakyReLU function. I 2 Input into the 2D convolution layer of the first convolution block, and output the feature F I 3-1 , the feature F I 3-1 Input to the BatchNormalization layer of the first convolutional block, and output the feature F I 3-2 , the feature F I 3-2 Input to the LeakyReLU function of the first convolutional block, and output the feature F I 3-3 ; (f-36) The second residual convolution block of the farmland texture extraction unit consists of a 2D convolution layer, a BatchNormalization layer, and a LeakyReLU function. I 3-3 Input to the 2D convolution layer of the second residual convolution block, and output the feature F I 4-1 , the feature F I 4-1 Input to the BatchNormalization layer of the second residual convolution block, and output the feature F I 4-2 , the feature F I 4-2 Input into the LeakyReLU function of the second residual convolution block, and output the feature F I 4-3 , the feature F I 4-3 With feature F I 3 -3 Perform the addition operation to obtain the feature F I 4 ; (f-37) will feature F I 4 Input into the Softmax function of the farmland texture extraction unit, and output the farmland texture weight matrix Map 2 , Map 2 ∈[0,1] C′×W×H ; (f-38) Map the farmland texture weight matrix 2 and the image feature tensor F 1 Perform element-by-element multiplication to obtain the enhanced farmland texture feature map M 1′ ; Step (g) comprises the following steps: (g-1) The decoupled cross attention of the conditional diffusion model is composed of the image embedding decomposition feature cross attention, the feature map embedding decomposition feature cross attention, and the text embedding decomposition feature cross attention; (g-2) The low-dimensional potential representation feature map F image Input into the U-Net network of the conditional diffusion model, and output the feature F unet , F unet ∈{F dowm1 ,F dowm2 ,F dowm3 ,F up1 ,F up2 ,F up3 }, F dowm1 ,F dowm2 ,F dowm3 is the feature of the three downsampling processes of the U-Net network, F up1 ,F up2 ,F up3 It is the feature of the three upsampling processes of the U-Net network; (g-3) Decoupled Cross-Attention Image Embedding Decomposition Feature Cross-Attention consists of the first Linear layer, the second Linear layer, and the third Linear layer, and the output image is embedded in the decomposition feature F Sp-I Input to the first Linear layer of the image embedding decomposition feature cross attention, and output the key vector key of the image embedding decomposition feature cross attention Sp-I , embed the output image into the decomposition feature F Sp-I Input it into the second Linear layer of the image embedding decomposition feature cross attention, and output the value vector value of the image embedding decomposition feature cross attention Sp-I , the feature F unet Input it into the third Linear layer of the image embedding decomposition feature cross attention, and output the query vector query of the image embedding decomposition feature cross attention, and convert the query vector query and key vector key of the image embedding decomposition feature cross attention into Sp-I 、value vector value Sp-I Input into the torch.nn.functional.scaled_dot_product_attention() function of the pytorch library, and output the feature F catt-I ; (g-4) Decoupling the feature map of cross attention and embedding the decomposed feature cross attention consists of the first linear layer, the second linear layer, and the third linear layer. The feature map is embedded in the decomposed feature Input to the first Linear layer of the feature map embedding decomposition feature cross attention, and output the key vector of the feature map embedding decomposition feature cross attention Embed feature maps into decomposed features Input to the second Linear layer of the feature map embedding decomposition feature cross attention, and output the value vector of the feature map embedding decomposition feature cross attention The feature F unet Input to the third Linear layer of the feature map embedding decomposition feature cross attention, output the query vector query of the feature map embedding decomposition feature cross attention, embed the query vector query of the feature map embedding decomposition feature cross attention, key vector Value vector Input into the torch.nn.functional.scaled_dot_product_attention() function of the pytorch library and output the feature (g-5) Decoupled Cross-Attention Text Embedding Decomposition Feature Cross-Attention consists of the first Linear layer, the second Linear layer, and the third Linear layer, which embeds the text into the decomposition feature F Sp-Text Input into the first Linear layer of the text embedding decomposition feature cross attention, and output the key vector key of the text embedding decomposition feature cross attention Sp-Text , embed the text into decomposition features F Sp-Text Input to the second Linear layer of the text embedding decomposition feature cross attention, and output the value vector value of the text embedding decomposition feature cross attention Sp-Text , the feature F unet Input into the third Linear layer of the text embedding decomposition feature cross attention, output the query vector query of the text embedding decomposition feature cross attention, and convert the query vector query and key vector key of the text embedding decomposition feature cross attention into Sp-Text 、value vector value Sp-Text Input into the torch.nn.functional.scaled_dot_product_attention() function of the pytorch library, and output the feature F catt-Text ; (g-6) The feature F catt-I ,feature Feature F catt-Text Perform the addition operation to obtain the decoupled cross attention Z; Step (h) comprises the following steps: (h-1) Use the torch.randn_like() function to convert the low-dimensional potential representation feature map F image Generate random noise of uniform size; (h-2) Combine random noise Noise with low-dimensional potential representation feature map F image Perform the addition operation to obtain the feature F noise-image , (h-3) The feature F noise-image Input into the U-Net model after integrating the decoupled cross attention Z and the U-Net network in the conditional diffusion model, and the output is the estimated noise Noise θ ; (h-4) Calculate random noise and estimated noise θ The mean square error is used as the loss function L loss .
2. According to claim 1, the controllable generation method of high-resolution farmland pseudo samples based on texture information guidance, It is characterized in that Step (a) comprises the following steps: (a-1) The i-th remote sensing image P in the public dataset of the High-resolution Remote Sensing Image Farmland Extraction Challenge i The corresponding original cultivated land plot vector data is obtained by using the RasterizeLayer function in the Python GDAL library with the i-th remote sensing image P i The pixel size is used as the benchmark to transform into a binary semantic segmentation label L for farmland plots i , i∈{1,2,...,n}, n is the number of remote sensing images in the public dataset of the High-Resolution Remote Sensing Imagery Cultivated Land Extraction Challenge; (a-2) Use the Warp function in the Python GDAL library to convert the i-th remote sensing image P i According to the boundary range vector file in the public dataset of the High-Resolution Remote Sensing Image Farmland Extraction Challenge, the cropped i-th remote sensing image P is obtained. i ′, use the Warp function in the Python GDAL library to convert the binary farmland plot semantic segmentation label L i According to the boundary range vector file in the public dataset of the High-Resolution Remote Sensing Image Farmland Extraction Challenge, the cropped binary farmland plot semantic segmentation label L is obtained. i ′; (a-3) if side% setpix D = 0, then the i-th remote sensing image P after clipping is not i ′ is used to expand the size, where side is the i-th remote sensing image P after cropping i 'The number of pixels of the side length, setpix D is the maximum cropping size set, % is the modulo operation, if side% setpix D ≠0, then the cropped i-th remote sensing image P i ′ is extended to nside by the number of pixels D , Where overlap is the overlap ratio, ceil(·) is the rounding operation; then the i-th remote sensing image P after the expansion size is i 'The extended position of nside D The pixel value of the pixel point is filled with 0, and the i-th remote sensing image P after the expansion size is i ′ corresponds to the clipped binary farmland plot semantic segmentation label L i Fill the corresponding position in ' with 0; (a-4) The i-th remote sensing image P after the size expansion operation in step (a-3) is i ′ Perform sliding window cropping operation to obtain the cropped i-th remote sensing image P i B , the i-th remote sensing image P after expansion i ′ corresponds to the clipped binary farmland plot semantic segmentation label L i ′Perform sliding window clipping operation to obtain the clipped binary farmland plot semantic segmentation label Then we get a large-scale, high-resolution remote sensing image farmland semantic segmentation dataset D 1-b , (a-5) if side% setpix X = 0, then the i-th remote sensing image P after clipping is not i 'Perform expansion size operation, where setpix X To set the small crop size, if side% setpix X ≠0, then the cropped i-th remote sensing image P i ′ is extended to nside by the number of pixels X , Where overlap is the overlap ratio, Then, the i-th remote sensing image P after the expansion i 'The extended position of nside X The pixel value of the pixel point is filled with 0, and the i-th remote sensing image P after the expansion size is i ′ corresponds to the clipped binary farmland plot semantic segmentation label L i ′; (a-6) the i-th remote sensing image P after the size expansion operation in step (a-5) is i ′ Perform sliding window cropping operation to obtain the cropped i-th remote sensing image P i S , the i-th remote sensing image P after expansion i ′ corresponds to the clipped binary farmland plot semantic segmentation label L i ′Perform sliding window clipping operation to obtain the clipped binary farmland plot semantic segmentation label Get the small-size high-resolution remote sensing image farmland semantic segmentation dataset D 1-s , 3. The controllable generation method of high-resolution pseudo-cultivated land samples based on texture information guidance according to claim 2, Features: Set the maximum crop size setpix D Greater than or equal to 256 pixels and less than or equal to 512 pixels, set the small crop size setpix X The pixel size is greater than or equal to 128 pixels and less than or equal to 256 pixels, and the overlap ratio is greater than or equal to 0 and less than or equal to 1.
4. The method for controlling the generation of high-resolution pseudo-cultivated land samples based on texture information according to claim 1, Features: The large-scale high-resolution remote sensing image farmland semantic segmentation dataset D 1-b The dataset is divided into training set and test set in a ratio of 4:
1.
5. The controllable generation method of high-resolution farmland pseudo samples based on texture information guidance according to claim 2, It is characterized in that Step (c) comprises the following steps: (c-1) The cropped i-th remote sensing image P i S Input into the CLIP model to get the text description of the i-th remote sensing image Get the text description set of n remote sensing images (c-2) Use the natural language processing toolkit NLTK in Python to describe the text of the i-th remote sensing image Perform part-of-speech analysis on the text description set The article, preposition, pronoun and modal particle are filtered to extract the combination of noun, adjective plus noun, and noun plus noun, and the cultivated land prompt word Pro of the i-th remote sensing image is obtained. i ; (c-3) Count the cultivated land prompt words Pro in the i-th remote sensing image i In the text description set Text image The frequency of occurrence in Fre i , we screened out nt cultivated land prompt words with a frequency greater than 100 and their corresponding frequencies, and sorted them from high to low according to the frequency value, and obtained the high-resolution remote sensing image cultivated land plot prompt word dataset D 2 , D 2 = {Pro 1 :Fre 1 ,Pro 2 :Fre 2 ,...,Pro i :Fre i ,...,Pro nt :Fre nt }.
6. The controllable generation method of high-resolution pseudo-cultivated land samples based on texture information guidance according to claim 1, Features: In step (f-32), the convolution kernel size of the 2D convolution layer of the cultivated land texture capture unit is 1, the step size is 2, and the padding is 32; in step (f-34), the convolution kernel size of the 2D convolution layer of the first residual convolution block of the cultivated land texture extraction unit is 7, the step size is 1, and the padding is 3; in step (f-35), the convolution kernel size of the 2D convolution layer of the first convolution block of the cultivated land texture extraction unit is 1, the step size is 2, and the padding is 32; in step (f-36), the second residual convolution block of the cultivated land texture extraction unit consists of a 2D convolution layer with a convolution kernel size of 7, a step size of 1, and a padding of 3; in step (f-4), the maximum text encoding length K is 77, and the text embedding size is 768.
7. The controllable generation method of high-resolution pseudo-cultivated land samples based on texture information guidance according to claim 1, Features: When training the conditional diffusion model in step (i), the initial learning rate is set to 0.001, the batch size is set to 4, and the epoch is set to 64.
8. The controllable generation method of high-resolution pseudo-cultivated land samples based on texture information guidance according to claim 1, It is characterized in that Step (j) comprises the steps of: (j-1) The i-th cropped remote sensing image P in the training set i B Input into the encoder of the optimized conditional diffusion model, and output the low-dimensional potential representation feature map F i ' mage ; (j-2) The i-th cropped remote sensing image P in the training set i B Input it into the conditional control unit of the optimized conditional diffusion model, and output the output image embedding decomposition feature F S ' p-I , feature map embedding decomposition features Text embedding decomposition feature F S ' p-Text ; (j-3) The feature map F i ' mage Input into the U-Net network of the optimized conditional diffusion model, and output the feature F u ' net , the feature F u ' net Input into the Linear layer, and output the shared query vector query of the conditional diffusion model with decoupled cross attention, embedding the image into the decomposed feature F S ' p-I , feature map embedding decomposition features Text embedding decomposition feature F S ' p-Text Input into the decoupled cross attention of the optimized conditional diffusion model, and output the decoupled cross attention Z′; (j-4) Use the torch.randn_like() function to convert the low-dimensional potential representation feature map F i ' mage Generates random noise of uniform size randn , The random noise randn Input into the U-Net model after integrating the decoupled cross attention Z′ and the U-Net network in the conditional diffusion model for 40 iterations, and the output is the estimated noise Noise estimate , (j-5) The decoder of the conditional diffusion model is the decoder of the pre-trained AutoEncoderKL, which estimates the noise estimate Input into the decoder of the optimized conditional diffusion model, and output the pseudo sample image I of the cultivated land plot f ∈R 3×W×H , all pseudo sample images of cultivated land plots in the training set constitute the pseudo cultivated land plot samples.
