Method for predicting time sequence of dissolved oxygen in culture pond
Through the CNN-DeepAR hybrid neural network model and multi-head attention mechanism, a dissolved oxygen timing prediction model was established, which solved the problems of unstable prediction effect and high computational complexity in the existing technology, and achieved high-precision prediction of dissolved oxygen in aquaculture and real-time monitoring have improved the management and early warning capabilities of the breeding farm.
Patent Information
- Application Number
- CN202410475087.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-19
- Publication Date
- 2024-12-10
AI Technical Summary
In actual application, the existing dissolved oxygen prediction model has problems such as unstable prediction effect, high computational complexity of prediction algorithms, and slow model training speed, which is difficult to meet the needs of real-time monitoring and early warning in aquaculture.
The CNN-DeepAR hybrid neural network model is used to combine the multi-head attention mechanism, and the water quality and meteorological data collected by the sensor are used for data pre-processing and correlation analysis, and a dissolved oxygen timing prediction model is established, and future prediction values are output in real time to monitor water quality and prevent sudden outbreaks. Post an incident.
The effect of dissolved oxygen prediction is stable, with high accuracy and fast model convergence speed, and the early warning and management capabilities of aquaculture farms are improved, water quality problems are discovered in a timely manner, management measures are optimized, energy consumption is reduced, and energy conservation and emission reduction are achieved.
Smart Images

Figure CN119108053A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of prediction and control of dissolved oxygen in aquaculture ponds, belonging to the technical field of system control. Background Art
[0002] One of the indicators that farmers pay most attention to in the process of water quality management is the dissolved oxygen (DO) content. Dissolved oxygen is one of the important factors for the survival of aquatic organisms. Its content can indirectly reflect the quality of aquaculture water. The quality of aquatic products is closely related to the quality of aquaculture water. Therefore, it is necessary to monitor and accurately predict DO in real time to prevent water deterioration and aquaculture accidents. In the aquaculture industry, aquaculture water is an open and complex system with nonlinear and dynamic characteristics. Water quality is easily affected by many factors. In factory aquaculture, online water quality monitoring systems can obtain water quality parameter information in water in real time and capture the time-varying laws of aquaculture water quality parameters. Dissolved oxygen, as an important parameter of aquaculture water, is related to the survival rate of aquaculture species. Using intelligent algorithms to effectively predict the trend of dissolved oxygen changes can effectively reduce the risks in the aquaculture production process, which has important practical significance for aquaculture water quality monitoring and regulation. Although the existing research methods at home and abroad have achieved good prediction results, there are still problems in the actual application process, such as unstable model prediction effect, high calculation complexity of prediction algorithm, slow model training speed, etc. Therefore, it is particularly important to develop a prediction algorithm with stable prediction effect, high prediction accuracy and fast model convergence speed. Summary of the invention
[0003] The present invention provides a method for predicting dissolved oxygen in a culture pond. The method uses the water quality and environmental parameter data of the culture pond collected by the sensor to establish a dissolved oxygen time series prediction model, and outputs the future prediction value in real time to monitor the water quality in real time and prevent emergencies, so as to improve the early warning and management capabilities of aquaculture farms. The technical scheme adopted is as follows:
[0004] The present invention utilizes the water quality and environmental parameter data related to the aquaculture pond provided by the aquaculture factory, pre-processes the data, and then inputs the data into the CNN-DeepAR hybrid neural network model for learning to obtain the prediction results.
[0005] Specifically, a method for predicting dissolved oxygen in a culture pond is provided, and the method for predicting dissolved oxygen in a culture pond comprises:
[0006] Step 1: Use sensors to collect water quality and environmental data of the breeding pond and meteorological and environmental data of the breeding farm in real time, obtain relevant water quality and meteorological raw data, and perform data preprocessing on the relevant water quality and meteorological raw data;
[0007] Step 2: After setting the initial aeration volume, the Pearson correlation coefficient method is used to perform a correlation analysis on the pre-treated water quality and meteorological data and the dissolved oxygen concentration in the aquaculture pond, to determine the correlation coefficient between the relevant water quality and meteorological data and the dissolved oxygen concentration in the aquaculture pond, and to select data parameters with a correlation coefficient greater than 0.4;
[0008] Step 3, using the water quality meteorological parameters with a correlation coefficient greater than 0.4 in step 2 as input to the CNN-DeepAR hybrid neural network model, and predicting the dissolved oxygen concentration value of the breeding pond at the next moment through the CNN-DeepAR hybrid neural network model;
[0009] Step 4: Add a multi-head attention mechanism to further optimize the model and combine information from different time points.
[0010] Furthermore, the water quality environmental data in step 1 include chemical oxygen demand (COD), aquaculture pond water temperature (T), pH value, turbidity (NTU), ammonia nitrogen (NH3) and dissolved oxygen concentration (DO); the relevant meteorological environmental data include luminosity (OD), atmospheric pressure (P), air temperature (t), and humidity (w).
[0011] Furthermore, the data preprocessing in step 1 includes, in order, elimination of abnormal data values, data filling and normalization processing. The normalization processing method adopts local response normalization, and the formula is as follows:
[0012]
[0013] Among them, a represents the output result after the convolution layer; Indicates a position in this output structure; N represents the number of channels; n / 2 represents the depyh_raduis in the function; parameters k, n, α, β represent normalized hyperparameters, setting k = 2, n = 5, α = 1*e-4, β = 0.75.
[0014] Furthermore, in step 2, the Pearson correlation coefficient method is used to perform correlation coefficient analysis on the pre-treated relevant water quality monitoring data:
[0015]
[0016] Where cov(x,y) represents the covariance of x and y; σ(x) represents the standard deviation of x; σ(y) represents the standard deviation of y; i Represents the variable x with serial number i; represents the average value of variable x; y i Represents the variable y with serial number i; Represents the mean value of the variable y.
[0017] Furthermore, in step 3, predicting the dissolved oxygen concentration value of the dissolved oxygen control system at the next moment by using the CNN-DeepAR hybrid neural network model includes:
[0018] Step 301: Convert the data into a format suitable for CNN. Transform the time series data into image data. Specifically, divide the time series data into multiple time windows, and fill the observation values in each window as pixel values into a two-dimensional matrix.
[0019] Step 302: Adding CNN layers to the DeepAR model requires a deep learning framework (such as TensorFlow or PyTorch). Use the convolutional layer function provided by the framework (tf.keras.layers.Conv2D in TensorFlow) to add one or more convolutional layers.
[0020] Step 303: After adding the CNN layer, the model needs to be retrained. During the training process, the parameters of the CNN layer (such as convolution kernel size, stride and padding) and other hyperparameters of the DeepAR model (such as learning rate and batch size) are adjusted.
[0021] Furthermore, the multi-head attention mechanism in step 4 further optimizes the model by combining information from different time points, including:
[0022] Step 401, define an attention layer to calculate the attention weight of each time step and feature. This attention layer accepts two inputs: one is the hidden state of the model, and the other is the input sequence. Then, it uses these two inputs to calculate the attention weight of each time step and feature.
[0023] Step 402: In each attention head, define a query, key, and value vector. There are h attention heads, and the vector dimension of each head is d. k . These vectors can be generated by defining three fully connected layers. Specifically, the vector of each head can be calculated using the following formula:
[0024] Query i =W i Q x
[0025] Key i =W i K x
[0026] Value i =W i V x
[0027] Among them, x is the input data, i represents the i-th head, W i Q , W i K and W i V are the weight matrices used to generate query, key, and value vectors, respectively.
[0028] Step 403: Calculate the attention weight of each time step by passing the attention score into the softmax function. The softmax function expression is:
[0029]
[0030] Among them, Z i is the output value of the th node, i is the number of output nodes, that is, the number of classification categories.
[0031] Step 404: Input the vector x1, x2, ..., x t Multiply it by the weighted average of the attention weights c to calculate the output vector y of the model:
[0032]
[0033]
[0034] Among them, W is a learnable parameter, a i is the attention weight, x i is the vector of input time steps.
[0035] Step 405: After the model training is completed, the cross-test data set is used to evaluate the performance of the model and output the single-step or multi-step prediction step length.
[0036] Furthermore, the sensor used in step 1 collects the water quality environment data of the breeding pond and the meteorological environment data of the breeding farm in real time to obtain relevant water quality and meteorological raw data, including:
[0037] Set the interval sampling time period, which is preset to 300s;
[0038] Collect water quality and meteorological data within the interval sampling time period, and determine the number of collected data of each water quality parameter and meteorological parameter in the current group of water quality data and meteorological data collected within the preset interval sampling time period; wherein the water quality environment data contained in the water quality data include: chemical oxygen demand, aquaculture pond water temperature, pH value, turbidity, ammonia nitrogen, and dissolved oxygen concentration; the relevant meteorological environment data include luminosity, atmospheric pressure, air temperature, and humidity;
[0039] By adjusting the number of data collected for each water quality and meteorological parameter, the interval sampling time period that meets the specified data number standard is determined as the standard period. The specified data number standard is that the number of data collected for at least one water quality or meteorological parameter in each period is one, and the number of data collected for other types of water quality or meteorological parameters is no more than three.
[0040] Water quality and meteorological data are collected in real time during each standard period, and the data corresponding to each period is regarded as a set of water quality and meteorological data. After collecting a set of water quality and meteorological data, the water quality or meteorological parameters containing multiple collected data in each set of data are averaged and converted into unique water quality or meteorological parameter data. It is ensured that each set of water quality and meteorological data contains only one data for each parameter.
[0041] Each set of processed water quality and meteorological data is used as the water quality and meteorological monitoring data for the current interval sampling time period.
[0042] Beneficial effects of the present invention:
[0043] 1. Dynamic monitoring: Dissolved oxygen is an important gas required for aquatic organisms to breathe. Predicting dissolved oxygen concentration can help farms monitor water quality in real time and detect water quality problems in a timely manner.
[0044] 2. Prevent emergencies: When the dissolved oxygen concentration in the aquaculture pond is lower than a certain threshold, it will cause harm to the aquacultured organisms and may even cause death. Predicting the dissolved oxygen concentration can provide early warning and help farms prevent water quality emergencies.
[0045] 3. Optimize management: Dissolved oxygen is related to factors such as water temperature and water flow. Predicting dissolved oxygen concentration can help farms optimize management measures, adjust parameters such as water flow and water temperature, maintain stable water quality, and improve breeding efficiency.
[0046] 4. Environmental protection and energy saving: The concentration of dissolved oxygen is closely related to the oxygen supply in the water. Predicting the dissolved oxygen concentration can help farms reasonably arrange oxygen supply, avoid waste, reduce energy consumption, and achieve the goal of energy conservation and emission reduction. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 is a flow chart of the present invention;
[0048] Figure 2 It is a schematic diagram of the CNN-DeepAR structure of the present invention; DETAILED DESCRIPTION
[0049] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0050] The present invention provides a method for predicting dissolved oxygen in a culture pond. The method uses the water quality and environmental parameter data of the culture pond collected by the sensor to establish a dissolved oxygen time series prediction model, and outputs the future prediction value in real time to monitor the water quality in real time and prevent emergencies, so as to improve the early warning and management capabilities of aquaculture farms. The technical scheme adopted is as follows:
[0051] The present invention utilizes the water quality and environmental parameter data related to the aquaculture pond provided by the aquaculture factory, pre-processes the data, and then inputs the data into the CNN-DeepAR hybrid neural network model for learning to obtain the prediction results.
[0052] Specifically, a method for predicting dissolved oxygen in a culture pond is provided, the method comprising:
[0053] Step 1: Use sensors to collect water quality and environmental data of the breeding pond and meteorological and environmental data of the breeding farm in real time, obtain relevant water quality and meteorological raw data, and perform data preprocessing on the relevant water quality and meteorological raw data;
[0054] Step 2: After setting the initial aeration volume, the Pearson correlation coefficient method is used to perform a correlation analysis on the pre-treated water quality and meteorological data and the dissolved oxygen concentration in the aquaculture pond, to determine the correlation coefficient between the relevant water quality and meteorological data and the dissolved oxygen concentration in the aquaculture pond, and to select data parameters with a correlation coefficient greater than 0.4;
[0055] Step 3, using the water quality meteorological parameters with a correlation coefficient greater than 0.4 in step 2 as input to the CNN-DeepAR hybrid neural network model, and predicting the dissolved oxygen concentration value of the breeding pond at the next moment through the CNN-DeepAR hybrid neural network model;
[0056] Step 4: Add a multi-head attention mechanism to further optimize the model and combine information from different time points.
[0057] Specifically, the water quality environmental data in step 1 include chemical oxygen demand (COD), aquaculture pond water temperature (T), pH value, turbidity (NTU), ammonia nitrogen (NH3) and dissolved oxygen concentration (DO); the relevant meteorological environmental data include luminosity (OD), atmospheric pressure (P), air temperature (t), and humidity (w).
[0058] Specifically, the data preprocessing in step 1 includes, in order, elimination of abnormal data values, data filling and normalization processing. The normalization processing method adopts local response normalization, and the formula is as follows:
[0059]
[0060] Among them, a represents the output result after the convolution layer; Indicates a position in this output structure; N represents the number of channels; n / 2 represents the depyh_raduis in the function; parameters k, n, α, β represent normalized hyperparameters, setting k = 2, n = 5, α = 1*e-4, β = 0.75.
[0061] Specifically, in step 2, the Pearson correlation coefficient method is used to perform correlation coefficient analysis on the pre-processed relevant water quality monitoring data:
[0062]
[0063] Where cov(x,y) represents the covariance of x and y; σ(x) represents the standard deviation of x; σ(y) represents the standard deviation of y; i Represents the variable x with serial number i; represents the average value of variable x; y i Represents the variable y with serial number i; Represents the mean value of the variable y.
[0064] Specifically, in step 3, predicting the dissolved oxygen concentration value of the dissolved oxygen control system at the next moment by using the CNN-DeepAR hybrid neural network model includes:
[0065] Step 301: Convert the data into a format suitable for CNN. Transform the time series data into image data. Specifically, divide the time series data into multiple time windows, and fill the observation values in each window as pixel values into a two-dimensional matrix.
[0066] Step 302: Adding CNN layers to the DeepAR model requires a deep learning framework (such as TensorFlow or PyTorch). Use the convolutional layer function provided by the framework (tf.keras.layers.Conv2D in TensorFlow) to add one or more convolutional layers.
[0067] Step 303: After adding the CNN layer, the model needs to be retrained. During the training process, the parameters of the CNN layer (such as convolution kernel size, stride and padding) and other hyperparameters of the DeepAR model (such as learning rate and batch size) are adjusted.
[0068] Specifically, the multi-head attention mechanism in step 4 further optimizes the model by combining information at different time points, including:
[0069] Step 401, define an attention layer to calculate the attention weight of each time step and feature. This attention layer accepts two inputs: one is the hidden state of the model, and the other is the input sequence. Then, it uses these two inputs to calculate the attention weight of each time step and feature.
[0070] Step 402: In each attention head, define a query, key, and value vector. There are h attention heads, and the vector dimension of each head is d. k . These vectors can be generated by defining three fully connected layers. Specifically, the vector of each head can be calculated using the following formula:
[0071] Query i =W i Q x
[0072] Key i =W i K x
[0073] Value i =W i V x
[0074] Among them, x is the input data, i represents the i-th head, W i Q , W i K and W i V are the weight matrices used to generate query, key, and value vectors, respectively.
[0075] Step 403: Calculate the attention weight of each time step by passing the attention score into the softmax function. The softmax function expression is:
[0076]
[0077] Among them, Z i is the output value of the th node, i is the number of output nodes, that is, the number of classification categories.
[0078] Step 404: Input the vector x1, x2, ..., x t Multiply it by the weighted average of the attention weights c to calculate the output vector y of the model:
[0079]
[0080]
[0081] Among them, W is a learnable parameter, a i is the attention weight, x i is the vector of input time steps.
[0082] Step 405: After the model training is completed, the cross-test data set is used to evaluate the performance of the model and output the single-step or multi-step prediction step length.
[0083] Specifically, in step 1, the water quality environment data of the breeding pond and the meteorological environment data of the breeding farm are collected in real time using sensors to obtain relevant water quality and meteorological raw data, including:
[0084] The first step is to set the interval sampling time period, which is preset to 300s;
[0085] The second step is to collect water quality and meteorological data within the interval sampling time period, and determine the number of collected data of each water quality parameter and meteorological parameter in the current group of water quality data and meteorological data collected within the preset interval sampling time period; wherein the water quality environmental data contained in the water quality data include: chemical oxygen demand, aquaculture pond water temperature, pH value, turbidity, ammonia nitrogen, and dissolved oxygen concentration; the relevant meteorological environmental data include luminosity, atmospheric pressure, air temperature, and humidity;
[0086] The third step is to adjust the number of data collected for each water quality and meteorological parameter, and determine the interval sampling time period that meets the specified data number standard as the standard period. The specified data number standard is that in each period, the number of data collected for at least one water quality or meteorological parameter is one, and the number of data collected for other types of water quality or meteorological parameters is no more than three.
[0087] Step 4: Collect water quality and meteorological data in real time during each standard period, and use the data corresponding to each period as a set of water quality and meteorological data. After collecting a set of water quality and meteorological data, average the water quality or meteorological parameters containing multiple collected data in each set of data and convert them into unique water quality or meteorological parameter data. Ensure that each set of water quality and meteorological data contains only one data for each parameter.
Claims
1. A method for predicting dissolved oxygen in a culture pond, characterized in that: The dissolved oxygen time series prediction method comprises: Step 1: Use sensors to collect water quality and environmental data of the breeding pond and meteorological and environmental data of the breeding farm in real time, obtain relevant water quality and meteorological raw data, and perform data preprocessing on the relevant water quality and meteorological raw data; Step 2: After setting the initial aeration volume, the Pearson correlation coefficient method is used to perform a correlation analysis on the pre-treated water quality and meteorological data and the dissolved oxygen concentration in the aquaculture pond, to determine the correlation coefficient between the relevant water quality and meteorological data and the dissolved oxygen concentration in the aquaculture pond, and to select data parameters with a correlation coefficient greater than 0.4; Step 3, using the water quality meteorological parameters with a correlation coefficient greater than 0.4 in step 2 as input to the CNN-DeepAR hybrid neural network model, and predicting the dissolved oxygen concentration value of the breeding pond at the next moment through the CNN-DeepAR hybrid neural network model; Step 4: Add a multi-head attention mechanism to further optimize the model and combine information from different time points.
2. The dissolved oxygen time series prediction method according to claim 1, characterized in that: The water quality environmental data in step 1 include chemical oxygen demand, aquaculture pond water temperature, pH value, turbidity, ammonia nitrogen, and dissolved oxygen concentration; the relevant meteorological environmental data include luminosity, atmospheric pressure, air temperature, and humidity.
3. The dissolved oxygen time series prediction method according to claim 1, characterized in that: The data preprocessing in step 1 includes, in order, elimination of abnormal data values, data filling and normalization processing. The normalization processing method adopts local response normalization, and the formula is as follows: Among them, a represents the output result after the convolution layer; Indicates a position in this output structure; N represents the number of channels; n / 2 represents the depyh_raduis in the function; parameters k, n, α, β represent normalized hyperparameters, setting k = 2, n = 5, α = 1*e-4, β = 0.
75.
4. The dissolved oxygen time series prediction method according to claim 1, characterized in that: In step 2, the Pearson correlation coefficient method is used to perform correlation coefficient analysis on the pre-processed relevant water quality monitoring data: Where cov(x,y) represents the covariance of x and y; σ(x) represents the standard deviation of x; σ(y) represents the standard deviation of y; x i Represents the variable x with serial number i; represents the average value of variable x; y i Represents the variable y with serial number i; Represents the mean value of the variable y.
5. The dissolved oxygen time series prediction method according to claim 1, characterized in that: In step 3, the CNN-DeepAR hybrid neural network model is used to predict the dissolved oxygen concentration value of the dissolved oxygen control system at the next moment, including: Step 301: Convert the data into a format suitable for CNN. Transform the time series data into image data. Specifically, divide the time series data into multiple time windows, and fill the observation values in each window as pixel values into a two-dimensional matrix. Step 302: Adding CNN layers to the DeepAR model requires a deep learning framework (such as TensorFlow or PyTorch). Use the convolutional layer function provided by the framework (tf.keras.layers.Conv2D in TensorFlow) to add one or more convolutional layers. Step 303: After adding the CNN layer, the model needs to be retrained. During the training process, the parameters of the CNN layer (such as convolution kernel size, stride and padding) and other hyperparameters of the DeepAR model (such as learning rate and batch size) are adjusted.
6. The dissolved oxygen time series prediction method according to claim 1, characterized in that: The addition of the multi-head attention mechanism in step 4 further optimizes the model by combining information from different time points, including: Step 401, define an attention layer to calculate the attention weight of each time step and feature. This attention layer accepts two inputs: one is the hidden state of the model, and the other is the input sequence. Then, it uses these two inputs to calculate the attention weight of each time step and feature. Step 402: In each attention head, define a query, key, and value vector. There are h attention heads, and the vector dimension of each head is d. k . These vectors can be generated by defining three fully connected layers. Specifically, the vector of each head can be calculated using the following formula: Query i =W i Q x Key i =W i K x Value i =W i V x Among them, x is the input data, i represents the i-th head, W i Q , W i K and W i V are the weight matrices used to generate query, key, and value vectors, respectively. Step 403: Calculate the attention weight of each time step by passing the attention score into the softmax function. The softmax function expression is: Among them, Z i is the output value of the th node, i is the number of output nodes, that is, the number of classification categories. Step 404: Input the vector x1, x2, ..., x t Multiply it by the weighted average of the attention weights c to calculate the output vector y of the model: Among them, W is a learnable parameter, a i is the attention weight, x i is the vector of input time steps. Step 405: After the model training is completed, the cross-test data set is used to evaluate the performance of the model and output the single-step or multi-step prediction step length.
7. The dissolved oxygen time series prediction method according to claim 1, characterized in that: In step 1, sensors are used to collect water quality and environmental data of the breeding pond and meteorological and environmental data of the breeding farm in real time to obtain relevant water quality and meteorological raw data, including: Set the interval sampling time period, which is preset to 300s; Collect water quality and meteorological data within the interval sampling time period, and determine the number of collected data of each water quality parameter and meteorological parameter in the current group of water quality data and meteorological data collected within the preset interval sampling time period; wherein the water quality environment data contained in the water quality data include: chemical oxygen demand, aquaculture pond water temperature, pH value, turbidity, ammonia nitrogen, and dissolved oxygen concentration; the relevant meteorological environment data include luminosity, atmospheric pressure, air temperature, and humidity; By adjusting the number of collected data for each water quality and meteorological parameter, determine the interval sampling time period that meets the specified data number standard as the standard period. The specified data number standard is that the number of collected data for at least one water quality or meteorological parameter in each period is one, and the number of collected data for other types of water quality or meteorological parameters is no more than three. Collect water quality and meteorological data in real time during each standard period, and take the data corresponding to each period as a set of water quality and meteorological data. After collecting a set of water quality and meteorological data, average the water quality or meteorological parameters that contain multiple collected data in each set of data and convert them into unique water quality or meteorological parameter data. Ensure that each set of water quality and meteorological data contains only one data for each parameter. Each set of processed water quality and meteorological data is used as the water quality and meteorological monitoring data for the current interval sampling time period.
Citation Information
Patent Citations
Multivariable input and multivariable output time series prediction method and system
CN112561704A
Aeration system dissolved oxygen control method based on adaptive neural network model
CN114275912A
