Crop yield prediction method, device, equipment, medium and program product

By preprocessing and feature extraction of crop image data, and combining a segmentation model with context awareness and a dual-stream feedforward module, the problem of recognition accuracy under illumination and complex backgrounds in crop yield prediction was solved, and high-precision crop yield prediction was achieved.

CN121661490APending Publication Date: 2026-03-13CHINA MOBILE (JIANGXI) VIRTUAL REALITY TECH CO LTD +3
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-28
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing crop yield prediction technologies are limited in their accuracy and have unclear boundaries when faced with variable lighting and complex farmland backgrounds. Traditional machine learning models struggle to capture the complex nonlinear relationships and temporal dynamics of crop growth, resulting in inaccurate prediction results.

Method used

By preprocessing the initial image data, multi-scale feature maps are extracted using a segmentation model. Local and global contextual information is captured by combining a context-aware module and a dual-stream feedforward module. Adaptive weighted fusion and pixel-level classification are then performed to generate clear crop planting area segmentation results, which are finally input into a yield prediction model for accurate prediction.

Benefits of technology

It improves the accuracy of crop yield forecasting, enables precise judgments in complex scenarios, generates clear segmentation boundaries, and enhances the accuracy and reliability of yield forecasting by combining deep learning with mechanistic models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121661490A_ABST
    Figure CN121661490A_ABST
Patent Text Reader

Abstract

The invention discloses a crop yield prediction method and device, equipment, a medium and a program product, and relates to the technical field of computers, and the method comprises the steps: carrying out the preprocessing of obtained initial image data of a crop planting region, and obtaining target image data; inputting the target image data into a preset segmentation model to perform feature extraction to obtain a multi-scale first feature map; capturing local context information and global context information of the first feature map based on the segmentation model to obtain a second feature map; based on the segmentation model, performing adaptive weighted fusion on the second feature maps to obtain a third feature map; performing pixel-level classification on the third feature map based on the segmentation model to determine a segmentation result of the crop planting area; and inputting the segmentation result into a preset yield prediction model so as to predict the crop yield in the crop planting area. According to the embodiment of the invention, the crop yield prediction precision can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, equipment, medium, and program product for predicting crop yield. Background Technology

[0002] Accurate crop yield forecasting is a core element in realizing smart agriculture and ensuring national food security. Accurate yield forecasts provide crucial data support for decision-making by agricultural producers, businesses, and government departments. Existing crop yield forecasting technologies primarily rely on remote sensing image analysis combined with traditional machine learning models. However, these methods have significant drawbacks. On the one hand, their recognition accuracy is limited by variable lighting and complex farmland backgrounds, resulting in unclear boundary delineation and inaccurate basic data for prediction. On the other hand, traditional machine learning models are too simplistic, failing to capture the complex nonlinear relationships and temporal dynamics of crop growth, and exhibiting poor adaptability to environmental changes and crop variety differences, leading to inaccurate prediction results. Summary of the Invention

[0003] This application provides a method, apparatus, equipment, medium, and program product for predicting crop yield, which can improve the accuracy of crop yield prediction.

[0004] In a first aspect, embodiments of this application provide a method for predicting crop yield, including: The initial image data of the acquired crop planting area is preprocessed to obtain the target image data; The target image data is input into a preset segmentation model for feature extraction to obtain a multi-scale first feature map; The local and global context information of the first feature map is captured based on the segmentation model to obtain the second feature map; Based on the segmentation model, the second feature maps are adaptively weighted and fused to obtain the third feature map; The third feature map is classified at the pixel level based on the segmentation model to determine the segmentation result of the crop planting area. The segmentation results are input into a preset yield prediction model to predict crop yields in crop planting areas.

[0005] Furthermore, the preprocessing of the initial image data of the acquired crop planting area to obtain the target image data includes: Acquire initial image data of the crop planting area, and rotate and scale the initial image data proportionally to obtain the first processing result; The first processing result is subjected to a Gaussian filter to obtain a smooth second processing result; The second processing result is then subjected to image enhancement to obtain the target image data.

[0006] Furthermore, the segmentation model includes a context-aware module and a two-stream feedforward module. The step of capturing local and global context information of the first feature map based on the segmentation model to obtain a second feature map includes: The local context information of the first feature map is extracted in parallel through the local branches of the context-aware module, and the local context information is summed after batch normalization to obtain local context features. The number of channels of the first feature map is expanded by the global branch of the context-aware module to obtain a fourth feature map. The fourth feature map is then mapped to several windows to obtain several vectors. The global context information of each vector is calculated using a multi-head attention mechanism to obtain global context features. The local context features and the global context features are aggregated to obtain aggregated features, and the aggregated features are enhanced by the dual-stream feedforward module to obtain the second feature map.

[0007] Further, the enhancement of the aggregated features through the dual-stream feedforward module to obtain the second feature map includes: The aggregated features are processed by a fully connected layer through the feedforward network branch of the dual-stream feedforward module to extract global details; The aggregated features are convolved through the supplementary branch of the dual-stream feedforward module to obtain a third processing result, and the third processing result is activated to obtain local details. The global details and the local details are multiplied pixel by pixel and then processed through a fully connected layer to obtain a fourth processing result. The fourth processing result is then added element by element to the aggregated features to obtain the second feature map.

[0008] Furthermore, before performing pixel-level classification of the third feature map based on the segmentation model, the method further includes: Perform a convolution operation on the third feature map to generate intermediate features; The intermediate features are subjected to depthwise separable convolution processing, and a spatial attention map is generated by the first activation function. The spatial attention map is multiplied pixel by pixel with the intermediate feature to obtain several multiplication results, and the multiplication results are added together to obtain the first optimized feature; The first optimized feature is sequentially subjected to depthwise separable convolution, batch normalization, and convolution to obtain the third processing result. The third processing result is added element-wise to the intermediate feature to obtain the second optimized feature; The second optimized feature is processed sequentially through the second activation function, convolution, and upsampling to obtain the fourth feature map.

[0009] Further, the step of performing pixel-level classification on the third feature map based on the segmentation model to determine the segmentation result of the crop planting area includes: The third feature map is upsampled to obtain the fifth feature map, and features are extracted from the fifth feature map to obtain the feature representation; Based on the feature representation, classification prediction is performed to obtain an original prediction map, wherein the value of each pixel in the original prediction map represents the probability of belonging to each category; The original prediction map is processed by an activation function to obtain the final semantic segmentation result; Based on the semantic segmentation results, the segmentation results of the rice planting area are determined.

[0010] Secondly, embodiments of this application also provide a crop yield prediction device, comprising: The acquisition module is used to preprocess the initial image data of the acquired crop planting area to obtain the target image data; The extraction module is used to input the target image data into a preset segmentation model to perform feature extraction and obtain a multi-scale first feature map; The capture module is used to capture the local and global context information of the first feature map based on the segmentation model to obtain the second feature map; The fusion module is used to adaptively weight and fuse each of the second feature maps based on the segmentation model to obtain a third feature map; The classification module is used to perform pixel-level classification on the third feature map based on the segmentation model to determine the segmentation result of the crop planting area; The prediction module is used to input the segmentation results into a preset yield prediction model to predict the crop yield in the crop planting area.

[0011] Thirdly, embodiments of this application provide an electronic device, including: a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, it implements the steps in the crop yield prediction method as described in any one of the first aspects.

[0012] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the crop yield prediction method as described in any one of the first aspects.

[0013] Fifthly, embodiments of this application also provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the steps of the crop yield prediction method as described in any one of the first aspects.

[0014] In this embodiment, preprocessing the initial image data effectively eliminates interference factors such as illumination and noise, improving data quality and laying the foundation for accurate segmentation. By capturing local and global contextual information in parallel, the details of individual crops can be identified, and the overall layout of crops in the field can be understood. This allows for accurate judgment even in complex scenarios such as dense planting, shading, or blurred boundaries, greatly improving the robustness and accuracy of segmentation. Adaptive weighted fusion of each second feature map effectively utilizes features at different scales, ensuring that the final third feature map used for segmentation retains both fine spatial details and high-level semantic information, guaranteeing the generation of clear and accurate segmentation boundaries. Pixel-level classification of the third feature map accurately obtains the segmentation results of crop planting areas. By inputting the segmentation results into a preset yield prediction model, the crop yield in the crop planting area can be accurately predicted. Compared with existing technologies, this application can improve the accuracy of crop yield prediction and recognition. Attached Figure Description

[0015] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 This is a flowchart of a crop yield prediction method according to an embodiment of this application; Figure 2 This is a schematic diagram illustrating the working mechanism of the window interaction module in the context-aware module of this application embodiment; Figure 3 This is an overall architecture diagram of a crop yield prediction system according to an embodiment of this application; Figure 4 This is a schematic diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0017] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0018] This application provides a method, apparatus, equipment, medium, and program product for predicting crop yield. The embodiments of this application will be described in detail below with reference to the accompanying drawings and specific examples and application scenarios.

[0019] Please see Figure 1 , Figure 1 This is a flowchart of a crop yield prediction method provided in an embodiment of this application. The method includes the following steps: steps S101 to S103. Step S101: Preprocess the initial image data of the acquired crop planting area to obtain target image data; In some embodiments, step S101 includes: acquiring initial image data of the crop planting area, rotating and scaling the initial image data proportionally to obtain a first processing result; performing a Gaussian filtering operation on the first processing result to obtain a smooth second processing result; and performing image enhancement on the second processing result to obtain the target image data. Specifically, firstly, initial image data of the crop planting area is collected and acquired using a drone; subsequently, data enhancement operations involving rotation and scaling are performed on the initial image data to increase data diversity and improve the model's generalization ability, resulting in a first processing result; next, a Gaussian filtering operation is performed on the first processing result to smooth the image and effectively remove noise, resulting in a smooth second processing result; finally, image enhancement is performed on the denoised second processing result by adjusting one or more combinations of brightness, contrast, saturation, and hue to optimize image quality, ultimately obtaining target image data that meets the input requirements of the segmentation model.

[0020] In some embodiments, the formulas for calculating rotation and scaling are as follows: ; ; In the formula, It is the result of rotation. The scaling result, rotation result, and scaling result together constitute the first processing result; It is the original image; These are the coordinates of pixels in the image; is the rotation angle; k is the scaling factor.

[0021] In some embodiments, the first processing result is subjected to Gaussian filtering to smooth the image and effectively remove noise, resulting in a smooth second processing result. Specifically, after determining the size of the Gaussian kernel, the Gaussian filtering result is calculated, and then the Gaussian kernel is applied to each pixel in the image to perform a convolution operation, resulting in a smooth second processing result.

[0022] In some embodiments, the formula for Gaussian filtering is as follows: ; In the formula, This is the result of Gaussian filtering. It is the standard deviation of the Gaussian distribution, which controls the width of the Gaussian function.

[0023] In some embodiments, each pixel The formula for performing the filtering operation can be expressed as: ; In the formula, These are the pixel values ​​in the original image. These are the weights in the Gaussian kernel. It is the Gaussian kernel radius.

[0024] In some embodiments, the formula for adjusting contrast is as follows: ; In the formula, These are the pixel values ​​of the original image. These are the pixel values ​​after adjusting the contrast. It is a contrast adjustment factor used to control the intensity of contrast. 128 is used to center the pixel value 0, so that the range of adjusted pixel values ​​is wider.

[0025] It should be noted that the crops referred to in this application may include, but are not limited to, rice, vegetables, etc., and this application does not impose any restrictions on them.

[0026] Step S102: Input the target image data into a preset segmentation model to perform feature extraction and obtain a multi-scale first feature map; In some embodiments, the segmentation model uses a ResNet-18 network as the backbone feature extraction network to perform layer-by-layer convolution and downsampling on the input target image data to extract multi-scale image features at different abstraction levels. Specifically, the first layers of the network capture low-level features of the image, such as edges and textures; as the network deepens, subsequent layers extract high-level features containing richer semantic information. Based on this, a feature pyramid network is introduced, which fuses the high-level and low-level features of the deep ResNet-18 network through a top-down path and lateral connections, thereby constructing a set of multi-scale first feature maps that possess both rich semantic information and precise spatial location information.

[0027] Step S103: Capture the local and global context information of the first feature map based on the segmentation model to obtain the second feature map; In some embodiments, the segmentation model includes a context-aware module and a two-stream feedforward module. Step S103 includes: extracting local context information of the first feature map in parallel through the local branch of the context-aware module, and summing the local context information after batch normalization to obtain local context features; expanding the number of channels of the first feature map through the global branch of the context-aware module to obtain a fourth feature map, mapping the fourth feature map to several windows to obtain several vectors, calculating the global context information of each vector using a multi-head attention mechanism to obtain global context features; aggregating the local context features and the global context features to obtain aggregated features, and enhancing the aggregated features through the two-stream feedforward module to obtain the second feature map. Specifically, firstly, through the local branch of the context-aware module, the local context information of the first feature map is extracted in parallel using standard 1×1 and 3×3 convolutions, and the local context information output by the two convolutions is batch normalized (BN) and summed to obtain refined local context features. Simultaneously, the first feature map is processed through the global branch of the context-aware module: firstly, a 1×1 convolution is used to expand the number of channels of the input feature to three times the original, resulting in a fourth feature map with higher dimensions; then, a windowing operation is used to map this fourth feature map into multiple vectors, which are then divided into multiple groups, serving as query (Q), key (K), and value (V) vectors, respectively; finally, a multi-head attention mechanism is used to calculate global contextual dependencies among these vectors, thereby capturing the overall semantic information of the image and obtaining global contextual features. Next, the local contextual features obtained in the above steps are aggregated with the global contextual features to generate aggregated features that integrate local details and global semantics.

[0028] For example, in the global branch, taking the input feature dimension C×H×W as an example, the number of channels is first expanded by a factor of 3 through a 1×1 convolution to obtain an output of 3C×H×W, and then a windowing operation is used to map it to... ×h)×(w×w)× A vector of dimension h can be further divided into h groups, each with dimension h. )×(w×w)× The Q, K, and V vectors are used to compute global contextual information using a multi-head attention mechanism.

[0029] In some embodiments, after obtaining the global context features, the initial global context features need to be enhanced using a window interaction module to fuse horizontal and vertical context information across windows, thereby obtaining a more representative global context representation. Specifically, a window of size (window size, 1) is used, for example... The average pooling kernel is used for horizontal pooling, while a window of size (1, window size) is used, for example... The average pooling kernel performs vertical pooling, and then the pooling results are summed to establish pixel dependencies across the window. The mathematical expression for this is: ; in, This indicates the position after fusion. pixel values, These represent the pixel values ​​calculated at the corresponding positions from the horizontal pooling branch and the vertical pooling branch, respectively. It is the size of the window; by connecting more intermediate windows, the modeling relationship between the above adjacent windows is extended to a size of [size missing]. In the adjacent regions, among which This represents the number of windows, allowing for the effective modeling of long-distance dependencies between any two windows within the region.

[0030] It should be noted that the schematic diagram of the working mechanism of the window interaction module in the context-aware module is as follows: Figure 2As shown, the core function of this module is to fuse horizontal and vertical contextual information across windows to obtain a more comprehensive global contextual representation. Its implementation consists of two parallel branches: Horizontal context extraction: using an average pooling layer with a kernel size of (window size, 1), the window is pooled horizontally to capture information between adjacent windows in the same row. Vertical context extraction: using an average pooling layer with a kernel size of (1, window size), the window is pooled vertically to capture information between adjacent windows in the same column. Specifically, the module simultaneously collects the pooling results from surrounding windows in both directions and then adds them together at the SUM node. This operation maintains and enhances long-range dependencies between windows in both the horizontal and vertical directions, ultimately outputting a feature that effectively represents global information over a larger area.

[0031] In some embodiments, enhancing the aggregated features through the dual-stream feedforward module to obtain the second feature map includes: processing the aggregated features with a fully connected layer through the feedforward network branch of the dual-stream feedforward module to extract global details; performing convolution processing on the aggregated features through the supplementary branch of the dual-stream feedforward module to obtain a third processing result, and activating the third processing result to obtain local details; multiplying the global details and the local details pixel by pixel and processing through a fully connected layer to obtain a fourth processing result, and adding the fourth processing result element by element to the aggregated features to obtain the second feature map. Specifically, firstly, the aggregated feature GL1 is simultaneously input into two parallel branches of the dual-stream feedforward module. Then, the aggregated feature GL1 is sequentially processed by layer normalization, a first fully connected layer, and a second fully connected layer through the feedforward network branch of the dual-stream feedforward module to extract and output global details containing the macroscopic structure of the image. Then, the aggregated feature GL1 is processed by layer normalization through the supplementary branch of the dual-stream feedforward module to output local details rich in local texture. Subsequently, the global details output by the feedforward network branch and the local details output by the supplementary branch are multiplied pixel-by-pixel to achieve deep fusion of the two types of information, resulting in a multiplication result. This multiplication result is then passed through a fully connected layer for nonlinear transformation and dimensionality adjustment, yielding the fourth processing result. Finally, the fourth processing result is added element-by-element to the initial aggregated feature GL1 via residual connections, effectively mitigating the gradient vanishing problem in deep networks while preserving the original feature information, ultimately outputting the enhanced second feature map.

[0032] In some embodiments, the aggregated feature GL1 is subjected to layer normalization, specifically as follows: First, a 1×1 convolution is used to perform a linear transformation on the normalized feature; then, a 3×3 depth convolution is used to further extract local details; then, the GELU nonlinear activation function is used to activate the convolution result, and finally, local details rich in local texture are output.

[0033] In some embodiments, the calculation process of the dual-stream feedforward module can be expressed by the following formula: ; In the formula, This is the second feature map. Represents pixel-by-pixel multiplication. Represents the GELU nonlinear activation function. and Indicates a fully connected layer. Represents a 1×1 convolution. represents a 3×3 depthwise convolution, LN represents normalization, and GL1 represents global-local context attention.

[0034] Step S104: Based on the segmentation model, adaptive weighted fusion is performed on each of the second feature maps to obtain the third feature map; In some embodiments, multiple second feature maps from different scales or levels are first size-aligned, typically by upsampling or downsampling to give them the same spatial dimensions (height H and width W). Subsequently, instead of simply concatenating or summing these feature maps, the module assigns an adaptive weight coefficient to each second feature map. These weight coefficients are not pre-set fixed values ​​but are dynamically generated by a small neural network (e.g., a simple fully connected layer or convolutional layer) based on the contextual information of each feature map, or learned through a channel- or spatial attention mechanism. The aim is to allow the model to autonomously learn the relative importance of features at different scales in the final segmentation task. Finally, each second feature map and its corresponding adaptive weight coefficient are summed pixel-wise, thus integrating them into a more informative and discriminative third feature map.

[0035] Step S105: Perform pixel-level classification on the third feature map based on the segmentation model to determine the segmentation result of the crop planting area; In some embodiments, before performing pixel-level classification on the third feature map based on the segmentation model, the method further includes: performing a convolution operation on the third feature map to generate intermediate features; performing depthwise separable convolution processing on the intermediate features and generating a spatial attention map through a first activation function; multiplying the spatial attention map and the intermediate features pixel by pixel to obtain several multiplication results, and adding the multiplication results to obtain a first optimized feature; performing depthwise separable convolution, batch normalization, and convolution processing on the first optimized feature sequentially to obtain a third processing result; adding the third processing result and the intermediate features element by element to obtain a second optimized feature; and processing the second optimized feature sequentially through a second activation function, convolution processing, and upsampling operations to obtain the fourth feature map. Specifically, firstly, a standard 3×3 convolution operation is applied to the input third feature map to generate an intermediate feature T. Subsequently, the intermediate feature T is processed by a 3×3 depthwise separable convolution to efficiently extract features. The extracted result is then activated using a sigmoid function as the first activation function, generating a spatial attention map S3'. This spatial attention map highlights the spatial locations in the image that require special attention. Next, the generated spatial attention map S3' is multiplied pixel-by-pixel with the original intermediate feature T, and the result is then added element-by-elementally to T to incorporate the spatial attention weights into the feature, thus obtaining the first optimized feature. Then, the first optimized feature is sequentially processed by depthwise separable convolution, batch normalization (BN), and a 1×1 convolution to obtain a third processing result. This third processing result is then added element-by-elementally to the initially generated intermediate feature T, using the idea of ​​residual connections to preserve the original feature information, thus obtaining the second optimized feature. Finally, the second optimized feature is processed sequentially using the ReLU function as the second activation function, followed by 1×1 convolution and upsampling operations to reduce the number of channels in the feature map to the target dimension C and restore the size to a resolution that matches the original input image, ultimately outputting the refined fourth feature map.

[0036] In some embodiments, the step of performing pixel-level classification on the third feature map based on the segmentation model to determine the segmentation result of the crop planting area includes: performing an upsampling operation on the third feature map to obtain a fifth feature map, and performing feature extraction on the fifth feature map to obtain a feature representation; performing classification prediction based on the feature representation to obtain an original prediction map, wherein the value of each pixel in the original prediction map represents the probability of belonging to each category; processing the original prediction map through an activation function to obtain the final semantic segmentation result; and determining the segmentation result of the rice planting area based on the semantic segmentation result. Specifically, firstly, the third feature map, after feature fusion and refinement, is upsampled to increase its spatial resolution to the same size as the original input image, resulting in a fifth feature map. Then, a series of convolutional layers are used to extract deeper features from the fifth feature map, yielding a semantically rich feature representation for final classification. Next, based on this feature representation, a convolutional layer with the same number of kernels as the number of categories is used for classification prediction, generating an original prediction map. Each pixel value in this original prediction map is a vector representing the original probability score of the pixel belonging to multiple categories such as background and rice. Then, the original prediction map is processed using a Softmax activation function, normalizing the original score of each pixel to a probability value between 0 and 1, with the sum of the probabilities of all categories being 1, thus obtaining the final semantic segmentation result. Finally, by setting a probability threshold (e.g., 0.5), all pixels belonging to the rice planting category (greater than the preset probability threshold) are identified from the semantic segmentation result, and these pixels are aggregated to determine and output the final segmentation result of the rice planting area.

[0037] Step S106: Input the segmentation results into a preset yield prediction model to predict the crop yield in the crop planting area.

[0038] In some embodiments, firstly, using the rice planting area segmentation results as the core input, and combining the biological characteristics of rice and environmental conditions, the initial parameters required for simulation of the yield prediction model (such as the DSSAT model) are set. These parameters include, but are not limited to, initial soil moisture content, soil nutrient levels (such as nitrogen, phosphorus, and potassium content), and possible initial biomass. Simultaneously, local meteorological data (such as daily temperature, sunshine hours, and precipitation) and specific genetic parameters of the planted rice variety are also input. After all this data is prepared, the DSSAT model is run, which dynamically simulates the entire growth process of rice from planting to maturity based on the input physical and genetic parameters. Through this simulation, the model can calculate key yield components, such as grains per panicle and thousand-grain weight, and ultimately integrate and estimate the yield per unit area and total yield.

[0039] This method significantly improves the accuracy and reliability of yield prediction by combining the precise spatial information obtained from deep learning segmentation with the dynamic simulation capability of the growth process by the mechanistic model.

[0040] In this embodiment, preprocessing the initial image data effectively eliminates interference factors such as illumination and noise, improving data quality and laying the foundation for accurate segmentation. By capturing local and global contextual information in parallel, the details of individual crops can be identified, and the overall layout of crops in the field can be understood. This allows for accurate judgment even in complex scenarios such as dense planting, shading, or blurred boundaries, greatly improving the robustness and accuracy of segmentation. Adaptive weighted fusion of each second feature map effectively utilizes features at different scales, ensuring that the final third feature map used for segmentation retains both fine spatial details and high-level semantic information, guaranteeing the generation of clear and accurate segmentation boundaries. Pixel-level classification of the third feature map accurately obtains the segmentation results of crop planting areas. By inputting the segmentation results into a preset yield prediction model, the crop yield in the crop planting area can be accurately predicted. Compared with existing technologies, this application can improve the accuracy of crop yield prediction and recognition.

[0041] Please refer to Figure 3 , Figure 3 This is a schematic diagram of a crop yield prediction device according to an embodiment of this application. The crop yield prediction device 300 specifically includes: The acquisition module 301 is used to preprocess the initial image data of the acquired crop planting area to obtain the target image data; The extraction module 302 is used to input the target image data into a preset segmentation model to perform feature extraction and obtain a multi-scale first feature map; The capture module 303 is used to capture the local context information and global context information of the first feature map based on the segmentation model to obtain the second feature map; The fusion module 304 is used to adaptively weight and fuse each of the second feature maps based on the segmentation model to obtain a third feature map; The classification module 305 is used to perform pixel-level classification on the third feature map based on the segmentation model to determine the segmentation result of the crop planting area; The prediction module 306 is used to input the segmentation results into a preset yield prediction model to predict the crop yield in the crop planting area.

[0042] The crop yield prediction device 300 provided in this application embodiment can perform the above-described... Figure 1The method embodiments shown are similar in principle and technical effect, and will not be described again here.

[0043] This application also provides an electronic device. Since the principle by which this electronic device solves the problem is similar to the image detection model training method in this application, the implementation of this electronic device can be found elsewhere. Figure 1 The implementation of the method shown will not be repeated here. Figure 4 As shown, the electronic device of this application embodiment includes: a processor 410, configured to read a program from a memory 420 and execute the method embodiment shown in this application.

[0044] Among them, Figure 4 In this context, the bus architecture can include any number of interconnected buses and bridges, specifically linking various circuits of one or more processors represented by processor 410 and memory represented by memory 420 together. The bus architecture can also link various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides the interface.

[0045] Optionally, the processor 410 is also configured to read a program from the memory 420 and execute the method embodiment shown.

[0046] The electronic device 400 provided in this application embodiment can perform the above-described... Figure 1 The method embodiments shown are similar in principle and technical effect, and will not be described again here.

[0047] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the above-described... Figure 1 The various processes in the embodiments of the method for predicting crop yields in China achieve the same technical effect, and to avoid repetition, they will not be described again here. The computer-readable storage medium mentioned includes, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0048] This application embodiment also provides a computer program / program product, which is stored in a storage medium and executed by at least one processor to implement the above. Figure 1 The various processes of the crop yield prediction method embodiment described herein can achieve the same technical effect, and will not be repeated here to avoid duplication.

[0049] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0050] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can be physically included separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0051] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute some steps of the transmission and reception methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0052] The above description is the preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principles described in this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for predicting crop yield, characterized in that, include: The initial image data of the acquired crop planting area is preprocessed to obtain the target image data; The target image data is input into a segmentation model for feature extraction to obtain a multi-scale first feature map; The local and global context information of the first feature map is captured based on the segmentation model to obtain the second feature map; Based on the segmentation model, the second feature maps are adaptively weighted and fused to obtain the third feature map; The third feature map is classified at the pixel level based on the segmentation model to determine the segmentation result of the crop planting area. The segmentation results are input into a preset yield prediction model to predict crop yields in crop planting areas.

2. The method according to claim 1, characterized in that, The process of preprocessing the initial image data of the acquired crop planting area to obtain the target image data includes: Acquire initial image data of the crop planting area, and rotate and scale the initial image data proportionally to obtain the first processing result; The first processing result is subjected to a Gaussian filter to obtain a smooth second processing result; The second processing result is then subjected to image enhancement to obtain the target image data.

3. The method according to claim 1, characterized in that, The segmentation model includes a context-aware module and a two-stream feedforward module. The step of capturing local and global context information of the first feature map based on the segmentation model to obtain a second feature map includes: The local context information of the first feature map is extracted in parallel through the local branches of the context-aware module, and the local context information is summed after batch normalization to obtain local context features. The number of channels of the first feature map is expanded by the global branch of the context-aware module to obtain a fourth feature map. The fourth feature map is then mapped to several windows to obtain several vectors. The global context information of each vector is calculated using a multi-head attention mechanism to obtain global context features. The local context features and the global context features are aggregated to obtain aggregated features, and the aggregated features are enhanced by the dual-stream feedforward module to obtain the second feature map.

4. The method according to claim 3, characterized in that, The step of enhancing the aggregated features through the dual-stream feedforward module to obtain the second feature map includes: The aggregated features are processed by a fully connected layer through the feedforward network branch of the dual-stream feedforward module to extract global details; The aggregated features are convolved through the supplementary branch of the dual-stream feedforward module to obtain a third processing result, and the third processing result is activated to obtain local details. The global details and the local details are multiplied pixel by pixel and then processed through a fully connected layer to obtain a fourth processing result. The fourth processing result is then added element by element to the aggregated features to obtain the second feature map.

5. The method according to any one of claims 1 to 4, characterized in that, Before performing pixel-level classification of the third feature map based on the segmentation model, the method further includes: Perform a convolution operation on the third feature map to generate intermediate features; The intermediate features are subjected to depthwise separable convolution processing, and a spatial attention map is generated by the first activation function. The spatial attention map is multiplied pixel by pixel with the intermediate feature to obtain several multiplication results, and the multiplication results are added together to obtain the first optimized feature; The first optimized feature is sequentially subjected to depthwise separable convolution, batch normalization, and convolution to obtain the third processing result. The third processing result is added element-wise to the intermediate feature to obtain the second optimized feature; The second optimized feature is processed sequentially through the second activation function, convolution, and upsampling to obtain the fourth feature map.

6. The method according to any one of claims 1 to 4, characterized in that, The step of performing pixel-level classification on the third feature map based on the segmentation model to determine the segmentation result of the crop planting area includes: The third feature map is upsampled to obtain the fifth feature map, and features are extracted from the fifth feature map to obtain the feature representation; Based on the feature representation, classification prediction is performed to obtain an original prediction map, wherein the value of each pixel in the original prediction map represents the probability of belonging to each category; The original prediction map is processed by an activation function to obtain the final semantic segmentation result; Based on the semantic segmentation results, the segmentation results of the rice planting area are determined.

7. A crop yield prediction device, characterized in that, include: The acquisition module is used to preprocess the initial image data of the acquired crop planting area to obtain the target image data; The extraction module is used to input the target image data into a preset segmentation model to perform feature extraction and obtain a multi-scale first feature map; The capture module is used to capture the local and global context information of the first feature map based on the segmentation model to obtain the second feature map; The fusion module is used to adaptively weight and fuse each of the second feature maps based on the segmentation model to obtain a third feature map; The classification module is used to perform pixel-level classification on the third feature map based on the segmentation model to determine the segmentation result of the crop planting area; The prediction module is used to input the segmentation results into a preset yield prediction model to predict the crop yield in the crop planting area.

8. An electronic device, characterized in that, include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the crop yield prediction method as described in any one of claims 1 to 6.

9. A computer-readable storage medium for storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps in the crop yield prediction method as described in any one of claims 1 to 6.

10. A computer program product, characterized in that, It includes computer instructions that, when executed by a processor, implement the steps in the crop yield prediction method as described in any one of claims 1 to 6.