A wastewater new pollutant early warning method and system, a computer device and a medium

CN122157842BActive Publication Date: 2026-08-28ZHEJIANG PROVINCE HANGZHOU ECOLOGICAL ENVIRONMENT MONITORING CENT
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610621133.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-05-08
Publication Date
2026-08-28
Estimated Expiration
2046-05-08

AI Technical Summary

Technical Problem

该方法仅能响应清单内物质,对清单外大量未知或新型污染物缺乏预警能力

Benefits of technology

[0051]与现有技术相比,本发明具有以下有益效果:通过执行动态背景扣除算法和特征哈希映射处理非靶向质谱数据并生成质谱特征流向量,实现了对废水中未知或新型化学物质指纹特征的在线提取与结构化表征,从而扩展了废水新污染物预警的化学物质覆盖范围。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122157842B_ABST
    Figure CN122157842B_ABST
Patent Text Reader

Abstract

The application discloses a wastewater new pollutant early warning method and system, computer equipment and medium. The method comprises the following steps: acquiring original mass spectrum data and performing a dynamic background deduction algorithm and a feature hash mapping to generate a mass spectrum feature flow vector, acquiring hydrological water quality original data to generate a hydrological feature flow vector; a directed and weighted graph representing the hydraulic connectivity between monitoring sites is constructed; the mass spectrum feature flow vector is input into a gated recurrent unit network to extract a mass spectrum time sequence feature vector, and the hydrological feature flow vector is input into a long short-term memory network to extract a hydrological time sequence feature vector; a gated fusion operation is performed to generate a fusion feature vector; the fusion feature vector is combined with the directed and weighted graph topology and input into a diffusion graph convolution network, and a new pollutant risk fingerprint vector at multiple future time steps is output. The application is used for realizing early warning of unknown new pollutants in wastewater.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of environmental monitoring and big data analysis technology, and relates to a method, system, computer equipment and medium for early warning of new pollutants in wastewater. Background Technology

[0002] With the acceleration of industrialization and urbanization, a large number of synthetic chemicals are being discharged into the aquatic environment. New pollutants such as pharmaceuticals and personal care products, perfluorinated and polyfluoroalkyl substances, and endocrine disruptors are frequently detected in surface water, groundwater, and drinking water, posing potential risks to the ecological environment and human health.

[0003] Current methods for monitoring new pollutants primarily rely on targeted analysis based on liquid chromatography or gas chromatography-tandem mass spectrometry (LC-MS / MS), which involves quantitative detection of a pre-defined list of known target substances according to standard procedures. This method can only respond to substances on the list and lacks the ability to provide early warnings for a large number of unknown or emerging pollutants outside the list. Furthermore, the entire process, from on-site sampling and laboratory pretreatment to instrumental analysis and data reporting, is time-consuming, resulting in a significant delay in early warning information and failing to provide effective decision support for environmental management before pollution incidents occur. Another type of time-series prediction method based on conventional water quality parameters can monitor indicators such as water temperature, pH, and dissolved oxygen in real time and predict water quality trends. However, new pollutants typically pose a risk at extremely low concentration levels, and their contribution to conventional water quality indicators is easily masked by environmental background fluctuations, making it difficult to accurately identify specific anomalies caused by unknown new pollutants.

[0004] Therefore, how to improve the coverage of early warning for unknown new pollutants, significantly advance the early warning window from post-event to pre-event, and effectively suppress the high false alarm rate caused by environmental background fluctuations are technical problems that need to be solved in this field. Summary of the Invention

[0005] To address the problems existing in the background technology, this invention proposes a method, system, computer equipment, and medium for early warning of new pollutants in wastewater.

[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A method for early warning of new pollutants in wastewater, comprising the following steps:

[0007] Obtain raw mass spectrometry data, and perform dynamic background subtraction algorithm and feature hash mapping based on the raw mass spectrometry data to generate mass spectrometry feature flow vector;

[0008] Obtain raw hydrological and water quality data, and generate hydrological characteristic flow vectors based on the raw hydrological and water quality data;

[0009] Obtain the geographical topological relationships and water flow directions of the monitoring stations, and construct a directed weighted graph representing the hydraulic connectivity between the monitoring stations;

[0010] The mass spectrometry feature flow vector is input into a gated recurrent unit network to extract the mass spectrometry time-series characterization vector.

[0011] The hydrological feature flow vector is input into a long short-term memory network to extract the hydrological time-series representation vector.

[0012] Based on the mass spectrometry time series characterization vector and the hydrological time series characterization vector, a gated fusion operation is performed to generate a fused characterization vector.

[0013] The fused representation vector is used as the dynamic feature of the node, and combined with the topology of the directed weighted graph, it is input into the diffusion graph convolutional network to output the new pollutant risk fingerprint vector for multiple future time steps.

[0014] Specifically, generating the mass spectrometry feature flow vector includes:

[0015] Obtain the raw total ion flow map and define the local intensity set according to the preset sliding time window;

[0016] The background distribution parameters in the local intensity set are estimated using a Gaussian mixture model and the expectation-maximization algorithm.

[0017] Calculate the dynamic threshold based on the background distribution parameters and the preset background threshold coefficient;

[0018] Effective chromatographic peaks are screened from the original total ion chromatogram based on the dynamic threshold.

[0019] Obtain the precise mass number, retention time, and peak area corresponding to the effective chromatographic peak;

[0020] The hash index is calculated using a hash function based on the exact mass number and the retention time.

[0021] The peak area is mapped to a fixed-dimensional vector based on the hash index to generate the mass spectrometry feature flow vector.

[0022] Specifically, the step of performing the gated fusion operation to generate the fusion representation vector includes:

[0023] The mass spectrometry time series representation vector is projected onto a preset fusion dimension using a first weight matrix to generate a projected mass spectrometry vector.

[0024] The hydrological time series representation vector is projected onto the preset fusion dimension using the second weight matrix to generate the projected hydrological vector.

[0025] The projected mass spectrum vector and the projected hydrological vector are concatenated, and the concatenated vector is input into a gating network. After processing by the Sigmoid activation function, the gating coefficient vector is output.

[0026] The first weighted vector is obtained by calculating the element-wise product of the gate coefficient vector and the projected mass spectrum vector.

[0027] Calculate the difference between the unit vector and the gate coefficient vector to obtain the difference vector;

[0028] The second weighted vector is obtained by calculating the element-wise product of the difference vector and the projected hydrological vector.

[0029] The first weighted vector is added to the second weighted vector to obtain the fused representation vector.

[0030] Specifically, the output of the new pollutant risk fingerprint vector for multiple future time steps includes:

[0031] Based on the forward and backward state transition matrices of the directed weighted graph, multi-step diffusion convolution operations are performed on the fused representation vector of a node and the fused representation vector of its neighboring nodes by stacking multiple diffusion graph convolution layers. This outputs a three-dimensional risk fingerprint vector for each node at multiple future time steps, containing normal probability, attention probability, and warning probability.

[0032] Specifically, the construction of the directed weighted graph characterizing the hydraulic connectivity between monitoring stations includes:

[0033] Using monitoring stations as nodes, water flow direction as directed edges, and normalized flow weight as edge weight, a directed weighted graph is constructed, and a corresponding adjacency matrix is ​​generated.

[0034] Specifically, an early warning method for new pollutants in wastewater also includes a pre-training step:

[0035] Obtain historical mass spectrometry characteristic flow sequences and historical hydrological characteristic flow sequences;

[0036] Partial time-step data from the historical mass spectrometry characteristic flow sequence and partial time-step data from the historical hydrological characteristic flow sequence are masked to obtain masked mass spectrometry sequences and masked hydrological sequences.

[0037] The masked mass spectrometry sequence is input into the gated recurrent unit network, the masked hydrological sequence is input into the long short-term memory network, and the gated fusion operation and the diffusion map convolutional network are executed to obtain the reconstructed data.

[0038] Based on the reconstruction loss between the reconstructed data and the original masked data, the parameters of the gated recurrent unit network, long short-term memory network, gated fusion operation, and diffusion graph convolutional network are initialized.

[0039] Specifically, a method for early warning of new pollutants in wastewater also includes fine-tuning steps:

[0040] Acquire historical anomalous event data with real risk labels, the historical anomalous event data including anomalous mass spectrometry characteristic flow sequences and anomalous hydrological characteristic flow sequences;

[0041] The abnormal mass spectrometry feature stream sequence is input into the gated recurrent unit network, the abnormal hydrological feature stream sequence is input into the long short-term memory network, and the gated fusion operation and the diffusion map convolutional network are executed to obtain the predicted risk fingerprint;

[0042] The parameters of the gated recurrent unit network, long short-term memory network, gated fusion operation, and diffusion graph convolutional network are updated based on the weighted cross-entropy loss between the predicted risk fingerprint and the real risk label.

[0043] Based on a method for early warning of new pollutants in wastewater, this technical solution also provides an early warning system for new pollutants in wastewater, including:

[0044] The preprocessing module is used to acquire raw mass spectrometry data, perform dynamic background subtraction algorithm and feature hash mapping based on the raw mass spectrometry data to generate mass spectrometry feature flow vectors, and acquire raw hydrological and water quality data to generate hydrological feature flow vectors based on the raw hydrological and water quality data.

[0045] The graph structure construction module is used to obtain the geographical topological relationships and water flow direction of the monitoring stations, and to construct a directed weighted graph that represents the hydraulic connectivity between the monitoring stations.

[0046] The multimodal coding module is connected to the preprocessing module and the graph structure construction module, respectively, and is used to input the mass spectrometry feature flow vector into the gated recurrent unit network to extract the mass spectrometry time series representation vector, and to input the hydrological feature flow vector into the long short-term memory network to extract the hydrological time series representation vector.

[0047] A cross-modal fusion module, connected to the multimodal coding module, is used to perform a gated fusion operation based on the mass spectrometry time series characterization vector and the hydrological time series characterization vector to generate a fused characterization vector;

[0048] The prediction module is connected to the cross-modal fusion module and the graph structure construction module, respectively. It is used to take the fused representation vector as the dynamic feature of the node, and combine it with the topology of the directed weighted graph, input it into the diffusion graph convolutional network, and output the new pollutant risk fingerprint vector for multiple future time steps.

[0049] This technical solution also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement any of the above-mentioned aspects in a method.

[0050] This technical solution also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any of the above-mentioned implementation methods.

[0051] Compared with the prior art, the present invention has the following beneficial effects: by executing a dynamic background subtraction algorithm and feature hash mapping to process non-targeted mass spectrometry data and generate mass spectrometry feature flow vectors, the online extraction and structured characterization of fingerprint features of unknown or novel chemical substances in wastewater are realized, thereby expanding the chemical substance coverage of early warning of new pollutants in wastewater.

[0052] By inputting mass spectrometry feature flow vectors into a gated recurrent unit network and hydrological feature flow vectors into a long short-term memory network and performing cross-modal gating fusion operations, adaptive complementary fusion of mass spectrometry modal information and hydrological and water quality modal information is achieved, which improves the response sensitivity of wastewater new pollutant risk warning to specific pollution events and the anti-interference ability to environmental background fluctuations.

[0053] By constructing a directed weighted graph representing the hydraulic connectivity between monitoring stations, and inputting the fused representation vectors into a diffusion graph convolutional network based on the topology of the directed weighted graph for spatiotemporal joint prediction, dynamic projection and early warning of the risk levels of new pollutants at various monitoring nodes in the basin at multiple future time steps were achieved. Attached Figure Description

[0054] Figure 1 This is a flowchart of a new wastewater pollutant early warning method according to the present invention;

[0055] Figure 2 This is a block diagram of a new wastewater pollutant early warning system according to the present invention;

[0056] Figure 3 This is the edge-cloud process architecture diagram of the present invention. Detailed Implementation

[0057] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0058] like Figures 1-3 As shown, the technical solution adopted by the present invention is as follows: A method for early warning of new pollutants in wastewater, comprising the following steps:

[0059] S1: Obtain raw mass spectrometry data, and perform dynamic background subtraction algorithm and feature hash mapping based on the raw mass spectrometry data to generate mass spectrometry feature flow vector.

[0060] In the edge-side and end-side collaborative processing flow of the wastewater new pollutant early warning method, the raw mass spectrometry data of the water sample is first collected by the analytical instruments at the online monitoring station. Subsequently, in the edge computing gateway, two processes are sequentially performed on the acquired raw mass spectrometry data: dynamic background subtraction algorithm and feature hash mapping.

[0061] The dynamic background subtraction algorithm robustly identifies and extracts effective chromatographic peaks that truly represent contaminants from raw data affected by matrix effects and instrument baseline drift. Feature hashing further projects the extracted, non-fixed-dimensional chromatographic peak information (including precise mass number, retention time, and peak area) onto a pre-defined fixed-length vector space using a specific hash function, thereby generating a structured vector with fixed dimensions, namely the mass spectrometry feature flow vector. The mass spectrometry characteristic flux vector The overall chemical fingerprint characteristics used to characterize the water sample at the current sampling time are one of the basic input data for realizing subsequent multimodal data fusion and spatiotemporal prediction.

[0062] The specific process of generating mass spectrometry characteristic flux vectors begins with preliminary processing of the raw mass spectrometry data. First, a raw total ion chromatogram (TIC) is obtained using an online solid-phase extraction-liquid chromatography-quadrupole time-of-flight mass spectrometry (SPE-LC-QTOF-MS) system. In the TIC, the horizontal axis represents chromatographic retention time, and the vertical axis represents the total ion intensity detected at the corresponding time point.

[0063] To dynamically analyze data and distinguish background noise from true chromatographic peaks, the system sets a sliding time window with a fixed time span. For the current chromatographic retention time point and the corresponding scan point intensity The sliding time window The time range before and after it is defined (in this embodiment) The value is 2.0 minutes. Within this time window... The intensity data points of all scan points within the area are aggregated to form a local intensity set for subsequent local analysis. This local intensity set It forms the data basis for performing background distribution estimation.

[0064] In obtaining local intensity sets Subsequently, a statistical model was used to analyze the intensity distribution within this set. Specifically, the system assumes that this local intensity set... The intensity distribution in the model is formed by mixing two different Gaussian distributions (or components), thus constituting a Gaussian mixture model.

[0065] One Gaussian component corresponds to background noise with a low mean intensity; the other Gaussian component corresponds to the true chromatographic peak signal with a high mean intensity. To accurately estimate the Gaussian distribution parameter (i.e., the background mean) representing the background noise from the mixed distribution... and background standard deviation The system uses the expectation-maximization algorithm for iterative calculation.

[0066] The expectation-maximization algorithm performs iterative calculations: In the expectation step (E-step), the calculation is performed for each data point based on the current model parameter estimates. The responsibility (i.e., posterior probability) of attributing to background or signal components.

[0067] In the maximization step (M-step), based on the calculated responsibility, the model parameters that maximize the data likelihood function are re-estimated, including the weights of each component. mean and variance By repeatedly alternating between the expectation step and the maximization step until the algorithm converges, parameter estimates that accurately characterize the background noise distribution within the current window can be obtained.

[0068] The mathematical expression of this process is: assuming a local intensity set It is composed of two Gaussian components: background noise and chromatographic peak signal, and its probability density function is:

[0069] ;

[0070] in For a set containing all parameters to be estimated, Represents a Gaussian distribution. The expected steps are performed iteratively (calculating the degree of responsibility). and ) and maximization steps (updating parameters) , , , , , , , ), until the complete log-likelihood value of the data. The change is less than the preset threshold (e.g.) The final converged background noise distribution parameters are obtained: background mean. and background standard deviation .

[0071] After estimating the background distribution parameters within the current sliding time window using a Gaussian mixture model and the expectation-maximization algorithm, the system then calculates a dynamic threshold to determine whether the current scan point is a valid chromatographic peak. This dynamic threshold The calculation method is as follows: the background mean vs. background standard deviation Multiplied by a preset empirical constant (i.e., background threshold coefficient) The results are then added together. The mathematical expression for this process is: .

[0072] Among them, the background threshold coefficient It is an adjustable parameter that adjusts the strictness of the judgment based on the fluctuation of background noise.

[0073] In one embodiment of the present invention, the background threshold coefficient The value is set to 3.5, which is determined based on statistical analysis of known true signal peaks and background noise in historical data. Those skilled in the art can adjust the background threshold coefficient within the range of 2.5 to 4.5 according to the instrument performance or the complexity of the water sample matrix in the actual application. The value of .

[0074] After calculating the current chromatographic retention time point dynamic threshold The system then performs a filtering operation to identify valid signals. Specifically, it sets the ion intensity at the current scan point... With the calculated dynamic threshold Compare them. If the ionic strength... Greater than the dynamic threshold Then determine the scan point. If a valid mass spectrometry peak signal exists at a certain point, that scan point will be marked as part of the valid chromatographic peak. Conversely, if the ion intensity... Less than or equal to the dynamic threshold If the signal at that scan point is determined to be mainly composed of background noise and does not contain valid chromatographic peak information, then this dynamic threshold-based screening process can robustly extract chromatographic peaks representing pollutant chemicals from the original total ion chromatogram, effectively suppressing baseline drift and matrix noise interference.

[0075] For each valid chromatographic peak selected through dynamic thresholding, the system further extracts its core characteristic parameters. These parameters constitute a tripartite information describing the chromatographic peak, specifically including: the precise mass number of the compound represented by the peak, i.e., the mass-to-charge ratio of the ion, expressed in Daltons per unit charge, with the symbol . The retention time of the chromatographic peak during liquid chromatography separation, in minutes, is indicated by the symbol . And the peak area obtained by integrating the chromatographic peak, denoted by . Peak area The magnitude of the ternary vector is proportional to the concentration (or content) of the compound in the sample. This ternary vector data forms the basis for subsequent conversion of non-targeted mass spectrometry information into structured vectors.

[0076] To obtain the precise mass number corresponding to each valid chromatographic peak Retention time and peak area After obtaining the ternary information, the system will use the precise mass number used to identify the characteristics of the compound. and retention time As input, a predefined hash function is used to generate an integer hash index. This hash index is used to determine the storage location of the triplet information within a fixed-length vector.

[0077] Specifically, the calculation process of a hash function is as follows: First, the exact mass number is... The value is multiplied by 1000 and then rounded to the nearest integer to obtain the first operand; at the same time, the retention time is recorded. The value is multiplied by 100 and then rounded to the nearest integer to obtain the second operand.

[0078] Next, a bitwise XOR operation is performed on the first operand and the second operand.

[0079] Finally, the result of the bitwise XOR operation is applied to a fixed vector dimension. (In this embodiment) A modulo operation (i.e., finding the remainder) is performed on a value of 10000, and the remainder is the final hash index value. The mathematical expression for this process is: The hash function is designed to hash numbers with similar exact mass values. and retention time Characteristic compounds are mapped to nearby or identical index positions.

[0080] After calculating the hash index of the currently valid chromatographic peak, the system uses that hash index to determine the peak area of ​​the chromatographic peak. Information is entered into a preset dimension. Fixed-length vector In, this vector This is the mass spectrometry characteristic flow vector.

[0081] The specific mapping method is as follows: The peak area of ​​the chromatographic peak... Take the logarithm to the base 10 (i.e.) The values ​​after () are accumulated into the vector. The hash index points to the corresponding element position. If multiple different chromatographic peaks result in the same hash index after hash calculation (i.e., a hash collision occurs), the peak area values ​​after logarithmic transformation of these chromatographic peaks will be accumulated into the same element at that index position.

[0082] Through this processing flow, all valid chromatographic peak information (of varying dimensions and in enormous quantity) detected within each 4-hour sampling cycle is compressed and mapped into a structured numerical vector with a fixed dimension (10,000 dimensions), namely the mass spectrometry characteristic flow vector. This vector, serving as a key input modality in the multimodal spatiotemporal graph neural network model, characterizes the overall chemical fingerprint features of the water sample at the current moment.

[0083] S2: Obtain raw hydrological and water quality data, and generate hydrological characteristic flow vectors based on the raw hydrological and water quality data.

[0084] In the end-side data acquisition process of the wastewater new pollutant early warning method, in addition to acquiring mass spectrometry data, raw hydrological and water quality data of the monitoring section are also acquired simultaneously to reflect the conventional physicochemical state and hydrodynamic conditions of the water body. These raw hydrological and water quality data come from multi-parameter water quality analyzers and acoustic Doppler current profilers deployed at monitoring stations.

[0085] In order to correlate with the mass spectrometry characteristic flux vector Aligned with the time dimension and used as another input to the multimodal model, the system performs aggregation, statistics and feature engineering processing on the massive amount of raw hydrological and water quality data collected at a fixed time period (4 hours in this embodiment).

[0086] The processing procedure specifically includes: performing statistical analysis on the original high-frequency sampled values ​​of various parameters within the period, and extracting statistical features that can reflect the central trend, dispersion, and changing trend of the data within the period.

[0087] Ultimately, these statistical features are combined into a low-dimensional, dense numerical vector, namely the hydrological characteristic flow vector. The hydrological characteristic flow vector As the second modal input of the multimodal spatiotemporal graph neural network model, it is used to provide environmental background information and auxiliary criteria for potential abnormal fluctuations related to new pollutant events.

[0088] The acquisition of raw hydrological and water quality data relies on two types of on-site online monitoring equipment.

[0089] The first type of equipment is a multi-parameter water quality analyzer, which is used to simultaneously collect five conventional water quality parameters of the water body, including water temperature, pH, dissolved oxygen, conductivity and turbidity.

[0090] The second type of equipment is the acoustic Doppler current profiler, used to collect two key hydrodynamic parameters of the cross-section: cross-sectional velocity and flow rate. Both types of equipment operate continuously at a fixed sampling frequency of 1 Hz, meaning they generate one measurement value for each of the seven parameters per second.

[0091] Therefore, within any consecutive 1-second time interval, the system will generate seven new raw data points (five water quality parameters plus two hydrological parameters). These high-frequency sampled raw data streams are transmitted in real time to the edge computing gateway via a data bus (such as an RS-485 bus), providing a high temporal resolution data foundation for subsequent periodic aggregation and feature extraction.

[0092] To convert high-frequency sampled hydrological and water quality raw data into mass spectrometry feature flow vectors With its structured feature of consistent sampling intervals, the system is configured with a fixed data aggregation period of 4 hours. Within a complete 4-hour period, since both the multi-parameter water quality analyzer and the acoustic Doppler current profiler sample at a frequency of 1 Hz, each of the seven parameters—five water quality parameters (temperature, pH, dissolved oxygen, conductivity, and turbidity) and two hydrological parameters (velocity and flow rate)—will generate 14,400 consecutive raw data points (calculated as: 1 time / second × 3600 seconds / hour × 4 hours = 14,400 times). Therefore, within a 4-hour aggregation period, the system needs to process 7 parameters × 14,400 data points, totaling 100,800 raw data points. The system then uses this period as the basic unit to perform subsequent statistical feature extraction on all raw data points.

[0093] For each of the seven parameters collected in the previous 4-hour aggregation period, the system performs the following three types of basic statistical characteristic calculations: First, it calculates the arithmetic mean of the parameter over the period, denoted as the mean. First, the parameter is used to characterize its central tendency or average level over the specified period. Second, the standard deviation of the parameter over the period is calculated and denoted as . This is used to characterize the dispersion or fluctuation of the parameter within that time period. Third, calculate the slope of the parameter's change within the period, denoted as... It is used to characterize the overall trend direction (rising or falling) and rate of the parameter's evolution over time during that period.

[0094] Change slope The calculation is based on the least squares linear regression method. By minimizing the sum of squared residuals between the fitted line and each data point, the slope of the line is solved, thereby quantifying the monotonic change trend of the parameter over 4 hours.

[0095] The slope of the change The calculation formula is: ,in This represents the total number of data points (i.e., 14400). For time series sequence numbers, These are the parameter values ​​corresponding to each time point. In addition to the three statistical characteristics (mean) for each individual parameter mentioned above. Standard deviation , slope of change In addition to the above, the system also calculates combined features that reflect the correlation between different parameters. For example, it calculates the correlation coefficient between flow rate and turbidity, a feature designed to capture the pattern of synchronous changes in turbidity and flow rate caused by rainfall or runoff, thus providing auxiliary information for distinguishing water quality fluctuations caused by natural factors.

[0096] After completing the statistical characteristic calculations for all seven parameters within the previous 4-hour aggregation cycle, the system summarizes and combines these results. Specifically, for each parameter, its mean is extracted. Standard deviation and the slope of change Three features and seven parameters generate a total of 21 features.

[0097] Based on this, a series of combined features (12 in this embodiment) are added, bringing the total number of features to 33. These 33 statistical features together constitute an ordered numerical sequence, which is organized into a low-dimensional dense vector, namely the hydrological feature flow vector. The vector has a dimension of 33, and is represented in mathematical space as... The hydrological characteristic flow vector Generated every 4 hours, along with the mass spectrometry feature flow vector generated at the same time. They are kept in time synchronization and uploaded to the cloud together as input data for the multimodal spatiotemporal graph neural network model.

[0098] S3: Obtain the geographical topological relationships and water flow directions of the monitoring stations, and construct a directed weighted graph representing the hydraulic connectivity between the monitoring stations.

[0099] In this invention, to achieve joint prediction of the risk of new pollutants at different locations within a watershed using a multimodal spatiotemporal graph neural network model, it is necessary to first establish graph-structured data that describes the hydraulic transport relationships between monitoring stations. To this end, the system acquires the geographic topological relationships (i.e., the relative spatial locations and upstream / downstream connections of each station within the river network) and the corresponding flow direction information of all monitoring stations within the target watershed.

[0100] Based on this information, the system constructs a graph-structured data set, specifically a directed weighted graph representing the hydraulic connectivity between monitoring stations. Direction and power It is a data structure composed of nodes, directed edges, and weights on the edges. In this invention, it is a directed weighted graph. Its function is to serve as the static topological input of the multimodal spatiotemporal graph neural network model, enabling the model to aggregate and propagate feature information from different nodes (monitoring stations) in the spatial dimension based on the river's flow direction and hydraulic transmission intensity when performing prediction calculations.

[0101] Construct a directed weighted graph representing the hydraulic connectivity between monitoring stations. The process includes the explicit definition of nodes, edges, and weights.

[0102] First, define a directed weighted graph. Node set Each online monitoring station deployed within the target watershed is abstracted as a node in a graph, and the set of nodes is denoted as . ,in The total number of monitoring stations (in this embodiment) (The value is 12). Secondly, define a directed weighted graph. edge set According to the natural flow direction of the river, if the water flow can pass through the node... The monitoring station is located at the node. The monitoring station where it is located then establishes a slave node in the graph. Pointing to node The directed edge.

[0103] edge set That is, the set of all such directed edges. Finally, define a directed weighted graph. Edge weights: To quantify the intensity of hydraulic transmission, each directed edge is assigned a weight. This weight is defined as a normalized flow weight, i.e., based on the number of connected nodes. and nodes The value is obtained by normalizing the average flow rate of a river cross-section over a specific time period. A higher normalized flow weight indicates a greater flow rate from the node... To the node The stronger the hydraulic transport capacity, the more significant the impact of pollutant diffusion with the water flow. Based on the above definition, the system generates an adjacency matrix for mathematical representation. The adjacency matrix It is a dimension A two-dimensional real matrix, where the first... Line 1 Column elements The rule for determining the value is: if there is a slave node To the node If there is a directed edge, then the element It equals the normalized flow weight corresponding to that edge; if there is no slave node To the node If there is a directed edge (i.e., no direct water flow connecting two stations), then the element The value is 0. This is achieved through the adjacency matrix. With power and influence The complete topological structure and weight information can be read and utilized by the multimodal spatiotemporal graph neural network model.

[0104] S4: Input the mass spectrometry feature flow vector into the gated recurrent unit network to extract the mass spectrometry time series characterization vector.

[0105] In the multimodal spatiotemporal graph neural network model of the early warning method for new pollutants in wastewater, in order to extract high-level features that can characterize the evolution of the chemical fingerprint of pollutants from the mass spectrometry feature stream data in the continuous time dimension, the system uses a specially designed single-modal temporal encoder to process the mass spectrometry modal data.

[0106] Specifically, the system will generate a series of mass spectrometry feature flow vectors within a window over a past period. The data is organized as a time sequence and input into a gated recurrent unit network (GRN). A GRN is a type of recurrent neural network with a gating mechanism, which can effectively capture long-term dependencies in sequential data and alleviate the gradient vanishing or exploding problems that may occur during the training process of traditional recurrent neural networks.

[0107] In this invention, the gated recurrent unit network is configured as a mass spectrometry modal encoder. Its function is to read a continuous mass spectrometry feature stream sequence and selectively memorize and forget the input information through its internal gating structure (update gate and reset gate), thereby gradually extracting the latent state containing the dynamic change information of the sequence.

[0108] Finally, the gated recurrent unit network outputs its hidden state vector at its last time step. This vector is considered a compact numerical representation of the evolution of mass spectrometry features over the input time period, i.e., the mass spectrometry time-series representation vector. This mass spectrometry time-series characterization vector It is then fed into a cross-modal gated fusion layer for fusion with hydrological characteristics.

[0109] In the specific implementation of the model, the input data of the gated recurrent unit network is a mass spectrometry feature stream sequence. Mass spectrometry characteristic flow sequences From the past continuous Each time step (in this embodiment) The mass spectrometry characteristic flux vector (with a value of 6, i.e., the past 24 hours). Arranged chronologically, its mathematical dimension is This indicates that the sequence contains 6 time steps, with each time step vector having a length of 10,000 dimensions. The sequence is fed into the gate-controlled recurrent unit network for processing step by step.

[0110] In terms of network structure, the gated recurrent unit network is stacked in 3 layers, with the number of hidden units in each layer being... The value is set to 512. After forward propagation through a 3-layer gated recurrent unit network, the hidden state output by the last layer of the network at the last time step is taken as the encoding result of this mode, i.e., the mass spectrometry time series representation vector. The dimension of this vector is consistent with the number of hidden units in the gated recurrent unit network, which is 512 dimensions, mathematically expressed as follows: The specific hyperparameters of the network (3 layers, 512 hidden units) were determined to be the optimal configuration after searching on historical datasets using Bayesian optimization methods. The aim was to balance the expressive power and computational efficiency of the model in order to best capture the temporal dependency patterns in the mass spectrometry feature stream sequence.

[0111] S5: Input the hydrological feature flow vector into the long short-term memory network to extract the hydrological time series representation vector.

[0112] In the multimodal spatiotemporal graph neural network model of the early warning method for new pollutants in wastewater, in order to extract high-level features that can characterize the evolution trend of the water body's normal state from the continuous time dimension of hydrological and water quality parameter feature flow data, the system adopts a specially designed single-modal temporal encoder to process the hydrological and water quality modal data.

[0113] Specifically, the system will generate a series of hydrological feature flow vectors within a window over a past period. The sequence is organized as a time series and input into a Long Short-Term Memory (LSTM) network. LTM is a variant of a recurrent neural network with gating mechanisms and dedicated memory units. By introducing input gates, forget gates, and output gates, it can selectively preserve long-term information and filter short-term fluctuations, effectively solving the problem that traditional recurrent neural networks struggle to capture long-distance dependencies when processing long sequences. In this invention, the LTM network is configured as a hydrological and water quality modal encoder. Its function is to read continuous hydrological feature flow sequences, and through the collaborative work of its internal gating structure and memory units, accumulate and refine the trend change information in the sequence, ultimately outputting a compact vector representation that summarizes the dynamic changes in hydrological and water quality within that time period—that is, a hydrological time series representation vector. This hydrological time series characterization vector It is then fed into a cross-modal gated fusion layer for fusion with mass spectrometry modal characterization.

[0114] In the specific implementation of the model, the input data of the long short-term memory network is the hydrological characteristic flow sequence. Hydrological characteristic flow sequence From the past continuous Each time step (in this embodiment) The value is 6, representing the hydrological characteristic flow vector over the past 24 hours. Arranged chronologically, its mathematical dimension is This indicates that the sequence contains 6 time steps, each with a 33-dimensional vector. The sequence is fed into a Long Short-Term Memory (LSTM) network for processing step by step.

[0115] In terms of network structure, the Long Short-Term Memory network is stacked into two layers, with the number of hidden units in each layer being... Set to 128. After forward propagation computation through a two-layer Long Short-Term Memory network, the hidden state output by the last layer of the network at the last time step is taken as the encoding result of this mode, i.e., the hydrological time series representation vector. The dimension of this vector is consistent with the number of hidden units in the Long Short-Term Memory network, which is 128 dimensions, mathematically expressed as... The specific hyperparameters of the network (2 layers, 128 hidden units) were determined to be the optimal configuration after searching on historical datasets using the Bayesian optimization method. The purpose is to effectively extract the temporal evolution patterns in hydrological and water quality characteristic flow sequences with a relatively compact model structure, while avoiding the risk of overfitting due to excessive model complexity.

[0116] S6: Perform a gated fusion operation based on the mass spectrometry time series characterization vector and the hydrological time series characterization vector to generate a fused characterization vector.

[0117] In the multimodal spatiotemporal graph neural network model, in order to effectively integrate mass spectrometry modal information and hydrological and water quality modal information, the system extracts the mass spectrometry time-series representation vectors separately. Hydrological time series representation vector Instead of simply splicing or adding the two together, an adaptive gating fusion operation is performed.

[0118] The function of this gated fusion operation is to dynamically determine, based on the characteristics of the current input data, whether to rely more on mass spectrometry modal representation or hydrological and water quality modal representation for each feature dimension. Through this mechanism, the model can flexibly adjust the contribution of the two modal information to the final decision under different environmental backgrounds and pollution scenarios.

[0119] For example, when hydrological and water quality parameters fluctuate drastically due to factors such as heavy rainfall, the model can automatically reduce the weight of the hydrological mode to avoid false alarms; while when weak but critical anomalies appear in mass spectrometry features, the model can increase the weight of the mass spectrometry mode to improve detection sensitivity. The final output of this gated fusion operation is a unified vector representation that integrates complementary information from the two modes, i.e., the fused representation vector. The fused representation vector This will be used as the node dynamic feature input for subsequent diffuse graph convolutional networks for spatiotemporal joint prediction.

[0120] The first step in performing gated fusion is to unify the dimensions of the temporal representation vectors of the two modes. This is because the mass spectrometry temporal representation vectors... The output of the gated recurrent unit network has a dimension of 512; while the hydrological time series representation vector... The output from the Long Short-Term Memory network has a dimension of 128. Since the two have different dimensions, they cannot be directly used for subsequent interactive calculations.

[0121] Therefore, the system first uses two independent trainable weight matrices to linearly project the two representation vectors onto a pre-defined unified fusion dimension. Specifically, the first weight matrix is ​​used. With mass spectrometry time-series characterization vector Multiply, and add the first bias vector Generate the projected mass spectrum vector At the same time, the second weight matrix is ​​used. Hydrological time series representation vector Multiply, and add the second bias vector Generate projected hydrological vectors First weight matrix The dimension is Second weight matrix The dimension is After this linear projection, the projected mass spectrum vector and projected hydrological vectors All dimensions were unified to 256 dimensions (i.e., fused dimensions). The value is 256). The mathematical expression of this process is: [The mass spectrometry time series characterization vector is then...] Through linear transformation Obtain the projected mass spectrum vector Hydrological time series representation vector Through linear transformation Obtain the projected hydrological vector Among them, the first weight matrix Second weight matrix The weight parameters and the first bias vector Second bias vector The bias parameters are all automatically learned and updated during model training using the backpropagation algorithm.

[0122] After obtaining the projected mass spectral vector with a uniform dimension of 256, and projected hydrological vectors The system then concatenates these vectors along their feature dimensions, forming a 512-dimensional joint vector. This concatenated vector is then fed into a gating network.

[0123] This gating network consists of a single-layer fully connected neural network. Its function is to calculate an adaptive gating coefficient to guide subsequent fusion based on the joint representation of the two modalities at the current time. Specifically, the gating network uses a trainable weight matrix. Multiply by the concatenated vector and add a bias vector. The calculation results are then subjected to a nonlinear transformation using the Sigmoid activation function. The Sigmoid activation function compresses the output values ​​to an open interval between 0 and 1. The output of this network is the gating coefficient vector. Its dimension is the same as the dimension of the projected vector, which is 256.

[0124] Gating coefficient vector Each element in the vector ranges from 0 to 1, representing the relative dependence of the model on the mass spectrometry modal representation in that feature dimension. The mathematical expression of this process is: [The following text appears to be a separate, unrelated section:] ...projecting the mass spectrometry vector... and projected hydrological vectors After concatenation, the gating coefficient vector is calculated using a gating network. ,Right now .

[0125] in, This represents a vector concatenation operation. For dimension The trainable weight matrix, It is a 256-dimensional trainable bias vector. This is the Sigmoid activation function.

[0126] Obtaining the gating coefficient vector The system then uses this to adaptively weight and mix the projection vectors of the two modes. First, the gating coefficient vector is calculated. With the projected mass spectrum vector The element-wise product of the elements, i.e., multiplying corresponding elements, yields a first weighted vector. This first weighted vector represents the portion of the mass spectrometry modal information that the model selects to retain and emphasize.

[0127] Secondly, calculate a unit vector where each element is 1 and the gating coefficient vector. The difference is used to obtain the difference vector. Since the gating coefficient vector... The element values ​​are between 0 and 1, and the element values ​​of the difference vector are also between 0 and 1, and are related to the gating coefficient vector. The sum of the element values ​​is 1.

[0128] Then, the difference vector and the projected hydrological vector are calculated. The element-wise product of these elements is called the second weighted vector. The second weighted vector represents the portion of hydrological and water quality modal information that is selected and emphasized by the model.

[0129] Finally, the first weighted vector and the second weighted vector are added together at their corresponding element positions, and the result is the final fused representation vector. The fused representation vector The dimension is 256, which can be expressed mathematically as: Fusion representation vector From the formula Calculated.

[0130] in, This represents element-wise multiplication. This represents a unit vector where all elements are 1. Through this gated weighting mechanism, the model can, at each feature dimension, apply weights based on the gate coefficient vector. The value of is selected and dynamically balanced between mass spectrometry modal characterization and hydrological and water quality modal characterization, thereby achieving effective deep fusion of the two heterogeneous data modes.

[0131] Fusion Dimension The value is 256, which was determined by searching the model's hyperparameters using the Bayesian optimization method, thus controlling the model's complexity while maintaining sufficient information capacity.

[0132] S7: The fused representation vector is used as the dynamic feature of the node, and combined with the topology of the directed weighted graph, it is input into the diffusion graph convolutional network to output the new pollutant risk fingerprint vector for multiple future time steps.

[0133] In the final stage of the multimodal spatiotemporal graph neural network model, the system needs to utilize the extracted and fused temporal features, combined with the spatial topological relationship of the watershed, to jointly predict the pollution risk of each monitoring station at future times.

[0134] Therefore, the system will use the fusion representation vector generated by the aforementioned cross-modal gating fusion layer. As the corresponding node at the current time step Dynamic characteristics. For those containing The watershed of each monitoring station (in this embodiment) (Value 12), the fusion representation vector of all nodes Stack the nodes in order to form the initial node feature matrix. Its dimensions are .

[0135] Simultaneously, the system reads the directed weighted graph representing the hydraulic connectivity between monitoring stations. The topology is based on an adjacency matrix. The form is used by the model. The initial node feature matrix... and directed power map The topology is input together into a spread graph convolutional network.

[0136] The function of the diffusion graph convolutional network is to propagate and aggregate features in the spatial dimension of the graph structure based on the water flow direction and flow weights. This allows the risk prediction of each node to not only rely on its own historical features but also to integrate feature information from its upstream and downstream related nodes. Finally, the diffusion graph convolutional network outputs the prediction result for each node over multiple consecutive time steps in the future; this result is defined as the new pollutant risk fingerprint vector. New pollutant risk fingerprint vector This is a three-dimensional vector, representing the probability that the node will be at different risk levels at corresponding future times. Through this spatiotemporal joint prediction mechanism, the model can capture the trend of pollution plumes migrating and spreading along the river in advance, achieving dynamic early warning of future pollution risks.

[0137] The specific process of spatiotemporal prediction using diffusion graph convolutional networks first requires constructing a state transition matrix describing the diffusion behavior of pollutants in the water flow network. This is based on an adjacency matrix characterizing hydraulic connectivity. The system calculates the forward state transition matrix respectively. and backward state transition matrix Forward state transition matrix By analyzing the adjacency matrix Each row is normalized to obtain the backward state transition matrix, where each element represents the one-step transition probability of water flowing downstream from the current node to the next downstream node. Then by adjusting the adjacency matrix The transpose matrix is ​​obtained by normalizing each row, and its elements represent the one-step reverse diffusion probability of water flow (or pollutant) from downstream nodes to upstream sources. This design helps to capture the impact of complex hydraulic conditions such as tides and backwater on pollutant transport. The calculation process can be expressed as: forward state transition matrix From the adjacency matrix Obtained by row normalization, i.e. Backward state transition matrix From the adjacency matrix The transpose is obtained by row normalization, i.e. ,in For the reason The rows and the diagonal matrix formed by them.

[0138] Obtaining the forward state transition matrix and backward state transition matrix Then, the system stacks Layer diffusion map convolutional layer (in this embodiment) The value is 2) to be used for the initial node feature matrix. Layer-by-layer transformation and feature extraction are performed. The operation of each diffusion map convolutional layer essentially involves performing multi-step diffusion convolution on the feature vectors of each node in the graph. Specifically, in the... In the layer calculation, the system utilizes the forward state transition matrix. and backward state transition matrix of power ( From 0 to In this embodiment, the maximum number of diffusion steps (Taking a value of 3), for the node feature matrix of this layer. Perform graph convolution operations.

[0139] and They represent the process. Forward diffusion and The weight relationships between nodes after each backward diffusion step. Each has an independent trainable convolutional kernel weight matrix (forward weight matrix) and backward weight matrix ).

[0140] System Calculation and Then all diffusion steps ( to The results of the calculations are summed and then processed by a nonlinear activation function (ReLU function is used in this embodiment) to obtain the output feature matrix of this layer. The mathematical expression for this diffusion map convolutional layer is: .

[0141] in It is the ReLU activation function. The maximum number of diffusion steps, and The first Layer The trainable weight matrix for each step.

[0142] By stacking The diffusion graph convolutional layer aggregates the feature information of each node and its multi-order neighborhood (upstream and downstream nodes), thereby capturing the spatial diffusion and transport patterns of pollutants. After the final diffusion graph convolutional layer, a fully connected output layer maps the final node feature representation to future... Each time step (in this embodiment) The value is 18, corresponding to the risk prediction output for the next 72 hours. For each node... And every future time step ( Each model outputs a three-dimensional vector, namely the risk fingerprint vector of new pollutants. The new pollutant risk fingerprint vector The three dimensions correspond to three risk categories: normal probability, attention probability, and warning probability.

[0143] The sum of the three probability values ​​being 1 represents the model's confidence level in predicting that the node will be at each risk level at the corresponding future time. Hyperparameters of the diffusion graph convolutional network include the maximum number of diffusion steps. Number of convolutional layers in the graph The optimal configuration is determined by searching on historical datasets using Bayesian optimization methods, aiming to balance the spatial receptive field size and computational complexity of the model.

[0144] Specifically, a method for early warning of new pollutants in wastewater also includes a pre-training step: acquiring historical mass spectrometry characteristic flow sequences and historical hydrological characteristic flow sequences.

[0145] In the early warning method for new pollutants in wastewater, in order to obtain good initial parameters before the multimodal spatiotemporal graph neural network model is formally put into use, and to improve the model's generalization ability and convergence speed under the condition of scarce labeled data, this invention also includes a self-supervised pre-training step before formal training. The first step of this pre-training step is to acquire historical data for pre-training. The system collects all historical mass spectrometry feature stream sequences generated and uploaded by the edge computing gateways of each monitoring station within a past period (the past 3 years in this embodiment) of the target watershed. and historical hydrological characteristic flow sequence These historical sequence data cover different seasons, different hydrological conditions, and the states before and after various known or unknown pollution events, providing rich and unlabeled samples for models to learn the normal dynamic evolution patterns of multimodal water environment data. Historical mass spectrometry characteristic flow sequences Each segment of the sample consists of continuous Mass spectral feature flow vectors at each time step Composition; Historical hydrological characteristic flow sequence Each segment of the sample is also composed of continuous Hydrological characteristic flow vectors at each time step constitute.

[0146] After acquiring historical multimodal sequence data, the pre-training task employs a masked autoencoder strategy to construct a self-supervised learning signal. Specifically, the system processes the historical mass spectrometry feature stream sequence in each input sample. and historical hydrological characteristic flow sequence Random masking operations are performed separately for historical mass spectrometry feature stream sequences. The system randomly selects 15% of the time steps in the sequence and analyzes the mass spectrometry feature flux vectors within these selected time steps. Specific feature regions are masked by setting the values ​​of their corresponding elements to zero or a special masking flag value. This applies to historical hydrological feature flow sequences. The system also randomly selects 15% of the time steps in the sequence and masks the continuous feature segments within these selected time steps. Through the above operations, the original complete sequence is destroyed, resulting in masked mass spectrometry sequences and masked hydrological sequences. These two sets of masked sequences will be used as inputs to the model in the pre-training stage.

[0147] During the forward propagation phase of pre-training, the system inputs the masked mass spectrometry sequence into the mass spectrometry mode encoder, i.e., the gated recurrent unit network; at the same time, it inputs the masked hydrological sequence into the hydrological and water quality mode encoder, i.e., the long short-term memory network.

[0148] Gated recurrent unit networks (GRUs) and long short-term memory networks (LSTMs) process the input sequences containing missing information, extracting the temporal representation vectors of the corresponding modalities. Subsequently, the system performs a cross-modal gated fusion operation, fusing the representation vectors of the two modalities into a fused representation vector. .

[0149] Next, the representation vectors are fused. Dynamic features of nodes are input into the diffusion graph convolutional network. Unlike the formal prediction task, during the pre-training phase, the output layer of the diffusion graph convolutional network is configured to reconstruct the masked original data, rather than predict future risk fingerprints.

[0150] The diffusion graph convolutional network utilizes graph structure information and contextual features of the unmasked portion to predict the location of each masked time step and feature. Its output is the reconstructed data. The reconstructed data includes reconstructed values ​​of the masked feature regions in the masked mass spectrometry sequence and reconstructed values ​​of the masked continuous segments in the masked hydrological sequence.

[0151] During the backpropagation and parameter update phases of pre-training, the system calculates the difference between the reconstructed data and the original masked data, which is quantified as the reconstruction loss. The reconstruction loss consists of two weighted components:

[0152] The first part is the sum of squares of the differences between each element of the original mass spectrometry feature flow vector and the reconstructed mass spectrometry feature flow vector, which is used to measure the reconstruction quality of the mass spectrometry mode.

[0153] The second part is the sum of squares of the differences between each element of the original hydrological characteristic flow vector and the reconstructed hydrological characteristic flow vector, which is used to measure the reconstruction quality of the hydrological and water quality modes.

[0154] Because the eigenvectors of the two modes differ in numerical dimensions and scale, the system introduces a preset balance coefficient (set to 0.1 in this embodiment) to weight the hydrological reconstruction loss, ensuring that the contributions of the reconstruction losses of the two modes to the total loss are relatively balanced. The total reconstruction loss is the mass spectrometry reconstruction loss plus the balance coefficient multiplied by the hydrological reconstruction loss.

[0155] The pre-training process aims to minimize this reconstruction loss. It employs a gradient-based optimization algorithm (such as the AdamW optimizer) to update all trainable parameters of the model. These parameters include: the weights and biases of the gated recurrent unit network, the weights and biases of the long short-term memory network, and the first weight matrix in the cross-modal gated fusion operation. Second weight matrix and gated network weight matrix This includes the bias vectors, the weight matrices of the convolutional kernels in each layer of the diffusion graph convolutional network, etc. After sufficient pre-training on large-scale historical data, the model learns the inherent correlations and normal evolution patterns of multimodal water environment data, and all its parameters are assigned a reasonable set of initial values. These initialized model parameters will be saved as the starting point for subsequent online fine-tuning using a small amount of labeled data.

[0156] Specifically, a method for early warning of new pollutants in wastewater also includes a fine-tuning step: acquiring historical abnormal event data with real risk labels, wherein the historical abnormal event data includes abnormal mass spectrometry characteristic flow sequences and abnormal hydrological characteristic flow sequences.

[0157] In the early warning method for new pollutants in wastewater, to enable the multimodal spatiotemporal graph neural network model to accurately classify and warn of the risk level of new pollutants based on good initial parameters obtained through self-supervised pre-training, this invention also includes a step of online fine-tuning using supervised data. The first step of this fine-tuning step is to acquire historical anomalous event data with real risk labels. This data comes from records of past periods in the target watershed that actually occurred and were confirmed as real new pollutant anomalous events through manual sampling and laboratory analysis.

[0158] In this embodiment, a total of 20 such historical anomaly events were collected, corresponding to multimodal data segments. Each historical anomaly event data includes two time series sequences: one is an abnormal mass spectrometry feature stream sequence for a period of time before and after the event. The other route consists of abnormal hydrological characteristic flow sequences within the same time period. In addition, each time-series data sample is accompanied by a true risk label marked by environmental experts based on laboratory assessment results. This label indicates the true risk level (normal, caution, or warning) for the corresponding time and location. These small amounts of valuable labeled data will be used to fine-tune the model's parameters, adjusting its decision boundaries towards accurately identifying new pollutant risk events.

[0159] During the fine-tuning forward propagation phase, the system's data processing flow is completely consistent with the formal inference phase. First, the acquired anomalous mass spectrometry feature stream sequence... The input is fed into a mass spectrometry modal encoder, i.e., a gated recurrent unit network; the abnormal hydrological characteristic flow sequence is then processed. The input is fed into a hydrological and water quality modal encoder, i.e., a long short-term memory network. The gated recurrent unit network outputs a mass spectrometry time-series representation vector. Long Short-Term Memory Network outputs hydrological time-series representation vector .

[0160] Secondly, the system performs a cross-modal gating fusion operation, dynamically calculating the gating coefficients based on the current input, and fusing the two time-series representation vectors into a fused representation vector. Finally, the fused representation vectors will be... As a dynamic characteristic of each node, combined with a directed weighted graph The topology is input into a diffusion graph convolutional network. This network aggregates feature information from upstream and downstream nodes in the spatial dimension through multiple diffusion convolution operations, and the output layer then processes this information for future... The risk is predicted for each time step (i.e., the next 72 hours). The output is the predicted risk fingerprint of each node at each future time step, which is a three-dimensional vector containing three probability values ​​(normal probability, attention probability, and warning probability).

[0161] During the fine-tuning backpropagation and parameter update phase, the system calculates the difference between the predicted risk fingerprint output by the model and the true risk label carried by the sample. This difference is quantified using weighted cross-entropy loss. Because the number of samples at different risk levels is severely imbalanced in new pollutant early warning tasks (most of the time samples are in a normal state, while early warning events are extremely rare), directly using standard cross-entropy loss would cause the model to tend to predict normal events while ignoring the few but crucial early warning events.

[0162] To address this issue, this invention employs weighted cross-entropy loss, assigning different weight coefficients to different risk categories. Specifically, for each prediction time step and each node, the system calculates the predicted probability value corresponding to the true category indicated by the true risk label, takes the negative of its natural logarithm, and then multiplies it by the preset weight coefficient corresponding to that true category. The total loss value is obtained by summing the weighted results at all time steps and all nodes.

[0163] The weight coefficients for each category are optimized and determined on the validation set using a grid search method with the goal of maximizing the F1 score of the warning category. In this embodiment, the optimal combination is: the weight of the warning category is 5.0, the weight of the attention category is 1.5, and the weight of the normal category is 1.0.

[0164] By assigning higher weights to the warning categories, the penalty for misclassifying warning events during training is significantly amplified, forcing the model to focus more on accurate identification of a minority of categories. The fine-tuning process aims to minimize this weighted cross-entropy loss, employing gradient-based optimization algorithms (such as the AdamW optimizer) to update all trainable parameters of the model. These parameters include: the weights and biases of the gated recurrent unit network, the weights and biases of the long short-term memory network, and the weight matrices in the cross-modal gating fusion operation. , , This includes bias vectors, convolutional kernel weight matrices of each layer in the diffusion graph convolutional network, etc. After fine-tuning on labeled anomalous event data, the model parameters are further specialized from the general representation obtained in the pre-training stage, enabling more accurate identification of early signs of new pollutant risk events and the issuance of graded warnings.

[0165] This invention also provides a wastewater new pollutant early warning system corresponding to the aforementioned wastewater new pollutant early warning method. This system adopts a modular architecture, including a preprocessing module, a graph structure construction module, a multimodal coding module, a cross-modal fusion module, and a prediction module.

[0166] The preprocessing module handles data acquisition and feature engineering at both the end and edge sides. This module acquires raw mass spectrometry data from online monitoring stations, performs dynamic background subtraction to remove noise and filter valid chromatographic peaks, and then transforms the peak information into fixed-dimensional mass spectrometry feature flow vectors through feature hashing. On the other hand, raw hydrological and water quality data collected by a multi-parameter water quality analyzer and an acoustic Doppler current profiler are acquired, and then statistically aggregated to generate hydrological characteristic flow vectors. .

[0167] The graph structure construction module is used to build static graph data representing the spatial relationships of monitoring stations. This module acquires the geographic topological location and river flow direction information of the monitoring stations, and constructs a directed weighted graph using the monitoring stations as nodes, the flow direction as directed edges, and normalized flow weights as edge weights. And generate the corresponding adjacency matrix. This provides topological constraints for subsequent spatiotemporal predictions.

[0168] The multimodal coding module is connected to both the preprocessing module and the graph structure construction module, and receives the mass spectrometry feature flow vector output by the preprocessing module. and hydrological characteristic flow vectors This module contains two parallel time-series encoders: a gated recurrent unit network for processing mass spectrometry feature stream sequences. Output mass spectrometry time-series characterization vector Long Short-Term Memory (LSTM) networks are used to process hydrological characteristic flow sequences. Output hydrological time series representation vector .

[0169] The cross-modal fusion module is connected to the multimodal coding module and receives the two temporal representation vectors mentioned above. This module projects the two representations to a unified dimension using a trainable weight matrix, and generates a gating coefficient vector using the concatenated vector and a gating network. Based on this, the two modal representations are adaptively weighted and mixed to output a fused representation vector. .

[0170] The prediction module is connected to both the cross-modal fusion module and the graph structure construction module, and receives the fusion representation vector output by the cross-modal fusion module. As dynamic characteristics of each node, and read the directed weighted graph provided by the graph structure construction module. adjacency matrix This module incorporates a diffusion graph convolutional network, utilizing forward and backward state transition matrices to perform multi-step diffusion convolution on node features, fusing information from upstream and downstream nodes in space, and ultimately outputting a three-dimensional new pollutant risk fingerprint vector for each node at multiple future time steps. It includes normal probability, attention probability, and warning probability.

[0171] For specific limitations regarding a new wastewater pollutant early warning system, please refer to the limitations of a new wastewater pollutant early warning method described above, which will not be repeated here. Each module in the aforementioned new wastewater pollutant early warning system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.

[0172] In one embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a method for early warning of new pollutants in wastewater.

[0173] For specific limitations on electronic devices, please refer to the limitations on a new wastewater pollutant early warning method mentioned above, which will not be repeated here.

[0174] In one embodiment, a computer-readable medium is provided storing a computer program, which, when executed by a processor, implements any step of a method for early warning of new pollutants in wastewater.

[0175] For specific limitations regarding computer-readable media, please refer to the limitations of a new wastewater pollutant early warning method mentioned above, which will not be repeated here.

[0176] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to 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.

[0177] In a specific embodiment, taking the Hangzhou section of the Qiantang River basin as a specific application scenario, a wastewater new pollutant early warning system was constructed and an early warning method was implemented. The basin covers 12 monitoring nodes, including the sluice gate, the upstream of the intake of Jiuxi Water Plant, and the upstream and downstream of the discharge outlet of Qige Wastewater Treatment Plant.

[0178] I. System Deployment and Multi-Source Data Acquisition.

[0179] Each monitoring node cabinet integrates a power supply unit, communication unit, water sampling unit, and analysis unit. The end-side equipment configuration is as follows:

[0180] Mass spectrometry data acquisition unit: An online solid-phase extraction-liquid chromatography-quadrupole time-of-flight mass spectrometry (SPE-LC-QTOF-MS) system was used. In this embodiment, an Agilent 1290 Infinity II online SPE system and an Agilent 6546 LC / Q-TOF mass spectrometer were selected. The system's mass accuracy in full-scan mode is better than 1 ppm, and its resolution (full mass range half-width at half-maximum, FWHM) is better than 40,000. The system automatically completes online enrichment, liquid chromatography separation, and full-scan mass spectrometry analysis of water samples at a fixed sampling interval of 4 hours. A sampling pump drew water samples from the river at a flow rate of 5 mL / min. After passing through a stainless steel filter with a pore size of 0.4-5 micrometers, the samples were enriched for 10 minutes on an online SPE column (Polar Advantage II, 2.1 mm x 20 mm). Subsequently, a six-way valve was switched to backflush the liquid chromatography mobile phase (phase A: water plus 0.1% formic acid, phase B: acetonitrile) into the analytical column (Zorbax Eclipse Plus C18, 2.1 mm x 100 mm, 1.8 micrometers) for gradient separation. The column temperature was set to 40 degrees Celsius. The effluent was then fed into a quadrupole time-of-flight mass spectrometer, where an electrospray ionization source was used to scan the samples in both positive and negative ion modes. The scan range was determined by the mass-to-charge ratio. Fifty to seventeen hundred. The original data is saved in .d format.

[0181] The water quality and hydrological data acquisition unit simultaneously deploys a multi-parameter water quality analyzer (YSI EXO2) and an acoustic Doppler current profiler (TRDI ChannelMaster H-ADCP). The multi-parameter water quality analyzer simultaneously acquires five parameters—water temperature, pH, dissolved oxygen, conductivity, and turbidity—at a frequency of 1 Hz. The acoustic Doppler current profiler acquires cross-sectional flow velocity and flow rate data at a frequency of 1 Hz. The raw data of the above seven parameters are transmitted in real time to the edge computing gateway via an RS-485 bus.

[0182] Edge computing gateway: It adopts the NVIDIA Jetson AGX Orin high-performance edge computing module, which is deployed on each monitoring node and is responsible for performing data preprocessing tasks.

[0183] II. Side data preprocessing and feature flow generation.

[0184] The edge computing gateway performs the following preprocessing procedures: For mass spectrometry data: The gateway runs a mass spectrometry data processing program developed in C++ (linked to the OpenMS library), monitoring the .d file directory in real time. Once a new file is generated, the dynamic background subtraction algorithm and feature hash mapping are immediately executed. In the dynamic background subtraction algorithm, a sliding time window is set. The value is 2.0 minutes, background threshold coefficient The value is 3.5 (this value is determined based on statistical analysis of known true signal peaks and background noise in historical data). In feature hashing mapping, the vector dimension is fixed. The value is set to 10000. After processing, a 10000-dimensional mass spectrometry feature flux vector is generated. ).

[0185] For hydrological and water quality data: The gateway runs a Python script (pymodbus library) to aggregate raw hydrological and water quality data within a 4-hour period. The mean values ​​for five water quality parameters and two hydrological parameters are calculated separately. ), standard deviation ( ) and slope of change ( The study also calculated additional combined features such as the correlation coefficient between flow rate and turbidity. Ultimately, a hydrological characteristic flow vector containing 33 statistical features was generated every 4 hours. .

[0186] Mass Spectrometry Feature Flow Vector and hydrological characteristic flow vectors All data are stamped with a unified, hardware-synchronized timestamp and uploaded to the central server via a dedicated fiber optic network using the MQTT protocol.

[0187] III. Graph Structure Construction.

[0188] The central server acquires the geographical topology and water flow direction information of 12 monitoring stations, and constructs a directed weighted graph representing the hydraulic connectivity between the monitoring stations. With monitoring stations as nodes, the node set... Represented as The set of edges is formed with the direction of water flow as the directed edge. Using normalized flow weights as edge weights, generate an adjacency matrix. Adjacency matrix The dimension is 12×12, and the elements are... The rule for determining the value is: if there is a slave node To the node If there is a directed edge, then Equals the normalized traffic weight; otherwise The value is zero.

[0189] IV. Model Deployment and Online Inference Early Warning.

[0190] The central server uses a Dell PowerEdge R760xa (configured with four NVIDIA H100 GPUs). The trained multimodal spatiotemporal graph neural network model is exported as a TorchScript file and deployed within the TorchServe inference framework. The inference service automatically triggers every 4 hours, executing the following process:

[0191] Step 1: Read the most recent data from each node in the Redis in-memory database. Mass spectral feature flow vectors at each time step Sequences, constituting mass spectrometry characteristic stream sequences The dimension is 6×10000; read the corresponding hydrological feature flow vector. Sequence, constituting hydrological characteristic flow sequence The dimensions are 6×33.

[0192] Step 2: Sequence of mass spectrometry characteristics Input is fed into a gated recurrent unit network. The gated recurrent unit network has 3 layers and the number of hidden units is [number missing]. The value is 512. The hidden state at the last time step is taken as the mass spectrometry time series representation vector. It has 512 dimensions.

[0193] Step 3: Analyze the hydrological characteristic flow sequence Input is fed into the Long Short-Term Memory (LSTM) network. The LTM network has 2 layers, and the number of hidden units is... The value is 128. The hidden state at the last time step is taken as the hydrological time series representation vector. It has 128 dimensions.

[0194] Step 4: Perform cross-modal gating fusion operation. Use the first weight matrix. (Dimension 256×512) Mass spectrometry time series representation vector Projected to the fusion dimension The projected mass spectrum vector is obtained. Using the second weight matrix (Dimension 256×128) Hydrological time series representation vector Projected to the fusion dimension The projected hydrological vectors are obtained. The projected mass spectrum vector and projected hydrological vectors Concatenated, and then processed by a gated network weight matrix The gating coefficient vector is processed using a (256×512) Sigmoid activation function. Fusion representation vector From the formula The calculation yielded, where This represents element-wise multiplication. It represents a vector that is all one.

[0195] Step 5: Merge the representation vectors of each node Stacked as the initial node feature matrix The dimension is 12×256. Read the adjacency matrix. Calculate the forward state transition matrix and backward state transition matrix Number of layers in a diffusion graph convolutional network It has 2 layers and a maximum number of diffusion steps. The value is 3. After two layers of diffusion map convolutional layers, the output layer outputs the future... New pollutant risk fingerprint vector at each time step (corresponding to the next 72 hours) , , New pollutant risk fingerprint vector It is a three-dimensional vector, with the three dimensions corresponding to the normal probability, the attention probability, and the warning probability, respectively.

[0196] V. Early Warning Triggering and Response.

[0197] The system has a built-in early warning judgment module that continuously monitors the output results. The early warning triggering logic is set as follows: if for any node... at any time in the future Early warning probability value If the probability is greater than 0.85 and this high-probability state persists for three consecutive time steps (i.e., 12 hours), then: send a Level III warning message to the preset environmental monitoring team management platform via an HTTP POST request. The message includes the warning node name, prediction start time, duration, and confidence level.

[0198] On the Web-GIS visualization interface, the node icon is highlighted in a flashing red state, and a heat map of the risk evolution over the next 72 hours is overlaid. An alarm SMS is sent to the relevant responsible persons through the SMS gateway.

[0199] Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for early warning of emerging pollutants in wastewater, characterized in that, Includes the following steps: Obtain raw mass spectrometry data, and perform dynamic background subtraction algorithm and feature hash mapping based on the raw mass spectrometry data to generate mass spectrometry feature flow vector; Obtain raw hydrological and water quality data, and generate hydrological characteristic flow vectors based on the raw hydrological and water quality data; Obtain the geographical topological relationships and water flow directions of the monitoring stations, and construct a directed weighted graph representing the hydraulic connectivity between the monitoring stations; The mass spectrometry feature flow vector is input into a gated recurrent unit network to extract the mass spectrometry time-series characterization vector. The hydrological feature flow vector is input into a long short-term memory network to extract the hydrological time-series representation vector. Based on the mass spectrometry time series characterization vector and the hydrological time series characterization vector, a gated fusion operation is performed to generate a fused characterization vector, wherein the gated fusion operation includes: The mass spectrometry time series representation vector is projected onto a preset fusion dimension using a first weight matrix to generate a projected mass spectrometry vector. The hydrological time series representation vector is projected onto the preset fusion dimension using the second weight matrix to generate the projected hydrological vector. The projected mass spectrum vector and the projected hydrological vector are concatenated, and the concatenated vector is input into a gating network. After processing by the Sigmoid activation function, the gating coefficient vector is output. The first weighted vector is obtained by calculating the element-wise product of the gate coefficient vector and the projected mass spectrum vector. Calculate the difference between the unit vector and the gate coefficient vector to obtain the difference vector; The second weighted vector is obtained by calculating the element-wise product of the difference vector and the projected hydrological vector. The first weighted vector is added to the second weighted vector to obtain the fused representation vector; The fused representation vector is used as the dynamic feature of the node, and combined with the topology of the directed weighted graph, it is input into the diffusion graph convolutional network to output the new pollutant risk fingerprint vector for multiple future time steps.

2. The method for early warning of new pollutants in wastewater according to claim 1, characterized in that, The generation of the mass spectrometry feature flow vector specifically includes: Obtain the raw total ion flow map and define the local intensity set according to the preset sliding time window; The background distribution parameters in the local intensity set are estimated using a Gaussian mixture model and the expectation-maximization algorithm. Calculate the dynamic threshold based on the background distribution parameters and the preset background threshold coefficient; Effective chromatographic peaks are screened from the original total ion chromatogram based on the dynamic threshold. Obtain the precise mass number, retention time, and peak area corresponding to the effective chromatographic peak; The hash index is calculated using a hash function based on the exact mass number and the retention time. The peak area is mapped to a fixed-dimensional vector based on the hash index to generate the mass spectrometry feature flow vector.

3. The method for early warning of new pollutants in wastewater according to claim 1, characterized in that, The output of the new pollutant risk fingerprint vector for multiple future time steps specifically includes: Based on the forward and backward state transition matrices of the directed weighted graph, multi-step diffusion convolution operations are performed on the fused representation vector of a node and the fused representation vector of its neighboring nodes by stacking multiple diffusion graph convolution layers. This outputs a three-dimensional risk fingerprint vector for each node at multiple future time steps, containing normal probability, attention probability, and warning probability.

4. The method for early warning of new pollutants in wastewater according to claim 1, characterized in that, The construction of the directed weighted graph characterizing the hydraulic connectivity between monitoring stations specifically includes: Using monitoring stations as nodes, water flow direction as directed edges, and normalized flow weight as edge weight, a directed weighted graph is constructed, and a corresponding adjacency matrix is ​​generated.

5. The method for early warning of new pollutants in wastewater according to claim 1, characterized in that, It also includes a pre-training step: Obtain historical mass spectrometry characteristic flow sequences and historical hydrological characteristic flow sequences; Partial time-step data from the historical mass spectrometry characteristic flow sequence and partial time-step data from the historical hydrological characteristic flow sequence are masked to obtain masked mass spectrometry sequences and masked hydrological sequences. The masked mass spectrometry sequence is input into the gated recurrent unit network, the masked hydrological sequence is input into the long short-term memory network, and the gated fusion operation and the diffusion map convolutional network are executed to obtain the reconstructed data. Based on the reconstruction loss between the reconstructed data and the original masked data, the parameters of the gated recurrent unit network, long short-term memory network, gated fusion operation, and diffusion graph convolutional network are initialized.

6. The method for early warning of new pollutants in wastewater according to claim 5, characterized in that, It also includes fine-tuning steps: Acquire historical anomalous event data with real risk labels, the historical anomalous event data including anomalous mass spectrometry characteristic flow sequences and anomalous hydrological characteristic flow sequences; The abnormal mass spectrometry feature stream sequence is input into the gated recurrent unit network, the abnormal hydrological feature stream sequence is input into the long short-term memory network, and the gated fusion operation and the diffusion map convolutional network are executed to obtain the predicted risk fingerprint; The parameters of the gated recurrent unit network, long short-term memory network, gated fusion operation, and diffusion graph convolutional network are updated based on the weighted cross-entropy loss between the predicted risk fingerprint and the real risk label.

7. A wastewater new pollutant early warning system, characterized in that, include: The preprocessing module is used to acquire raw mass spectrometry data, perform dynamic background subtraction algorithm and feature hash mapping based on the raw mass spectrometry data to generate mass spectrometry feature flow vectors, and acquire raw hydrological and water quality data to generate hydrological feature flow vectors based on the raw hydrological and water quality data. The graph structure construction module is used to obtain the geographical topological relationships and water flow direction of the monitoring stations, and to construct a directed weighted graph that represents the hydraulic connectivity between the monitoring stations. The multimodal coding module is connected to the preprocessing module and the graph structure construction module, respectively, and is used to input the mass spectrometry feature flow vector into the gated recurrent unit network to extract the mass spectrometry time series representation vector, and to input the hydrological feature flow vector into the long short-term memory network to extract the hydrological time series representation vector. A cross-modal fusion module, connected to the multimodal coding module, is used to perform a gated fusion operation based on the mass spectrometry time-series representation vector and the hydrological time-series representation vector to generate a fused representation vector, wherein the gated fusion operation includes: The mass spectrometry time series representation vector is projected onto a preset fusion dimension using a first weight matrix to generate a projected mass spectrometry vector. The hydrological time series representation vector is projected onto the preset fusion dimension using the second weight matrix to generate the projected hydrological vector. The projected mass spectrum vector and the projected hydrological vector are concatenated, and the concatenated vector is input into a gating network. After processing by the Sigmoid activation function, the gating coefficient vector is output. The first weighted vector is obtained by calculating the element-wise product of the gate coefficient vector and the projected mass spectrum vector. Calculate the difference between the unit vector and the gate coefficient vector to obtain the difference vector; The second weighted vector is obtained by calculating the element-wise product of the difference vector and the projected hydrological vector. The first weighted vector is added to the second weighted vector to obtain the fused representation vector; The prediction module is connected to the cross-modal fusion module and the graph structure construction module, respectively. It is used to take the fused representation vector as the dynamic feature of the node, and combine it with the topology of the directed weighted graph, input it into the diffusion graph convolutional network, and output the new pollutant risk fingerprint vector for multiple future time steps.

8. A computer 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, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Water quality prediction method based on graph neural network and spatial-temporal feature fusion

    CN119598402A

  • Space-time joint modeling system and method for watershed water quality prediction

    CN120373544A