Prediction method of cherry fruit cracking environmental parameters based on GA-Attention-LSTM algorithm

Through the GA-Attention-LSTM algorithm, combined with genetic algorithms and attention mechanisms, the problem of low cherry cracking prediction accuracy in cherry planting is solved, accurate prediction of cherry cracking environmental parameters is achieved, digital early warning support is provided, and prediction accuracy is improved performance and computing speed.

CN114707418BActive Publication Date: 2024-10-29DALIAN UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210422910.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-21
Publication Date
2024-10-29
Estimated Expiration
2042-04-21

AI Technical Summary

Technical Problem

The problem of cherry fruit cracking in solar greenhouses during cherry planting troubles farmers. Traditional prediction methods cannot accurately predict the influencing factors, resulting in low accuracy of prediction results and affecting farmers' economic interests.

Method used

The GA-Attention-LSTM algorithm is used to obtain highly relevant environmental feature data, perform normalization processing and sliding window generation matrix, build a long-short-term memory neural network prediction model, and add genetic algorithm optimization, combined with the attention mechanism, to predict Cherry fruit cracking environmental parameters.

Benefits of technology

It achieves accurate prediction of the environmental characteristics of cherry cracking, improves prediction accuracy and calculation speed, provides digital early warning support, and reduces farmers' economic losses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114707418B_ABST
    Figure CN114707418B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for predicting cherry fruit cracking environmental parameters integrating a GA-Attention-LSTM algorithm, comprising: obtaining environmental data of greenhouse cherry planting, obtaining environmental characteristics with a strong correlation with cherry fruit cracking by a correlation analysis method, and normalizing the environmental characteristics; using a sliding window method to generate a matrix form of the processed environmental characteristic data; constructing a long-short-term memory (Long-Short Term Memory, LSTM) neural network prediction model based on a genetic algorithm (Genetic Algorithm, GA) and adding an attention (Attention) mechanism to obtain the cherry fruit cracking environmental parameters in the greenhouse. The present invention predicts the environment of the cherry greenhouse by means of data analysis and deep learning, and provides digital early warning support for farmers' fruit cracking prevention.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of smart agriculture, and in particular to a method for predicting environmental parameters of cherry fruit cracking by integrating a GA-Attention-LSTM algorithm. Background Art

[0002] With the rapid development of artificial intelligence technology, the application of deep learning and machine learning technologies in agricultural planting has become more and more common. Cherry planting has always been the pillar industry of Dalian's planting industry. It is also a dominant and characteristic industry in Dalian, which can bring huge benefits to the local economic development. In 1988, the Dalian Academy of Agricultural Sciences introduced the "Mei Zao" cherry to my country. At present, this variety has been planted on a large scale in Dalian. Mei Zao was bred by Washington State University in the United States. It has the advantages of more flesh, good taste, easy storage, and rich nutrition. It is sought after by a large number of consumers. However, in the process of planting cherries in solar greenhouses, cherry cracking has always been a thorny problem that plagues farmers. Once greenhouse cherries crack, the market value will be greatly reduced. Large-scale fruit cracking will bring huge economic losses to farmers, and the output value will also be seriously affected.

[0003] In the actual cherry planting process, there are many environmental factors that affect the temperature and humidity values ​​in the greenhouse, which cannot be reflected in traditional prediction methods. Although LSTM neural networks are widely used, they also have shortcomings. For example, finding the optimal hyperparameter value, number of hidden layers, batch size, etc. is an uncertain polynomial problem, which will affect the accuracy of the prediction results. Summary of the invention

[0004] The purpose of the present invention is to provide a method for predicting cherry fruit cracking environmental parameters integrating a GA-Attention-LSTM algorithm, which predicts the environment of a cherry greenhouse by means of data analysis and deep learning, and provides digital early warning support for farmers' fruit cracking prevention.

[0005] To achieve the above objectives, the present application proposes a method for predicting cherry fruit cracking environmental parameters by integrating the GA-Attention-LSTM algorithm, including:

[0006] Acquire environmental data of greenhouse cherry planting, obtain environmental characteristics that are strongly correlated with cherry fruit cracking through a correlation analysis method, and perform normalization processing on the environmental characteristics;

[0007] The processed environmental feature data are generated into a matrix form using a sliding window method;

[0008] A long-short term memory (LSTM) neural network prediction model based on genetic algorithm (GA) and attention mechanism was constructed to obtain the environmental parameters of cherry fruit cracking in the greenhouse.

[0009] Furthermore, the environmental data for greenhouse cherry cultivation include air humidity, air temperature, CO2 concentration, light intensity, soil temperature, soil moisture content, soil pH value, and soil conductivity.

[0010] Furthermore, the environmental characteristics that are strongly correlated with cherry fruit cracking are obtained through correlation analysis, and the environmental characteristics are normalized, specifically:

[0011] The formula for obtaining the correlation coefficient is:

[0012]

[0013] Through the above analysis, it can be concluded that air humidity, air temperature, light intensity, soil temperature, soil moisture content and the occurrence of cherry fruit cracking have a strong correlation, and air humidity is marked as x 1j , air temperature is marked as x 2j , light intensity is marked as x 3j , soil temperature is marked as x 4j , soil moisture content is marked as x 5j ;

[0014] The air humidity x 1j , air temperature x 2j , light intensity x 3j , soil temperature x 4j and soil moisture x 5j Outlier processing of environmental data;

[0015] The environmental data after outlier processing is mapped to the range of 0 to 1. The formula is as follows:

[0016]

[0017] In the formula, x in is the normalized value, x ij is the value before normalization, x ijmin is the minimum value of the environment variable, x ijmax is the maximum value of the environmental variable; the normalized air humidity, air temperature, light intensity, soil temperature and soil moisture are marked as x respectively. 1n 、x 2n 、x 3n 、x 4n 、x5n .

[0018] Furthermore, a sliding window method is used to generate a matrix form of the processed environmental feature data, specifically:

[0019] Data collection is in hours, so the window length is set to 12, then x 1n 、x 2n 、x 3n 、x 4n 、x 5n The window shape of the five sets of data is (12*5), and the matrix expression of window E is:

[0020]

[0021] Set the step size to 1, and the moving direction of the sliding window E is vertically downward, sliding in time series;

[0022] Generate a matrix of shape (n*5) and mark the matrix as E n .

[0023] Furthermore, the attention mechanism is added to the long short-term memory neural network prediction model, specifically: in the hidden layer unit of the neural network, the attention mechanism is the input air humidity x 1n , air temperature x 2n , light intensity x 3n , soil temperature x 4n , soil moisture content x 5n Assign weights corresponding to the probabilities.

[0024] Furthermore, the long short-term memory neural network prediction model includes two LSTM hidden layers, one Attention layer and one fully connected layer; wherein x 1n 、x 2n 、x 3n 、x 4n 、x 5n is the input vector; it is first imported into the LSTM hidden layer, and then imported into the Attention layer. The calculation process of the Attention mechanism of this layer is as follows:

[0025] C=(c1 c2 c3 c4 c5)

[0026] G=(g1 g2 g3 g4 g5)

[0027] D=(d1 d2 d3 d4 d5)

[0028] c1, c2, c3, c4, c5 represent the input environment features x 1n , x 2n , x3n , x 4n , x 5n The search engine is represented by the matrix C in the calculation process; g1, g2, g3, g4, g5 represent the input environment features x 1n , x 2n , x 3n , x 4n , x 5n The corresponding search key is represented by the matrix G during the calculation process; d1, d2, d3, d4, d5 represent the input environment features x 1n , x 2n , x 3n , x 4n , x 5n The corresponding numerical values ​​are represented by matrix D during the calculation process.

[0029] Furthermore, the air humidity x is obtained in the Attention layer 1n , air temperature x 2n , light intensity x 3n , soil temperature x 4n , soil moisture content x 5n The weights are:

[0030]

[0031]

[0032]

[0033] The top three are air humidity x 1n , air temperature x 2n , soil moisture content x 5n The corresponding weight;

[0034]

[0035] Vectors ω1, ω2, ω5 are the air humidity x 1n , air temperature x 2n , soil moisture content x 5n The weight of is represented by the matrix ω. When calculating the weight, the traditional softmax function in Attention is not used, but a direct weighted summation method is used, which can not only achieve the same effect but also simplify the calculation.

[0036] Furthermore, the output of the long short-term memory neural network prediction model is the air humidity y in the cherry cracking environment. 1n , air temperature y 2n , soil moisture content y 5nThe predicted value is represented by matrix Y, which is:

[0037]

[0038]

[0039] Furthermore, the parameters of the long short-term memory neural network prediction model are optimized by the GA algorithm, and the parameters include the number of LSTM layers, the number of hidden layers, and the number of neurons in the hidden layers.

[0040] Compared with the prior art, the above technical solution adopted by the present invention has the advantages that the main cause affecting cherry fruit cracking can be accurately found through the method of the present invention, and the environmental characteristic curve predicted by cherry fruit cracking is roughly consistent with the actual environmental characteristic curve in the greenhouse, which can provide farmers with the predicted value of the environmental parameters at the next moment, and use the predicted value to warn of cherry fruit cracking in the greenhouse. The designed long short-term memory neural network prediction model has the advantages of high prediction accuracy, fast calculation speed and high training efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 This is a sliding window workflow diagram of the present invention;

[0042] Figure 2 This is a flow chart of the operation of the long short-term memory neural network prediction model of the present invention;

[0043] Figure 3 The flow chart of the GA algorithm for optimizing the long short-term memory neural network prediction model of the present invention;

[0044] Figure 4 It is a comparison diagram of humidity prediction curves of the present invention;

[0045] Figure 5 It is a comparison diagram of the temperature prediction curve of the present invention;

[0046] Figure 6 It is a comparison diagram of the soil moisture content prediction curve of the present invention. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application, that is, the embodiments described are only part of the embodiments of the present application, not all of the embodiments.

[0048] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0049] Example 1

[0050] The time when the greenhouse produces cracked fruit is when the cherry growth cycle enters the coloring period. The greenhouse enters this growth cycle around early February. Therefore, the present invention is based on the environmental data after early February for research, and uses "Meizao" cherry as the test variety to improve the LSTM neural network to predict the air temperature and humidity and soil moisture content in the greenhouse, providing digital early warning support for farmers to prevent cracked fruit. The specific implementation method includes:

[0051] Step 1, obtaining environmental data of greenhouse cherry planting, obtaining environmental characteristics that are strongly correlated with cherry fruit cracking through a correlation analysis method, and normalizing the environmental characteristics;

[0052] Specifically, correlation analysis refers to analyzing two or more correlated feature variables to measure the degree of correlation between each feature variable. The larger the correlation coefficient between the two, the closer the relationship, and vice versa. The specific implementation method is:

[0053] S11. The correlation coefficient formula shows that air humidity, air temperature, light intensity, soil temperature, soil water content and cherry fruit cracking are strongly correlated, and air humidity is marked as x. 1j , air temperature is marked as x 2j , light intensity is marked as x 3j , soil temperature is marked as x 4j , soil moisture content is marked as x 5j ;

[0054] S12. Since the data acquisition device in the greenhouse may face problems such as network instability and agricultural planting interference, which may affect the accuracy of data prediction; therefore, the air humidity x 1j , air temperature x 2j , light intensity x 3j , soil temperature x 4j and soil moisture x 5j Perform outlier processing on environmental data;

[0055] S13. Map the environmental data after outlier processing to the range of 0 to 1, so as to improve the convergence speed of the model and the accuracy of prediction.

[0056] Step 2: Using the sliding window method, the processed environmental feature data is converted into a matrix form;

[0057] Specifically, the sliding window method is an operation performed on an array or string of a specific size. During the sliding window process, an element is output from the left and an element is input from the right, and finally a matrix data set of the time series is generated, which reduces the complexity of the problem and is more conducive to the input of the network. The specific implementation method is:

[0058] S21. Data collection is in hours, so the window length is set to 12, then x 1n 、x 2n 、x 3n 、x 4n 、x 5n The window shape of the five sets of data is (12*5), and the matrix expression of window E is obtained;

[0059] S22. Set the step size to 1, and the moving direction of the sliding window E is vertically downward, sliding in the list time sequence;

[0060] S23. Finally, a matrix with a shape of (n*5) is generated and the matrix is ​​marked as E n .

[0061] Step 3, construct a long short-term memory neural network prediction model based on genetic algorithm and adding attention mechanism to obtain the environmental parameters of cherry fruit cracking in the greenhouse;

[0062] Specifically, the attention mechanism will be in the hidden layer unit of the neural network for the input air humidity x 1n , air temperature x 2n , light intensity x 3n , soil temperature x 4n , soil moisture content x 5n Assigning weights to corresponding probabilities will give higher weights to key influencing factors. At the same time, because the Attention mechanism works well when performing highly parallel computations, the computational and storage overhead of the model will hardly be affected by the addition of this mechanism.

[0063] The long short-term memory neural network prediction model includes 2 LSTM hidden layers, 1 Attention layer and 1 fully connected layer. Input vector x 1n 、x 2n 、x 3n 、x 4n 、x 5n First, it enters the input layer, passes through two LSTM hidden layers, and then enters the Attention layer; in the Attention layer, x 1n 、x 2n 、x 3n、x 4n 、x 5n Calculate the weights, merge the input vector and the corresponding weights to get a new feature, input it into the fully connected layer, and you can get the predicted value y 1n ,y 2n ,y 5n ,like Figure 2 As shown; the role of the two LSTM hidden layers is to process the input vector x 1n 、x 2n 、x 3n 、x 4n 、x 5n Multi-level abstraction can better linearly divide different types of data. However, the number of hidden layers should not be too many. As the number of layers increases, the parameters will also explode, which is not conducive to subsequent processing.

[0064] The GA algorithm is a parallel, efficient and global search method that can automatically acquire and accumulate knowledge about the search space during the search process, and adaptively control the search process to obtain the best solution. This is a very effective way to improve the prediction accuracy of the LSTM network model by selecting the optimal number of neurons and batch size. In the process of optimizing the LSTM network model, the optimized parameters mainly include the number of LSTM layers, the number of hidden layers, and the number of neurons in the hidden layer. The specific implementation process is as follows: Figure 3 As shown, it includes: (1) generating the initial population of GA; (2) selecting the MSE of the LSTM network through the fitness function; (3) then performing the selection mutation operation; (4) judging whether the fitness value meets the requirements, if not, returning to (3) to continue execution; (5) obtaining the optimal parameters and fitness.

[0065] The MAE of the GA-Attention-LSTM model is 0.112, and the MSE is 0.087. Compared with the traditional LSTM model, the MAE is 12.80% higher, and the MSE is 9.72% higher. It can be seen that the GA-Attention-LSTM model has lower error and less loss than the traditional LSTM model, and can better predict the environmental parameters in the greenhouse. The comparison between the predicted value and the actual value of the model is shown in the figure below. Figure 4-6 shown.

[0066] The foregoing description of specific exemplary embodiments of the present invention is for the purpose of illustration and demonstration. These descriptions are not intended to limit the present invention to the precise form disclosed, and it is clear that many changes and variations can be made based on the above teachings. The purpose of selecting and describing the exemplary embodiments is to explain the specific principles of the present invention and its practical application, so that those skilled in the art can realize and utilize various different exemplary embodiments of the present invention and various different selections and changes. The scope of the present invention is intended to be limited by the claims and their equivalents.

Claims

1. A method for predicting cherry fruit cracking environmental parameters integrating GA-Attention-LSTM algorithm, characterized in that: include: Acquire environmental data of greenhouse cherry planting, obtain environmental characteristics that are strongly correlated with cherry fruit cracking through a correlation analysis method, and perform normalization processing on the environmental characteristics; The processed environmental feature data are generated into a matrix form using a sliding window method; A long short-term memory neural network prediction model based on genetic algorithm and attention mechanism was constructed to obtain the environmental parameters of cherry fruit cracking in the greenhouse. The attention mechanism is added to the long short-term memory neural network prediction model, specifically: in the hidden layer unit of the neural network, the attention mechanism is the input air humidity x 1n , air temperature x 2n , light intensity x 3n , soil temperature x 4n , soil moisture content x 5n Assign weights to the corresponding probabilities; The long short-term memory neural network prediction model includes two LSTM hidden layers, one Attention layer and one fully connected layer; 1n 、x 2n 、x 3n 、x 4n 、x 5n is the input vector; it is first imported into the LSTM hidden layer, and then imported into the Attention layer. The calculation process of the Attention mechanism of this layer is as follows: C=(c1 c2 c3 c4 c5) G=(g1 g2 g3 g4 g5) D=(d1 d2 d3 d4 d5) c1, c2, c3, c4, c5 represent the input environment features x 1n , x 2n , x 3n , x 4n , x 5n The search engine is represented by the matrix C in the calculation process; g1, g2, g3, g4, g5 represent the input environment features x 1n , x 2n , x 3n , x 4n , x 5n The corresponding search key is represented by the matrix G during the calculation process; d1, d2, d3, d4, d5 represent the input environment features x 1n , x 2n , x 3n , x 4n , x 5n The corresponding values ​​are represented by matrix D during the calculation process; Get the air humidity x in the Attention layer 1n , air temperature x 2n , light intensity x 3n , soil temperature x 4n , soil moisture content x 5n The weights are: The top three are air humidity x 1n , air temperature x 2n , soil moisture content x 5n The corresponding weight; Vectors ω1, ω2, ω5 are the air humidity x 1n , air temperature x 2n , soil moisture content x 5n The weight of is represented by the matrix ω; The output of the long short-term memory neural network prediction model is the air humidity y in the cherry cracking environment. 1n , air temperature y 2n , soil moisture content y 5n The predicted value is represented by matrix Y, which is:

2. The method for predicting cherry fruit cracking environmental parameters integrating GA-Attention-LSTM algorithm according to claim 1 is characterized in that: The environmental data for greenhouse cherry cultivation include air humidity, air temperature, CO2 concentration, light intensity, soil temperature, soil moisture content, soil pH value, and soil conductivity.

3. The method for predicting cherry fruit cracking environmental parameters integrating GA-Attention-LSTM algorithm according to claim 1 is characterized in that: The environmental characteristics with strong correlation with cherry fruit cracking were obtained by correlation analysis method, and the environmental characteristics were normalized. Specifically, the correlation coefficient was obtained by the formula: Through the above analysis, it can be concluded that air humidity, air temperature, light intensity, soil temperature, soil moisture content and the occurrence of cherry cracking have a strong correlation, and air humidity is marked as x 1j , air temperature is marked as x 2j , light intensity is marked as x 3j , soil temperature is marked as x 4j , soil moisture content is marked as x 5j ; The air humidity x 1j , air temperature x 2j , light intensity x 3j , soil temperature x 4j and soil moisture x 5j Perform outlier processing on environmental data; The environmental data after outlier processing is mapped to the range of 0 to 1. The formula is as follows: In the formula, x in is the normalized value, x ij is the value before normalization, x ijmin is the minimum value of the environment variable, x ijmax is the maximum value of the environmental variable; the normalized air humidity, air temperature, light intensity, soil temperature and soil moisture are marked as x respectively. 1n 、x 2n 、x 3n 、x 4n 、x 5n .

4. The method for predicting cherry fruit cracking environmental parameters integrating GA-Attention-LSTM algorithm according to claim 1 is characterized in that: The sliding window method is used to generate the processed environmental feature data into a matrix form, specifically: Data collection is in hours, so the window length is set to 12, then x 1n 、x 2n 、x 3n 、x 4n 、x 5n The window shape of the five sets of data is (12*5), and the matrix expression of window E is: Set the step size to 1, and the moving direction of the sliding window E is vertically downward, sliding in time series; Generate a matrix of shape (n*5) and mark the matrix as E n .

5. The method for predicting cherry fruit cracking environmental parameters integrating GA-Attention-LSTM algorithm according to claim 1, characterized in that: The GA algorithm is used to optimize the parameters of the long short-term memory neural network prediction model, wherein the parameters include the number of LSTM layers, the number of hidden layers, and the number of neurons in the hidden layers.

Citation Information

Patent Citations

  • Sweet cherry fruit cracking rate evaluation method based on entropy weight algorithm and machine learning technology

    CN113487037A

  • Multi-factor electrical load prediction method based on deep learning

    CN113962364A

  • Method for predicting air quality with aid of machine learning models

    US20190325334A1