Drainage basin water quality prediction method, device, equipment and medium
By constructing a multi-index water quality prediction model, using the water quality feature extraction module and the time feature extraction module to fusion information in the time dimension and channel dimension, the limitations of the existing water quality prediction model in dealing with complex nonlinear relationships and joint modeling of multi-dimensional data are solved, and higher water quality prediction accuracy and calculation efficiency are achieved.
Patent Information
- Application Number
- CN202510379380.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2045-03-28
AI Technical Summary
The existing water quality prediction models have limitations in dealing with complex nonlinear relationships, capturing the mutual influence and long-term dependence between water quality indicators, especially in the joint modeling of multi-dimensional data, which is difficult to effectively handle.
By using the multi-index water quality prediction method, a multi-index water quality prediction model including water quality feature extraction module, time feature extraction module and fully connected module is constructed. The model combines information in the time dimension and channel dimension, and processes missing values through chain equation interpolation to improve the prediction accuracy of the model.
It effectively improves the performance and accuracy of the water quality prediction model, can better capture the spatial and temporal dependence of water quality data and the multi-dimensional interaction influence, and improves the accuracy and calculation efficiency of water quality prediction.
Smart Images

Figure CN119884672A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of water area detection, and in particular to a method, device, equipment and medium for predicting water quality in a river basin. Background Art
[0002] At present, the research on water quality prediction mainly relies on the modeling and analysis of historical water quality data. Although traditional water quality prediction methods such as statistical regression models and time series analysis models can achieve water quality prediction to a certain extent, they have certain limitations in dealing with complex nonlinear relationships and capturing the mutual influence and long-term dependence between water quality indicators. With the rapid development of deep learning technology, prediction models based on neural networks have gradually become an important research direction in the field of water quality prediction. These models can automatically capture the development trend of water quality data and show higher prediction accuracy and application potential than traditional methods. However, in practical applications, water quality data usually involves multiple pollutant indicators, which often have complex spatial and temporal correlations. Although some existing water quality prediction models can capture the dependencies of some time dimensions, there are still certain challenges in the joint modeling of multi-dimensional data, especially in the modeling of time dependence and the interaction between multiple water quality indicators. Therefore, how to deal with missing values in water quality data, capture multi-dimensional spatiotemporal dependencies, and improve the prediction accuracy and computational efficiency of the model are still key issues that need to be solved in the field of water quality prediction. Summary of the invention
[0003] The present invention provides a method, device, equipment and medium for predicting water quality in a river basin, the purpose of which is to improve the accuracy of water quality prediction.
[0004] In order to achieve the above object, the present invention provides a method for predicting water quality in a river basin, comprising: Step 1, obtaining historical water quality monitoring data of multiple water quality monitoring stations, where the historical water quality monitoring data includes water quality monitoring time and historical water quality data; Step 2, inputting historical water quality monitoring data into the constructed multi-indicator water quality prediction model, training the multi-indicator water quality prediction model, and obtaining a trained multi-indicator water quality prediction model; Step 3: Input the historical water quality monitoring data obtained by the target water quality monitoring station in the target watershed into the trained multi-index water quality prediction model to perform water quality prediction, and obtain the prediction results of future water quality indicators of the target watershed; The multi-index water quality prediction model includes a water quality feature extraction module for information fusion in the time dimension and channel dimension, a time feature extraction module for adding time information to the features of each time step, and a fully connected module for fusion; The input end of the water quality feature extraction module and the input end of the time feature extraction module are both the input ends of the multi-indicator water quality prediction model. The output end of the water quality feature extraction module and the output end of the time feature extraction module are both connected to the input end of the fully connected module, and the output end of the fully connected module is the output end of the multi-indicator water quality prediction model.
[0005] Furthermore, before step 2, it also includes: The historical water quality monitoring data were interpolated using the chain equation interpolation method to obtain a complete water quality monitoring data set.
[0006] Furthermore, the historical water quality monitoring data are interpolated using the chain equation interpolation method to obtain a complete water quality monitoring data set, including: Missing values of each variable in the historical water quality monitoring data were replaced with temporary placeholders for the non-missing values of the corresponding variable before interpolation; For each variable with missing values, other variables were used to interpolate the variables with missing values through a linear regression model to obtain a complete water quality monitoring data set.
[0007] Furthermore, the water quality feature extraction module is composed of multiple multi-layer perception units stacked together; The input end of the first multi-layer perception unit among the multiple multi-layer perception units is the input end of the water quality feature extraction module; The output end of the last multi-layer perception unit among the multiple multi-layer perception units is connected to the input end of the fully connected module.
[0008] Specifically, the multi-layer perception unit includes: The first batch normalization layer, the first multi-layer perception layer, the first Dropout layer, the first residual connection layer, the second batch normalization layer, the second multi-layer perception layer, the second Dropout layer, and the second residual connection layer; The input end of the first batch normalization layer is the input end of the multi-layer perception unit and is connected to the first input end of the first residual connection layer. The output end of the first batch normalization layer is connected to the input end of the first multi-layer perception layer, the output end of the first multi-layer perception layer is connected to the input end of the first Dropout layer, the output end of the first Dropout layer is respectively connected to the second input end of the first residual connection layer, the output end of the first residual connection layer is connected to the input end of the second batch normalization layer, the output end of the second batch normalization layer is connected to the input end of the second multi-layer perception layer, the output end of the second multi-layer perception layer is connected to the input end of the Dropout layer, the output end of the Dropout layer and the output end of the first residual connection layer are both connected to the input end of the second residual connection layer, and the output end of the second residual connection layer is the output end of the multi-layer perception unit and is connected to the input end of the fully connected module.
[0009] Further, the temporal feature extraction module includes a first nonlinear hidden layer, a second nonlinear hidden layer, and a linear projection layer connected in sequence; The input end of the nonlinear hidden layer is the input end of the temporal feature extraction module; The output end of the linear projection layer is the output end of the temporal feature extraction module and is connected to the input end of the fully connected module.
[0010] Specifically, the temporal feature extraction module is used to: The water quality monitoring time in the historical water quality monitoring data is input into the first nonlinear hidden layer for mapping to obtain the first time feature , the expression is: in, Indicates the water quality monitoring time in the historical water quality monitoring data. represents the weight matrix of the first nonlinear hidden layer, represents the activation function, represents the bias, represents the channel dimension, represents the dimension of the first nonlinear hidden layer, represents the field of real numbers; The first time feature is input into the second nonlinear hidden layer for mapping to obtain the second time feature , the expression is: in, represents the weight matrix of the second nonlinear hidden layer, represents the bias, represents the dimension of the second nonlinear hidden layer; The second time feature is input into the linear projection layer, and the second time feature is mapped to a dimension consistent with the number of feature channels to obtain the third time feature , the expression is: in, represents the weight matrix of the linear projection layer, represents the bias, Represents the dimensions of the linear projection layer.
[0011] The present invention also provides a watershed water quality prediction device, comprising: An acquisition module is used to acquire historical water quality monitoring data of multiple water quality monitoring sites, where the historical water quality monitoring data includes water quality monitoring time and historical water quality data; A training module, used for inputting historical water quality monitoring data into the constructed multi-indicator water quality prediction model, training the multi-indicator water quality prediction model, and obtaining a trained multi-indicator water quality prediction model; A prediction module is used to input the historical water quality monitoring data obtained by the target water quality monitoring station in the target watershed into the trained multi-index water quality prediction model to perform water quality prediction and obtain the prediction results of future water quality indicators of the target watershed; The multi-index water quality prediction model includes a water quality feature extraction module for information fusion in the time dimension and channel dimension, a time feature extraction module for adding time information to the features of each time step, and a fully connected module for fusion; The input end of the water quality feature extraction module and the input end of the time feature extraction module are both the input ends of the multi-indicator water quality prediction model. The output end of the water quality feature extraction module and the output end of the time feature extraction module are both connected to the input end of the fully connected module, and the output end of the fully connected module is the output end of the multi-indicator water quality prediction model.
[0012] The present invention also provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a method for predicting water quality of a watershed when executing the computer program.
[0013] The present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the method for predicting water quality of a watershed is implemented.
[0014] The above scheme of the present invention has the following beneficial effects: The present invention obtains historical water quality monitoring data of multiple water quality monitoring stations and constructs a multi-index water quality prediction model, trains the multi-index water quality prediction model, and obtains a trained multi-index water quality prediction model; inputs historical water quality monitoring data obtained by the target water quality monitoring station in the target watershed into the trained multi-index water quality prediction model to predict water quality, and obtains the prediction results of future water quality indicators of the target watershed; the multi-index water quality prediction model includes a water quality feature extraction module for information fusion in the time dimension and the channel dimension, a time feature extraction module for adding time information to the features of each time step, and a fully connected module for fusion; compared with the prior art, the multi-index water quality prediction model provided by the present invention uses a water quality feature extraction module to capture the fluctuation trend of water quality monitoring data and the potential interactive influence information between different water quality indicators in the time dimension and the channel dimension respectively; after encoding the timestamp of the historical water quality monitoring data by adding a time feature extraction module, a time factor is added to each predicted water quality indicator to increase the model to capture the time fluctuation trend of the water quality monitoring data, thereby effectively improving the performance of the water quality prediction model and thus improving the accuracy of water quality prediction.
[0015] Other beneficial effects of the present invention will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a schematic diagram of a flow chart of an embodiment of the present invention; Figure 2 It is a schematic diagram of the structure of a multi-index water quality prediction model in an embodiment of the present invention; Figure 3 A schematic diagram of the structure of a multi-layer perception unit in an embodiment of the present invention; Figure 4 It is a schematic diagram of the structure of a watershed water quality prediction device in an embodiment of the present invention; Figure 5 Schematic diagram of the structure of a terminal device in an embodiment of the present invention. DETAILED DESCRIPTION
[0017] In order to make the technical problems, technical solutions and advantages to be solved by the present invention clearer, the following will be described in detail with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0018] In the description of the present invention, it should be noted that the terms “first”, “second” and “third” are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0019] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installation", "connection" and "connection" should be understood in a broad sense, for example, it can be a locking connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0020] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0021] In view of the existing problems, the present invention provides a method, device, equipment and medium for predicting water quality in a river basin.
[0022] like Figure 1 , Figure 2 As shown, an embodiment of the present invention provides a method for predicting water quality in a river basin, comprising: Step 1, obtaining historical water quality monitoring data of multiple water quality monitoring stations, where the historical water quality monitoring data includes water quality monitoring time and historical water quality data; Step 2, inputting historical water quality monitoring data into the constructed multi-indicator water quality prediction model, training the multi-indicator water quality prediction model, and obtaining a trained multi-indicator water quality prediction model; Step 3: Input the historical water quality monitoring data obtained by the target water quality monitoring station in the target watershed into the trained multi-index water quality prediction model to perform water quality prediction, and obtain the prediction results of future water quality indicators of the target watershed; The multi-index water quality prediction model includes a water quality feature extraction module for information fusion in the time dimension and channel dimension, a time feature extraction module for adding time information to the features of each time step, and a fully connected module for fusion; The input end of the water quality feature extraction module and the input end of the time feature extraction module are both the input ends of the multi-indicator water quality prediction model. The output end of the water quality feature extraction module and the output end of the time feature extraction module are both connected to the input end of the fully connected module, and the output end of the fully connected module is the output end of the multi-indicator water quality prediction model.
[0023] Specifically, historical water quality monitoring data includes water quality monitoring time and historical water quality data. Among them, historical water quality data includes multiple types, namely dissolved oxygen concentration data, permanganate index, total phosphorus data and total nitrogen data. Among them, dissolved oxygen concentration data represents molecular oxygen in the air dissolved in the water body, which is used to reflect the self-purification ability of the water body. The permanganate index is used to reflect the pollution of organic and non-electrode oxidizable substances in the water body. The total phosphorus data is used to reflect the content of phosphorus in the water body. The total nitrogen data represents the total amount of various forms of organic and non-electrode nitrogen in the water body, which is used to reflect the eutrophication state of the water body. The historical water quality monitoring data is expressed as: in, Represents historical water quality monitoring data, Represents historical water quality data, , Indicates the type of historical water quality data, Indicates A time series of historical water quality data, , represents the sequence length, Indicates the water quality monitoring time.
[0024] Due to accidental factors, the water quality monitoring data monitored by the water quality monitoring station may be missing due to non-human reasons such as power outages or sensor fault lights, thereby affecting the availability of the data, and this missing data is continuous, that is, the water quality monitoring results are lost for a period of time.
[0025] In order to eliminate the adverse effects of missing data on the accuracy of the water quality prediction model, the embodiment of the present invention further includes, before step 2: The historical water quality monitoring data were interpolated using the chain equation interpolation method to obtain a complete water quality monitoring data set.
[0026] Specifically, the historical water quality monitoring data are interpolated using the chain equation interpolation method to obtain a complete water quality monitoring data set, including: Missing values of each variable in the historical water quality monitoring data were replaced with temporary placeholders for the non-missing values of the corresponding variable before interpolation; For each variable with missing values, other variables were used to interpolate the variables with missing values through a linear regression model to obtain a complete water quality monitoring data set.
[0027] In the embodiment of the present invention, the process of interpolating the variables with missing values by using other variables through the linear regression model will be iterated multiple times, and each round of interpolation is based on the interpolation result of the previous round until all missing values are filled. The specific process is as follows: remember is a water quality monitoring dataset with no missing values. is a water quality monitoring dataset with missing values. , Indicates Historical water quality data with missing values The interpolation process requires a total of Round cycle, Generally, an integer between 10 and 50 is used. In the first cycle, exist The regression on , and interpolate the missing values of according to this regression. The interpolation should follow the principle of multiple interpolation, that is, consider the random variability of model parameters and the random variability of model parameters at the same time; then do exist (including interpolated values) and The regression on The missing values are interpolated; this process continues until the last exist The regression on The missing values of the second to nth rounds of imputation will follow the process of the first round, except that each regression now includes all variables except the variable itself, and each round of the cycle should use the latest imputed values. After all the cycles are completed, take the The interpolation results of the rounds are taken as the final results to form a complete water quality monitoring data set. data set, you need to convert the above The round-robin process is independent Second-rate.
[0028] Most preferably, the water quality feature extraction module is formed by stacking a plurality of multi-layer perception units; The input end of the first multi-layer perception unit among the multiple multi-layer perception units is the input end of the water quality feature extraction module; The output end of the last multi-layer perception unit among the multiple multi-layer perception units is connected to the input end of the fully connected module.
[0029] In the embodiment of the present invention, the water quality feature extraction module is composed of four multi-layer perception units stacked together.
[0030] Most preferably, Figure 3 As shown, the multi-layer perception unit includes: The first batch normalization layer, the first multi-layer perception layer, the first Dropout layer, the first residual connection layer, the second batch normalization layer, the second multi-layer perception layer, the second Dropout layer, and the second residual connection layer; The input end of the first batch normalization layer is the input end of the multi-layer perception unit and is connected to the first input end of the first residual connection layer. The output end of the first batch normalization layer is connected to the input end of the first multi-layer perception layer, the output end of the first multi-layer perception layer is connected to the input end of the first Dropout layer, the output end of the first Dropout layer is respectively connected to the second input end of the first residual connection layer, the output end of the first residual connection layer is connected to the input end of the second batch normalization layer, the output end of the second batch normalization layer is connected to the input end of the second multi-layer perception layer, the output end of the second multi-layer perception layer is connected to the input end of the Dropout layer, the output end of the Dropout layer and the output end of the first residual connection layer are both connected to the input end of the second residual connection layer, and the output end of the second residual connection layer is the output end of the multi-layer perception unit and is connected to the input end of the fully connected module.
[0031] In the embodiment of the present invention, the specific implementation process of the multi-layer perception unit is as follows: The historical water quality data in the complete water quality monitoring dataset Enter the first batch normalization layer, represents the time step of historical data, Indicates the type of historical water quality data. First, the input historical water quality data is batch normalized along the time direction. The calculation expression is: ; in, represents the historical water quality data after batch normalization, represents the batch normalization operation, Represents a flattening operation; The batch normalized historical water quality data is input into the first multi-layer perception layer for processing, and the expression is: in, represents the time characteristics of initial water quality, , Represents the linear change matrix in the time dimension, represents the bias term; Initial water quality time characteristics Input the first Dropout layer to perform the dropout operation, the expression is: The historical water quality data in the complete water quality monitoring dataset And the water quality time characteristics after dropout operation Input the first residual connection layer for residual connection, the expression is: in, represents the temporal characteristics of water quality extracted along the time dimension; The water quality temporal characteristics extracted along the time dimension Input the second batch normalization layer to perform batch normalization along the channel dimension. The calculation expression is: ; The water quality time characteristics after batch normalization Input to the second multi-layer perception layer for processing, the expression is: in, Represents the linear change matrix of the time dimension, is the bias term; The water quality time characteristics processed by the second multi-layer perception layer Enter the second Dropout layer for dropout operation, the expression is: The water quality temporal characteristics extracted along the time dimension And the water quality time characteristics after the second dropout layer operation Enter the second residual connection layer for residual connection, the expression is: in, represents the final water quality time characteristics, It contains the temporal trend information of various water quality data in the input water quality data and the relationship information between various water quality indicators.
[0032] Most preferably, the temporal feature extraction module comprises a first nonlinear hidden layer, a second nonlinear hidden layer, and a linear projection layer connected in sequence; The input end of the nonlinear hidden layer is the input end of the temporal feature extraction module; The output end of the linear projection layer is the output end of the temporal feature extraction module and is connected to the input end of the fully connected module.
[0033] In the embodiment of the present invention, each nonlinear hidden layer projects the input data along the time feature and the multivariate dimension, and the final linear projection layer completes the time feature encoding.
[0034] Specifically, the temporal feature extraction module is used to: The water quality monitoring time in the historical water quality monitoring data is input into the first nonlinear hidden layer for mapping to obtain the first time feature , the expression is: in, Indicates the water quality monitoring time in the historical water quality monitoring data. represents the weight matrix of the first nonlinear hidden layer, represents the activation function, represents the bias, represents the channel dimension, represents the dimension of the first nonlinear hidden layer, represents the field of real numbers; The first time feature is input into the second nonlinear hidden layer for mapping to obtain the second time feature , the expression is: in, represents the weight matrix of the second nonlinear hidden layer, represents the bias, represents the dimension of the second nonlinear hidden layer; The second time feature is input into the linear projection layer, and the second time feature is mapped to a dimension consistent with the number of feature channels to obtain the third time feature , the expression is: in, represents the weight matrix of the linear projection layer, Indicates bias.
[0035] Specifically, the fully connected module combines the third temporal features and After fusion and mapping to the output space, the prediction results of water quality indicators are obtained, and the expression is: in, It represents the prediction result of water quality index. represents the weight matrix of the fully connected module, represents the bias, Represents the fused features.
[0036] In this embodiment of the present invention, step 2 specifically includes: The complete water quality monitoring data is divided into an 80% training set and a 20% validation set. The training set is used to train the multi-index water quality prediction model, and the performance of the multi-index water quality prediction model is evaluated on the validation set. Before training the multi-indicator water quality prediction model, the different data metrics of different characteristic parameters in the water quality monitoring data are considered. The data is normalized before being used as the input of the multi-indicator water quality prediction model. Normalized data is essentially a linear transformation of time series data, scaling the data to This type of transformation will not affect the original fluctuation information of the data series. The maximum and minimum normalization formula is as follows: During the training experiment, the learning rate was set to 0.001, and the adaptive weight loss function was used to measure the model training error. The loss function was back-propagated through the adaptive moment estimation optimizer (Adaptive Moment Estimation, Adam) to update the network parameters. The model training rounds (Epochs) were 50 times, and the batch size (Batch_size) was set to 32; In particular, in terms of the loss function, the embodiment of the present invention takes into account that in multiple water quality index prediction tasks, it is necessary to consider dynamically adjusting the contribution of each water quality index prediction error to the overall loss to improve the performance and prediction adaptability of the model; The embodiment of the present invention improves the mean square error (MSE) loss function commonly used in regression prediction tasks and designs an adaptive weight loss function as the loss function for model training.
[0037] The MSE loss function assists the model in reducing the large prediction errors of some samples during the training process by squaring the error. The calculation formula is as follows: in, It is The true value of the samples, It is The predicted value of samples, is the total number of samples.
[0038] The calculation formula of the adaptive weight loss function further constructed on this basis is as follows: in, is the sum of the losses of each predicted water quality index, is the MSE loss function, that is, The cumulative training error of features, It is The weights of the indicators are determined by the prediction errors of the predicted water quality indicators. For samples with large prediction errors, their weights can be increased, so that the model pays more attention to water quality indicators that are more difficult to predict.
[0039] During the training process, the loss function is calculated and back-propagated based on the prediction results output by the multi-indicator water quality prediction model. The gradient is calculated based on the result of back-propagation, and the model parameters are updated based on the gradient until the end of the training round. The trained multi-indicator water quality prediction model is obtained, which can be used to predict multiple water quality parameter indicators at the same time.
[0040] In an embodiment of the present invention, historical water quality monitoring data obtained by a target water quality monitoring station in a target river basin is input into a trained multi-index water quality prediction model to perform water quality prediction, and a prediction result of future water quality indicators of the target river basin is obtained. The prediction result of water quality indicators includes the dissolved oxygen concentration, permanganate index, total phosphorus content and total nitrogen content of the target river basin in a period of time in the future. The dissolved oxygen concentration, permanganate index, total phosphorus content and total nitrogen content of the target river basin in a period of time in the future are used to evaluate the degree of water pollution in the target river basin in a period of time in the future.
[0041] The embodiment of the present invention obtains historical water quality monitoring data of multiple water quality monitoring stations and inputs them into a multi-index water quality prediction model to construct the multi-index water quality prediction model, and trains the multi-index water quality prediction model to obtain a trained multi-index water quality prediction model; the historical water quality monitoring data obtained by the target water quality monitoring station in the target watershed is input into the trained multi-index water quality prediction model to predict water quality, and obtain the prediction results of future water quality indicators of the target watershed; the multi-index water quality prediction model includes a water quality feature extraction module for information fusion in the time dimension and the channel dimension, a time feature extraction module for adding time information to the features of each time step, and a fully connected module for fusion; compared with the prior art, the multi-index water quality prediction model provided by the embodiment of the present invention uses a water quality feature extraction module to capture the fluctuation trend of water quality monitoring data and the potential interactive influence information between different water quality indicators in the time dimension and the channel dimension respectively; after encoding the timestamp of the historical water quality monitoring data by adding a time feature extraction module, a time factor is added to each predicted water quality indicator to increase the model to capture the time fluctuation trend of the water quality monitoring data, thereby effectively improving the performance of the water quality prediction model and thus improving the accuracy of water quality prediction.
[0042] Corresponding to the basin water quality prediction method described in the above embodiment, Figure 4 As shown, the embodiment of the present invention further provides a river basin water quality prediction device 100, the river basin water quality prediction device 100 comprises: An acquisition module 101 is used to acquire historical water quality monitoring data of multiple water quality monitoring sites, where the historical water quality monitoring data includes water quality monitoring time and historical water quality data; A training module 102 is used to input historical water quality monitoring data into the constructed multi-indicator water quality prediction model, train the multi-indicator water quality prediction model, and obtain a trained multi-indicator water quality prediction model; Prediction module 103, used to input historical water quality monitoring data acquired by the target water quality monitoring station in the target watershed into the trained multi-index water quality prediction model to perform water quality prediction, and obtain the prediction results of future water quality indicators of the target watershed; The multi-index water quality prediction model includes a water quality feature extraction module for information fusion in the time dimension and channel dimension, a time feature extraction module for adding time information to the features of each time step, and a fully connected module for fusion; The input end of the water quality feature extraction module and the input end of the time feature extraction module are both the input ends of the multi-indicator water quality prediction model. The output end of the water quality feature extraction module and the output end of the time feature extraction module are both connected to the input end of the fully connected module, and the output end of the fully connected module is the output end of the multi-indicator water quality prediction model.
[0043] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0044] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0045] The embodiment of the present invention also provides a terminal device, such as Figure 5 As shown, the terminal device D10 of this embodiment includes: at least one processor D100 ( Figure 5 Only one processor is shown in the figure), a memory D101, and a computer program D102 stored in the memory D101 and executable on the at least one processor D100, wherein the processor D100 implements the above-mentioned basin water quality prediction method when executing the computer program D102.
[0046] The terminal device D10 may be a computing device such as a desktop computer, a notebook, a PDA, a server, a server cluster, a cloud server, etc. The terminal device may include, but is not limited to, a processor D100 and a memory D101. Those skilled in the art will appreciate that Figure 5 This is only an example of the terminal device D10 and does not constitute a limitation on the terminal device D10. The terminal device D10 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0047] The processor D100 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0048] In some embodiments, the memory D101 may be an internal storage unit of the terminal device D10, such as a hard disk or memory of the terminal device D10. In other embodiments, the memory D101 may also be an external storage device of the terminal device D10, such as a plug-in hard disk, a smart memory card (SMC, SmartMedia Card), a secure digital (SD, Secure Digital) card, a flash card (Flash Card), etc. equipped on the terminal device D10. Further, the memory D101 may also include both an internal storage unit of the terminal device D10 and an external storage device. The memory D101 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory D101 may also be used to temporarily store data that has been output or is to be output.
[0049] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0050] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0051] An embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, a method for predicting water quality of a watershed is implemented.
[0052] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the construction device / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a disk or an optical disk.
[0053] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for predicting water quality in a river basin, characterized in that: include: Step 1, obtaining historical water quality monitoring data of multiple water quality monitoring sites, wherein the historical water quality monitoring data includes water quality monitoring time and historical water quality data; Step 2, inputting the historical water quality monitoring data into the constructed multi-indicator water quality prediction model, training the multi-indicator water quality prediction model, and obtaining a trained multi-indicator water quality prediction model; Step 3, inputting the historical water quality monitoring data obtained by the target water quality monitoring station in the target watershed into the trained multi-index water quality prediction model to perform water quality prediction, and obtaining the prediction results of future water quality indicators of the target watershed; The multi-index water quality prediction model includes a water quality feature extraction module for information fusion in the time dimension and channel dimension, a time feature extraction module for adding time information to the features of each time step, and a fully connected module for fusion; The input end of the water quality feature extraction module and the input end of the time feature extraction module are both input ends of the multi-indicator water quality prediction model, the output end of the water quality feature extraction module and the output end of the time feature extraction module are both connected to the input end of the fully connected module, and the output end of the fully connected module is the output end of the multi-indicator water quality prediction model.
2. The method for predicting water quality of a river basin according to claim 1, characterized in that: Before step 2, the method further includes: The historical water quality monitoring data is interpolated using a chain equation interpolation method to obtain a complete water quality monitoring data set.
3. The method for predicting water quality of a river basin according to claim 2, characterized in that: The historical water quality monitoring data are interpolated using the chain equation interpolation method to obtain a complete water quality monitoring data set, including: replacing missing values of each variable in the historical water quality monitoring data with temporary placeholders for non-missing values of the corresponding variable before interpolation; For each variable with missing values, other variables were used to interpolate the variables with missing values through a linear regression model to obtain a complete water quality monitoring data set.
4. The method for predicting water quality in a river basin according to claim 3, characterized in that: The water quality feature extraction module is composed of a plurality of multi-layer perception units stacked together; The input end of the first multi-layer perception unit among the multiple multi-layer perception units is the input end of the water quality feature extraction module; The output end of the last multi-layer perception unit among the multiple multi-layer perception units is connected to the input end of the fully connected module.
5. The method for predicting water quality of a river basin according to claim 4, characterized in that: The multi-layer perception unit comprises: The first batch normalization layer, the first multi-layer perception layer, the first Dropout layer, the first residual connection layer, the second batch normalization layer, the second multi-layer perception layer, the second Dropout layer, and the second residual connection layer; The input end of the first batch normalization layer is the input end of the multi-layer perception unit and is connected to the first input end of the first residual connection layer. The output end of the first batch normalization layer is connected to the input end of the first multi-layer perception layer. The output end of the first multi-layer perception layer is connected to the input end of the first Dropout layer. The output ends of the first Dropout layer are respectively connected to the second input end of the first residual connection layer. The output end of the first residual connection layer is connected to the input end of the second batch normalization layer. The output end of the second batch normalization layer is connected to the input end of the second multi-layer perception layer. The output end of the second multi-layer perception layer is connected to the input end of the Dropout layer. The output end of the Dropout layer and the output end of the first residual connection layer are both connected to the input end of the second residual connection layer. The output end of the second residual connection layer is the output end of the multi-layer perception unit and is connected to the input end of the fully connected module.
6. The method for predicting water quality of a river basin according to claim 5, characterized in that: The temporal feature extraction module comprises a first nonlinear hidden layer, a second nonlinear hidden layer, and a linear projection layer connected in sequence; The input end of the nonlinear hidden layer is the input end of the time feature extraction module; The output end of the linear projection layer is the output end of the temporal feature extraction module and is connected to the input end of the fully connected module.
7. The method for predicting water quality in a river basin according to claim 6, characterized in that: The time feature extraction module is used for: The water quality monitoring time in the historical water quality monitoring data is input into the first nonlinear hidden layer for mapping to obtain the first time feature , the expression is: ; in, Indicates the water quality monitoring time in the historical water quality monitoring data. represents the weight matrix of the first nonlinear hidden layer, represents the activation function, Indicates bias, represents the channel dimension, represents the dimension of the first nonlinear hidden layer, represents the field of real numbers; The first time feature is input into the second nonlinear hidden layer for mapping to obtain the second time feature , the expression is: ; in, represents the weight matrix of the second nonlinear hidden layer, Indicates bias, represents the dimension of the second nonlinear hidden layer; The second time feature is input into the linear projection layer, and the second time feature is mapped to a dimension consistent with the number of feature channels to obtain the third time feature , the expression is: ; in, represents the weight matrix of the linear projection layer, Indicates bias, Represents the dimensions of the linear projection layer.
8. A watershed water quality prediction device, characterized in that: include: An acquisition module, used to acquire historical water quality monitoring data of multiple water quality monitoring sites, wherein the historical water quality monitoring data includes water quality monitoring time and historical water quality data; A training module, used for inputting the historical water quality monitoring data into the constructed multi-indicator water quality prediction model, training the multi-indicator water quality prediction model, and obtaining a trained multi-indicator water quality prediction model; A prediction module, used to input historical water quality monitoring data obtained by the target water quality monitoring station in the target watershed into the trained multi-index water quality prediction model to perform water quality prediction, and obtain the prediction results of future water quality indicators of the target watershed; The multi-index water quality prediction model includes a water quality feature extraction module for information fusion in the time dimension and channel dimension, a time feature extraction module for adding time information to the features of each time step, and a fully connected module for fusion; The input end of the water quality feature extraction module and the input end of the time feature extraction module are both input ends of the multi-indicator water quality prediction model, the output end of the water quality feature extraction module and the output end of the time feature extraction module are both connected to the input end of the fully connected module, and the output end of the fully connected module is the output end of the multi-indicator water quality prediction model.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for predicting water quality of a river basin as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for predicting water quality of a river basin as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Water quality prediction model training method and device, water quality prediction method and device, equipment and medium
CN113361690A
Event sequence prediction method based on time sequence convolution and relation modeling
CN114723003A
Basin water quality prediction method and system, electronic equipment and storage medium
CN116187203A
Time series data prediction method, device and equipment
CN117668490A
Water quality influence factor importance measuring method, system and equipment and storage medium
CN118606650A
Cited By
Water quality monitoring data analysis method and system
CN120632369A
A method and system for analyzing water quality monitoring data
CN120632369B
Water quality prediction method and device, computer equipment and storage medium
CN120804601A