CN117726051A - Method, device and storage medium for predicting yield of special crops - Google Patents

Method, device and storage medium for predicting yield of special crops Download PDF

Info

Publication number
CN117726051A
CN117726051A CN202410176207.8A CN202410176207A CN117726051A CN 117726051 A CN117726051 A CN 117726051A CN 202410176207 A CN202410176207 A CN 202410176207A CN 117726051 A CN117726051 A CN 117726051A
Authority
CN
China
Prior art keywords
yield
crop
data
yield prediction
model
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202410176207.8A
Other languages
Chinese (zh)
Other versions
CN117726051B (en
Inventor
郑文刚
张钟莉莉
杨林楠
于景鑫
郜鲁涛
单飞飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Intelligent Equipment Technology Research Center of Beijing Academy of Agricultural and Forestry Sciences
Original Assignee
Intelligent Equipment Technology Research Center of Beijing Academy of Agricultural and Forestry Sciences
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Intelligent Equipment Technology Research Center of Beijing Academy of Agricultural and Forestry Sciences filed Critical Intelligent Equipment Technology Research Center of Beijing Academy of Agricultural and Forestry Sciences
Priority to CN202410176207.8A priority Critical patent/CN117726051B/en
Publication of CN117726051A publication Critical patent/CN117726051A/en
Application granted granted Critical
Publication of CN117726051B publication Critical patent/CN117726051B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application discloses a method, a device and a storage medium for predicting the yield of special crops, which are applied to the technical field of neural network learning, wherein the method comprises the following steps: acquiring growth data of crops, wherein the growth data comprises first growth data of a first crop and second growth data of a second crop; the yield of the first crop is greater than the yield of the second crop, and/or the planting range of the first crop is greater than the yield of the second crop; training the created initial yield prediction model based on the first growth data to obtain a yield prediction basic model; adjusting model parameters of the yield prediction basic model based on the second growth data and a set self-adaptive learning mechanism to obtain a yield prediction model; and obtaining a yield prediction result of the second crop to be predicted based on the growth data and the yield prediction model of the second crop to be predicted. The method and the device provided by the application improve the yield prediction accuracy and the prediction stability of the special crops.

Description

Method, device and storage medium for predicting yield of special crops
Technical Field
The application relates to the technical field of neural network learning, in particular to a method and a device for predicting the yield of special crops and a storage medium.
Background
The special crops are crops which grow in specific areas or in specific environments and have certain characteristics or excellent quality, such as tea leaves, grapes, strawberries and the like. The prediction of the yield of the special crops can help users to improve the quality and the income of the special crops, reduce the production cost and the production risk, optimize the allocation and the utilization of agricultural resources and promote the sustainable development of agriculture, so that the yield prediction of the special crops is of great importance. But the yield of the special crops is low, the planting range is small, so that the data size of the growth data of the special crops is small, and the yield prediction of the special crops is difficult.
Therefore, how to predict the yield of the special crops is a technical problem to be solved in the industry.
Disclosure of Invention
The application provides a method, a device and a storage medium for predicting the yield of special crops, which are used for solving the technical problem of how to predict the yield of the special crops in the prior art.
In a first aspect, the present application provides a method for predicting yield of a specialty crop, comprising:
acquiring growth data of crops, wherein the growth data comprises first growth data of a first crop and second growth data of a second crop; the yield of the first crop is greater than the yield of the second crop, and/or the planting range of the first crop is greater than the yield of the second crop;
Training the created initial yield prediction model based on the first growth data to obtain a yield prediction basic model;
adjusting model parameters of the yield prediction basic model based on the second growth data and a set self-adaptive learning mechanism to obtain a yield prediction model;
and obtaining a yield prediction result of the second crop to be predicted based on the growth data of the second crop to be predicted and the yield prediction model.
In some embodiments, the training of the created initial yield prediction model based on the first growth data comprises:
determining feature extraction rules corresponding to various growth data based on the category labels of the growth data;
extracting a feature vector of any growth data based on a feature extraction rule corresponding to the any growth data;
splicing the feature vectors of the first growth data in the extracted various growth data to obtain the total feature vector of the first growth data;
training the initial yield prediction model by taking the total feature vector as sample data.
In some embodiments, the various types of growth data include:
soil nutrient data and crop yield corresponding to the soil nutrient data; weather data and crop yield corresponding to the weather data; the soil type and the crop yield corresponding to the soil type, and the plant growth stage image and the crop yield corresponding to the plant growth stage image.
In some embodiments, the yield prediction base model comprises:
the feature fusion layer is used for carrying out fusion processing on various feature vectors in the total feature vectors to obtain various first feature vectors; the vector dimensions of the various first feature vectors are the same;
the attention layer is used for giving different weights to various first feature vectors based on the association relation between various feature vectors and crop yield and a self-attention mechanism to obtain a second feature vector;
a residual layer for optimizing model parameters of the initial yield prediction model based on differences between the second feature vectors received by the plurality of residual blocks and third feature vectors output by the residual blocks;
and the output layer is used for generating a yield prediction result of the first crop based on the optimized initial yield prediction model.
In some embodiments, the deriving the yield prediction base model comprises:
dividing the first growth data into a plurality of training sample sets based on a set sample set data amount;
respectively inputting training samples in each training sample set into a current initial yield prediction model to obtain a current yield prediction result output by the current initial yield prediction model;
Comparing the current yield prediction result with the real crop yield in the training sample based on a preset loss function to obtain a current loss value;
performing model optimization on the current initial yield prediction model based on the current loss value to obtain a new initial yield prediction model;
updating the current initial yield prediction model based on the new initial yield prediction model until the current loss value accords with a set termination condition or the current training iteration number is greater than or equal to a preset iteration number, so as to obtain the yield prediction basic model.
In some embodiments, the adjusting of the model parameters of the yield prediction base model based on the second growth data and a set adaptive learning mechanism comprises:
performing data enhancement processing on the second growth data to increase the data volume of the second growth data;
adjusting model parameters of the yield prediction basic model based on the processed second growth data;
wherein the data enhancement processing includes at least one of data rotation processing, data scaling processing, data cropping processing, data flipping processing, and data addition noise.
In some embodiments, the adjusting of the model parameters of the yield prediction base model based on the second growth data and a set adaptive learning mechanism comprises:
setting an adaptive learning mechanism based on the meta learner;
model parameters of the yield prediction base model are adjusted based on data characteristics of the second growth data and the adaptive learning mechanism.
In some embodiments, the obtaining the yield prediction result of the second crop to be predicted based on the growth data of the second crop to be predicted and the yield prediction model includes:
creating a yield prediction interface for the second crop;
selecting a selection item corresponding to the growth data of the second crop to be predicted on the yield prediction interface, or inputting the growth data of the second crop to be predicted in an input area of the yield prediction interface;
and graphically displaying the yield prediction result of the second crop to be predicted, which is output by the yield prediction model, on the yield prediction interface.
In a second aspect, the present application provides a specialty crop yield prediction apparatus comprising:
the acquisition module is used for acquiring growth data of crops, wherein the growth data comprises first growth data of first crops and second growth data of second crops; the yield of the first crop is greater than the yield of the second crop, and/or the planting range of the first crop is greater than the yield of the second crop;
The pre-training module is used for training the created initial yield prediction model based on the first growth data to obtain a yield prediction basic model;
the training module is used for adjusting the model parameters of the yield prediction basic model based on the second growth data and a set self-adaptive learning mechanism to obtain a yield prediction model;
and the prediction module is used for obtaining a yield prediction result of the second crop to be predicted based on the growth data of the second crop to be predicted and the yield prediction model.
In a third aspect, the present application provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method described above.
According to the special crop yield prediction method, device and storage medium, the initial yield prediction model is pre-trained through the first growth data of the first crop to obtain the yield prediction basic model, the yield prediction basic model is further trained through the second growth data of the second crop and the set self-adaptive learning mechanism based on the yield prediction basic model to obtain the yield prediction model, so that the finally obtained yield prediction model is suitable for yield prediction of the second crop, the yield of the second crop can be accurately predicted even though the data size of the second growth data is small, and the yield prediction accuracy and prediction stability of the second crop are improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the technical solutions of the present application or the prior art, the following description will briefly introduce the drawings used in the embodiments or the description of the prior art, and it is obvious that, in the following description, the drawings are some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a method for predicting yield of a specialty crop according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a distinctive crop yield prediction apparatus according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the present application solution better understood by those skilled in the art, the following description will be made in detail and with reference to the accompanying drawings in the embodiments of the present application, it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like herein are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or modules is not necessarily limited to those steps or modules that are expressly listed or inherent to such process, method, article, or apparatus.
The method for predicting the yield of the special crops is applicable to a terminal, and the terminal can be various electronic devices with a display screen and supporting web browsing, including but not limited to servers, smart phones, tablet computers, laptop portable computers, desktop computers and the like.
In the technical scheme of the application, the related information is collected, stored, used, processed, transmitted, provided, disclosed and the like, which all meet the requirements of related laws and regulations, necessary security measures are taken, and the public order is not violated.
Fig. 1 is a flow chart of a method for predicting yield of a special crop according to an embodiment of the present application, as shown in fig. 1, the method includes steps 110, 120, 130 and 140. The method flow steps are only one possible implementation of the present application.
Step 110, acquiring growth data of crops, wherein the growth data comprises first growth data of a first crop and second growth data of a second crop; the yield of the first crop is greater than the yield of the second crop and/or the planting range of the first crop is greater than the yield of the second crop.
Specifically, the execution subject of the distinctive crop yield prediction method provided in the embodiments of the present application features a distinctive crop yield prediction apparatus, which may be a hardware device independently set in a terminal, or may be a software program running in the terminal. For example, when the terminal is a desktop computer, the distinctive crop yield prediction apparatus may be embodied as an application such as prediction software in the desktop computer.
Crops in accordance with embodiments of the present application include both conventional crops and specialty crops.
The conventional crop is the first crop in this application. The first crop refers to crops which are commonly planted in agricultural production, are adaptive and have stable yield, such as wheat, corn, rice, soybean, cotton and the like. The first crop is widely planted in various places, and has rich varieties and higher yield.
The special crop is the second crop in the application. The second crop is typically grown to a smaller extent than the first crop and the yield is typically lower than the first crop.
Growth data are relevant data that affect crop yield. The factors influencing the yield of the special crops are more than those of the conventional crops, so that compared with the existing yield prediction method, the method for predicting the yield of the second crops is more comprehensive in type of the obtained production data, and accordingly accuracy of yield prediction of the second crops can be improved.
The growth data can be divided into soil nutrient data and crop yield corresponding to the soil nutrient data, crop yield corresponding to the meteorological data and the meteorological data, crop yield corresponding to the soil type and the soil type, crop yield corresponding to the plant growth stage image and the plant growth stage image according to the data types, and the sources of the growth data of different types can be different.
The growth data of crops can be obtained by measuring soil components, a public database, satellite remote sensing and other approaches.
Soil nutrient data may include the pH (potential of hydrogen, pH) of the soil and the organic content, nitrogen, phosphorus, potassium, etc. nutrient content. The data may be obtained by measuring the soil composition content or may be queried from a public database.
The meteorological data may include temperature, humidity, precipitation, solar hours, wind speed, and the like. The data may be obtained by weather station or satellite remote sensing monitoring.
Soil types may include texture, structure, and color of the soil, among others. The units of the data are respectively as follows: texture (clay, sand, soil, etc.), structure (block, plate, grain, etc.), color (red, yellow, black, white, etc.). The data can be obtained by means of soil classification or satellite remote sensing monitoring.
The image data of the plant growth stage may include the growth height of the crop, the leaf area index of the crop, the chlorophyll content, and the like. The data may be obtained through unmanned aerial vehicle monitoring or satellite remote sensing monitoring.
The growth data of the first crop is the first growth data, and the growth data of the second crop is the second growth data. Because the first crop is widely planted and high in yield, the data size of the first growth data is much larger than the data size of the second growth data.
And step 120, training the created initial yield prediction model based on the first growth data to obtain a yield prediction basic model.
Specifically, the initial yield prediction model is a neural network model that has not yet begun to be pre-trained. And obtaining a yield prediction basic model after the pre-training is finished. The yield prediction base model is a base model which is pre-trained according to the first growth data.
An initial yield prediction model may be created from feature fusion, attention mechanisms, residual connection, and adaptively learned end-to-end architecture.
And inputting the feature vector of the first growth data into the initial yield prediction model to obtain yield data output by the initial yield prediction model. The initial yield prediction model is trained using the first growth data, and model parameters are optimized by a back propagation algorithm and adaptive moment estimation (Adaptive Moment Estimation, adam) to minimize the prediction error, thereby obtaining a yield prediction base model.
Because the data volume of the conventional crops is large and the data quality is good, the initial yield prediction model can be fully trained, and a yield prediction basic model with good performance can be obtained.
And 130, adjusting model parameters of the yield prediction basic model based on the second growth data and the set self-adaptive learning mechanism to obtain a yield prediction model.
Specifically, since the second crop is different from the first crop, the yield prediction base model is also difficult to accurately predict the yield of the second crop, and thus the yield prediction base model needs to be further fine-tuned by the second growth data to achieve migration and driving of the model. The pre-trained yield prediction basic model is applied to a data set of second growth data, and model parameters and model structures of the yield prediction basic model are finely adjusted through the second growth data and a set self-adaptive learning mechanism, so that the yield prediction basic model is suitable for yield prediction of second crops, and a final yield prediction model is obtained.
The adaptive learning mechanism refers to a learning algorithm or method that is capable of automatically adjusting learning processes and parameters. The continuous optimization and the adaptive updating of the yield prediction basic model are realized by continuously observing, analyzing and adapting to the change of the environment, so that the final yield prediction model is obtained. The final yield prediction model can accurately predict the yield of the second crop.
In the process of training from the initial yield prediction model to the yield prediction basic model and in the process of training from the yield prediction basic model to the yield prediction model, the technologies such as data enhancement, regularization and early stopping method can be used for preventing the overfitting of the model, so that the generalization capability of the model is ensured.
The adaptive learning mechanism may be applied in the training of the initial yield prediction model to the yield prediction base model, and in the training of the yield prediction base model to the yield prediction model, to cause the model to automatically adjust the learning strategy based on the growth data. The meta learning method can be used for setting a self-adaptive learning mechanism, so that a model can learn how to learn, dynamically adjust the model structure, parameters, optimizers and the like, an optimal learning effect is achieved for the model, and the model is self-adaptive and evolved in various growth data samples.
The accuracy, stability, generalization capability and the like of the yield prediction basic model or the yield prediction model can be checked by using indexes and methods such as mean square error, correlation coefficient, cross verification and the like so as to ensure the accuracy of the output result of the model.
And 140, obtaining a yield prediction result of the second crop to be predicted based on the growth data and the yield prediction model of the second crop to be predicted.
Specifically, the second crop to be predicted is a specialty crop for which yield prediction is to be performed. And inputting the growth data of the second crop to be predicted into the trained yield prediction model, and obtaining a yield prediction result corresponding to the second crop to be predicted, which is output by the yield prediction model.
The yield prediction result may be yield data corresponding to the second crop to be predicted, for example, may be kilograms of the special crop produced per mu of the second crop to be predicted.
According to the special crop yield prediction method provided by the embodiment of the application, the initial yield prediction model is pre-trained through the first growth data of the first crop to obtain the yield prediction basic model, the yield prediction basic model is further trained through the second growth data of the second crop and the set self-adaptive learning mechanism to obtain the yield prediction model, the finally obtained yield prediction model is suitable for yield prediction of the second crop, the yield of the second crop can be accurately predicted even though the data size of the second growth data is small, and the yield prediction accuracy and the prediction stability of the second crop are improved.
It should be noted that each embodiment of the present application may be freely combined, permuted, or executed separately, and does not need to rely on or rely on a fixed execution sequence.
In some embodiments, step 120 comprises;
determining feature extraction rules corresponding to various growth data based on the category labels of the growth data;
extracting a feature vector of any growth data based on a feature extraction rule corresponding to any growth data;
splicing the feature vectors of the first growth data in the extracted various growth data to obtain the total feature vector of the first growth data;
the total feature vector is used as sample data to train the initial yield prediction model.
Specifically, the growth data has a plurality of categories, a category label can be set for each category of growth data, and the category label can be the data name of each category of growth data.
The data attributes of the growth data of different categories and the association relation between the growth data and the yield are different, so that the growth data of different categories of labels can be provided with corresponding feature extraction rules. Feature extraction rules are rules or algorithms for extracting useful and representative features from raw growth data.
Through feature extraction and feature data integration, a comprehensive feature representation which can reflect the relationship between crop yield and various growth data can be formed, so that the model can be trained by inputting an initial yield prediction model or an input yield prediction basic model later.
Category labels may include soil nutrient data, meteorological data, soil type, plant growth stage images, and the like.
For the soil nutrient data and the corresponding crop yield (simply referred to as soil nutrient-yield data), a method of principal component analysis (Principal Component Analysis, PCA) can be used to reduce the dimension of the high-dimension soil nutrient data into a low-dimension feature vector, while retaining the main information of the soil nutrient data.
PCA is an unsupervised linear dimension reduction method, and the principle is that original data is projected to the direction with the maximum variance through orthogonal transformation, so that a new feature vector is obtained. The growth data are sample data.
Original soil nutrient data are setWherein->For the number of samples, +.>Is the characteristic number of soil nutrient data, +.>Is a matrix. The goal of PCA is to find a projection matrix +.>So that a new feature vectorThe following conditions are satisfied: / >Variance of->Maximum, i.eWherein->Trace representing matrix, +.>Covariance matrix of (2)Is a diagonal array ++>Wherein->For projection matrix +.>For the characteristic number of the soil nutrient data after dimension reduction, < ->Indicate->Variance of individual features>Representing a diagonal matrix. Features may also be understood as feature vectors.
By Lagrange multiplier method, can be solvedIs->Covariance matrix>Front of (2)And the feature vector corresponding to the maximum feature value. By calculating->And extracting the anterior->Feature vectors corresponding to the maximum feature values are used as projection matrix +.>Thereby obtaining a new feature vector +>. Can be based on the practiceCase-by-case selection->Is of a size such that the new feature vector retains more than 90% of the original data, i.e. Will->Characterization as soil nutrient-yield data, noted as
For meteorological data, a convolutional neural network (Convolutional Neural Network, CNN) may be used to convert multidimensional meteorological data into one-dimensional feature vectors while extracting spatial and temporal features of the data. CNN is a deep neural network, and its principle is to map high-dimensional features of original data to low-dimensional feature space by operations such as multi-layer convolution, pooling and activation, so as to realize feature extraction and dimension reduction. Setting original meteorological data Wherein->For the number of samples, +.>For the number of channels, h is the height, +.>For width, the goal of CNN is to find a mapping function +.>So that a new feature vector +.>Wherein->The feature number after the meteorological data is subjected to dimension reduction meets the following conditions: />Can keep->Spatial and temporal characteristics of (a), i.e.)>Can reflect->Variations in different channels, different heights and different widths. />Can remove->Redundancy and noise information of (i.e.)>Can inhibit->Is characterized by irrelevant and interference informationImportant and useful information in the database.
Creating CNN composed of three convolution layers, two pooling layers, one full connection layer and one output layer as mapping functionThereby obtaining a new feature vector +>. Parameters such as the convolution kernel size, the number of convolution kernels, the step length and filling of the convolution layers, and parameters such as the pooling type, the pooling window size and the step length of the pooling layers can be selected according to actual conditions, so that the CNN can effectively extract the characteristics of meteorological data. Will->Characteristic of meteorological data, denoted +.>
For soil type data, a single-heat encoding method may be used to convert discrete soil type data into continuous feature vectors while retaining the class information of the data. One-hot coding is a common coding method, and the principle is that each category is represented by a binary vector, wherein only one element is 1, and the other elements are 0, so that the category distinction is realized. Setting original soil type data Wherein->For the number of samples, +.>The value of (2) is +.>Wherein->For category number, the goal of the one-hot coding is to find a coding matrix +.>So that a new eigenvector of the soil type is +.>Wherein->The characteristic number after the dimension reduction of the soil type meets the following conditions: />Can keep->Category information of (i.e.)>Can reflect->To which category. />Different categories can be distinguished, i.e. +.>Is a different binary vector and has only one element of 1 and the remaining elements of 0.
Can use the combination ofGo->A matrix of columns is used as coding matrix->Wherein->If and only if->The +.o of the feature vector corresponding to each category>The number of elements is 1, otherwise->. Can be selected according to the actual situation>The size of the model is such that the new feature vector can effectively represent soil type data.
Image data for plant growth stageThe multi-time sequence image data can be converted into one-dimensional feature vectors by using a Long Short-Term Memory (LSTM) method, and the time sequence and the spatial features of the data are extracted. LSTM is a variant of a recurrent neural network (Recurrent Neural Network, RNN) whose principle is to map the timing information of the original data to a hidden state by a recurrent unit with forgetting gate, input gate, output gate and memory unit, thus realizing feature extraction and dimension reduction. Setting image data of original plant growth stage Wherein->For the number of samples, +.>Is the time sequence number->For the number of channels, h is the height, +.>For width, the goal of LSTM is to find a mapping function +.>So that the characteristic vector of the new plant growth stage imageWherein->The feature number after the dimension reduction of the image in the plant growth stage meets the following conditions:can keep->Timing and spatial characteristics of (a), i.e.)>Can reflect->In the variation of different time sequences, different channels, different heights and different widths. />Can remove->Redundancy and noise information of (i.e.)>Can inhibit->Is of no relation to interference information in (1)>Important and useful information in the database.
LSTM consisting of two LSTM layers, a fully connected layer and an output layer can be used as mapping functionThereby obtaining a new feature vector +>. The hidden state size, the parameters of the forgetting gate, the input gate and the output gate of the LSTM layer and the parameters of the full connection layer are selected according to the actual situation, so that the LSTM can effectively extract the characteristics of the image data. The application willCharacteristic representation of the image data, denoted +.>
Characterizing the four data, i.eSplicing to form a comprehensive characteristic representation +.>,/>. Will->As the total feature vector, the initial yield prediction model is trained using the total feature vector as sample data.
According to the characteristic crop yield prediction method, the comprehensive growth data are obtained, and the characteristics of different types of growth data are extracted by using different characteristic extraction rules, so that yield prediction efficiency and accuracy are improved.
In some embodiments, the yield prediction base model comprises:
the feature fusion layer is used for carrying out fusion processing on various feature vectors in the total feature vectors to obtain various first feature vectors; the vector dimensions of the various first feature vectors are the same;
the attention layer is used for giving different weights to various first feature vectors based on the association relation between various feature vectors and crop yield and a self-attention mechanism to obtain a second feature vector;
the residual layer optimizes model parameters of the initial yield prediction model based on differences between second characteristic vectors received by the residual blocks and third characteristic vectors output by the residual blocks;
and the output layer is used for generating a yield prediction result of the first crop based on the optimized initial yield prediction model.
Step 130 includes:
dividing the first growth data into a plurality of training sample sets based on the set sample set data amount;
Respectively inputting each training sample set into a current initial yield prediction model to obtain a current yield prediction result output by the current initial yield prediction model;
comparing the current yield prediction result with the actual crop yield in the training sample based on a preset loss function to obtain a current loss value;
model optimization is carried out on the current initial yield prediction model based on the current loss value, and a new initial yield prediction model is obtained;
updating the current initial yield prediction model based on the new initial yield prediction model until the current loss value accords with a set termination condition or the current training iteration number is greater than or equal to a preset iteration number, so as to obtain a yield prediction basic model.
Specifically, an end-to-end initial yield prediction model of feature fusion, attention mechanism, residual connection and self-adaptive learning is used as a basic framework, the feature vector of the extracted first growth data is input into the initial yield prediction model to obtain a first crop yield prediction result output by the initial yield prediction model, the initial yield prediction model is trained to obtain a yield prediction basic model, the yield prediction of conventional crops is realized, and a powerful and flexible reference model is provided for the yield prediction of subsequent special crops.
The architecture of the yield prediction basic model is designed in detail, and the method is as follows:
the input of the yield prediction basic model is the total eigenvectorOutput is crop yield data->Wherein->Indicate->Crop yield value of individual samples,/-)>
The yield prediction base model consists of four main components:
(1) And the feature fusion layer is used for fusing the feature vectors from different sources to form a unified feature representation, namely, various feature vectors in the total feature vector are fused to obtain various first feature vectors, and the vector dimensions of the various first feature vectors are the same.
A full connection layer can be used as a feature fusion layer, the parameters of whichAnd parameters-> Wherein->For the output dimension of the feature fusion layer, choose +.>The size of the feature fusion layer enables the feature fusion layer to effectively fuse features of different sources. Output of feature fusion layer->Wherein->For the activation function, a hyperbolic tangent function is used as the activation function.
(2) And the attention layer is used for weighting the characteristic representation, highlighting important characteristics and suppressing irrelevant characteristics.
A self-attention mechanism may be used as an attention layer by calculating the self-correlation of the feature representation to obtain an attention weight matrix, and then weighting the feature representation with the matrix to achieve an assessment and adjustment of the importance of the feature. A full connection layer can be used as a parameter of the self-attention mechanism, its parameter And parameters->. Output of self-attention mechanism->WhereinFor normalization function->Wherein->Is an n-dimensional real vector, +.>Is the%>Elements for normalizing each row of the attention weight matrix to a probability distribution. />Is the%>Element(s)>Namely the second feature vector.
(3) And the residual layer is used for increasing the depth of the network and improving the expression capability of the network.
The residual layer has the function of increasing the depth of the network, improving the expression capability of the network and simultaneously preventing the problem of gradient disappearance. A plurality of residual blocks can be used as residual layers, each residual block consisting of two fully connected layers and an activation function, wherein parameters of the first fully connected layerAnd parameters->Parameter of the second fully connected layer +.>And parameters->The activation function is a hyperbolic tangent function. Output of residual block. The output of the residual block is the third feature vector. The number of residual blocks is selected according to actual conditions, so that the residual layer can effectively increase the depth and the expression capacity of the network.
(4) And an output layer for converting the output of the network into a predicted value of crop yield.
The output layer functions to convert the output of the network into a predicted value of crop yield. The application uses a full connection layer as an output layer, and parameters thereof And parameters->Wherein->Is the output dimension of the residual layer. Output of output layer->Wherein->For the output of the residual layer,/>Is the predicted value of crop yield. It is to be noted that +.>Each representing a matrix, but the specifics of the different matrices may differ.
The application designs the training of the yield prediction basic model in detail, and specifically comprises the following steps:
the training data of the yield prediction basic model is a data set of a large number of conventional crops, wherein the training data comprises characteristic vectors of various growth data and crop yield data, and is recorded asWherein->Is->Eigenvectors of growth data of individual samples, +.>Is->Crop yield data for each sample, +.>Is the number of samples.
Loss function of yield prediction base modelIs mean square error>Wherein->Predicting all parameters of the base model for yield, +.>Is->Predicted values of crop yield for each sample.
The optimization algorithm of the yield prediction basic model is Adam, which is based on the principle of learning by dynamically adjusting each parameterThe advantages of the gradient descent method and the momentum method are combined, so that the rapid and stable parameter updating is realized. Adam parameters areWherein->For initial learning rate, < > >And->Attenuation coefficients of first and second moments, respectively, < ->Is a constant of numerical stability. And selecting parameters of Adam according to actual conditions, so that the yield prediction basic model can be effectively converged to an optimal solution. Updating the parameters of the yield prediction base model using the following formula +.>
;/>
Wherein,for the number of iterations->Gradient as loss function, i.e.)>,/>And->Estimate of first and second moments, respectively, < ->And->Estimate of the first and second moments after bias correction, respectively,/->Is the updated parameter.
The training process from the initial yield prediction model to the yield prediction base model is as follows: dividing training data into a plurality of small batches, namely dividing first growth data into a plurality of training sample sets, wherein the data size of each small batch isAccording to the actual situation select->The size of the model enables the yield prediction basic model to fully utilize training data, and meanwhile, the problem of memory overflow is avoided.
For each training sample set, calculating a predicted value of crop yield by using a yield prediction basic model, comparing the predicted value with a true value, calculating a value of a loss function, and updating parameters of the yield prediction basic model by using an Adam algorithm. This process is repeated until a set termination condition is reached, i.e. the loss function of the yield prediction basis model reaches a small and stable value, or the maximum number of iterations is reached, which is selected according to the actual situation, so that the yield prediction basis model can be sufficiently trained while avoiding the problem of overfitting. Finally, the test data are predicted by using the yield prediction basic model, the prediction performance of the yield prediction basic model is estimated, and a mean square error (Mean Squared Error, MSE) and a correlation coefficient (Correlation Coefficient, corr) are used as evaluation indexes, wherein the formula is as follows:
Wherein,and->Mean value of true value and predicted value, respectively, < >>Is the number of samples. The method and the device aim to enable the mean square error of the yield prediction basic model to be as small as possible and enable the correlation coefficient to be as large as possible, so that the prediction accuracy and stability of the yield prediction basic model are guaranteed.
According to the special crop yield prediction method, the feature vector based on various growth data and the end-to-end pre-training model based on deep learning are constructed to serve as the reference model, so that the accuracy of the special crop yield prediction is improved.
In some embodiments, step 130 comprises:
performing data enhancement processing on the second growth data to increase the data volume of the second growth data;
adjusting model parameters of the yield prediction basic model based on the processed second growth data;
the data enhancement processing includes at least one of data rotation processing, data scaling processing, data clipping processing, data flipping processing, and data addition noise.
Specifically, the yield prediction base model is fine-tuned using second growth data of a second crop.
And taking the yield prediction basic model as an initial state of the yield prediction model, inputting the initial state as a characteristic vector of second growth data, and outputting the initial state as crop yield data. Parameters of a yield prediction base model are finely adjusted to increase generalization capability of the model. The finally obtained yield prediction basic model can adapt to the data characteristics of the special crops, and the accuracy and adaptability of the yield prediction of the special crops are improved.
The training data of the training process from the yield prediction base model to the yield prediction model is a data set of the specialty crop. I.e. a second data set of growth data, comprising characteristic vectors of various types of growth data and crop yield data, noted asWherein->Is->The eigenvectors of the growth data of the individual samples,is->Crop yield data for each sample, +.>Is the number of samples.
Because the data amount of the second crop is smaller, the model is prevented from being overfitted by using data enhancement, regularization, early stop method and the like, and the method is concretely as follows:
the function of data enhancement is to generate more data by performing some transformations on the original data, including rotation, scaling, clipping, flipping, noise, etc., thereby expanding the scale and diversity of the training data.
Subjecting the second growth data to data enhancement processing, such as subjecting plant growth stage image data in the second growth data to data enhancement, specifically including randomly selecting an angle for each image dataRotating the image data, namely, each pixel point in the image data is according to a rotation matrixAnd converting to obtain the rotated image data. For each image data, a scaling factor is randomly selected +. >Scaling the image data by multiplying the coordinates of each pixel point in the image data by +.>And obtaining scaled image data. For each image data, randomly selecting a cropping ratioClipping the image data, namely, a proportion of the image data is +.>Is cut out to be used as the cut image data. For each image data, a probability +.>The image data is turned over, i.e. with probability +.>And overturning the image data along the horizontal or vertical direction to obtain the overturned image data. For each image data, randomly selecting a noiseIntensity->Noise is carried out on the image data, namely, the normal distribution compliant ++is added into the image data>And obtaining the noisy image data.
Regularization works by imposing some constraints on the parameters of the model, includingNorms, & gt>Norms, etc., so that the parameters of the model are not too large or too small, thereby preventing the model from being too complex or too simple. All parameters of the yield prediction model are +.>The norm regularization method comprises the following steps: for each parameter->The present application adds a regularization term to the loss function >Wherein->For regularization coefficient, choose +.>The regularization can effectively prevent over-fitting without affecting the fitting ability of the model. Regularized loss function->Wherein->Is the number of parameters,/>Is->Parameters->Is->Predictive value of crop yield of individual samples, i.e. +.>
The early-stop method has the effect of stopping training by monitoring the change of the loss function of the model on the training set and the verification set and stopping training when the loss function of the model on the verification set is no longer reduced, so that the model is prevented from being excessively fitted on the training set. First, training data is divided into training and validation sets, e.g., at a ratio of 8:2, i.e., 80% of the data is used for training and 20% of the data is used for validation. Then, for each small lot, a yield prediction base model is used to calculate a predicted value of crop yield, and the value of the loss function is calculated compared with the true value, and the Adam algorithm is used to update the parameters of the fine tuning model. At the same time, the values of the loss functions of the yield prediction base model on the training set and the validation set, as well as the parameters of the model, are recorded. This process is repeated until the loss function of the model on the validation set reaches a minimum or a maximum number of iterations. And finally, using the parameters of the model with the minimum loss function on the verification set as final parameters of the yield prediction basic model to obtain a yield prediction model.
The performance of the model can be evaluated and verified using the mean square error and the correlation coefficient as evaluation indexes, and the prediction accuracy, stability, generalization capability and the like of the model can be verified using different indexes and methods including mean square error, correlation coefficient, cross verification and the like. The purpose of the application is to prove the validity and superiority of the model, and the credibility and reliability of the model through the evaluation and verification. The model in the embodiment of the application comprises a yield prediction model or a yield prediction basic model.
The present application describes in detail the evaluation and verification of the performance of a model, in particular as follows:
MSE is an indicator for measuring the prediction error of a model, defined as the mean of the squares of the differences between the predicted and actual values. The smaller the mean square error, the smaller the prediction error of the representation model and the higher the prediction accuracy. The data set is divided into a training set and a testing set, the proportion can be 8:2, namely 80% of data is used for training, 20% of data is used for testing, and the proportion can be defined according to practical conditions. The training set is used to train the model to obtain parameters of the model. And predicting the test set by using the model, and calculating the mean square error between the predicted value and the true value to serve as an evaluation index of the prediction accuracy of the model.
Corr is an index for measuring the prediction stability of a model, which is defined as the degree of linear correlation between a predicted value and a true value. The value range of the correlation coefficient is [ -1,1], and the larger the absolute value is, the closer the predicted value of the model is to the true value, and the higher the prediction stability is. The data set is divided into a training set and a testing set, the proportion is 8:2, namely 80% of data is used for training, 20% of data is used for testing, and the proportion can be defined according to practical conditions. The training set is used to train the model to obtain parameters of the model. And predicting the test set by using the model, and calculating a correlation coefficient between the predicted value and the true value to serve as an evaluation index of the prediction stability of the model.
Cross-validation is a method for measuring the generalization ability of a model, and is based on the principle of dividing a data set intoA subset of>The subset is used as a training set, the rest subset is used as a test set, the training set is used for training a model to obtain parameters of the model, the model is used for predicting the test set, and an evaluation index between a predicted value and a true value, including mean square error, is calculatedThe difference and the correlation coefficient. Repeat->For times, get->The average value of the evaluation indexes of the individual models is used as the evaluation index of the generalization ability of the models. The cross verification can effectively avoid the influence of randomness of data division on model evaluation, and improve the reliability and stability of the model evaluation. Can be selected according to actual conditions >Such that the amount of data per subset is large enough without affecting computational efficiency.
According to the special crop yield prediction method provided by the embodiment of the application, the data quantity of the second growth data can be increased in a data enhancement mode, and the yield prediction efficiency is improved.
In some embodiments, step 130 comprises:
setting an adaptive learning mechanism based on the meta learner;
model parameters of the yield prediction base model are adjusted based on data characteristics of the second growth data and an adaptive learning mechanism.
Specifically, meta learning is a technique of learning how to learn, which can enable a model to automatically adjust learning strategies according to different data and tasks, thereby realizing rapid adaptation and generalization. The meta learning can use the flexible learning capability to solve the problems of small data volume, large data distribution change, various data scenes and the like of special crops, thereby improving the generalization capability and the migration capability of the model.
The method establishes an adaptive learning mechanism, so that a yield prediction model or a yield prediction basic model can automatically adjust a learning strategy according to the quantity and quality of different data sets. The method for learning the meta-element is used, so that the model can learn how to learn, and the structure, parameters, optimizers and the like of the model are dynamically adjusted according to the characteristics of data so as to achieve the optimal learning effect. Through the self-adaptive learning mechanism, the model can adapt and evolve in different data environments, and the generalization capability and the robustness of the model are improved.
The input of the adaptive learning mechanism is a plurality of different data sets, including a first growth data and a second growth data, recorded asWherein->,/>Is->A data set comprising feature vectors of various types of growth data and crop yield data, < ->Is->The->Eigenvectors of growth data of individual samples, +.>Is->The->Crop yield data for each sample, +.>Is->Number of samples of the data set, +.>Is the number of data sets.
The output of the adaptive learning mechanism is an adaptive yield prediction model or a yield prediction base model, which is recorded asIts parameter is->Input as feature vectors of various kinds of growth data, output as crop yield data, i.eWherein->Is the characteristic vector of any one growth data.
The core of the self-adaptive learning mechanism is a meta-learner, which is recorded asIts parameter is->The input is a data set and the output is a parameter of a model, namely +.>Wherein->For any one data set,/->Is the number of parameters of the model. The meta learner is used for learning parameters of a proper model according to the characteristics of the data set, so that the model can perform well on the data set and has certain generalization capability.
The adaptive learning mechanism comprises the following steps: first, for each datasetUse meta learner->Calculating parameters of a model ∈>Then use this parameter as model +.>Is +.>Training to obtain a health food>Proprietary predictive model->Wherein->Is the characteristic vector of any one growth data. Then, for each dataset +.>Use of proprietary predictive model->Predicting test data, evaluating proprietary prediction model +.>Using the mean square error and the correlation coefficient as evaluation indexes. Finally, using reinforcement learning method, update meta learner->Parameter of->So that the meta learner can learn the parameters of a better model, thereby improving the proprietary pre-learningTest model->Is a predicted performance of (a). The following formula is specifically used to update the meta learner +.>Parameter of->
Wherein,is->Proprietary predictive model on individual data sets +.>Scoring of the predicted performance of (i.e.),/>Gradient for element learner->Is the updated parameters of the meta learner.
The training process of the self-adaptive learning mechanism is as follows: each data setThe training set and the test set are divided, wherein the ratio is 8:2, namely 80% of data are used for training, and 20% of data are used for testing. Then, for each dataset +. >Use meta learner->Calculating parameters of a model ∈>Then use this parameter as model +.>Is +.>Training the training set of (2) to obtain a training set of (I)>Proprietary predictive model->At the same time, use proprietary predictive model +.>Data set->Predicting the test set of (2) and evaluating the proprietary prediction model +.>Calculating a score of predictive performance +.>. This process is repeated until all data sets have been processed once, and then the meta learner is updated using reinforcement learning method>Parameter of->Enabling the meta learner to learn a betterParameters of the model. This process is repeated until the parameters of the meta-learner reach a small and stable value, or a maximum number of iterations is reached, and the maximum number of iterations is selected according to the actual situation, so that the meta-learner can be fully trained while avoiding the problem of overfitting. Finally, use meta learner->Final parameters->Calculating the parameters of a model +.>Wherein->For the set of all data sets, then use this parameter as model +.>To obtain an adaptive yield prediction modelWherein->Is the characteristic vector of any one growth data.
According to the characteristic crop yield prediction method provided by the embodiment of the application, through a self-adaptive dynamic modeling mechanism, the model can adapt and evolve in different data environments by utilizing the flexibility and autonomy of meta-learning, the generalization capability and migration capability of the model are improved, and the problems of unreasonable model establishment, inflexible model learning and the like in the traditional method are solved.
In some embodiments, step 140 comprises:
creating a yield prediction interface of the second crop;
selecting a selection item corresponding to the growth data of the second crop to be predicted on the yield prediction interface, or inputting the growth data of the second crop to be predicted in an input area of the yield prediction interface;
and displaying the yield prediction result of the second crop to be predicted, which is output by the yield prediction model, on a yield prediction interface in a graphical mode.
Specifically, an interactive visual yield prediction interface of the second crop is created, growth data such as soil type and meteorological conditions are input on the yield prediction interface by a user, and then the effect of the growth data on yield is intuitively displayed by the yield prediction interface.
Implementations of the yield prediction interface use web page development techniques, including hypertext markup language (Hypertext Markup Language, HTML), cascading style sheets (Cascading Style Sheets, CSS), computer programming language (e.g., javaScript, JS), etc., as well as some visual libraries, including Data-Driven Documents (d 3. JS) and enterprise-level Data visualization implementation libraries (Enterprise Charts, echorts), etc. The present application can use the following techniques to construct a yield prediction interface, implement interface functions and effects.
HTML is a markup language for describing the structure and content of web pages, and is used herein to define basic elements of a yield prediction interface, including titles, text, input boxes, buttons, charts, and the like.
CSS is a style sheet language for describing web page styles and layouts, and is used in the present application to set style properties such as color, font, margin, and alignment of a yield prediction interface, and responsive design of the yield prediction interface, so that the yield prediction interface can accommodate different screen sizes and device types.
JS is a scripting language for implementing dynamic interaction and logic functions of web pages, and is used for implementing the main functions of a yield prediction interface, including obtaining user input, calling the interface of a model, processing the return result of the model, generating and updating charts, and the like.
D3.js is a JavaScript library for creating data-based dynamic graphics, which can be used to create charts of yield predictions, including line graphs, bar graphs, scatter graphs, etc., and interactive effects of charts of tools, including zoom, drag, and hint, etc.
Echarties is a JavaScript library for creating data-based interactive charts and visualizations that can be used to create charts presented by yield prediction interfaces, including radar charts, dashboards, maps, etc., and interactive effects of charts of yield prediction interfaces, including filtering, switching, and animations, etc.
The yield prediction interface may include the following:
the title of the yield prediction interface may be displayed as "crop yield prediction visualization tool".
The user input area includes a plurality of input boxes and buttons for allowing the user to input specific conditions including soil type, weather conditions, etc., and to submit and reset the input operations, and the input boxes may include selections corresponding to the growth data.
For example, the input box may include a soil type input box for a user to select a category of soil, including sandy loam, clay, sand, etc., a drop down list may be used as the input box to provide a plurality of options for the user to select, each option corresponding to a soil type code, e.g., 1 for sandy loam, 2 for clay, and 3 for sand, etc.; the input box of meteorological data is used for enabling a user to input meteorological values, including temperature, humidity, rainfall, wind speed and the like, a plurality of text boxes can be used as input boxes, the user is required to input a numerical value in degrees celsius, percentages, millimeters or meters per second and the like, and each input box is provided with a corresponding label for describing the input meaning, including 'temperature (DEG C)' humidity (%) 'rainfall (mm)' or 'wind speed (m/s)', and the like.
The buttons may include a submit button, and the condition for letting the user submit the input may be displayed as "submit" using a button as the submit button, and when the user clicks the submit button, the yield prediction tool in the yield prediction interface may call the interface of the yield prediction model with the user's input as the growth data of the second crop to be predicted, obtain the return result of the yield prediction model, and then generate and update the chart according to the yield prediction result of the second crop to be predicted, and display the yield prediction result.
The buttons may further include a reset button for allowing the user to reset the inputted condition, and one button may be used as the reset button, which is displayed as "reset", and when the user clicks the reset button, the yield prediction tool restores all input boxes to the initial state, clears the user's input, clears the chart, and restores the chart to the initial state.
And the result output area comprises a plurality of charts for displaying the yield prediction result of the second crop to be predicted and the influence of various growth data on the crop yield.
For example, a line graph may be used to show yield predictions. The horizontal axis of the line graph is time, the unit is month, the vertical axis is predicted yield, the unit is ton per hectare, the broken line is a change curve of predicted yield along with time, the color is blue, the line width is 2 pixels, the dot pattern is circular, the dot size is 5 pixels, the dot color is white, the dot frame is blue, the dot frame width is 1 pixel, when a user moves a mouse to a certain point, a prompt box is displayed on a yield prediction interface, and the time and the predicted yield value of the point are displayed.
Yield predictions may be shown using a histogram. The horizontal axis of the histogram is time in months, the vertical axis is yield, the vertical axis is ton per hectare, the histogram is yield, the column is green, and the width is 10 pixels, when the user moves the mouse to a column, a prompt box is displayed on the yield prediction interface, and the time and yield values of the column are displayed. The real yield value can be represented by a dotted line, the color is red, the line width is 2 pixels, the line is 5 pixels, the solid line is 5 pixels, and the blank is 5 pixels are alternated, when the user moves the mouse onto the dotted line, the yield prediction interface displays a prompt box, and the time of the dotted line and the real yield value are displayed.
Yield predictions may be presented using a scatter plot that is used to show the correlation of predicted yield with various types of growth data. The horizontal axis of the scatter diagram is the predicted yield, the unit is ton per hectare, the vertical axis is the numerical value of various growth data, the unit is determined according to the type of the growth data, the scattered point is a data point of the predicted yield and the various growth data, the color is purple, the size is 5 pixels, the shape is circular, and when a user moves a mouse to a certain scattered point, a prompting frame is displayed on the yield prediction interface to display the predicted yield of the scattered point and the numerical value of the growth data. Correlation coefficients may be used to represent the correlation of the predicted yield with various types of growth data, a text box may be displayed in the upper right corner of the scatter plot, the value of the correlation coefficient may be displayed, and the meaning of the correlation coefficient.
The yield prediction results can be shown by using a radar chart, wherein each axis of the radar chart is a numerical value of growth data, the unit is determined according to the type of the growth data, the range of each axis is determined according to the maximum value and the minimum value of the growth data, and a polygon is a closed curve formed by the predicted yield and data points of various types of growth data.
The combined effect of the predicted yield and various growth data can also be expressed by the area of the polygon, which is defined as the area of the planar pattern formed after vertices of the polygon are connected in a clockwise or counterclockwise direction.
The yield prediction result can be displayed through the instrument panel, the appearance of the instrument panel is circular, the color is gray, the scale is the scale of the instrument panel, the range is [0, 100], the unit is divided, each scale is 10 minutes, the pointer is the pointer of the instrument panel, the color is red, the length is 80% of the circular radius, and the angle is the value of the comprehensive evaluation of the predicted yield.
A comprehensive evaluation index, which is defined as the inverse of the ratio of the absolute value of the difference between the predicted yield and the true yield to the true yield multiplied by 100, i.e., the comprehensive evaluation, can also be used to represent a comprehensive evaluation of the predicted yieldWherein->For true yield, +. >To predict yield, it is mapped to [0, 100 according to the value of the comprehensive evaluation index]As the angle of the pointer of the instrument panel, the pointer is classified into five classes, namely "excellent", "good", "general", "poor" and "very poor", according to the angle of the pointer, and the corresponding angle ranges are respectively [80, 100 ]]、[60,80)、[40,60)、[20,40)、[0,20)。
The expression form and specific parameters (color, font, etc.) of the above-described image are merely examples, and may be adjusted according to actual situations.
According to the special crop yield prediction method, through creating the interactive visual yield prediction interface, a user can input growth data and intuitively check specific influences of the data on predicted yield, user experience and participation are improved, the user can understand and obtain a prediction result of a yield prediction model conveniently, usability and practicability of special crop yield prediction are improved, and therefore more effective service is provided for agricultural development.
In some embodiments, the method for distinctive crop yield prediction comprises the steps of:
(1) And (3) data acquisition: the multi-mode growth data is acquired from a plurality of data sources, and mainly comprises the following categories: the soil nutrient data and the crop yield corresponding to the soil nutrient data; crop yield corresponding to the meteorological data and the meteorological data; soil type and crop yield corresponding to soil type, plant growth stage image and crop yield corresponding to plant growth stage image.
(2) And (3) data processing: the acquired growth data is processed for ease of use in model construction and analysis. The following method may be employed.
And (5) data cleaning. The quality inspection is required to be performed on the data to remove or repair missing values, abnormal values, repeated values, inconsistent values and the like so as to improve the integrity and accuracy of the data.
Data normalization. It is necessary to scale the data to have the same dimensions and ranges to improve the comparability and stability of the data.
And (5) reducing the dimension of the data. The data needs to be subjected to feature selection or feature extraction, and redundant or irrelevant features are removed or combined so as to improve the simplicity and the effectiveness of the data.
(3) Model construction:
yield prediction base model: using a computer programming language (e.g., python language) and a PyTorch library, a feature vector, deep-learned end-to-end yield prediction base model based on various types of growth data is constructed, the model comprising the following three components: and (5) feature fusion. And splicing the feature vectors from different sources together by using a full connection layer to form a comprehensive feature vector which is used as the input of the model. Attention mechanisms. And calculating the correlation between different features by using a self-attention layer, and giving different weights to the different features so as to highlight important features and restrain unimportant features. Residual connection. And adding the output of the characteristic fusion layer and the output of the attention mechanism layer by using a residual error connecting layer to form a residual error, thereby enhancing the expression capability of the model and preventing gradient from disappearing or exploding. PyTorch is an open-source Python machine learning library.
Yield prediction model: and (3) fine tuning a yield prediction basic model by using a Python language and a PyTorch library to realize migration and driving of a special prediction model of the special crops, wherein the yield prediction model comprises the following two components: data enhancement. The growth data of the special crops are expanded by using some data enhancement methods including random cutting, rotation, overturning, noise and the like, so that the diversity and the robustness of the data are increased. Regularization. The model is constrained using regularization methods, including weight decay, batch normalization, and discarding, to prevent over-fitting and under-fitting of the model.
Adaptive learning mechanisms. Using Python language and PyTorch library, an adaptive learning mechanism is developed to enable the model to automatically adjust the learning strategy according to the amount and quality of different data sets, the mechanism comprising the following two components: and (5) meta learning. And a meta learner is used for dynamically adjusting the structure, parameters, optimizers and the like of the model according to the characteristics of the data so as to achieve the optimal learning effect. The model is enabled to be quickly adapted to new tasks under the condition of a small amount of second growth data by using a model-independent meta-learning method, so that cross-task generalization is realized. And (5) strengthening learning. A reinforcement learner is used to give positive or negative feedback to the model based on its performance, thereby allowing the model to adapt and evolve itself in different data environments. By using the depth deterministic strategy gradient method, the model can learn the optimal strategy in the continuous action space, thereby realizing cross-environment optimization.
For the running environment of the model, the following configuration is required:
and (5) configuring hardware. It is necessary to use a computer with high performance, to configure at least 16GB of memory, at least 4 cores of processor, at least 1TB of hard disk, and at least one graphics card to ensure the running speed and efficiency of the model. And (5) configuring software. An operating system with stability and compatibility, and a programming environment with flexibility and usability are needed to ensure safe and convenient operation of the model.
The following describes a distinctive crop yield prediction apparatus provided in the embodiments of the present application, and the distinctive crop yield prediction apparatus described below and the distinctive crop yield prediction method described above may be referred to correspondingly.
Fig. 2 is a schematic structural diagram of a device for predicting yield of a special crop according to an embodiment of the present application, and as shown in fig. 2, the device includes an acquisition module 210, a pre-training module 220, a training module 230, and a prediction module 240.
The acquisition module is used for acquiring growth data of crops, wherein the growth data comprises first growth data of first crops and second growth data of second crops; the yield of the first crop is greater than the yield of the second crop, and/or the planting range of the first crop is greater than the yield of the second crop;
The pre-training module is used for training the created initial yield prediction model based on the first growth data to obtain a yield prediction basic model;
the training module is used for adjusting model parameters of the yield prediction basic model based on the second growth data and a set self-adaptive learning mechanism to obtain a yield prediction model;
and the prediction module is used for obtaining a yield prediction result of the second crop to be predicted based on the growth data and the yield prediction model of the second crop to be predicted.
Specifically, according to embodiments of the present application, any of the acquisition module, the pre-training module, the training module, and the prediction module may be combined and implemented in one module, or any of the modules may be split into multiple modules.
Alternatively, at least some of the functionality of one or more of the modules may be combined with at least some of the functionality of other modules and implemented in one module.
According to embodiments of the present application, at least one of the acquisition module, the pre-training module, the training module, and the prediction module may be implemented at least in part as hardware circuitry, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system-on-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or in hardware or firmware, such as any other reasonable way of integrating or packaging the circuitry, or in any one of or a suitable combination of any of the three.
Alternatively, at least one of the acquisition module, the pre-training module, the training module and the prediction module may be at least partially implemented as a computer program module which, when executed, may perform the respective functions.
According to the special crop yield prediction device provided by the embodiment of the application, the initial yield prediction model is pre-trained through the first growth data of the first crop to obtain the yield prediction basic model, the yield prediction basic model is further trained through the second growth data of the second crop and the set self-adaptive learning mechanism to obtain the yield prediction model, the finally obtained yield prediction model is suitable for yield prediction of the second crop, the yield of the second crop can be accurately predicted even though the data size of the second growth data is small, and the yield prediction accuracy and the prediction stability of the second crop are improved.
In some embodiments, the pre-training module is specifically configured to:
determining feature extraction rules corresponding to various growth data based on the category labels of the growth data;
extracting a feature vector of any growth data based on a feature extraction rule corresponding to any growth data;
Splicing the feature vectors of the first growth data in the extracted various growth data to obtain the total feature vector of the first growth data;
the total feature vector is used as sample data to train the initial yield prediction model.
In some embodiments, the types of growth data include:
the soil nutrient data and the crop yield corresponding to the soil nutrient data; crop yield corresponding to the meteorological data and the meteorological data; soil type and crop yield corresponding to soil type, plant growth stage image and crop yield corresponding to plant growth stage image.
In some embodiments, the yield prediction base model comprises:
the feature fusion layer is used for carrying out fusion processing on various feature vectors in the total feature vectors to obtain various first feature vectors; the vector dimensions of the various first feature vectors are the same;
the attention layer is used for giving different weights to various first feature vectors based on the association relation between various feature vectors and crop yield and a self-attention mechanism to obtain a second feature vector;
the residual layer optimizes model parameters of the initial yield prediction model based on differences between second characteristic vectors received by the residual blocks and third characteristic vectors output by the residual blocks;
And the output layer is used for generating a yield prediction result of the first crop based on the optimized initial yield prediction model.
In some embodiments, the pre-training module is further specifically configured to:
dividing the first growth data into a plurality of training sample sets based on the set sample set data amount;
respectively inputting each training sample set into a current initial yield prediction model to obtain a current yield prediction result output by the current initial yield prediction model;
comparing the current yield prediction result with the actual crop yield in the training sample based on a preset loss function to obtain a current loss value;
model optimization is carried out on the current initial yield prediction model based on the current loss value, and a new initial yield prediction model is obtained;
updating the current initial yield prediction model based on the new initial yield prediction model until the current loss value accords with a set termination condition or the current training iteration number is greater than or equal to a preset iteration number, so as to obtain a yield prediction basic model.
In some embodiments, the training module is specifically configured to:
performing data enhancement processing on the second growth data to increase the data volume of the second growth data;
adjusting model parameters of the yield prediction basic model based on the processed second growth data;
The data enhancement processing includes at least one of data rotation processing, data scaling processing, data clipping processing, data flipping processing, and data addition noise.
In some embodiments, the training module is further specifically configured to:
setting an adaptive learning mechanism based on the meta learner;
model parameters of the yield prediction base model are adjusted based on data characteristics of the second growth data and an adaptive learning mechanism.
In some embodiments, the prediction module is specifically configured to:
creating a yield prediction interface of the second crop;
selecting a selection item corresponding to the growth data of the second crop to be predicted on the yield prediction interface, or inputting the growth data of the second crop to be predicted in an input area of the yield prediction interface;
and displaying the yield prediction result of the second crop to be predicted, which is output by the yield prediction model, on a yield prediction interface in a graphical mode.
It should be noted that, the special crop yield prediction device provided in the embodiment of the present application can implement all the method steps implemented in the above special crop yield prediction method embodiment, and can achieve the same technical effects, and detailed descriptions of the same parts and beneficial effects as those of the method embodiment in the embodiment are omitted herein.
Fig. 3 is a schematic structural diagram of an electronic device provided in an embodiment of the present application, and as shown in fig. 3, the electronic device may include: processor (Processor) 310, communication interface (Communications Interface) 320, memory (Memory) 330 and communication bus (Communications Bus) 340, wherein Processor 310, communication interface 320, memory 330 accomplish communication with each other through communication bus 340. The processor 310 may invoke logic commands in the memory 330 to perform the method described above, including:
acquiring growth data of crops, wherein the growth data comprises first growth data of a first crop and second growth data of a second crop; the yield of the first crop is greater than the yield of the second crop, and/or the planting range of the first crop is greater than the yield of the second crop;
training the created initial yield prediction model based on the first growth data to obtain a yield prediction basic model;
adjusting model parameters of the yield prediction basic model based on the second growth data and a set self-adaptive learning mechanism to obtain a yield prediction model;
and obtaining a yield prediction result of the second crop to be predicted based on the growth data and the yield prediction model of the second crop to be predicted.
In addition, the logic commands in the memory described above may be implemented in the form of software functional modules and stored in a computer readable storage medium when sold or used as a stand alone product. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several commands for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The processor in the electronic device provided by the embodiment of the present application may call the logic instruction in the memory to implement the above method, and the specific implementation manner of the processor is consistent with the implementation manner of the foregoing method, and may achieve the same beneficial effects, which are not described herein again.
The present application also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the methods provided by the above embodiments.
The specific embodiment is consistent with the foregoing method embodiment, and the same beneficial effects can be achieved, and will not be described herein.
Embodiments of the present application provide a computer program product comprising a computer program which, when executed by a processor, implements a method as described above.
The apparatus embodiments described above are merely illustrative, wherein the modules illustrated as separate components may or may not be physically separate, and the components shown as modules may or may not be physical, i.e., may be located in one place, or may be distributed over a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and are not limiting thereof; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the corresponding technical solutions.

Claims (10)

1. A method for predicting yield of a specialty crop, comprising:
acquiring growth data of crops, wherein the growth data comprises first growth data of a first crop and second growth data of a second crop; the yield of the first crop is greater than the yield of the second crop, and/or the planting range of the first crop is greater than the yield of the second crop;
training the created initial yield prediction model based on the first growth data to obtain a yield prediction basic model;
adjusting model parameters of the yield prediction basic model based on the second growth data and a set self-adaptive learning mechanism to obtain a yield prediction model;
And obtaining a yield prediction result of the second crop to be predicted based on the growth data of the second crop to be predicted and the yield prediction model.
2. The method of claim 1, wherein training the created initial yield prediction model based on the first growth data comprises:
determining feature extraction rules corresponding to various growth data based on the category labels of the growth data;
extracting a feature vector of any growth data based on a feature extraction rule corresponding to the any growth data;
splicing the feature vectors of the first growth data in the extracted various growth data to obtain the total feature vector of the first growth data;
training the initial yield prediction model by taking the total feature vector as sample data.
3. The method for predicting yield of a specialty crop as set forth in claim 2, wherein said types of growth data include:
soil nutrient data and crop yield corresponding to the soil nutrient data; weather data and crop yield corresponding to the weather data; the soil type and the crop yield corresponding to the soil type, and the plant growth stage image and the crop yield corresponding to the plant growth stage image.
4. The method for predicting yield of a specialty crop as claimed in claim 2 wherein said yield prediction base model comprises:
the feature fusion layer is used for carrying out fusion processing on various feature vectors in the total feature vectors to obtain various first feature vectors; the vector dimensions of the various first feature vectors are the same;
the attention layer is used for giving different weights to various first feature vectors based on the association relation between various feature vectors and crop yield and a self-attention mechanism to obtain a second feature vector;
a residual layer for optimizing model parameters of the initial yield prediction model based on differences between the second feature vectors received by the plurality of residual blocks and third feature vectors output by the residual blocks;
and the output layer is used for generating a yield prediction result of the first crop based on the optimized initial yield prediction model.
5. The method for predicting yield of a specialty crop as claimed in claim 1, wherein said deriving a yield prediction basis model comprises:
dividing the first growth data into a plurality of training sample sets based on a set sample set data amount;
respectively inputting training samples in each training sample set into a current initial yield prediction model to obtain a current yield prediction result output by the current initial yield prediction model;
Comparing the current yield prediction result with the real crop yield in the training sample based on a preset loss function to obtain a current loss value;
performing model optimization on the current initial yield prediction model based on the current loss value to obtain a new initial yield prediction model;
updating the current initial yield prediction model based on the new initial yield prediction model until the current loss value accords with a set termination condition or the current training iteration number is greater than or equal to a preset iteration number, so as to obtain the yield prediction basic model.
6. The method of claim 1, wherein said adjusting model parameters of said yield prediction base model based on said second growth data and a set adaptive learning mechanism comprises:
performing data enhancement processing on the second growth data to increase the data volume of the second growth data;
adjusting model parameters of the yield prediction basic model based on the processed second growth data;
wherein the data enhancement processing includes at least one of data rotation processing, data scaling processing, data cropping processing, data flipping processing, and data addition noise.
7. The method of claim 1, wherein said adjusting model parameters of said yield prediction base model based on said second growth data and a set adaptive learning mechanism comprises:
setting an adaptive learning mechanism based on the meta learner;
model parameters of the yield prediction base model are adjusted based on data characteristics of the second growth data and the adaptive learning mechanism.
8. The method for predicting yield of a specialty crop according to claim 1, wherein said obtaining a yield prediction result of a second crop to be predicted based on growth data of the second crop to be predicted and the yield prediction model comprises:
creating a yield prediction interface for the second crop;
selecting a selection item corresponding to the growth data of the second crop to be predicted on the yield prediction interface, or inputting the growth data of the second crop to be predicted in an input area of the yield prediction interface;
and graphically displaying the yield prediction result of the second crop to be predicted, which is output by the yield prediction model, on the yield prediction interface.
9. A distinctive crop yield prediction apparatus, comprising:
the acquisition module is used for acquiring growth data of crops, wherein the growth data comprises first growth data of first crops and second growth data of second crops; the yield of the first crop is greater than the yield of the second crop, and/or the planting range of the first crop is greater than the yield of the second crop;
the pre-training module is used for training the created initial yield prediction model based on the first growth data to obtain a yield prediction basic model;
the training module is used for adjusting the model parameters of the yield prediction basic model based on the second growth data and a set self-adaptive learning mechanism to obtain a yield prediction model;
and the prediction module is used for obtaining a yield prediction result of the second crop to be predicted based on the growth data of the second crop to be predicted and the yield prediction model.
10. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the method of predicting yield of a specialty crop as claimed in any one of claims 1 to 8.
CN202410176207.8A 2024-02-08 2024-02-08 Method, device and storage medium for predicting yield of special crops Active CN117726051B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410176207.8A CN117726051B (en) 2024-02-08 2024-02-08 Method, device and storage medium for predicting yield of special crops

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410176207.8A CN117726051B (en) 2024-02-08 2024-02-08 Method, device and storage medium for predicting yield of special crops

Publications (2)

Publication Number Publication Date
CN117726051A true CN117726051A (en) 2024-03-19
CN117726051B CN117726051B (en) 2024-05-10

Family

ID=90207360

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410176207.8A Active CN117726051B (en) 2024-02-08 2024-02-08 Method, device and storage medium for predicting yield of special crops

Country Status (1)

Country Link
CN (1) CN117726051B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113537604A (en) * 2021-07-21 2021-10-22 中国农业大学 Crop yield prediction method and device by coupling process model and deep learning
US20210358106A1 (en) * 2020-05-18 2021-11-18 Zhejiang University Crop yield prediction method and system based on low-altitude remote sensing information from unmanned aerial vehicle
CN116307266A (en) * 2023-05-15 2023-06-23 山东建筑大学 Crop growth prediction method, device, electronic equipment and storage medium
US20240028957A1 (en) * 2022-07-20 2024-01-25 Tata Consultancy Services Limited Methods and systems for high resolution and scalable crop yield forecasting
CN117455062A (en) * 2023-11-09 2024-01-26 贵州航天智慧农业有限公司 Crop yield prediction algorithm based on multi-source heterogeneous agricultural data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210358106A1 (en) * 2020-05-18 2021-11-18 Zhejiang University Crop yield prediction method and system based on low-altitude remote sensing information from unmanned aerial vehicle
CN113537604A (en) * 2021-07-21 2021-10-22 中国农业大学 Crop yield prediction method and device by coupling process model and deep learning
US20240028957A1 (en) * 2022-07-20 2024-01-25 Tata Consultancy Services Limited Methods and systems for high resolution and scalable crop yield forecasting
CN116307266A (en) * 2023-05-15 2023-06-23 山东建筑大学 Crop growth prediction method, device, electronic equipment and storage medium
CN117455062A (en) * 2023-11-09 2024-01-26 贵州航天智慧农业有限公司 Crop yield prediction algorithm based on multi-source heterogeneous agricultural data

Also Published As

Publication number Publication date
CN117726051B (en) 2024-05-10

Similar Documents

Publication Publication Date Title
Merghadi et al. Machine learning methods for landslide susceptibility studies: A comparative overview of algorithm performance
Grönquist et al. Deep learning for post-processing ensemble weather forecasts
James et al. An introduction to statistical learning: With applications in python
CN110929774B (en) Classification method, model training method and device for target objects in image
Potter et al. Visualizing summary statistics and uncertainty
Rodriguez-Galiano et al. Evaluation of different machine learning methods for land cover mapping of a Mediterranean area using multi-seasonal Landsat images and Digital Terrain Models
US20190251707A1 (en) Saliency prediction for a mobile user interface
Feng et al. Hyperspectral band selection based on trivariate mutual information and clonal selection
Cook et al. Applied regression including computing and graphics
Xu et al. Support vector machines: a recent method for classification in chemometrics
Wan et al. Crop classification with WorldView-2 imagery using Support Vector Machine comparing texture analysis approaches and grey relational analysis in Jianan Plain, Taiwan
US20060161814A1 (en) Method and system of data analysis using neural networks
Cheng et al. Visually exploring missing values in multivariable data using a graphical user interface
Baño-Medina et al. On the suitability of deep convolutional neural networks for continental-wide downscaling of climate change projections
Capobianco et al. Target detection with semisupervised kernel orthogonal subspace projection
CN112180471B (en) Weather forecasting method, device, equipment and storage medium
CN102208037A (en) Hyper-spectral image classification method based on Gaussian process classifier collaborative training algorithm
CN110689065A (en) Hyperspectral image classification method based on flat mixed convolution neural network
Lee et al. Nested support vector machines
CN105354845B (en) A kind of semi-supervised change detecting method of remote sensing image
Alam et al. Classification of deep-SAT images under label noise
CN104680190A (en) Target detection method and device
CN117726051B (en) Method, device and storage medium for predicting yield of special crops
Reinhardt et al. Comparison of different wind data interpolation methods for a region with complex terrain in Central Asia
CN113537278A (en) Wine detection method and system based on 1D-CNN electronic tongue

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant