Neural network water and fertilizer control ratio method and system based on adaptive forget gate mechanism
The deep neural network-based dynamic water-fertilizer ratio control method with an adaptive forget gate mechanism utilizes a bidirectional LSTM model to process environmental data, overcoming the shortcomings of traditional water-fertilizer ratio control methods in terms of flexibility and accuracy. This enables intelligent management of the agricultural environment and real-time adjustment of water-fertilizer ratios.
Patent Information
- Application Number
- CN202411939629.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2044-12-26
AI Technical Summary
Traditional water-fertilizer ratio control methods lack flexibility, have limited accuracy, and are difficult to manage intelligently when faced with complex and changing agricultural environments. They are unable to respond to soil moisture, plant growth status, and environmental changes in real time, resulting in uneven fertilization and inefficient resource utilization.
A deep neural network-based dynamic water-fertilizer ratio control method based on an adaptive forget gate mechanism is adopted. Environmental data is collected by sensors, processed in real time using a bidirectional LSTM prediction model, and combined with the adaptive forget gate adjustment mechanism to achieve dynamic adjustment of the water-fertilizer ratio.
It enables flexible responses to complex agricultural environments, ensures the accuracy of water and fertilizer ratios and intelligent management of the system, improves the automation and precision of water and fertilizer management, and enhances the ability to respond quickly to environmental changes.
Smart Images

Figure CN120029050B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of agricultural production, and particularly relates to a neural network water and fertilizer control ratio method and system based on an adaptive forgetting gate mechanism. BACKGROUND
[0002] In modern agricultural production, precise irrigation and fertilization are of great significance for improving crop yield and quality, saving resources and protecting the environment. Currently, traditional water and fertilizer ratio control methods mostly rely on experience or fixed control strategies, such as schemes based on PID controllers. However, these methods have the following major shortcomings when faced with complex and variable agricultural environments, especially when dealing with different weather and seasonal changes:
[0003] 1. Lack of flexibility: Traditional methods usually use preset programs or manual adjustments, which are difficult to respond to real-time changes in soil moisture, plant growth status and environmental changes. Traditional PID controllers rely on manual adjustment and fixed parameter setting, and cannot flexibly respond to dynamic changes in environmental conditions such as temperature, humidity and conductivity;
[0004] 2. Limited accuracy: Fixed ratio strategies cannot accurately adapt to the specific requirements of different soil types, crop needs and growth stages, resulting in uneven fertilization or low water and fertilizer utilization, which affects the healthy growth of crops and resource utilization efficiency;
[0005] 3. Difficulty in intelligent management: Traditional systems rely on operators' experience for adjustment, which is difficult for non-professionals to operate and prone to misoperation, affecting the stability and effectiveness of the system.
[0006] Although existing technologies can achieve automatic water and fertilizer ratio to some extent, they still face significant challenges in response speed, control accuracy and system robustness. For example, existing systems often cannot respond in time to rapidly changing environmental conditions such as rainfall and temperature fluctuations; in addition, the debugging process of traditional PID control is complex, and its non-linear control accuracy is low, easily disturbed by external factors, with poor stability and robustness. SUMMARY
[0007] The purpose of the present application is to solve the problems of lack of flexibility, limited accuracy and difficulty in intelligent management of traditional water and fertilizer ratio control methods in the face of complex and variable agricultural environments, and to propose a neural network water and fertilizer dynamic control ratio method and system based on an adaptive forgetting gate mechanism.
[0008] The technical solution of the present application is: a deep neural network water and fertilizer dynamic control ratio method based on an adaptive forgetting gate mechanism, comprising the following steps:
[0009] S1. Collecting original environmental data of the planting area using sensors;
[0010] S2. Standardizing and processing the original environmental data to obtain processed environmental data;
[0011] S3. Constructing a bidirectional LSTM prediction model based on an adaptive forgetting gate adjustment mechanism, inputting the processed environmental data into the bidirectional LSTM prediction model based on the adaptive forgetting gate adjustment mechanism for processing, and outputting a prediction value of an optimal water-fertilizer ratio;
[0012] S4. Converting the prediction value of the optimal water-fertilizer ratio into an operation instruction, adjusting the working state of a water pump and a fertilizer supply system according to the operation instruction and a feedback mechanism, and completing dynamic water-fertilizer ratio control.
[0013] The beneficial effects of the present application are:
[0014] The bidirectional LSTM prediction model based on the adaptive forgetting gate adjustment is adopted in the present application, the dynamic changes of crop demand and environmental conditions are reflected through real-time collected environmental data, and these environmental data are input into the bidirectional LSTM model for prediction in combination with the adaptive forgetting gate mechanism, which can flexibly cope with complex nonlinear relationships and ensure that the system can always maintain the accuracy of water-fertilizer demand prediction in the dynamic changes of agricultural environment, thereby realizing automatic prediction and accurate adjustment of water-fertilizer ratio.
[0015] As a preferred, the formula of the standardization processing in step S2 is:
[0016]
[0017] wherein, represents the standardized environmental data, represents the original environmental data, represents the mean of the original environmental data, represents the standard deviation of the original environmental data;
[0018] The feature processing includes interactive feature extraction and personalized feature generation; the personalized features are automatically generated according to crop types and growth stages.
[0019] As a preferred, the bidirectional LSTM prediction model based on the adaptive forgetting gate adjustment mechanism in step S3 includes two independent LSTM layers, which are a forward LSTM layer and a backward LSTM layer; the forward LSTM layer and the backward LSTM layer are both composed of a plurality of LSTM units connected in sequence.
[0020] The forward LSTM layer is used for processing environmental data from the starting point of the time sequence forwardly;
[0021] The backward LSTM layer is used for processing environmental data from the end of the time sequence backwardly;
[0022] At each time step, the output of the bidirectional LSTM prediction model is the combination of the output of the forward LSTM layer and the output layer of the backward LSTM. Its recursive formula is:
[0023]
[0024] in, express The hidden state of the forward LSTM layer at that moment, express The hidden state of the backward LSTM layer at time t, express The hidden state of the moment, express The hidden state of the forward LSTM layer at that moment, express The hidden state of the backward LSTM layer at time t, express The environmental data that is input into the LSTM unit at all times, represents the propagation calculation of the LSTM unit, Represents a splicing operation.
[0025] Preferably, the LSTM unit includes a memory update unit, an input gate, a forget gate and an output gate;
[0026] The memory unit is used to store information; the information is the relationship between environmental data and water-fertilizer ratio requirements;
[0027] The input gate is used to determine the impact of the environmental data input at the current moment on the current information;
[0028] The forget gate is used to determine how much historical information to discard. The forget gate in the adaptive forget gate adjustment mechanism is adjusted according to real-time environmental data.
[0029] The output gate is used to determine the hidden state of the current time step;
[0030] The LSTM unit specifically includes the following formula:
[0031]
[0032] in, represents the output parameter of the input gate, represents the output parameter of the forget gate, represents the output parameter of the output gate, Indicates that the LSTM unit is The memory unit of time, represents the sigmoid activation function, a weight representing an input gate, a bias representing a hidden state at a time point, a bias representing an input gate, a weight representing a forget gate, a bias representing a forget gate, an adjustment factor dynamically calculated according to a current environmental condition, a weight representing an output gate, a bias representing an output gate, an element-wise multiplication, a memory cell of an LSTM unit at a time point, a memory representation corresponding to input information at a time point, a hyperbolic tangent activation function.
[0033] As a preferred, the expression formula of the predicted value of the optimal water-fertilizer ratio in step S3 is:
[0034]
[0035] wherein, the predicted value of the optimal water-fertilizer ratio, a weight matrix of the hidden state to the output layer, a bias term of the output layer.
[0036] As a preferred, the bidirectional LSTM prediction model based on the adaptive forget gate adjustment mechanism in step S3 learns the relationship between the environmental data and the water-fertilizer ratio demand by minimizing a loss function in the training process; the expression formula of the loss function is:
[0037]
[0038] wherein, the actual value of the water-fertilizer ratio, the predicted value output by the bidirectional LSTM prediction model based on the adaptive forget gate adjustment mechanism, the number of training samples, the current time point.
[0039] As a preferred, the feedback mechanism in step S4 is specifically: real-time monitoring the actual working state of the water pump and the fertilizer supply, and comparing with the predicted value of the optimal water-fertilizer ratio; if there is a deviation between the actual working state and the predicted value, adjusting the control parameters of the water pump and the fertilizer supply; if there is no deviation between the actual working state and the predicted value, normally working.
[0040] The beneficial effects of the above preferred embodiments are:
[0041] 1. Through interactive feature extraction and personalized feature generation, the prediction ability of the bidirectional LSTM prediction model based on the adaptive forgetting gate adjustment mechanism can be effectively improved.
[0042] 2. Through the adaptive forgetting gate adjustment mechanism, the forgetting rate is automatically adjusted according to the real-time changes of the environment (such as temperature, humidity, rainfall, etc.), realizing intelligent adaptation to different environmental conditions, and providing a more automated, flexible and accurate water and fertilizer management solution.
[0043] 3. The feedback control mechanism can effectively improve the accuracy of the supply and the adaptability of the system by real-time monitoring of the supply system state and applying feedback data to the adaptive forgetting gate adjustment to automatically adjust the water pump and fertilizer supply strategy.
[0044] The second aspect is a deep neural network water and fertilizer dynamic control ratio system based on an adaptive forgetting gate mechanism, comprising:
[0045] A data acquisition module for acquiring original environmental data of a planting area;
[0046] A data standardization and feature engineering module for receiving the original environmental data and performing standardization and feature processing on the original environmental data to obtain processed environmental data;
[0047] An adaptive forgetting gate adjustment bidirectional LSTM prediction module for receiving the processed environmental data, constructing a bidirectional LSTM prediction model based on an adaptive forgetting gate adjustment mechanism, and inputting the processed environmental data into the bidirectional LSTM prediction model based on the adaptive forgetting gate adjustment mechanism for processing to output a prediction value of the optimal water and fertilizer ratio;
[0048] A control execution module for receiving the optimal water and fertilizer ratio scheme, converting the prediction value of the optimal water and fertilizer ratio into an operation instruction, and adjusting the working state of the water pump and fertilizer supply system according to the operation instruction and feedback mechanism to complete the water and fertilizer dynamic control ratio.
[0049] The third aspect is a non-transitory computer readable storage medium storing computer instructions for causing a computer to execute the method of the first aspect.
[0050] The fourth aspect is a computer program product comprising a computer program which, when executed by a processor, implements the method of the first aspect. BRIEF DESCRIPTION OF DRAWINGS
[0051] Figure 1The figure shows a flow chart of the deep neural network water-fertilizer dynamic ratio control method based on the adaptive forget gate mechanism provided in Example 1 of the present invention.
[0052] Figure 2 The figure shows the comparison results between the bidirectional LSTM (i.e., the bidirectional LSTM prediction model based on the adaptive forget gate adjustment mechanism) and the PID prediction provided in Example 3 of the present invention. DETAILED DESCRIPTION
[0053] The exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be understood that the embodiments shown and described in the accompanying drawings are merely exemplary and are intended to illustrate the principles and spirit of the present invention, rather than to limit the scope of the present invention.
[0054] Example 1:
[0055] like Figure 1 As shown, a method for dynamic water-fertilizer ratio control based on a deep neural network with an adaptive forget gate mechanism includes the following steps:
[0056] S1. Sensors are used to collect raw environmental data from the growing area. To accurately predict water-fertilizer ratios, various types of sensors, including temperature, humidity, and conductivity sensors, are deployed within the growing area. These sensors collect raw environmental data in real time at a fixed frequency. This data reflects dynamic changes in the crop growth environment, such as rising temperature, falling humidity, or changes in soil conductivity. All collected data is transmitted to a data processing center via wireless transmission modules or wired networks. The placement and number of sensors can be flexibly adjusted based on the size of the growing area, crop type, and environmental conditions to ensure the comprehensiveness and accuracy of the collected data.
[0057] S2. performing standardization and feature processing on the original environmental data to obtain processed environmental data;
[0058] S3. Construct a bidirectional LSTM prediction model based on an adaptive forget gate adjustment mechanism, input the processed environmental data into the bidirectional LSTM prediction model based on the adaptive forget gate adjustment mechanism for processing, and output the predicted value of the optimal water-fertilizer ratio;
[0059] S4. Convert the predicted value of the optimal water-fertilizer ratio into an operating instruction, and adjust the working state of the water pump and fertilizer supply system according to the operating instruction and the feedback mechanism to complete the dynamic control of the water-fertilizer ratio.
[0060] The prediction value of the optimal water and fertilizer ratio generated by the adaptive forgetting gate mechanism based bidirectional LSTM prediction model each time is converted into operation instructions, which control the flow rate of the water pump and the working state of the fertilizer supply system. The adaptive forgetting gate adjustment mechanism enables the bidirectional LSTM prediction model to be flexibly adjusted under different environmental conditions. When the environment changes rapidly (such as rainfall or temperature change), the adaptive forgetting gate mechanism retains key environmental information by adjusting the parameters of the forgetting gate in real time, thereby more accurately adapting to these changes. For example, in the case of a sharp rise in temperature, by reducing unimportant historical information (such as humidity information at a distant time), the new water and fertilizer demand is quickly adapted to ensure that the irrigation and fertilization needs of crops are met in a timely manner.
[0061] In this embodiment, since different types of data collected by the sensor (such as temperature, humidity and conductivity) have different units and dimensions, directly inputting the bidirectional LSTM neural network may result in poor training effect, therefore, in step S2, data standardization technology is adopted to adjust all original environmental data to the same scale; the formula of the standardization processing is:
[0062]
[0063] wherein, represents the standardized environmental data, represents the original environmental data, represents the mean of the original environmental data, represents the standard deviation of the original environmental data;
[0064] The feature processing includes interactive feature extraction and personalized feature generation; considering that the interaction between temperature and humidity has an important influence on water and fertilizer demand, the interactive feature of temperature and humidity is obtained by calculating the product of temperature and humidity; the personalized feature is automatically generated according to the crop species and growth stage.
[0065] In this embodiment, the bidirectional LSTM prediction model based on the adaptive forgetting gate adjustment mechanism in step S3 includes two independent LSTM layers, namely the forward LSTM layer and the backward LSTM layer, which simultaneously process the forward (past to present) and backward (future to present) information of the time series, thereby better capturing the global dependence relationship in the time series; the forward LSTM layer and the backward LSTM layer are each composed of a plurality of LSTM units connected in sequence, and the LSTM unit can selectively retain or forget historical information by introducing a memory unit;
[0066] The forward LSTM layer is used to process environmental data from the starting point of the time series forwardly;
[0067] The backward LSTM layer is used to process the environment data from the end of the time series;
[0068] At each time step, the output of the bidirectional LSTM prediction model is the combination of the output of the forward LSTM layer and the output layer of the backward LSTM, and the recursive formula is:
[0069]
[0070] wherein, denotes the hidden state of the forward LSTM layer at time t-1, denotes the hidden state of the backward LSTM layer at time t-1, denotes the hidden state at time t, denotes the hidden state of the forward LSTM layer at time t-1, denotes the hidden state of the backward LSTM layer at time t-1, denotes the environment data input into the LSTM unit at time t, denotes the propagation calculation of the LSTM unit, denotes a splicing operation for combining and is to connect the hidden states of the forward and backward LSTM layers into a complete output, and the LSTM unit is a recurrent neural network unit for processing time series data, and here the forward and backward propagation calculations of an LSTM unit are actually represented by different and The formula shows the complete structure of the bidirectional LSTM prediction model, which mainly captures the context information in the input sequence through the forward and backward LSTM layers.
[0071] In the embodiment, the LSTM unit includes a memory update unit, an input gate, a forget gate, and an output gate.
[0072] The memory unit is used to store information, i.e., the relationship between the environment data and the water and fertilizer ratio requirement.
[0073] The input gate is used to determine the influence of the environment data input at the current time on the current information.
[0074] The forgetting gate is used to determine how much historical information to discard; in order to further enhance the adaptability of the model to environmental changes, an adaptive forgetting gate adjustment mechanism is introduced. In the original LSTM model, the forgetting gate fixedly controls the forgetting rate of historical information. However, in the agricultural environment, different environmental conditions (such as rainfall, temperature changes, etc.) will affect the dynamic changes of water and fertilizer demand, so it is necessary to dynamically adjust the forgetting rate of the forgetting gate. By introducing the adaptive forgetting gate adjustment mechanism, the bidirectional LSTM prediction model can automatically adjust the forgetting rate according to the changes of the current environmental conditions, so as to retain more historical information at some critical moments (for example, when extreme weather occurs), and more quickly forget irrelevant historical information in other cases; the forgetting gate in the adaptive forgetting gate adjustment mechanism is adjusted according to real-time environmental data; the adaptive forgetting gate adjustment mechanism can ensure that the bidirectional LSTM prediction model has better adaptability to the prediction of water and fertilizer ratio under different periods and different environments;
[0075] The output gate is used to determine the hidden state of the current time step;
[0076] The LSTM unit specifically includes the following formula:
[0077]
[0078] wherein, represents the output parameter of the input gate, represents the output parameter of the forgetting gate, represents the output parameter of the output gate, represents the memory cell of the LSTM unit at time, represents the sigmoid activation function, represents the weight of the input gate, represents the hidden state at time, represents the bias of the input gate, represents the weight of the forgetting gate, represents the bias of the forgetting gate, represents an adjustment factor dynamically calculated according to the current environmental conditions, represents the weight of the output gate, represents the bias of the output gate, represents element-wise multiplication, represents the memory cell of the LSTM unit at time, represents the memory representation corresponding to the input information at time, represents the hyperbolic tangent activation function.
[0079] In the embodiment, the bidirectional LSTM prediction model based on the adaptive forgetting gate adjustment mechanism minimizes the loss function during the training process The relationship between the learning environment data and the water and fertilizer ratio demand is learned, and the training data includes historical environment data of different crops and different growth stages and the corresponding optimal water and fertilizer ratio; the expression formula of the loss function is as follows:
[0080]
[0081] wherein, represents the actual value of the water and fertilizer ratio, represents the predicted value output by the bidirectional LSTM prediction model based on the adaptive forgetting gate adjustment mechanism, represents the number of training samples, represents the current time.
[0082] The bidirectional LSTM prediction model based on the adaptive forgetting gate adjustment mechanism also has a self-learning function. By continuously introducing new environment data, the bidirectional LSTM prediction model parameters are dynamically updated, and the prediction accuracy of the bidirectional LSTM prediction model parameters is optimized. The new data will further help the bidirectional LSTM prediction model parameters to understand the long-term impact of environmental changes on crop water and fertilizer demand.
[0083] In the embodiment, the input environment data is processed step by step through multiple LSTM units. The environment data (such as temperature T, humidity H, and electrical conductivity EC) at each time step is taken as input, and the corresponding hidden state and output are generated through the bidirectional LSTM layer, and finally the optimal water and fertilizer ratio at the current time step is predicted. The expression formula of the predicted value of the optimal water and fertilizer ratio in step S3 is as follows:
[0084]
[0085] wherein, represents the predicted value of the optimal water and fertilizer ratio, represents the weight matrix from the hidden state to the output layer, represents the bias term of the output layer.
[0086] In this embodiment, the feedback mechanism in step S4 is specifically: real-time monitoring of the actual working state of the water pump and fertilizer supply, and comparison with the predicted value of the optimal water-fertilizer ratio; if there is deviation between the actual working state and the predicted value, the control parameters of the water pump and fertilizer supply are adjusted; if there is no deviation between the actual working state and the predicted value, the system works normally. This feedback mechanism not only can adjust the water-fertilizer ratio in real time, but also can further optimize the adjustment mechanism of the adaptive forgetting gate according to the feedback data. The historical feedback data will be used to further adjust and train the dynamic adjustment rules of the adaptive forgetting gate, so as to improve the long-term prediction ability and adaptability of the bidirectional LSTM prediction model.
[0087] In this embodiment,
[0088] Embodiment 2:
[0089] Based on embodiment 1, this embodiment provides a deep neural network water-fertilizer dynamic control ratio system based on an adaptive forgetting gate mechanism, which is used to configure and execute the deep neural network water-fertilizer dynamic control ratio method based on the adaptive forgetting gate mechanism in embodiment 1. The system comprises:
[0090] A data acquisition module is configured to acquire original environmental data of a planting area. The data acquisition module is provided with a sensor fault detection and data recovery function to ensure the continuity and robustness of data acquisition.
[0091] A data standardization and feature engineering module is configured to receive the original environmental data and perform standardization and feature processing on the original environmental data to obtain processed environmental data.
[0092] An adaptive forgetting gate adjusted bidirectional LSTM prediction module is configured to receive the processed environmental data, construct a bidirectional LSTM prediction model based on an adaptive forgetting gate adjustment mechanism, input the processed environmental data into the bidirectional LSTM prediction model based on the adaptive forgetting gate adjustment mechanism for processing, and output a predicted value of the optimal water-fertilizer ratio.
[0093] A control execution module is configured to receive the optimal water-fertilizer ratio scheme, convert the predicted value of the optimal water-fertilizer ratio into an operation instruction, and adjust the working state of the water pump and fertilizer supply system according to the operation instruction and the feedback mechanism to complete the water-fertilizer dynamic control ratio.
[0094] In this embodiment, a readable storage medium and a computer program product are also provided.
[0095] In the embodiment, the readable storage medium can be a non-transitory computer readable storage medium storing computer instructions for causing a computer to perform part or all of the steps of the method for dynamically controlling the ratio of water and fertilizer based on a deep neural network with an adaptive forgetting gate mechanism provided in the foregoing embodiment 1 of the present application.
[0096] In the embodiment, the computer program product comprises a computer program which, when executed by a processor, implements part or all of the steps of the method for dynamically controlling the ratio of water and fertilizer based on a deep neural network with an adaptive forgetting gate mechanism provided in the foregoing embodiment 1 of the present application.
[0097] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general purpose computer, a special purpose computer, or other programmable data processing apparatus, so that the program codes, when executed by the processor or controller, cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program codes can be executed entirely on a machine, partially on a machine, partially on a machine as a separate software package and partially on a remote machine, or entirely on a remote machine or server.
[0098] In the context of the present application, the machine readable medium can be a tangible medium which can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine readable medium can be a machine readable signal medium or a machine readable storage medium. The machine readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the above. More specific examples of the machine readable storage medium will include one or more lines of electrical connection, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0099] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0100] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0101] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server is generally established by computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0102] Embodiment 3:
[0103] On the basis of embodiment 1, virtual simulation is carried out by using Simulink of Matlab R2021a. Simulink is a powerful system modeling and simulation tool, which can efficiently simulate complex dynamic systems. In this embodiment, the model of the bidirectional LSTM model based on the adaptive forget gate mechanism and the PID controller is established by using Simulink, and the virtual simulation of water and fertilizer ratio control is carried out.
[0104] In Simulink, the bidirectional LSTM model based on the adaptive forget gate mechanism is trained and simulated through time series data, combined with real-time environmental sensor data to predict and adjust the water-fertilizer ratio. The standard LSTM module is used in the Simulink model, and the adaptive forget gate adjustment mechanism is integrated to dynamically optimize the water-fertilizer ratio.
[0105] The model of the PID controller is adjusted according to the traditional proportional (Kp), integral (Ki), and derivative parameters (Kd), and adjusts the irrigation water and fertilizer application amount through real-time feedback. During the simulation process, the parameter settings of the PID controller are based on the experience values of conventional agricultural irrigation practices.
[0106] In this embodiment, the bidirectional LSTM control method and the PID control method are tested under the same environmental conditions. By comparing the water-fertilizer ratio response of the two methods under the same dynamic environment, the control accuracy, response speed, and stability of the two methods are evaluated. Finally, we compare the performance of the adaptive forget gate adjustment mechanism bidirectional LSTM neural network and the PID controller in water-fertilizer ratio prediction. As shown in Figure 2 , the three curves represent the true water-fertilizer ratio, the adaptive forget gate adjustment mechanism bidirectional LSTM prediction value, and the PID prediction value, respectively.
[0107] As can be seen from Figure 2 , the prediction results of the adaptive forget gate adjustment mechanism bidirectional LSTM (red dashed line) are almost completely coincident with the true value (blue solid line), which indicates that the adaptive forget gate adjustment mechanism bidirectional LSTM model can accurately capture the complex dependence and nonlinear changes in the time series, and has strong fitting ability. Especially in most time steps, the prediction results of the adaptive forget gate adjustment mechanism bidirectional LSTM can well track the actual water-fertilizer demand, showing high prediction accuracy and time series dependence capturing ability.
[0108] In contrast, the prediction results of the PID controller (green dashed line) have significant deviations from the true value at most time steps. Although the PID controller can provide predictions close to the true value at certain time steps, due to its dependence on fixed control parameters, it is difficult to adapt to complex nonlinear changes, resulting in large deviations when the environmental variables fluctuate dramatically. The PID controller is difficult to adapt to rapid changes in the environment in real time, so it is significantly inferior to the adaptive forget gate adjustment mechanism bidirectional LSTM in control accuracy.
[0109] Overall, the adaptive forgetting gate regulation mechanism bidirectional LSTM performs significantly better than the PID controller in this water and fertilizer ratio prediction task. Its strong nonlinear processing ability and adaptability enable it to provide more accurate and stable solutions for intelligent water and fertilizer management in agricultural environments. This result proves that bidirectional LSTM combined with adaptive forgetting gate regulation mechanism can achieve efficient prediction and control in dynamic agricultural environments, superior to traditional PID methods.
[0110] Those skilled in the art will appreciate that the embodiments described herein are presented for the purpose of aiding the reader in understanding the principles of the present application and should be construed as not limiting the scope of protection of the present application to such specific recitations and embodiments. Those skilled in the art can make various other specific modifications and combinations according to the technical inspiration disclosed in the present application without departing from the essence of the present application, and these modifications and combinations are still within the scope of protection of the present application.
Claims
1. A deep neural network water and fertilizer dynamic control ratio method based on an adaptive forgetting gate mechanism, characterized in that, The method comprises the following steps: S1. Collecting original environment data of the planting area by using a sensor; S2. Standardizing and processing the original environment data to obtain processed environment data; S3. Constructing a bidirectional LSTM prediction model based on an adaptive forgetting gate adjustment mechanism and comparing with a PID prediction, inputting the processed environment data into the bidirectional LSTM prediction model based on the adaptive forgetting gate adjustment mechanism for processing, and outputting a prediction value of the optimal water-fertilizer ratio; The bidirectional LSTM prediction model based on the adaptive forgetting gate adjustment mechanism comprises two independent LSTM layers, namely a forward LSTM layer and a backward LSTM layer; both the forward LSTM layer and the backward LSTM layer are composed of a plurality of LSTM units connected in sequence; The LSTM unit comprises a memory updating unit, an input gate, a forgetting gate and an output gate; The memory updating unit is used for storing information, i.e. the relationship between environment data and water-fertilizer ratio demand; The input gate is used for determining the influence of the current time input environment data on the current information; The forgetting gate is used for determining how much historical information to discard, and the forgetting gate is adjusted according to real-time environment data in the adaptive forgetting gate adjustment mechanism; The output gate is used for determining the hidden state of the current time step; The LSTM unit specifically comprises the following formulas: in, represents the output parameter of the input gate, represents the output parameter of the forget gate, represents the output parameter of the output gate, Indicates that the LSTM unit is The memory unit of time, represents the sigmoid activation function, represents the weight of the input gate, express The hidden state of the moment, represents the bias of the input gate, represents the weight of the forget gate, represents the bias of the forget gate, Represents the adjustment factor dynamically calculated based on current environmental conditions, represents the weight of the output gate, represents the bias of the output gate, represents element-wise multiplication, Indicates that the LSTM unit is The memory unit of time, express The memory representation corresponding to the input information at each moment, represents the hyperbolic tangent activation function, express The hidden state of the moment, express Constant input of environmental data into the LSTM unit; S4. Converting the prediction value of the optimal water-fertilizer ratio into an operation instruction, adjusting the working state of the water pump and the fertilizer supply system according to the operation instruction and a feedback mechanism, and completing water-fertilizer dynamic ratio control; The feedback mechanism is also used for further optimizing the adjustment mechanism of the adaptive forgetting gate, specifically: further adjusting and training the dynamic adjustment rules of the adaptive forgetting gate by using historical feedback data, so as to improve the long-term prediction ability and adaptability of the bidirectional LSTM prediction model.
2. The deep neural network water and fertilizer dynamic control ratio method based on an adaptive forgetting gate mechanism according to claim 1, characterized in that, The formula of the standardization processing in step S2 is: wherein, denotes the standardized environmental data, denotes the raw environmental data, denotes the mean of the raw environmental data, denotes the standard deviation of the raw environmental data; The feature processing comprises interactive feature extraction and personalized feature generation; the personalized features are automatically generated according to crop types and growth stages.
3. The deep neural network water-fertilizer dynamic ratio control method based on the adaptive forgetting gate mechanism according to claim 1, characterized in that The forward LSTM layer is used for processing environment data from the starting point of the time sequence; The backward LSTM layer is used for processing environment data from the end of the time sequence; At each time step, the output of the bidirectional LSTM prediction model is the combination of the output of the forward LSTM layer and the output of the backward LSTM layer, and the recursive formula is: wherein, denotes the hidden state of the forward LSTM layer at time step t, denotes the hidden state of the backward LSTM layer at time step t, denotes the hidden state of the forward LSTM layer at time step t, denotes the hidden state of the backward LSTM layer at time step t, denotes the propagation computation of an LSTM unit, denotes a concatenation operation.
4. The deep neural network water and fertilizer dynamic control ratio method based on an adaptive forgetting gate mechanism according to claim 1, characterized in that, The expression formula of the prediction value of the optimal water-fertilizer ratio in step S3 is: wherein, represents the predicted value of the optimal water-fertilizer ratio, represents a weight matrix from the hidden state to the output layer, represents a bias term of the output layer. 5.The deep neural network water and fertilizer dynamic control ratio method based on adaptive forget gate mechanism according to claim 1, characterized in that, The bidirectional LSTM prediction model based on the adaptive forgetting gate adjustment mechanism in step S3 minimizes a loss function during training The expression formula of the loss function is as follows: The expression formula of the loss function is as follows: Wherein, represents the water and fertilizer ratio actual value, represents the prediction value output by the bidirectional LSTM prediction model based on the adaptive forgetting gate adjustment mechanism, represents the number of training samples, represents the current time. 6.The deep neural network water and fertilizer dynamic control ratio method based on adaptive forget gate mechanism according to claim 1, characterized in that, The feedback mechanism in step S4 is specifically: monitoring the actual working state of the water pump and the fertilizer supply in real time, and comparing it with the prediction value of the optimal water-fertilizer ratio; if there is a deviation between the actual working state and the prediction value, the control parameters of the water pump and the fertilizer supply are adjusted; if there is no deviation between the actual working state and the prediction value, the system works normally.
7. A deep neural network dynamic water and fertilizer control ratio system based on the deep neural network dynamic water and fertilizer control ratio method of any one of claims 1-6, characterized in that, It comprises: A data acquisition module for acquiring original environment data of a planting area; The data standardization and feature engineering module is configured to receive the original environment data, and perform standardization processing and feature processing on the original environment data to obtain processed environment data. The adaptive forgetting gate adjustment bidirectional LSTM prediction module is configured to receive the processed environment data, construct a bidirectional LSTM prediction model based on an adaptive forgetting gate adjustment mechanism, input the processed environment data into the bidirectional LSTM prediction model based on the adaptive forgetting gate adjustment mechanism for processing, and output a prediction value of an optimal water-fertilizer ratio. The control execution module is configured to receive the optimal water-fertilizer ratio scheme, convert the prediction value of the optimal water-fertilizer ratio into an operation instruction, and adjust a working state of a water pump and a fertilizer supply system according to the operation instruction and a feedback mechanism to complete dynamic control of the water-fertilizer ratio.
8. A non-transitory computer-readable storage medium having stored thereon computer instructions, wherein, The computer instructions are configured to enable a computer to perform the method according to any one of claims 1-6.
9. A computer program product, characterised in that, The computer program is configured to enable a processor to perform the method according to any one of claims 1-6.
Citation Information
Patent Citations
Hydroponic fertilizer applicator
CN112470907A
Meteorological disaster prediction method based on AI
CN119167036A