An agricultural greenhouse extraction method based on improved U-Net model

By improving the structure and loss function of the U-Net model and combining it with spectral index data, the problem of greenhouse extraction in remote sensing images using the traditional U-Net model was solved, and greenhouse recognition with higher accuracy and robustness was achieved.

CN120495906BActive Publication Date: 2025-09-16ZHONGNONG SUNSHINE (JILIN PROVINCE) BIG DATA GROUP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510983128.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-17
Publication Date
2025-09-16
Estimated Expiration
2045-07-17

AI Technical Summary

Technical Problem

The traditional U-Net model has difficulty in effectively extracting the features of agricultural greenhouses from remote sensing images. In particular, it is prone to omissions and difficulty in distinguishing different objects with the same spectrum in complex backgrounds, and cannot adapt to the extraction needs of multi-scale targets.

Method used

By introducing spectral index data, an improved U-Net model structure, and a composite loss function, the model's feature representation capabilities and spatial detail preservation are enhanced. Specific measures include constructing an encoder and decoder, embedding channel attention, spatial attention, and coordinate attention modules, and using cross entropy, Dice loss, and focal loss functions for model training and optimization.

Benefits of technology

It improves the recognition accuracy and robustness of agricultural greenhouses in remote sensing images, can better distinguish greenhouses from background objects, adapt to multi-scale target extraction, and improves the accuracy and completeness of the extraction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120495906B_ABST
    Figure CN120495906B_ABST
Patent Text Reader

Abstract

A method for extracting agricultural greenhouses based on an improved U-Net model. This method belongs to the technical field of extracting greenhouses from remote sensing images. The U-Net network is used for extracting objects from remote sensing images, but due to its simple structure, it cannot extract effective features in the complex and diverse surrounding environments of high-resolution remote sensing images, resulting in insufficient contextual information, omissions, and difficulty in extraction. Traditional methods for extracting objects often use RGB images as data sources, ignoring the use of the spectral characteristics of objects. This approach easily leads to the phenomenon of identical objects, especially in complex background conditions, making it difficult to effectively distinguish and extract target objects. This method improves on dataset construction, feature channel design, and the standard U-Net network structure, breaking through the technical bottlenecks of existing models in feature representation capabilities and spatial detail preservation, and has important research value for promoting the development of precision agriculture and smart agricultural management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of greenhouse range extraction using remote sensing images, and in particular relates to an agricultural greenhouse extraction method based on an improved U-Net model. Background Art

[0002] As an important carrier of modern facility agriculture, the accurate acquisition of spatial distribution information of agricultural greenhouses is of great significance for crop yield estimation, agricultural resource management, and agricultural policy formulation. With the rapid development of high-resolution remote sensing technology, semantic segmentation methods based on deep learning have become an important means of extracting surface cover information. Agricultural greenhouses are characterized by dense distribution, diverse shapes, and blurred boundaries in remote sensing images. The multi-layer downsampling of traditional U-Nets easily leads to the loss of small target features. The phenomenon of homospectral heterogeneity is prominent in the complex background of agricultural greenhouses (such as plastic coverings, building roofs, and other interferences with similar spectral characteristics to greenhouses), making it difficult for conventional convolution operations to effectively capture discriminative features. Furthermore, there are significant scale differences among greenhouses in different regions, making conventional convolution operations difficult to adapt to the needs of multi-scale target extraction. Summary of the Invention

[0003] The present invention provides an agricultural greenhouse extraction method based on an improved U-Net model, which breaks through the technical bottlenecks of existing models in feature representation ability and spatial detail preservation, and has important research value for promoting the development of precision agriculture and smart agricultural management.

[0004] The method of the present invention comprises the following steps:

[0005] S1. Dataset Construction: Acquire remote sensing image data of agricultural greenhouses and introduce spectral index data for band synthesis to form 6-band original image data; label the original image data with agricultural greenhouse samples, crop them into blocks, and divide the data set to obtain training and validation sets;

[0006] S2. Perform data enhancement on the dataset: perform data enhancement on the training set and validation set respectively;

[0007] S3. Build an improved U-Net model: Use the U-Net network as the basic network of the model to build the encoder and decoder. When building the encoder, introduce the channel attention module, spatial attention module, and coordinate attention module;

[0008] S4. Model training and optimization evaluation: Construct a composite loss function and combine the training set and validation set to iteratively train the improved U-Net model and optimize the results to obtain the optimal greenhouse recognition model;

[0009] S5. Automated extraction of agricultural greenhouses: Segment the target original image, input the segmentation results into the optimal greenhouse recognition model to obtain the block-by-block greenhouse extraction results, connect the target original image to perform spatial information calibration on the block-by-block greenhouse extraction results, splice the block-by-block greenhouse extraction results to obtain the spliced ​​greenhouse extraction results, optimize the greenhouse range morphology of the spliced ​​greenhouse extraction results to obtain the final greenhouse extraction results.

[0010] Furthermore, the spectral index data includes NIR band data, NDVI index data and NDBI index data, and the 6-band original image data includes three band data in the RGB band, NIR band data, NDVI index data and NDBI index data.

[0011] Furthermore, the training set is augmented by random resizing, horizontal flipping, vertical flipping, random cropping, conversion to tensor, and normalization.

[0012] The validation set is augmented by converting it into a tensor and normalizing it.

[0013] Furthermore, the encoder is constructed as follows:

[0014] Construct the input layer: perform two initial 3*3 convolutions on the input X tensor to extract basic features, and then perform two additional 3*3 convolutions to further enhance the features while keeping the number of channels unchanged;

[0015] Construct downsampling layer: perform 4 layers of downsampling, each downsampling layer uses a 2*2 pooling layer for downsampling, and then performs two 3*3 convolutions for feature extraction;

[0016] Construct an attention mechanism layer: introduce a channel attention module to weight each channel through global average pooling; then introduce a spatial attention module to enhance spatial information by calculating the weighted average at each spatial position; finally, introduce coordinate attention to use pooling operations to calculate the attention in two directions along the spatial dimension.

[0017] Furthermore, the construction of the decoder is specifically as follows:

[0018] Five layers of upsampling are performed, and each upsampling layer restores the feature map size and fuses the feature information from the encoding path through upsampling + skip connection + double convolution.

[0019] Furthermore, the composite loss function is specifically:

[0020] ;

[0021] in, 、 、 and are proportional coefficients respectively. By adjusting the proportional coefficients, the overall performance of greenhouse extraction can be improved. is the cross entropy loss function, is the Dice loss function, is the marginal loss function, is the Focal Loss loss function.

[0022] Furthermore, the spliced ​​greenhouse extraction results are optimized for the greenhouse range morphology, and the final greenhouse extraction results are as follows:

[0023] S71. Morphological classification: Define morphological feature vectors to classify the seamless greenhouse extraction results through:

[0024] Conduct, among which , represents the area of ​​the patch, Indicates the perimeter of the patch;

[0025] S72, Boundary Optimization: Boundary smoothing algorithm is used to optimize clustered greenhouses, while minimum bounding rectangle method is used to optimize scattered greenhouses;

[0026] S73. Double constraints: Based on the minimum circumscribed rectangle construction area and the aspect ratio, eliminate the image patches with an area less than 100 square meters, and further eliminate the image patches with an aspect ratio greater than 2 to obtain the final greenhouse extraction results.

[0027] The beneficial effects of the method of the present invention are:

[0028] The U-Net network is used to extract objects from remote sensing images. However, due to its simple structure, it cannot extract effective features in the complex and diverse surrounding environments of high-resolution remote sensing images, resulting in insufficient contextual information being extracted, and problems such as omissions and extraction difficulties may occur.

[0029] Traditional object extraction methods often use RGB images as their data source, neglecting to utilize the spectral characteristics of objects. This approach can easily lead to the phenomenon of identical objects appearing to be different from one another, making it difficult to effectively distinguish and extract target objects, especially under complex background conditions.

[0030] This method makes improvements in dataset construction, feature channel design, and standard U-Net network structure, including:

[0031] At the data level, near-infrared band data and vegetation index data are introduced, and near-infrared, NDVI and NDBI features are used to enhance the spectral expression ability of greenhouse objects, thereby improving the discrimination performance of the model.

[0032] At the network structure level, the channel attention + spatial attention + coordinate attention mechanism is embedded at the bottom of the U-Net encoder to enhance the network's ability to focus on key information, suppress background interference, and improve the model's recognition effect on greenhouse targets.

[0033] In terms of loss function design, a composite loss function is proposed to constrain the model from two aspects: pixel-level classification accuracy and overall contour structure optimization, thereby improving the robustness and accuracy of the extraction results.

[0034] Greenhouses exhibit significant differences from other land features in remote sensing imagery in terms of spectral, exponential, morphological, and textural characteristics, making them highly separable. Based on this, a greenhouse feature sample set was constructed and divided into a training set and a validation set in a 7:3 ratio. By inputting these samples into an improved U-Net network, optimizing the training parameters, and performing multiple rounds of training, a greenhouse recognition model was ultimately developed. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 Schematic diagram of reflectivity and remote sensing index values ​​of different surface objects in an embodiment of the present invention;

[0036] Figure 2 It is an improved U-Net model in the embodiment of the present invention. DETAILED DESCRIPTION

[0037] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0038] Example 1

[0039] This embodiment provides an agricultural greenhouse extraction method based on an improved U-Net model, the method comprising the following steps:

[0040] S1. Dataset Construction: Acquire remote sensing image data of agricultural greenhouses and introduce spectral index data for band synthesis to form 6-band original image data; label the original image data with agricultural greenhouse samples, crop them into blocks, and divide the data set to obtain training and validation sets;

[0041] S2. Perform data enhancement on the dataset: perform data enhancement on the training set and validation set respectively;

[0042] S3. Build an improved U-Net model: Use the U-Net network as the basic network of the model to build the encoder and decoder. When building the encoder, introduce the channel attention module, spatial attention module, and coordinate attention module;

[0043] S4. Model training and optimization evaluation: Construct a composite loss function and combine the training set and validation set to iteratively train the improved U-Net model and optimize the results to obtain the optimal greenhouse recognition model;

[0044] S5. Automated extraction of agricultural greenhouses: Segment the target original image, input the segmentation results into the optimal greenhouse recognition model to obtain the block-by-block greenhouse extraction results, connect the target original image to perform spatial information calibration on the block-by-block greenhouse extraction results, splice the block-by-block greenhouse extraction results to obtain the spliced ​​greenhouse extraction results, optimize the greenhouse range morphology of the spliced ​​greenhouse extraction results to obtain the final greenhouse extraction results.

[0045] Example 2

[0046] This embodiment further limits the embodiment 1 and further explains step S1.

[0047] Image preprocessing: Acquire sub-meter remote sensing image data from Jilin-1, Gaofen-1, and other satellites, as well as medium-resolution image data from Sentinel-2, and perform image preprocessing. The preprocessing specifically includes performing radiometric correction, geometric correction, orthorectification, and atmospheric correction in sequence.

[0048] Spectral index calculation: Figure 1 As shown in the figure, the reflectivity and remote sensing index values ​​of different surface objects are different. B1-B10 refers to bands 1 to 10 of remote sensing images, so this method introduces the NIR band (to enhance greenhouse characteristics), calculates the NDVI index (to eliminate the influence of vegetation and water bodies), and calculates the NDBI index (to enhance greenhouse characteristics).

[0049] Band synthesis: Band synthesis is performed using traditional RGB bands, NIR bands, NDVI, and NDBI indices to form a new 6-band raw data image.

[0050] Greenhouse sample annotation: Combine field sampling survey data with greenhouse morphological characteristics, spectral characteristics, and texture characteristics to annotate image samples and form a greenhouse sample vector layer.

[0051] Block cropping: The image sample data and the labeled greenhouse samples are cropped in blocks with a block size of 516*516 and a step size of 516*516.

[0052] Dataset division: The dataset is divided into training set and validation set in a ratio of 7:3.

[0053] Example 3

[0054] This embodiment further limits the embodiment 1 and further explains step S2.

[0055] Perform data augmentation on the training set:

[0056] The training data is subjected to various enhancement methods such as random resizing, horizontal flipping, vertical flipping, random cropping, conversion to tensor, normalization, etc. to increase the robustness and generalization ability of the model.

[0057] Random Resize: Randomly resize the image between 50% and 120% of base_size.

[0058] Horizontal Flip: Flip the image horizontally with a probability of 50%.

[0059] Vertical Flip: Flip the image vertically with a probability of 50%.

[0060] Random Crop: Randomly crop the image to crop_size.

[0061] Convert to Tensor: Convert the image to a PyTorch tensor for subsequent processing.

[0062] Normalization: Normalize the image and calculate the mean and standard deviation of the image.

[0063] Perform data augmentation on the validation set:

[0064] Convert to Tensor: Convert an image to a PyTorch tensor.

[0065] Normalization: Normalize the image and calculate the mean and standard deviation of the image.

[0066] Example 4

[0067] This embodiment further limits the embodiment 1 and further explains step S3. The improved U-Net model is as follows: Figure 2 shown.

[0068] Use the U-Net network as the basic network of the model to build the encoder and decoder.

[0069] The encoder consists of four encoding blocks with the same structure. Each encoding block consists of two 3*3 convolutional layers and one pooling layer. The convolutional layer is used to extract features, and the pooling layer is used to increase the receptive range and extract local context information.

[0070] Multiple attention modules are embedded at the end of the encoder to enhance effective features and suppress invalid features to improve performance.

[0071] The decoder consists of four identical decoding blocks. Each encoding block consists of two 3x3 convolutional layers and one upsampling layer to restore the spatial dimensions of the image. Skip connections are used to connect the corresponding encoding and decoding blocks, while preserving the detailed information extracted by the encoder.

[0072] The encoder part is constructed as follows.

[0073] Construct the input layer: Input the X tensor and perform two initial 3*3 convolutions to extract basic features to obtain feature map X1. Then perform two additional 3*3 convolutions to further enhance the features to obtain feature map X2, while keeping the number of channels unchanged, which is 64.

[0074] Construct the downsampling layer:

[0075] Perform 4 downsampling (down1-down4), each downsampling process uses a 2*2 pooling layer for downsampling, and then performs two 3*3 convolutions for feature extraction;

[0076] The first downsampling layer (down1) has 64 input channels (base_c) and 128 output channels (base_c*2). 2*2 pooling is performed on X2, and the feature map size becomes H / 2. Then two 3*3 convolutions are performed, and the number of channels becomes 128, resulting in the feature map X3.

[0077] The second downsampling layer (down2) has 128 input channels (base_c*2) and 256 output channels (base_c*4). 2*2 pooling is performed on X3, the feature map size becomes H / 4, and two 3*3 convolutions are performed, the number of channels becomes 256, and the feature map X4 is obtained.

[0078] The third downsampling layer (down3) has 256 input channels (base_c*4) and 512 output channels (base_c*8). 2*2 pooling is performed on X4, and the feature map size becomes H / 8. Two 3*3 convolutions are performed, and the number of channels becomes 512, resulting in the feature map X5.

[0079] The fourth downsampling layer (down4) has 512 input channels (base_c*8) and 1028 output channels (base_c*16). 2*2 pooling is performed on X5, the feature map size becomes H / 16, and two 3*3 convolutions are performed, the number of channels becomes 1024, and the feature map X6 is obtained.

[0080] Improvements to the channel attention + spatial attention + coordinate attention modules are introduced:

[0081] The channel attention module is introduced to weight each channel through global average pooling; the spatial attention module is then introduced to enhance spatial information by calculating the weighted average at each spatial location (pixel); and finally, the coordinate attention module is introduced to use pooling operations to calculate attention in two directions along the spatial dimension. By introducing these three attention modules, the model can better focus on important channel, spatial location, and coordinate features, improving overall performance.

[0082] Channel attention module: The channel attention mechanism enhances key features and suppresses irrelevant features by modeling the relationship between different channel features. The specific steps for calculating channel attention weights are as follows:

[0083] First, perform global average pooling and global maximum pooling on the input feature map A to obtain two channel descriptions: and ;

[0084] Then, and The feature transformation is performed through two fully connected (FC) layers with shared weights to generate channel attention features respectively. After adding the two, the final channel attention weight is obtained through the Sigmoid activation function. :

[0085] ;

[0086] in, represents the Sigmoid activation function, 、 are two linear transformations.

[0087] Spatial Attention Module: The spatial attention mechanism emphasizes the information of local areas by modeling the importance of features at different spatial locations. The specific steps for calculating spatial attention weights are as follows:

[0088] First, perform maximum pooling and average pooling on the input feature map A along the channel dimension to generate two single-channel feature maps respectively;

[0089] Then, the two single-channel feature maps are spliced ​​along the channel dimension to obtain a 2-channel feature map, and a 7*7 convolution operation is performed to generate a spatial attention map, and the final spatial attention weight is obtained through the Sigmoid activation function. :

[0090] ;

[0091] in,[ ] represents the channel concatenation operation of the feature map, Represents a convolution operation with a 7×7 convolution kernel.

[0092] Coordinate Attention Module:

[0093] The Coordinate Attention module is a method that combines channel attention and position information to enhance the model's ability to perceive global information while maintaining accurate position information. Its main calculation process is divided into three steps.

[0094] Coordinate attention weight calculation:

[0095] Coordinate attention decomposes channel attention into two independent directional attentions, namely horizontal and vertical directions, and performs global average pooling on the input feature map, calculating the mean of the features along the horizontal and vertical directions respectively. and :

[0096] ;

[0097] ;

[0098] in, represents the channel index, Represents the horizontal and vertical positions respectively. , are the height and width of the feature map.

[0099] Coordinate attention weight update:

[0100] Will and The shared 1D convolution layer is used to map the features to a low-dimensional space to reduce computational complexity and parameter redundancy. Nonlinear activation is then applied to the mapped features and restored to the original channel dimension through another 1D convolution layer to obtain the weight matrix and .

[0101] Coordinate attention weight mapping:

[0102] The calculated and Perform broadcast expansion and apply it to the original feature map To enhance the feature representation of different positions, the enhanced feature map is finally obtained , which retains the ability of channel attention and combines spatial location information, enabling the model to better capture long-range dependencies and improve target recognition and feature expression capabilities.

[0103] Compared with the traditional dual attention (spatial attention + channel attention), the introduction of coordinate attention has stronger feature expression ability, more accurate extraction of small targets and boundary areas, and stronger robustness to background noise.

[0104] The decoder part is constructed as follows.

[0105] Constructing the upsampling layer: Perform four upsampling passes (up1-up4). Each upsampling process restores the feature map size through upsampling, skip connections, and double convolution, while also integrating feature information from the encoding path. The first upsampling layer (up1) has 1024 input channels (base_c * 16) and 512 output channels (base_c * 8). X6 is upsampled to H / 16; X5 is passed in via a skip connection. Since the sizes may not match, X6 is padded, aligned, and concatenated to 1024 channels. Two 3x3 convolutions are performed to output a 512-channel feature map X7.

[0106] The second upsampling layer (up2) has 512 input channels (base_c * 8) and 256 output channels (base_c * 4). X7 is upsampled to H / 8; X4 is passed in via a skip connection; X7 is padded to ensure that the sizes of X4 and X7 match, and then concatenated to 512 channels. Two 3*3 convolutions are performed to output a 256-channel feature map X8.

[0107] The third upsampling layer (up3) has 256 input channels (base_c * 4) and 128 output channels (base_c * 2). X8 is upsampled to H / 4; X3 is passed in via a skip connection; X8 is padded to ensure that the sizes of X3 and X8 match, and then concatenated to 256 channels. Two 3*3 convolutions are performed to output a 128-channel feature map X9.

[0108] The fourth upsampling layer (up4) has 128 input channels (base_c * 2) and 64 output channels (base_c); X9 is upsampled to H / 2; X2 is passed in via a skip connection; X9 is padded to ensure that the sizes of X2 and X9 match, and then concatenated to 128 channels; two 3*3 convolutions are performed to output a 64-channel feature map X10;

[0109] Finally, upsample (last) the input channel to 128 (base_c *2) and the output channel to 64 (base_c); upsample X10 to H; pass X1 of the encoding layer through the skip connection; pad X10 to ensure that the sizes of X1 and X10 match and then concatenate them to 128 channels; output a 64-channel feature map through two 3*3 convolutions; pass this feature map through a 1*1 convolution to map the number of channels from 64 to the number of output categories num_classes to generate the final feature map.

[0110] Example 5

[0111] This embodiment further limits the embodiment 1 and further explains step S4.

[0112] The SGD optimizer is used to update the model parameters: the learning rate lr is set to 0.001, the momentum parameter momentum is set to 0.9, and the weight decay parameter weight_decay is set to 0.0001.

[0113] Adopt hybrid longitude training: use GradScaler() for gradient scaling to improve training stability.

[0114] Learning rate adjustment: LambdaLR is used to adjust the learning rate at the step level to ensure that the learning rate during training gradually decays as the training progresses; learning rate warmup=True avoids violent fluctuations in model parameters in the early stages of training and improves model convergence

[0115] Designed using a composite loss function:

[0116] The cross entropy + Dice loss function (focusing on pixel classification and overlap), the Focal Loss loss function (focusing on small targets and boundary extraction), and the edge loss function (reducing holes and locating boundaries) are used as the loss function of the model according to different weights. Different loss functions are used to constrain the results in different aspects, improve the robustness of the model, and optimize the extraction results of the greenhouse.

[0117] The composite loss function is:

[0118] ;

[0119] in, 、 、 and are proportional coefficients respectively. By adjusting the proportional coefficients, the overall performance of greenhouse extraction can be improved. is the cross entropy loss function, is the Dice loss function, is the marginal loss function, is the Focal Loss loss function.

[0120] In the Focal Loss loss function, γ is the focus parameter, which is usually set to 2 and is used to reduce the loss contribution of simple samples.

[0121] Since greenhouses often account for a small proportion in remote sensing images and have too many background pixels, Focal Loss can reduce the weight of easily classified pixels, focus on difficult-to-classify pixels, and improve the accuracy of small targets and boundary areas.

[0122] In greenhouse extraction tasks, object boundaries are often fuzzy, and simple region loss may not be able to accurately capture edge information. Introducing edge loss here allows for specialized edge supervision at the pixel level, thereby improving the edge accuracy of the segmentation results and reducing holes and edge discontinuities.

[0123] Proven 、 、 and The performance is best when the ratio is 1:1:1:1 respectively. The optimal model is obtained after multiple rounds of iterative training and result optimization.

[0124] Example 6

[0125] This embodiment further limits the embodiment 1 and further explains step S5.

[0126] Initial extraction of greenhouse:

[0127] After preprocessing the target image, the image is segmented into blocks of size 516*516 and step size 516*516. The segmentation results are input into the optimal greenhouse recognition model obtained in step S4, and finally the greenhouse recognition results of the blocks are obtained.

[0128] Spatial information calibration and result stitching:

[0129] Based on the coordinate mapping principle, the spatial correspondence between the block result and the original image is established. Assume that the geographic transformation matrix is:

[0130]

[0131] Where, is the image pixel coordinate, is the image geographic coordinate, is the geographic transformation matrix.

[0132] The greenhouse recognition results after spatial information calibration are spliced ​​and connected to the original images for spatial information calibration.

[0133] Seamless stitching is achieved through bilinear interpolation algorithm:

[0134] ;

[0135] Where, Represents the pixel value of the stitched image at the global coordinate (X, Y), Indicates the blocks, Indicates the The pixel value corresponding to each block, Indicates the The pixel coordinates corresponding to each block.

[0136] Weight It is determined by the Euclidean distance of the overlapping areas of adjacent blocks to ensure spatial continuity after splicing.

[0137] Greenhouse range morphology optimization:

[0138] (1) Morphological classifier

[0139] Define the morphological eigenvectors: ;

[0140] Aspect ratio (L ≥ W): , , is the patch area, For compactness, is the aspect ratio, P is the perimeter of the pattern;

[0141] Classification rules: .

[0142] (2) Boundary optimization

[0143] Through morphological screening, greenhouses are divided into two types: clustered greenhouses and scattered greenhouses. The boundary smoothing algorithm is used for clustered greenhouses:

[0144] Smooth the border to eliminate small depressions and jagged edges, making the border more regular and continuous;

[0145] in, represents a buffer (expansion) operation, Represents the anti-buffer (erosion) operation, A circular structuring element representing the radius.

[0146] For scattered greenhouses, the minimum enclosing rectangle method is used to make the minimum enclosing rectangle satisfy:

[0147] ;in θ is the rotation angle, and They represent the new horizontal and vertical coordinate values ​​obtained after the coordinate transformation of the target contour point under the rotation angle, and the optimization is achieved by traversing the normal direction of the convex hull edge.

[0148] (3) Establish dual constraints:

[0149] ;

[0150] Compare the area of ​​the minimum enclosing rectangle with the aspect ratio and remove areas smaller than The spots with aspect ratio greater than 2 are further eliminated.

[0151] Example 7

[0152] This example verifies the beneficial effects of the improved U-Net model. To thoroughly evaluate the impact of different attention mechanism modules on the performance of the greenhouse extraction task, a series of systematic ablation experiments were designed and conducted. Specifically, based on the channel attention module, spatial attention, coordinate attention, boundary attention, and shape attention were gradually introduced. The performance of each combination was compared within the same network framework. All experiments were conducted using the same dataset and training strategy to ensure the comparability and reliability of the evaluation results. The results are shown in Table 1.

[0153] Table 1:

[0154]

[0155] Experimental results show that when channel attention alone is used, model performance is relatively average, with a mean IoU of 79.8 and a dice coefficient of 0.628. Introducing spatial attention significantly improves the mean IoU to 83.4, demonstrating the positive impact of spatial context on greenhouse extraction. Further incorporating coordinate attention achieves optimal performance, with a mean IoU of 85.2 and a dice coefficient of 0.783, demonstrating that jointly modeling spatial position and channel information significantly improves target region recognition.

[0156] However, when the boundary attention module was introduced in addition to the channel, spatial, and coordinate attention modules, model performance actually declined somewhat (mean IoU dropped to 82.6). This suggests that while boundary attention can enhance edge representation in some tasks, it may introduce excessive noise or interference in this task. Further adding the shape attention module also failed to improve performance, and even dropped the mean IoU to 82.3. This may be because shape constraints increase the difficulty of model learning, affecting the overall segmentation effect.

[0157] Further based on the above experiments, in order to evaluate the impact of NIR bands, NDVI, and NDBI indices on the performance of greenhouse extraction tasks, NIR bands, NDVI, and NDBI indices were introduced at the dataset level, and a band synthetic image consisting of traditional RGB bands, NIR bands, NDVI, and NDBI indices was constructed as a new dataset input.

[0158] Experimental results show that the model accuracy is further improved when the NIR band, NDVI, and NDBI indices are introduced for new data set training, with the mean IoU increasing to 86.64 and the dice coefficient reaching 0.823.

Claims

1. An agricultural greenhouse extraction method based on an improved U-Net model, characterized in that: The method comprises the following steps: S1. Dataset Construction: Acquire remote sensing image data of agricultural greenhouses and introduce spectral index data for band synthesis to form 6-band original image data; label the original image data with agricultural greenhouse samples, crop them into blocks, and divide the data set to obtain training and validation sets; The spectral index data includes NIR band data, NDVI index data and NDBI index data. The 6-band original image data includes three band data in the RGB band, NIR band data, NDVI index data and NDBI index data. S2. Perform data enhancement on the dataset: perform data enhancement on the training set and validation set respectively; S3. Build an improved U-Net model: Use the U-Net network as the basic network of the model to build the encoder and decoder. When building the encoder, introduce the channel attention module, spatial attention module, and coordinate attention module; The encoder consists of an input layer, a downsampling layer, and an attention mechanism layer. In the attention mechanism layer, a channel attention module is introduced to weight each channel through global average pooling. Then, the spatial attention module is introduced to enhance spatial information by calculating the weighted average at each spatial position; finally, the coordinate attention is introduced to calculate the attention in two directions along the spatial dimension using the pooling operation; S4. Model training and optimization evaluation: Construct a composite loss function and combine the training set and validation set to iteratively train the improved U-Net model and optimize the results to obtain the optimal greenhouse recognition model; S5. Automated extraction of agricultural greenhouses: Segment the target original image, input the segmentation results into the optimal greenhouse recognition model to obtain the block-by-block greenhouse extraction results, connect the target original image to perform spatial information calibration on the block-by-block greenhouse extraction results, splice the block-by-block greenhouse extraction results to obtain the spliced ​​greenhouse extraction results, optimize the greenhouse range morphology of the spliced ​​greenhouse extraction results to obtain the final greenhouse extraction results.

2. The agricultural greenhouse extraction method based on the improved U-Net model according to claim 1, characterized in that, The training set is augmented with data by random resizing, horizontal flipping, vertical flipping, random cropping, conversion to tensor, and normalization. The validation set is augmented by converting it into a tensor and normalizing it.

3. The agricultural greenhouse extraction method based on the improved U-Net model according to claim 2, characterized in that, The encoder is constructed as follows: Construct the input layer: perform two initial 3*3 convolutions on the input X tensor to extract basic features, and then perform two additional 3*3 convolutions to further enhance the features while keeping the number of channels unchanged; Construct downsampling layer: perform 4 layers of downsampling, each downsampling layer uses a 2*2 pooling layer for downsampling, and then performs two 3*3 convolutions for feature extraction; Build the attention mechanism layer.

4. The agricultural greenhouse extraction method based on the improved U-Net model according to claim 3, characterized in that, The construction of the decoder is specifically as follows: Five layers of upsampling are performed, and each upsampling layer restores the feature map size and fuses the feature information from the encoding path through upsampling + skip connection + double convolution.

5. The agricultural greenhouse extraction method based on the improved U-Net model according to claim 4 is characterized in that, The composite loss function is specifically: ; in, 、 、 and are proportional coefficients respectively. By adjusting the proportional coefficients, the overall performance of greenhouse extraction can be improved. is the cross entropy loss function, is the Dice loss function, is the marginal loss function, is the FocalLoss loss function.

6. The agricultural greenhouse extraction method based on the improved U-Net model according to claim 5 is characterized in that, The spliced ​​greenhouse extraction results are optimized for the greenhouse range morphology, and the final greenhouse extraction results are as follows: S71. Morphological classification: Define morphological feature vectors to classify the seamless greenhouse extraction results through: Conduct, among which , represents the area of ​​the patch, Indicates the perimeter of the patch; S72, Boundary Optimization: Boundary smoothing algorithm is used to optimize clustered greenhouses, while minimum bounding rectangle method is used to optimize scattered greenhouses; S73. Double constraints: Based on the minimum circumscribed rectangle construction area and the aspect ratio, eliminate the image patches with an area less than 100 square meters, and further eliminate the image patches with an aspect ratio greater than 2 to obtain the final greenhouse extraction results.

Citation Information

Patent Citations

  • Land cover remote sensing monitoring method based on multi-source feature fusion

    CN115527123A

  • Remote sensing extraction method and system for agricultural plastic greenhouse

    CN117612021A