A water quality prediction method and system based on vegetation image and hybrid water quality model
By combining vegetation hyperspectral images and water quality historical data, a mixed water quality prediction model is constructed, which solves the problem that traditional water quality prediction methods are difficult to accurately reflect water quality changes, and improves the accuracy and reliability of water quality prediction.
Patent Information
- Application Number
- CN202411406887.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-10-10
AI Technical Summary
Traditional water quality prediction methods rely only on historical water quality data, which is difficult to accurately reflect the spatial and temporal characteristics of water quality changes, and ignore the impact of vegetation environment on water quality, resulting in difficulty in improving the prediction accuracy.
Using a water quality prediction method based on vegetation images and mixed water quality models, the vegetation hyperspectral images around the target water body were pretreated, and the vegetation surface reflectivity and NDVI index were extracted, and the data set was constructed based on the water quality historical data to construct the ABC optimization algorithm. , mixed water quality prediction model of LSTM model and attention mechanism is trained and optimized.
The accuracy of water quality prediction is improved, the impact of vegetation environment on water quality is taken into account, the adaptability and robustness of the model is enhanced, and the reliability and real-time prediction are improved.
Smart Images

Figure CN118918483B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of water quality prediction, and in particular to a water quality prediction method and system based on vegetation images and a hybrid water quality model. Background Art
[0002] Traditional water quality prediction methods include regression analysis, time series analysis, and neural networks. These methods only use historical water quality data for prediction and are difficult to accurately reflect the spatiotemporal characteristics of water quality changes. Deep learning technology is a machine learning method based on neural networks. It has powerful feature extraction and pattern recognition capabilities and can be applied to water quality prediction. Long short-term memory neural networks are often used to predict water quality. This type of prediction model can effectively solve the problems of gradient explosion and vanishing in recursive neural network water quality prediction.
[0003] However, relying solely on long-term and short-term memory neural networks also has its shortcomings, and some important data features are easily overlooked. In addition, traditional water quality prediction methods usually only consider historical data of water quality parameters, ignoring the impact of the surrounding plant environment on water quality, making it difficult to improve the accuracy of water quality prediction. Summary of the invention
[0004] Based on this, the present application proposes a water quality prediction method and system based on vegetation images and hybrid water quality models, aiming to not only consider the historical data of water quality parameters, but also the impact of the surrounding plant environment on water quality, so as to improve the accuracy of water quality prediction.
[0005] A first aspect of the present application provides a water quality prediction method based on vegetation images and a hybrid water quality model, the water quality prediction method comprising:
[0006] Performing a first preprocessing on the initial vegetation hyperspectral image around the target water body to obtain a first vegetation hyperspectral image;
[0007] Acquire the vegetation surface reflectance and NDVI index in the first vegetation hyperspectral image, and convert the vegetation surface reflectance and NDVI index into vegetation hyperspectral data;
[0008] Performing a second preprocessing on the historical water quality data of the target water body to obtain water quality data;
[0009] Constructing a data set according to the vegetation hyperspectral data and the water quality data;
[0010] Constructing a mixed water quality prediction model, wherein the mixed water quality prediction model includes an ABC optimization algorithm, an LSTM model, and an attention mechanism;
[0011] Training the mixed water quality prediction model according to the data set to obtain a mixed water quality prediction optimization model;
[0012] Water quality prediction is performed based on the hybrid water quality prediction optimization model.
[0013] Compared with the prior art, the present application provides a water quality prediction method based on vegetation images and a hybrid water quality model, which has the following beneficial effects:
[0014] 1. Improve the accuracy of water quality prediction: By performing the first preprocessing of the initial vegetation hyperspectral image around the target water body and the second preprocessing of the water quality historical data, the information related to water quality is extracted and converted into vegetation hyperspectral data and water quality data. Then, the constructed hybrid water quality prediction model is trained and optimized. The model combines the ABC optimization algorithm, LSTM model and attention mechanism to better capture the spatiotemporal characteristics and complex relationships in water quality data, thereby improving the accuracy of water quality prediction.
[0015] 2. Consider the impact of multiple factors: This technical solution considers the impact of vegetation images and water quality data on water quality prediction. Vegetation can reflect the environmental conditions and ecological characteristics around the water body, while water quality data directly reflects the pollution of the water body. By combining these two factors, we can have a more comprehensive understanding of the changing trend of water quality and improve the reliability of prediction.
[0016] 3. Strong adaptability: The ABC optimization algorithm can automatically adjust the parameters of the model to adapt to different water quality data sets and prediction requirements. The LSTM model has good time series processing capabilities and can capture long-term trends and seasonal changes in water quality data. The attention mechanism can assign weights according to the importance of the data, improving the generalization ability and prediction accuracy of the model.
[0017] As an optional implementation manner of the first aspect, the first preprocessing includes:
[0018] Clipping the initial vegetation hyperspectral image to obtain an image of the study area;
[0019] The images of the study area were subjected to median filtering, denoising, feature extraction using principal component analysis, and maximum-minimum normalization to eliminate dimensional differences between different bands.
[0020] As an optional implementation manner of the first aspect, the step of obtaining the vegetation surface reflectance and the NDVI index in the first vegetation hyperspectral image includes:
[0021] Acquire radiation data in the first vegetation hyperspectral image, the radiation data including solar radiation value and atmospheric radiation value, and record digital counts DN of different bands;
[0022] Obtaining an atmospheric correction coefficient according to the apparent reflectance of different bands in the first vegetation hyperspectral image;
[0023] Obtaining the surface radiation brightness according to the digital count DN and the atmospheric radiation value;
[0024] Obtaining incident radiation brightness according to the solar radiation value and the atmospheric correction coefficient;
[0025] Obtaining vegetation surface reflectivity according to the surface radiation brightness and the incident radiation brightness;
[0026] The NDVI index is obtained according to the ratio of the vegetation surface reflectance in the red light band and the near infrared band.
[0027] As an optional implementation manner of the first aspect, the second preprocessing includes:
[0028] The missing values of the historical water quality data are filled by using the average value filling method to obtain the first water quality data;
[0029] The first water quality data is processed by maximum-minimum normalization to obtain water quality data, and the range of the water quality data is between [0, 1].
[0030] As an optional implementation manner of the first aspect, the step of constructing a data set according to the vegetation hyperspectral data and the water quality data includes:
[0031] Aligning the time tags of the vegetation hyperspectral data and the water quality data to integrate them into a data set with a time series;
[0032] Select any time point in the data set with time series, use a part of the data set before the time point as the training set, and use another part of the data set after the time point as the test set.
[0033] As an optional implementation manner of the first aspect, the ABC optimization algorithm includes:
[0034] Initialize the number of employed bee colonies in the ABC optimization algorithm , the maximum number of cycles of the food source limit, the maximum number of iterations MC, the maximum training period mE, and the number of hidden layer neurons nHN of the LSTM-Attention model;
[0035] The root mean square error is used as the fitness function to calculate the previous The fitness of each food source;
[0036] Execute the employed bee stage and the observer bee stage to limit the optimization range of the fitness function;
[0037] Performing the scout bee stage to discard food sources that do not meet the retention conditions and obtain substitute food sources;
[0038] Determine whether the termination condition of the fitness function optimization is met. If so, output the optimal solution (nHN, mE); if not, return to continue executing the employed bee stage, the observation bee stage, and the scout bee stage.
[0039] As an optional implementation of the first aspect, the hybrid water quality prediction model includes an LSTM-Attention model, which includes three LSTM layers, two random deactivation layers, an attention mechanism layer and a fully connected layer. The LSTM layer is used to obtain long-term dependencies of water quality data, the random deactivation layer is used to prevent overfitting, the attention mechanism layer is used to assign weights according to the attention mechanism, and the fully connected layer is used to output prediction results.
[0040] A second aspect of an embodiment of the present application provides a water quality prediction system based on vegetation images and a hybrid water quality model, the system comprising:
[0041] A first data acquisition module is used to perform a first preprocessing on the initial vegetation hyperspectral image around the target water body to obtain a first vegetation hyperspectral image; obtain the vegetation surface reflectance and NDVI index in the first vegetation hyperspectral image, and convert the vegetation surface reflectance and NDVI index into vegetation hyperspectral data;
[0042] A second data acquisition module, used for performing a second preprocessing on the water quality historical data of the target water body to obtain water quality data;
[0043] A data set acquisition module, used to construct a data set based on the vegetation hyperspectral data and the water quality data;
[0044] A model building module, used to build a mixed water quality prediction model, wherein the mixed water quality prediction model includes an ABC optimization algorithm, an LSTM model and an attention mechanism;
[0045] A model training module, used for training the mixed water quality prediction model according to the data set to obtain a mixed water quality prediction optimization model;
[0046] The model prediction module is used to predict water quality based on the mixed water quality prediction optimization model.
[0047] A third aspect of an embodiment of the present application provides a computer device, which includes a memory, a processor, and a processing program stored in the memory and executable on the processor, wherein the processing program, when executed by the processor, implements the above-mentioned water quality prediction method based on vegetation images and a hybrid water quality model.
[0048] A fourth aspect of an embodiment of the present application provides a storage medium having a processing program stored thereon. When the processing program is executed by a processor, the processing program executes the above-mentioned water quality prediction method based on vegetation images and a hybrid water quality model.
[0049] Additional aspects and advantages of the present application will be given in part in the following description, and in part will become apparent from the following description, or will be understood through the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A flow chart of a water quality prediction method based on vegetation images and a hybrid water quality model proposed in the first embodiment of the present application;
[0051] Figure 2 This is an algorithm flow chart of the ABC-LSTM-Attention hybrid water quality model proposed in the first embodiment of this application;
[0052] Figure 3 A schematic diagram of the structure of a water quality prediction system based on vegetation images and a hybrid water quality model proposed in the second embodiment of the present application.
[0053] The following specific implementation methods will further illustrate the present application in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0055] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here. In addition, the "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally represents that the objects associated with each other are in an "or" relationship.
[0056] In order to illustrate the technical solution described in this application, a specific embodiment is provided below for illustration.
[0057] See also Figure 1, which is a flow chart of a water quality prediction method based on vegetation images and a hybrid water quality model proposed in the first embodiment of the present application. The proposed method includes the following contents.
[0058] S1: performing a first preprocessing on an initial vegetation hyperspectral image around a target water body to obtain a first vegetation hyperspectral image.
[0059] It should be noted that in water quality prediction methods, using vegetation hyperspectral images as input data is an effective method, because the growth and health of vegetation can indirectly reflect the water quality of the water body. Hyperspectral images can provide richer spectral information than traditional color images, which is very useful for analyzing and identifying vegetation status.
[0060] Specifically, step S1 includes:
[0061] S11: Collect satellite hyperspectral remote sensing data of the target water body and its surrounding area of 5 km from the Gaofen-5 satellite, and use ArcGIS to crop the image of the study area;
[0062] It should be noted that the selection of a 5-kilometer range around the target water body ensures that important information related to the target water body is included, while reducing the interference of irrelevant data. This allows a more comprehensive understanding of the interaction between the water body and the surrounding environment, as well as possible influencing factors. Satellite hyperspectral remote sensing data using the Gaofen-5 satellite can provide more detailed and accurate information about ground objects, which helps to gain a deeper understanding of the characteristics of the target water body and its surrounding environment. Hyperspectral remote sensing data can capture subtle differences in ground objects within the spectral range, which is of great significance for water body monitoring, water quality analysis, ecological research, etc. In addition, ArcGIS is a professional geographic information system software for managing, analyzing and visualizing geospatial data. Using ArcGIS to crop images of the study area ensures that the acquired images match the research needs, and further spatial analysis and processing can be performed. By cropping images, you can focus on a specific study area and improve the pertinence and practicality of the data.
[0063] S12: Median filtering and total variation denoising are performed on the cropped image of the study area, feature extraction is performed using the principal component analysis method, and minimum-maximum normalization is used to eliminate the dimensional differences between different bands. The minimum-maximum normalization calculation formula is:
[0064]
[0065] In the formula is the data after maximum and minimum normalization, X is the input data before normalization, is the minimum value in the input data, is the maximum value in the input data.
[0066] It should be noted that median filtering can remove noise from an image. It sorts the pixel values in the neighborhood and then selects the middle value as the pixel value after filtering, thereby reducing the impact of noise. Median filtering can protect the edge and detail information of the image while effectively removing noise. Total Variation denoising is a denoising method based on the variational principle. It removes noise by minimizing the total variation of the image. The total variation is a measure of the degree of variation of the grayscale value of the image in space. By reducing the total variation, the image can be made smoother while retaining the edge and detail information of the image. Principal component analysis is a commonly used feature extraction method that can convert high-dimensional data into low-dimensional data. Through principal component analysis, the main features of the image can be extracted, the dimension of the data can be reduced, and most of the information of the image can be retained. This can improve the efficiency and accuracy of subsequent processing and reduce the impact of noise and interference. Minimum-maximum normalization can map the grayscale values of different bands into a unified range. This can eliminate the impact of dimensional differences between different bands, making the features of different bands comparable in subsequent processing. Normalization can make the data more standardized and improve the generalization ability and accuracy of the model. Therefore, the comprehensive application of the above processing steps can improve the quality and processability of the image, provide a better basis for subsequent analysis and application, help remove noise, retain image features, reduce data dimensions, and make features between different bands comparable, thereby improving the effectiveness and accuracy of the entire image processing process.
[0067] S2: Obtain vegetation surface reflectance and NDVI index in the first vegetation hyperspectral image, and convert the vegetation surface reflectance and NDVI index into vegetation hyperspectral data.
[0068] It should be noted that the vegetation surface reflectance refers to the ratio of the light reflected by the vegetation surface to the incident light, which contains the spectral characteristic information of the vegetation. The NDVI (Normalized Difference Vegetation Index) index is a commonly used vegetation index that reflects the growth status and coverage of vegetation by calculating the difference between the vegetation surface reflectance in the red and near-infrared bands. Converting the vegetation surface reflectance and the NDVI index into vegetation hyperspectral data can further analyze and process these spectral information. Through hyperspectral data, more detailed spectral characteristics can be obtained, including wavelength, intensity, and slope, which can be associated with water quality parameters to improve the accuracy of water quality prediction. In addition, hyperspectral data can also be used in vegetation classification, vegetation monitoring, and environmental analysis. It provides a non-destructive, fast, and comprehensive way to obtain vegetation information, which is of great significance for understanding vegetation ecosystems and environmental changes. Such a preprocessing step helps to combine vegetation images with water quality prediction models, use the spectral characteristics of vegetation to predict water quality parameters, and provide a scientific basis for water quality monitoring and management.
[0069] Specifically, step S2 includes:
[0070] S21: Acquire radiation data in the first vegetation hyperspectral image, wherein the radiation data includes solar radiation values and atmospheric radiation values, and record digital counts DN of different bands;
[0071] Obtaining an atmospheric correction coefficient according to the apparent reflectance of different bands in the first vegetation hyperspectral image data;
[0072] Obtaining the surface radiation brightness according to the digital count DN and the atmospheric radiation value;
[0073] Obtaining incident radiation brightness according to the solar radiation value and the atmospheric correction coefficient;
[0074] The vegetation surface reflectivity is obtained according to the surface radiation brightness and the incident radiation brightness.
[0075] The calculation formula of vegetation surface reflectivity is:
[0076] .
[0077] S22: Vegetation hyperspectral data is converted into ENVI format data using ENVI software, and the NDVI index is calculated based on the vegetation surface reflectance. The calculation formula is:
[0078] ,
[0079] Where NIR is the reflectivity in the near-infrared band, and Red is the reflectivity in the red light band.
[0080] S3: Perform a second preprocessing on the historical water quality data of the target water body to obtain water quality data.
[0081] It should be noted that historical water quality data may contain noise, missing values or outliers, which will affect the accuracy and reliability of the model. Through the second preprocessing, the data can be cleaned, unreasonable values can be removed, and missing data can be filled, thereby improving the quality of the data.
[0082] Specifically, step S3 includes:
[0083] S31: Obtain historical water quality data (water temperature, pH, dissolved oxygen, conductivity, turbidity, total phosphorus, chlorophyll α, monitoring time) from the water quality monitoring website and save it as a csv file;
[0084] It should be noted that water quality monitoring is an important means of assessing the health of water bodies. By obtaining indicators such as water temperature, pH, dissolved oxygen, conductivity, turbidity, total phosphorus, chlorophyll α, etc., we can fully understand the ecological status of water bodies, which is convenient for researchers, environmental protection departments and relevant decision makers to analyze water quality trends. In addition, saving these data as csv files can facilitate data integration and analysis. csv is a common data format that can be easily read and processed by a variety of data analysis software (such as Excel, R, Python, etc.).
[0085] S32: Use the average value filling method to fill in the missing values of historical water quality data. The formula is as follows:
[0086]
[0087] In the formula, are the missing values that need to be processed. , , It is the water quality data of the 3 points before the missing value.
[0088] It should be noted that compared with directly deleting missing values or using other complex interpolation methods, mean value filling can better preserve the overall characteristics of the original data without causing too much distortion to the data distribution. In addition, the mean value filling method has a small amount of calculation and a fast operation speed, and can quickly complete the filling work for large-scale data sets.
[0089] S33: Use maximum-minimum normalization to process the data so that the water quality data input to the model is between [0,1]. The formula is as follows:
[0090]
[0091] In the formula, is the data after maximum-minimum normalization, X is the input water quality historical data, is the minimum value in the historical water quality data. It is the maximum value in the historical water quality data.
[0092] It should be noted that different water quality indicators may have different dimensions and value ranges. Normalization can eliminate the influence of these dimensions and make the various features comparable on the same scale. In addition, when training machine learning models, normalization can accelerate the convergence of the model, especially for algorithms based on gradient descent (such as neural networks), because they are very sensitive to the scale of the input data.
[0093] S4: constructing a data set according to the vegetation hyperspectral data and the water quality data.
[0094] It should be noted that by combining vegetation hyperspectral data with water quality data, the relationship between vegetation status and water quality can be deeply analyzed. Hyperspectral data can provide information such as vegetation growth status, species distribution and health, while water quality data reflects the degree of water pollution, nutrient concentration, etc. By integrating these two types of data, the mechanism of vegetation's impact on water quality can be revealed, thereby providing a scientific basis for water quality management.
[0095] Specifically, step S4 includes:
[0096] Step S41: ensuring that the water quality data and the vegetation hyperspectral data have the same timestamp or time tag so as to correspond them;
[0097] Step S42: Integrate the water quality data and vegetation hyperspectral data in chronological order.
[0098] Exemplarily, a table is created in which each row represents a specific time point and each column includes water quality indicators and vegetation hyperspectral data;
[0099] Step S43: Divide the integrated data set into a training set and a test set.
[0100] Exemplarily, to ensure temporal order, any time point is selected from a data set with a time series, a portion of the data set before the time point is used as a training set, and another portion of the data set after the time point is used as a test set.
[0101] S5: Construct a hybrid water quality prediction model, which includes an ABC optimization algorithm, an LSTM model and an attention mechanism.
[0102] It should be noted that the ABC optimization algorithm simulates the honey-collecting behavior of bees in nature to find the optimal solution to the problem. Applying it to model parameter optimization can more effectively adjust the structure and parameters of the LSTM model and improve the prediction accuracy of the model. As a special recurrent neural network, the LSTM model has advantages in processing time series data and can capture long-term dependencies in water quality data, thereby improving the accuracy of prediction. The attention mechanism can automatically identify and highlight the key factors affecting water quality by assigning different weights to different features, further improving the performance of the prediction model. Therefore, building a hybrid water quality prediction model that integrates the ABC optimization algorithm, the LSTM model, and the attention mechanism can improve the accuracy of water quality prediction.
[0103] Specifically, step S5 includes:
[0104] S51: Initialize the number of employed bee colonies in the ABC optimization algorithm , the maximum number of cycles of the food source limit, the maximum number of iterations MC, the maximum training period mE, and the number of hidden layer neurons nHN of the LSTM-Attention model;
[0105] It should be noted that the number of employed bee colonies can determine the number of "bees" used to search for the optimal solution in the algorithm, which usually affects the search ability and efficiency of the algorithm; the maximum number of cycles of the food source can limit the number of times each food source is searched to avoid excessive search on the local optimal solution; the maximum number of iterations is used to set the total number of iterations of the algorithm to ensure that the algorithm can converge within a certain time; the maximum training cycle is used to determine the maximum number of cycles for LSTM-Attention model training, which affects the stability and performance of the model; the number of hidden layer neurons is used to set the number of neurons in the hidden layer of the LSTM-Attention model, which can affect the complexity and learning ability of the model.
[0106] S52: Use the root mean square error (RMSE) as the fitness function to calculate the previous The fitness of a food source, where the root mean square error is calculated as:
[0107]
[0108] In the formula, represents the kth predicted value;
[0109] The root mean square error (RMSE) is used as a fitness function to evaluate the error between the model's predicted value and the actual value. The smaller the RMSE, the better the prediction performance of the model.
[0110] S53: executing the employed bee stage and the observer bee stage to limit the optimization range of the fitness function;
[0111] S54: executing the scout bee stage, which is used to discard the food source that does not meet the retention conditions and obtain a substitute food source;
[0112] It should be noted that in the hired bee stage, hired bees search for new solutions based on the fitness function and try to improve the current food source.
[0113] In the observation bee stage, the observation bees further explore the solution space based on the search of the employed bees to find a better solution.
[0114] In the scout bee stage, when a food source has not found a better solution after multiple iterations, the scout bee will abandon the food source and randomly generate a new food source to prevent the algorithm from falling into a local optimum.
[0115] S55: Determine whether the termination condition of the fitness function optimization is met. If so, output the optimal solution (nHN, mE); if not, return to continue executing the employed bee stage, the observation bee stage and the scout bee stage;
[0116] Steps S51 to S55 can effectively optimize model parameters and improve prediction accuracy by simulating the foraging behavior of bees and combining the powerful prediction ability of the LSTM-Attention model. At the same time, by setting reasonable termination conditions and iteration times, it can ensure that the algorithm finds the optimal solution within a limited time and avoids waste of resources.
[0117] S56: The experimental environment is set to Windows 10 operating system, and the Keras deep learning framework based on Tensorflow is used to build an LSTM-Attention model. The LSTM-Attention model includes three LSTM layers, two random dropout layers (Droupt layers), one Attention layer and a fully connected layer (Dense layer). The LSTM layer is used to obtain the long-term dependency of water quality data, the Drout layer is used to prevent overfitting, the attention mechanism layer is used to assign weights according to the attention mechanism, and the Dense layer is used to output the prediction results;
[0118] S57: Substitute the optimal solution obtained from step S51 to step S55 into the LSTM-Attention model.
[0119] See also Figure 2 , the above steps S51 to S57 are the algorithm flow chart of the ABC-LSTM-Attention hybrid water quality model.
[0120] S6: Training the mixed water quality prediction model according to the data set to obtain a mixed water quality prediction optimization model.
[0121] S7: Perform water quality prediction based on the mixed water quality prediction optimization model.
[0122] In summary, the data set of the traditional water quality prediction model only contains historical water quality data. The present invention takes into account the impact of vegetation around the water body on the water body, combines the hyperspectral image information of the vegetation with the historical water quality data as the data set, and realizes the fusion of multimodal data, thereby more comprehensively capturing the various factors affecting water quality and improving the comprehensiveness of water quality prediction. Based on the LSTM neural network, the present invention introduces the attention mechanism and uses the artificial bee colony algorithm to optimize the LSTM-Attention hybrid prediction model, so that the model has iterative and optimizable features, and can be adaptively adjusted in different scenarios and time periods, thereby improving the robustness of the model. By adopting a hybrid model, a variety of technologies are integrated to improve the real-time and accuracy of water quality prediction, making it more valuable for practical applications.
[0123] See also Figure 3 , which is a schematic diagram of the structure of a water quality prediction system based on vegetation images and a hybrid water quality model proposed in the second embodiment of the present application, and the system includes:
[0124] The first data acquisition module 10 is used to acquire vegetation hyperspectral data. The first data acquisition module 10 includes:
[0125] The initial image acquisition unit 101 is used to perform a first preprocessing on the initial vegetation hyperspectral image around the target water body to obtain a first vegetation hyperspectral image;
[0126] The feature data conversion unit 102 is used to obtain the vegetation surface reflectance and NDVI index in the first vegetation hyperspectral image, and convert the vegetation surface reflectance and NDVI index into vegetation hyperspectral data;
[0127] A second data acquisition module 20 is used to perform a second preprocessing on the water quality historical data of the target water body to obtain water quality data;
[0128] A data set acquisition module 30, used to construct a data set according to the vegetation hyperspectral data and the water quality data;
[0129] A model building module 40 is used to build a mixed water quality prediction model, wherein the mixed water quality prediction model includes an ABC optimization algorithm, an LSTM model and an attention mechanism;
[0130] A model training module 50 is used to train the mixed water quality prediction model according to the data set to obtain a mixed water quality prediction optimization model;
[0131] The model prediction module 60 is used to perform water quality prediction based on the mixed water quality prediction optimization model.
[0132] On the other hand, the present application also proposes a computer device, which includes a memory, a processor, and a processing program stored in the memory and executable on the processor. When the processing program is executed by the processor, the above-mentioned water quality prediction method based on vegetation images and hybrid water quality models is implemented.
[0133] On the other hand, the present application further proposes a storage medium on which a processing program is stored. When the processing program is executed by a processor, the water quality prediction method based on vegetation images and a hybrid water quality model is executed.
[0134] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0135] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0136] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A water quality prediction method based on vegetation image and hybrid water quality model, characterized in that: The water quality prediction method comprises: Performing a first preprocessing on an initial vegetation hyperspectral image within 5 kilometers around a target water body to obtain a first vegetation hyperspectral image; obtaining a vegetation surface reflectance and an NDVI index in the first vegetation hyperspectral image, and converting the vegetation surface reflectance and the NDVI index into vegetation hyperspectral data, specifically including: obtaining radiation data in the first vegetation hyperspectral image, the radiation data including solar radiation values and atmospheric radiation values, and recording digital counts DN of different bands; obtaining an atmospheric correction coefficient according to the apparent reflectance of different bands in the first vegetation hyperspectral image; obtaining surface radiation brightness according to the digital counts DN and the atmospheric radiation values; obtaining incident radiation brightness according to the solar radiation values and the atmospheric correction coefficient; obtaining the vegetation surface reflectance according to the surface radiation brightness and the incident radiation brightness; obtaining the NDVI index according to the ratio of the vegetation surface reflectance in the red light and near infrared bands; Performing a second preprocessing on the historical water quality data of the target water body to obtain water quality data, specifically comprising: filling the missing values of the historical water quality data with an average value filling method to obtain first water quality data; processing the first water quality data with a maximum-minimum normalization to obtain water quality data, wherein the range of the water quality data is between [0,1]; Constructing a data set according to the vegetation hyperspectral data and the water quality data, specifically comprising: aligning the time labels of the vegetation hyperspectral data and the water quality data to integrate them into a data set with a time series; selecting any time point in the data set with a time series, using a part of the data set before the time point as a training set, and using another part of the data set after the time point as a test set; Constructing a mixed water quality prediction model, the mixed water quality prediction model includes an ABC optimization algorithm, an LSTM model and an attention mechanism, the mixed water quality prediction model includes an LSTM-Attention model, the LSTM-Attention model includes three LSTM layers, two random deactivation layers, an attention mechanism layer and a fully connected layer, the LSTM layer is used to obtain the long-term dependency of water quality data, the random deactivation layer is used to prevent overfitting, the attention mechanism layer is used to assign weights according to the attention mechanism, and the fully connected layer is used to output the prediction results; Training the mixed water quality prediction model according to the data set to obtain a mixed water quality prediction optimization model; Water quality prediction is performed based on the hybrid water quality prediction optimization model.
2. The water quality prediction method according to claim 1, characterized in that: The first preprocessing comprises: Clipping the initial vegetation hyperspectral image to obtain an image of the study area; The images of the study area were subjected to median filtering, denoising, feature extraction using principal component analysis, and maximum-minimum normalization to eliminate dimensional differences between different bands.
3. The water quality prediction method according to claim 1, characterized in that: The ABC optimization algorithm includes: Initialize the number of employed bee colonies in the ABC optimization algorithm , the maximum number of cycles of the food source limit, the maximum number of iterations MC, the maximum training period mE, and the number of hidden layer neurons nHN of the LSTM-Attention model; The root mean square error is used as the fitness function to calculate the previous The fitness of each food source; Execute the employed bee stage and the observer bee stage to limit the optimization range of the fitness function; Performing the scout bee stage to discard food sources that do not meet the retention conditions and obtain substitute food sources; Determine whether the termination condition of the fitness function optimization is met. If so, output the optimal solution (nHN, mE); if not, return to continue executing the employed bee stage, the observation bee stage, and the scout bee stage.
4. A water quality prediction system based on vegetation images and hybrid water quality models, characterized in that: The water quality prediction system comprises: The first data acquisition module is used to perform a first preprocessing on the initial vegetation hyperspectral image within 5 kilometers around the target water body to obtain a first vegetation hyperspectral image; obtain the vegetation surface reflectance and NDVI index in the first vegetation hyperspectral image, and convert the vegetation surface reflectance and NDVI index into vegetation hyperspectral data, specifically including: obtaining radiation data in the first vegetation hyperspectral image, the radiation data including solar radiation value and atmospheric radiation value, and recording digital counts DN of different bands; obtaining an atmospheric correction coefficient according to the apparent reflectance of different bands in the first vegetation hyperspectral image; obtaining surface radiation brightness according to the digital counts DN and the atmospheric radiation value; obtaining incident radiation brightness according to the solar radiation value and the atmospheric correction coefficient; obtaining the vegetation surface reflectance according to the surface radiation brightness and the incident radiation brightness; obtaining the NDVI index according to the ratio of the vegetation surface reflectance in the red light and near infrared bands; A second data acquisition module is used to perform a second preprocessing on the water quality historical data of the target water body to obtain water quality data, specifically including: filling the missing values of the water quality historical data with an average value filling method to obtain first water quality data; using maximum-minimum normalization to process the first water quality data to obtain water quality data, wherein the range of the water quality data is between [0,1]; The data set acquisition module is used to construct a data set according to the vegetation hyperspectral data and the water quality data, specifically including: aligning the time tags of the vegetation hyperspectral data and the water quality data to integrate them into a data set with a time series; selecting any time point in the data set with a time series, using a part of the data set before the time point as a training set, and using another part of the data set after the time point as a test set; A model building module, used to build a mixed water quality prediction model, the mixed water quality prediction model includes an ABC optimization algorithm, an LSTM model and an attention mechanism, the mixed water quality prediction model includes an LSTM-Attention model, the LSTM-Attention model includes three LSTM layers, two random deactivation layers, an attention mechanism layer and a fully connected layer, the LSTM layer is used to obtain the long-term dependency of water quality data, the random deactivation layer is used to prevent overfitting, the attention mechanism layer is used to assign weights according to the attention mechanism, and the fully connected layer is used to output the prediction results; A model training module, used for training the mixed water quality prediction model according to the data set to obtain a mixed water quality prediction optimization model; The model prediction module is used to predict water quality based on the mixed water quality prediction optimization model.
5. A computer device, characterized in that: The computer device includes a memory, a processor, and a processing program stored in the memory and executable on the processor. When the processing program is executed by the processor, the water quality prediction method according to any one of claims 1 to 3 is implemented.
6. A storage medium, characterized in that: The storage medium stores a processing program, and when the processing program is executed by a processor, the water quality prediction method according to any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Water quality prediction method, system and equipment based on multispectral image and medium
CN115690385A