A water quality heavy metal detection method based on intelligent sensors

CN122671393BActive Publication Date: 2026-10-09HENAN SUIJING ENVIRONMENTAL PROTECTION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611169710.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-08-04
Publication Date
2026-10-09
Estimated Expiration
2046-08-04

AI Technical Summary

Technical Problem

[0002]对水体中多种重金属离子进行同步精确检测时,水体的基质成分复杂,不同重金属的光谱响应峰和电化学氧化还原电位常存在重叠,导致信号的交叉干扰严重

Benefits of technology

[0013] Based on the real-time initial spectral and electrochemical response sequences of the water body, a water body background feature tensor is constructed. From this tensor, the excitation wavelength and excitation potential adjustments are calculated, dynamically generating optimized excitation parameters. These optimized parameters then drive the sensor to actively apply pulsed excitation light and square-wave pulsed voltage to the water body, acquiring delayed spectral and pulsed electrochemical response signals, respectively. This method shifts the excitation parameters in real-time according to the actual background energy distribution of the water body, actively matching the excitation conditions and avoiding background interference regions. It can simultaneously enhance the specific response of heavy metals and suppress the contribution of the matrix background in both spectral and electrochemical dimensions, obtaining heavy metal-induced signals with higher contrast. It also makes it easier to capture the weak responses of low-concentration heavy metals. After inputting the delayed spectral response signal and the pulsed electrochemical response signal into the cross-modal feature decoupling network, the components corresponding to the same heavy metal in the spectral latent features and electrochemical latent features are forced to align in a common direction through alternating direction multiplier iteration. Simultaneously, orthogonal constraints are applied to components corresponding to different heavy metals. During the network weight iteration update process, an orthogonality penalty term is constructed using the cosine similarity between feature encoding vectors, which is weighted with the reconstruction loss to form the overall optimization objective until the absolute value of the cosine similarity between the feature encoding vector of each heavy metal and the feature encoding vectors of all other heavy metals is lower than a preset separation threshold. This approach, which introduces orthogonality constraints and iterative convergence criteria within the cross-modal joint decoupling framework, ensures that the representations of different heavy metals in the latent space are independent and do not produce correlated projections. This eliminates cross-contamination in ion concentration estimation during the deep decoupling stage, making the concentration regression results of multi-component heavy metals closer to the true concentration distribution. It demonstrates good concentration resolution capability for water quality scenarios with multiple heavy metal types and overlapping signals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122671393B_ABST
    Figure CN122671393B_ABST
Patent Text Reader

Abstract

The application discloses a water quality heavy metal detection method based on intelligent sensors and relates to the technical field of water quality detection. The method comprises the following steps: continuously collecting an initial optical spectrum response sequence and an initial electrochemical response sequence of water bodies through an intelligent sensor array arranged at a sampling point; constructing a water body background feature tensor and dynamically adjusting excitation parameters of the intelligent sensor array to obtain optimized excitation parameters; driving the intelligent sensor array to actively excite the water bodies by using the optimized excitation parameters, and acquiring a delayed optical spectrum response signal and a pulse electrochemical response signal; inputting the two signals into a cross-modal feature decoupling network to separate out a feature coding vector corresponding to each heavy metal; and iteratively updating network weights according to the orthogonality constraint between the feature coding vectors until a separation degree criterion is met, and outputting a concentration estimation value of each heavy metal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of water quality testing technology, specifically to a method for detecting heavy metals in water based on intelligent sensors. Background Technology

[0002] When simultaneously and accurately detecting multiple heavy metal ions in water bodies, the complex matrix composition of the water often leads to overlapping spectral response peaks and electrochemical redox potentials of different heavy metals, resulting in severe signal cross-interference. Existing detection methods mostly employ passive spectral acquisition or conventional electrochemical scanning with fixed excitation parameters. The characteristics of the target heavy metal in the obtained response signal are easily obscured by dynamically changing background noise and the responses of other coexisting ions, making it difficult to accurately separate and invert the independent concentrations of each heavy metal from the mixed signal. Due to the lack of an adaptive excitation adjustment mechanism for real-time water background conditions, signals obtained under fixed parameter conditions often fail to effectively highlight the characteristic responses of heavy metals, leading to problems of feature aliasing and insufficient separation in subsequent signal decoupling processes. In signal analysis, existing technologies treat spectral signals and electrochemical responses as two independent channels, processing them separately and extracting features using conventional principal component analysis (PCA) or independent component analysis (ICA). These methods do not impose strict mathematical alignment and differentiation constraints on the potential representations of the same heavy metal extracted from different modal signals. This fails to guarantee that the separated feature vectors are orthogonal in the latent space, leading to cross-contamination in the concentration estimates of different heavy metals. This results in a significant decrease in detection accuracy for water bodies with a large variety of heavy metals and significant concentration differences. How to dynamically optimize the sensor excitation method based on the real-time background characteristics of the water body to maximize the prominence of heavy metal-induced feature signals, and how to apply joint decoupling constraints to the multimodal responses to obtain independent feature representations for each heavy metal, are pressing problems in this field. Summary of the Invention

[0003] This invention aims to propose a water heavy metal detection method based on intelligent sensors. By real-time monitoring of the initial spectral and electrochemical responses of the water body, the excitation parameters of the sensor array are dynamically adjusted to enhance the induced signal of heavy metals and suppress background interference. Furthermore, cross-modal signal joint processing is implemented, and an orthogonality constraint and iterative decoupling mechanism between features are established to achieve independent feature extraction and accurate concentration estimation of multiple heavy metals in the water body. This achieves the goal of simultaneous high-precision detection of multiple heavy metal concentrations in complex water matrices.

[0004] To achieve the above objectives, the present invention provides the following technical solution: The present invention provides a method for detecting heavy metals in water quality based on intelligent sensors, the method comprising:

[0005] The initial spectral response sequence and initial electrochemical response sequence of the water body are continuously collected by an intelligent sensor array deployed at sampling points. A water body background feature tensor is constructed based on the initial spectral response sequence and the initial electrochemical response sequence. The excitation parameters of the intelligent sensor array are dynamically adjusted based on the water body background feature tensor to obtain optimized excitation parameters. The optimized excitation parameters are used to drive the intelligent sensor array to actively excite the water body, acquiring heavy metal-induced delayed spectral response signals and pulsed electrochemical response signals. The delayed spectral response signals and the pulsed electrochemical response signals are input into a pre-trained cross-modal feature decoupling network to separate the feature encoding vector corresponding to each heavy metal. Based on the orthogonality constraint between the feature encoding vectors corresponding to all heavy metals, the internal weights of the cross-modal feature decoupling network are iteratively updated until the feature encoding vector of each heavy metal meets the preset separation criterion, and the concentration estimate of each heavy metal is output.

[0006] As a preferred technical solution of the present invention, when constructing the water body background feature tensor, the initial spectral response sequence is arranged according to the acquisition time to form a spectral time matrix, and the initial electrochemical response sequence is arranged according to the acquisition time to form an electrochemical time matrix. A Kronecker product operation is performed on the spectral time matrix and the electrochemical time matrix to obtain the water body background feature tensor. A main diagonal slice is extracted from the water body background feature tensor, and the energy distribution centroid of the main diagonal slice is calculated. Based on the energy distribution centroid, the excitation wavelength adjustment and excitation potential adjustment of the intelligent sensor array are determined. The excitation wavelength adjustment and excitation potential adjustment are respectively superimposed on the default excitation wavelength and default excitation potential of the intelligent sensor array to obtain the optimized excitation parameters. This process utilizes the tensor structure of the water body background and automatically adjusts the excitation parameters guided by the energy distribution centroid, so that the excitation conditions match the current water body background characteristics, thereby effectively suppressing the interference of the background matrix and creating favorable conditions for the enhanced extraction of weak heavy metal signals.

[0007] Furthermore, in the active excitation and signal acquisition stage, the light source module in the intelligent sensor array emits pulsed excitation light to the water body according to the optimized excitation wavelength in the optimized excitation parameters. The echo spectrum of the water body is acquired within a first delay time window after the pulsed excitation light stops, serving as the delayed spectral response signal. The electrochemical probe in the intelligent sensor array applies a square wave pulse voltage to the water body according to the optimized excitation potential in the optimized excitation parameters. The current decay curve of the water body is acquired within a second delay time window after the square wave pulse voltage stops, serving as the pulsed electrochemical response signal. The start times of the first and second delay time windows are determined by the principal eigenvalues ​​of the water body background feature tensor. Adaptively setting the delay acquisition window based on the background principal eigenvalues ​​accurately captures the specific hysteresis responses of different heavy metal ions during excited-state decay, distinguishing the target heavy metal signal from background transient interference in the time domain, thereby improving the selectivity and signal-to-noise ratio of the detection.

[0008] In the cross-modal feature decoupling stage, a preferred embodiment of the present invention is as follows: The delayed spectral response signal is decomposed using wavelet transform to obtain spectral detail coefficients at multiple scales; the pulsed electrochemical response signal is decomposed using empirical mode decomposition to obtain multiple intrinsic mode function components; the spectral detail coefficients at multiple scales and the multiple intrinsic mode function components are mapped to the same latent space dimension to form a spectral latent feature matrix and an electrochemical latent feature matrix; the spectral latent feature matrix and the electrochemical latent feature matrix are iterated using alternating direction multipliers, in which the components corresponding to the same heavy metal in the spectral latent feature and the electrochemical latent feature are forced to align in a common direction in each iteration, while orthogonal constraints are applied to the components corresponding to different heavy metals, until convergence, at which point the feature encoding vector corresponding to each heavy metal is output. Through the dual-modal deep decoupling and orthogonal alignment strategy, even when multiple heavy metals coexist and the signals highly overlap, the inherent features of each heavy metal can be separated into mutually independent encoding vectors, effectively eliminating inter-modal redundancy and cross-interference.

[0009] To ensure the independence of each heavy metal feature encoding vector, this invention uses the sum of the absolute values ​​of the cosine similarities between all pairwise feature encoding vectors of all heavy metals as an orthogonality penalty term. The weighted sum of the reconstruction loss of the cross-modal feature decoupling network and the orthogonality penalty term is calculated as the overall optimization objective. The gradient of the internal weights of the cross-modal feature decoupling network is calculated based on the overall optimization objective, and an adaptive moment estimation optimizer is used to update the internal weights along the gradient descent direction. During the update process, the adaptive moment estimation optimizer adaptively adjusts the weight coefficient of the orthogonality penalty term in the overall optimization objective based on the historical gradient variance of the orthogonality penalty term. This update process is repeated until the absolute value of the cosine similarity between the feature encoding vector of each heavy metal and the feature encoding vectors of all other heavy metals is less than a preset separation threshold. The feature encoding vector at the point of stopping iteration is then input into the concentration regression branch to obtain the concentration estimate for each heavy metal. Orthogonality constraints drive the network to learn uncorrelated feature representations, and with adaptive penalty weight adjustment, the network convergence speed is significantly accelerated, ensuring that the concentration estimation is not affected by other heavy metal components, and greatly improving the accuracy and robustness of the prediction results.

[0010] The specific calculation method of the concentration regression branch is as follows: Obtain the feature encoding vector at the time of stopping iteration; calculate the Euclidean distance between this feature encoding vector and multiple reference feature encoding vectors pre-stored in the concentration regression branch; find the three reference feature encoding vectors with the smallest Euclidean distance; take a weighted average of the known heavy metal concentration values ​​corresponding to these three reference feature encoding vectors, with the weight being the reciprocal of their respective Euclidean distances; use the weighted average result as the concentration estimate of that heavy metal; perform the above operation on the feature encoding vector corresponding to each heavy metal, and output the concentration estimates of all heavy metals. This method utilizes the local nearest neighbor structure of known samples to achieve high-precision concentration interpolation, avoiding the overfitting problem of traditional fully connected regression under limited sample conditions.

[0011] Furthermore, after outputting the concentration estimate for each heavy metal, the estimated concentration is compared with a preset concentration alarm threshold one by one. When the estimated concentration of any heavy metal exceeds the corresponding concentration alarm threshold, the intelligent sensor array is triggered to switch to continuous sampling mode. The new spectral response sequence and new electrochemical response sequence obtained from continuous sampling are re-input into the cross-modal feature decoupling network to obtain an updated concentration estimate. The comparison result between the updated concentration estimate and the concentration alarm threshold, along with the corresponding timestamp, is encapsulated into an alarm data packet and sent to the remote monitoring platform through the wireless communication module of the intelligent sensor array. This forms a complete closed loop from routine monitoring to continuous verification of exceeding limits, and then to remote early warning, enabling sudden heavy metal pollution events to be detected, confirmed, and reported in the first instance, significantly improving the timeliness and intelligence level of water quality monitoring.

[0012] The technical effects and advantages provided by the present invention in the above technical solution are as follows:

[0013] Based on the real-time initial spectral and electrochemical response sequences of the water body, a water body background feature tensor is constructed. From this tensor, the excitation wavelength and excitation potential adjustments are calculated, dynamically generating optimized excitation parameters. These optimized parameters then drive the sensor to actively apply pulsed excitation light and square-wave pulsed voltage to the water body, acquiring delayed spectral and pulsed electrochemical response signals, respectively. This method shifts the excitation parameters in real-time according to the actual background energy distribution of the water body, actively matching the excitation conditions and avoiding background interference regions. It can simultaneously enhance the specific response of heavy metals and suppress the contribution of the matrix background in both spectral and electrochemical dimensions, obtaining heavy metal-induced signals with higher contrast. It also makes it easier to capture the weak responses of low-concentration heavy metals. After inputting the delayed spectral response signal and the pulsed electrochemical response signal into the cross-modal feature decoupling network, the components corresponding to the same heavy metal in the spectral latent features and electrochemical latent features are forced to align in a common direction through alternating direction multiplier iteration. Simultaneously, orthogonal constraints are applied to components corresponding to different heavy metals. During the network weight iteration update process, an orthogonality penalty term is constructed using the cosine similarity between feature encoding vectors, which is weighted with the reconstruction loss to form the overall optimization objective until the absolute value of the cosine similarity between the feature encoding vector of each heavy metal and the feature encoding vectors of all other heavy metals is lower than a preset separation threshold. This approach, which introduces orthogonality constraints and iterative convergence criteria within the cross-modal joint decoupling framework, ensures that the representations of different heavy metals in the latent space are independent and do not produce correlated projections. This eliminates cross-contamination in ion concentration estimation during the deep decoupling stage, making the concentration regression results of multi-component heavy metals closer to the true concentration distribution. It demonstrates good concentration resolution capability for water quality scenarios with multiple heavy metal types and overlapping signals. Attached Figure Description

[0014] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.

[0015] Figure 1 This is a flowchart of a water quality heavy metal detection method based on intelligent sensors;

[0016] Figure 2 This is a flowchart of the dynamic adjustment of excitation parameters based on the water body background feature tensor;

[0017] Figure 3This is a flowchart of the delayed spectroscopy and pulsed electrochemical response signal acquisition process driven by optimized excitation parameters;

[0018] Figure 4 This is a flowchart of iterative training and heavy metal concentration estimation for a cross-modal feature decoupling network based on orthogonality constraints. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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, 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.

[0020] See Figure 1 This invention provides a method for detecting heavy metals in water based on intelligent sensors. The method involves continuously acquiring initial spectral and electrochemical response sequences of water bodies using an intelligent sensor array deployed at sampling points. A water body background feature tensor is constructed based on these sequences, and the excitation parameters of the intelligent sensor array are dynamically adjusted to obtain optimized excitation parameters. These optimized parameters are then used to drive the intelligent sensor array to actively excite the water body, acquiring heavy metal-induced delayed spectral and pulsed electrochemical response signals. The delayed spectral and pulsed electrochemical response signals are input into a pre-trained cross-modal feature decoupling network to separate the feature encoding vectors corresponding to each heavy metal. Based on the orthogonality constraints among the feature encoding vectors of all heavy metals, the internal weights of the cross-modal feature decoupling network are iteratively updated until the feature encoding vector of each heavy metal satisfies a preset separation criterion, and the concentration estimate of each heavy metal is output.

[0021] Example 1:

[0022] In specific implementation, please refer to Figure 2 After obtaining the initial spectral response sequence and the initial electrochemical response sequence, a water background feature tensor is constructed based on the initial spectral response sequence and the initial electrochemical response sequence. The excitation parameters of the smart sensor array are then dynamically adjusted based on the water background feature tensor to obtain the optimized excitation parameters.

[0023] The initial spectral response sequence is arranged according to the acquisition time to form a spectral-time matrix, with the number of acquisition time points being [number missing]. The spectral response collected at each time point includes The intensity values ​​of each wavelength channel, the dimension of the spectral time matrix is... The initial electrochemical response sequence was arranged according to the acquisition time to form an electrochemical time matrix, with the number of acquisition time points also being [number missing]. The electrochemical response collected at each time point includes The current values ​​of each potential channel, and the dimensions of the electrochemical time matrix are... The Kronecker product is performed on the spectral time matrix and the electrochemical time matrix to obtain the water background feature tensor. Let the spectral time matrix be... The electrochemical time matrix is Water background feature tensor for and Kronecker's product, The dimension of the matrix generated by the operation is After dimensional rearrangement, it forms a fourth-order tensor with dimension . The first and second dimensions correspond to time indices, the third dimension corresponds to spectral wavelength channels, and the fourth dimension corresponds to electrochemical potential channels.

[0024] Extracting the main diagonal slice from the water background feature tensor: The extraction method is as follows: sequentially extract elements at the same index position in the first and second dimensions of the water background feature tensor. When the indices of the first and second dimensions are both... At that time, we obtain a dimension as The matrix, to all From 1 to The corresponding matrices are flattened and concatenated in index order to form a matrix of length [length missing]. A one-dimensional real vector is used as the one-dimensional expansion sequence of the main diagonal slice. The square of the modulus of each element in the one-dimensional expansion sequence of the main diagonal slice is then normalized to obtain the energy probability distribution sequence. Let the i-th element in the one-dimensional expansion sequence of the main diagonal slice be... The square of the modulo of each element is The energy probability distribution sequence of the th element The calculation method is as follows , This is the sum of all squared values ​​modulo 1.

[0025] Using the index positions of the energy probability distribution sequence as discrete coordinates, the first-order raw moment of the energy probability distribution sequence is calculated to obtain the energy distribution barycenter. Calculated using the following formula:

[0026]

[0027] in, The length of the one-dimensional unfolded sequence of the main diagonal slice. This represents the index position of the energy probability distribution sequence. The first in the energy probability distribution sequence The probability value of each element.

[0028] Preset background reference center Background reference focus This is the statistical mean of the centroids of the energy distribution obtained from a large number of clean water samples under standard conditions and following the same procedures. The centroid of the energy distribution... Background reference center The difference multiplied by the first proportionality coefficient The wavelength adjustment amount of the excitation light is obtained. ,Right now The center of gravity of energy distribution Background reference center The difference multiplied by the second proportionality coefficient The excitation potential adjustment amount is obtained. ,Right now .

[0029] First proportional coefficient The lower limit of the adjustable wavelength of the light source in the intelligent sensor array is determined by the adjustable range of the light source. The upper limit of the adjustable wavelength of the light source is Set the adjustable half-width of the light source to The maximum allowable positive offset of the background reference centroid is denoted as The absolute value of the maximum negative offset allowed by the background reference centroid is denoted as ,Pick Then the first proportionality coefficient Second proportionality coefficient The adjustable potential range of the intelligent sensor array determines the lower limit of its adjustable potential. The upper limit of the adjustable potential is The adjustable half-width of the potential is set to Then the second proportionality coefficient .

[0030] Adjust the excitation wavelength Default excitation wavelength superimposed on the smart sensor array The optimized excitation wavelength was obtained. Adjust the excitation potential amount Default excitation potential superimposed on the smart sensor array The optimized excitation potential is obtained. Optimize excitation wavelength and optimization of excitation potential Together they constitute the optimized excitation parameters.

[0031] Example 2:

[0032] In specific implementation, please refer to Figure 3 After obtaining the optimized excitation parameters, the intelligent sensor array is used to actively excite the water body and obtain the heavy metal-induced delayed spectral response signal and pulsed electrochemical response signal.

[0033] The light source module in the intelligent sensor array emits pulsed excitation light into the water body according to the optimized excitation wavelength in the optimized excitation parameters. The light source module in the intelligent sensor array includes a tunable laser and a pulse modulator. The optimized excitation wavelength is used as the wavelength setting value input for the tunable laser. The pulse modulator generates a pulse modulation signal with a preset excitation pulse width, driving the tunable laser to output pulsed excitation light with a wavelength equal to the optimized excitation wavelength and a pulse width equal to the preset excitation pulse width. The pulsed excitation light is directly incident on the water body being measured through an optical fiber probe. After the pulsed excitation light stops, a delay time is waited, and the echo spectrum of the water body is collected within a preset acquisition window. This acquisition window is denoted as the first delay time window. The water echo spectrum collected within this first delay time window serves as the delayed spectral response signal. The acquisition of the delayed spectral response signal is performed by the spectral acquisition module in the intelligent sensor array. The spectral acquisition module includes a grating monochromator and a photomultiplier tube array. The photomultiplier tube array outputs a voltage value corresponding to the echo spectral intensity at each wavelength position. The voltage values ​​at all wavelength positions collected within the first delay time window are arranged in wavelength order to form the delayed spectral response signal.

[0034] The electrochemical probe in the intelligent sensor array applies a square-wave pulse voltage to the water body according to the optimized excitation potential in the optimized excitation parameters. The electrochemical probe in the intelligent sensor array is a three-electrode system, including a working electrode, a reference electrode, and an auxiliary electrode. The optimized excitation potential serves as the potential setpoint input for the working electrode relative to the reference electrode. A square-wave pulse voltage with a preset pulse width is generated by a potentiostat and applied to the working electrode. After the square-wave pulse voltage stops, a delay time is waited, and the current decay curve of the water body is acquired within a preset acquisition window. This acquisition window is designated as the second delay time window, and the water current decay curve acquired within this second delay time window serves as the pulsed electrochemical response signal. The acquisition of the pulsed electrochemical response signal is performed by the current sampling unit built into the potentiostat in the intelligent sensor array. The current sampling unit acquires the current value flowing between the working electrode and the auxiliary electrode at a preset sampling frequency within the second delay time window. The time series composed of all sampling times and corresponding current values ​​serves as the pulsed electrochemical response signal.

[0035] The start times of the first and second delay time windows are determined by the principal eigenvalues ​​of the water background feature tensor. This is achieved by performing high-order singular value decomposition on the water background feature tensor. Let the water background feature tensor be... The dimension is Higher-order singular value decomposition (LSVDe) decomposes the water body background feature tensor into a core tensor and the modular multiplication of four pattern matrices, and extracts the largest singular value of the core tensor. This largest singular value of the core tensor is taken as the main feature value of the background, denoted as . The base delay time is obtained by multiplying the background principal feature value by a preset feature value-to-time mapping coefficient. The calculation formula is:

[0036]

[0037] in, The base delay time is in milliseconds. These are the preset mapping coefficients from feature values ​​to time, expressed in milliseconds per feature value. The range of values ​​is to , These are the main background eigenvalues. Mapping coefficients. The value is based on the following: Testing a known clean water sample free of heavy metals under laboratory conditions, the echo spectral intensity collected after the excitation pulse stops decays from its maximum value to its maximum value. The required time is denoted as the spectral decay time constant. Simultaneously, the current amplitude acquired after the square wave pulse voltage stops decays from its maximum value to its maximum value. The required time is denoted as the electrochemical decay time constant. The spectral decay time constant and the electrochemical decay time constant are divided by the background principal characteristic value corresponding to the clean water sample, respectively, to obtain two ratios. The arithmetic mean of the two ratios is taken as the mapping coefficient. The set value.

[0038] Base delay time The starting point of the first delay time window, i.e., the time after the pulse excitation light stops. Data acquisition begins at a specific time. Half of the base delay time is used as the start time of the second delay time window, i.e., the second delay time window begins after the square wave pulse voltage stops. Data acquisition begins immediately. The duration of the first delay window is preset by the excitation pulse width in the optimized excitation parameters, specifically by setting one-tenth of the excitation pulse width as the duration of the first delay window. The duration of the second delay window is preset by the square wave pulse width in the optimized excitation parameters, specifically by setting one-tenth of the square wave pulse width as the duration of the second delay window.

[0039] Example 3:

[0040] In practice, after obtaining the delayed spectral response signal and the pulsed electrochemical response signal, the delayed spectral response signal and the pulsed electrochemical response signal are input into a pre-trained cross-modal feature decoupling network to separate the feature encoding vector corresponding to each heavy metal.

[0041] The delayed spectral response signal was decomposed using wavelet transform to obtain spectral detail coefficients at multiple scales. The wavelet transform employed the Daubechies wavelet basis function, with a decomposition level of five. After high-pass and low-pass filtering at each level, the delayed spectral response signal was decimated twice, resulting in five levels of spectral detail coefficient sequences. The length of each level's sequence varied, reflecting the local fluctuation characteristics of the delayed spectral response signal at different frequency scales. The five levels of spectral detail coefficient sequences were concatenated in descending order of frequency to form a one-dimensional spectral multi-scale feature vector.

[0042] Empirical mode decomposition (EMD) is performed on the pulsed electrochemical response signal to obtain multiple intrinsic mode function (EMF) components. EMD then performs envelope fitting on the pulsed electrochemical response signal, extracting EMF components that satisfy the EMF conditions layer by layer. The extraction stops when the residual signal is a monotonic function or the number of extreme points in the residual signal is less than two. The number of EMF components depends on the time-frequency characteristics of the pulsed electrochemical response signal itself. The number of extracted EMF components is denoted as . Each intrinsic mode function component is a time series of the same length as the pulsed electrochemical response signal, and all of them... The intrinsic mode function components are concatenated in the extraction order to form a one-dimensional electrochemical multi-scale feature vector.

[0043] Spectral detail coefficients at multiple scales and multiple intrinsic mode function components are mapped to the same latent space dimension, forming spectral latent feature matrices and electrochemical latent feature matrices. The cross-modal feature decoupling network consists of a spectral feature mapping subnetwork and an electrochemical feature mapping subnetwork. The spectral feature mapping subnetwork receives spectral multi-scale feature vectors as input and contains two fully connected hidden layers. The first fully connected hidden layer has 128 neurons, and the second fully connected hidden layer has 64 neurons. The activation function for both layers is the hyperbolic tangent function. The number of neurons in the output layer is proportional to the preset latent space dimension. equal, Setting it to 32 outputs a spectral latent feature vector. The electrochemical feature mapper network receives the electrochemical multi-scale feature vector as input and contains two fully connected hidden layers. The first fully connected hidden layer has 128 neurons, and the second fully connected hidden layer has 64 neurons. The activation function for both layers is the hyperbolic tangent function. The number of neurons in the output layer is proportional to the dimension of the latent space. If they are equal, the output is the electrochemical latent feature vector. After the above mapping, the spectral latent feature vector and the electrochemical latent feature vector have the same dimension. .

[0044] The weight parameters of the spectral feature mapping subnetwork and the electrochemical feature mapping subnetwork are obtained through joint training. The training data contains multiple training samples. Each training sample contains a spectral multi-scale feature vector and an electrochemical multi-scale feature vector corresponding to a water sample with known heavy metal composition and concentration. During training, a contrastive loss function is used to make the spectral latent feature vector and the electrochemical latent feature vector of the same training sample closer to each other in the latent space, while the latent feature vectors of different training samples are further apart.

[0045] In a single detection process, delayed spectral response signals and pulsed electrochemical response signals at multiple time points may be acquired. The spectral latent feature vectors obtained after wavelet transform decomposition and mapping using a spectral feature mapping subnetwork for each time point are used as row vectors. These row vectors are arranged in chronological order, and all row vectors are stacked to form a spectral latent feature matrix. This spectral latent feature matrix is ​​denoted as... , dimension , Let be the number of time points in the delayed spectral response signal. The electrochemical latent feature vectors obtained after empirical mode decomposition and mapping of the pulsed electrochemical response signal at each time point are used as row vectors, arranged in chronological order. All row vectors are stacked to form the electrochemical latent feature matrix, denoted as . , dimension , This represents the number of time points in the pulsed electrochemical response signal.

[0046] Alternating direction multiplier iterations are performed on the spectral and electrochemical latent feature matrices. The shared dictionary matrix is ​​initialized. , dimension , The preset number of heavy metal types. Set to the total number of known heavy metal species to be detected, sharing a dictionary matrix. Each column corresponds to a common representation basis of a heavy metal in the latent space. Initialize the orthogonal sparse coding matrix. , dimension , The total number of eigenvectors, orthogonal sparse coding matrix Each column corresponds to the encoding coefficient of a latent feature vector under the shared dictionary matrix.

[0047] Fixed shared dictionary matrix Solve for the orthogonal sparse coding matrix The objective function is to minimize the difference between the product of the spectral latent feature matrix and the product of the shared dictionary matrix and the corresponding spectral component in the orthogonal sparse coding matrix, and simultaneously minimize the difference between the product of the electrochemical latent feature matrix and the product of the shared dictionary matrix and the corresponding electrochemical component in the orthogonal sparse coding matrix.

[0048]

[0049] in, The spectral latent feature matrix, This is the electrochemical hidden characteristic matrix. To share the dictionary matrix, This is a submatrix corresponding to the spectral part of the orthogonal sparse coding matrix. This is a submatrix corresponding to the electrochemical part of the orthogonal sparse coding matrix. For a complete orthogonal sparse coding matrix, Let Frobenius norm be the matrix. Let L1 norm be the matrix. For sparse regularization coefficients, The value is set to 0.01, and is determined by the sparse regularization coefficient value that maximizes the matching accuracy between the decoupled feature encoding vector and the known heavy metal label on the validation set.

[0050] Fixed orthogonal sparse coding matrix Update the shared dictionary matrix This involves minimizing the weighted sum of the differences between the products of the spectral latent feature matrix and the shared dictionary matrix multiplied by the corresponding spectral components of the orthogonal sparse coding matrix, and between the products of the electrochemical latent feature matrix and the shared dictionary matrix multiplied by the corresponding electrochemical components of the orthogonal sparse coding matrix. After the update, the shared dictionary matrix is ​​forced to... The inner product between different columns of a shared dictionary matrix is ​​zero. Perform Gram-Schmidt orthogonalization to enable shared dictionary matrices. satisfy , It is an identity matrix.

[0051] The process alternates between solving the orthogonal sparse coding matrix with a fixed shared dictionary matrix and updating the shared dictionary matrix with the fixed orthogonal sparse coding matrix. Each alternation is defined as one iteration cycle. After each iteration cycle, the change in the orthogonal sparse coding matrix is ​​calculated. This change is defined as the Frobenius norm difference between the orthogonal sparse coding matrix obtained in the current iteration cycle and the one obtained in the previous iteration cycle. The change is then compared with a preset convergence threshold. Comparison, Set as When the change is less than the convergence threshold When the alternating direction multiplier iteration is considered to have converged, the iteration is stopped.

[0052] After convergence, the dimension of each row of the orthogonal sparse coding matrix is... This row contains the coding coefficients corresponding to all latent feature vectors. This row is extracted separately and used as the feature coding vector for the heavy metal corresponding to that row of the orthogonal sparse coding matrix. For all... For each heavy metal, the corresponding row of the orthogonal sparse coding matrix is ​​extracted to obtain the feature coding vector for each heavy metal.

[0053] Example 4:

[0054] In specific implementation, please refer to Figure 4 After obtaining the feature encoding vector corresponding to each heavy metal, the internal weights of the cross-modal feature decoupling network are iteratively updated according to the orthogonality constraint between the feature encoding vectors corresponding to all heavy metals until the feature encoding vector of each heavy metal satisfies the preset separation criterion, and the concentration estimate of each heavy metal is output.

[0055] Calculate the cosine similarity between each pair of feature encoding vectors corresponding to all heavy metals. Let there be... The first heavy metal The feature encoding vectors corresponding to the heavy metals are denoted as follows: , dimension , The total number of eigenvectors. For any two different heavy metals... and Feature encoding vector With feature encoding vector cosine similarity The calculation method is as follows , Feature encoding vector With feature encoding vector The inner product, Feature encoding vector L2 norm, Feature encoding vector The L2 norm. For all distinct heavy metal pairs. and Calculate cosine similarity absolute value Summing all the absolute values ​​yields the orthogonality penalty term. The calculation method is as follows .

[0056] Calculate the reconstruction loss of a cross-modal feature decoupling network. Reconstruction loss The loss consists of two parts: spectral reconstruction loss and electrochemical reconstruction loss. The spectral reconstruction loss is the squared Frobenius norm of the product of the spectral latent feature matrix and the shared dictionary matrix multiplied by the corresponding spectral component in the orthogonal sparse coding matrix. The electrochemical reconstruction loss is the squared Frobenius norm of the product of the electrochemical latent feature matrix and the shared dictionary matrix multiplied by the corresponding electrochemical component in the orthogonal sparse coding matrix. This is the sum of spectral reconstruction loss and electrochemical reconstruction loss.

[0057] Reconstructing loss Orthogonality penalty term Calculate the weighted sum to obtain the overall optimization objective. The formula for calculating the overall optimization objective is:

[0058]

[0059] in, For the overall optimization objective, To reconstruct the loss, As an orthogonality penalty term, This represents the weighting coefficient of the orthogonality penalty term in the overall optimization objective. The initial value is set to The setting is based on the fact that during the pre-training phase of the cross-modal feature decoupling network, a grid search method is used within the range of values. to Inner step length Perform a search, calculate the feature encoding vector separation index for each search, and select the value that maximizes the separation index as the weight coefficient. The initial value.

[0060] The gradients of the internal weights of the cross-modal feature decoupling network are calculated based on the overall optimization objective. The internal weights of the cross-modal feature decoupling network include the weight matrix and bias vector of the first fully connected hidden layer in the spectral feature mapping sub-network, the weight matrix and bias vector of the second fully connected hidden layer in the spectral feature mapping sub-network, the weight matrix and bias vector of the first fully connected hidden layer in the electrochemical feature mapping sub-network, the weight matrix and bias vector of the second fully connected hidden layer in the electrochemical feature mapping sub-network, the shared dictionary matrix, and the orthogonal sparse coding matrix. The partial derivatives of the overall optimization objective with respect to each internal weight are calculated for each of the above internal weights to obtain the gradient vector or gradient matrix corresponding to each internal weight.

[0061] The adaptive moment estimation optimizer updates the internal weights along the gradient descent direction. The adaptive moment estimation optimizer maintains first-order and second-order moment estimates for each internal weight, along with a decay factor for the first-order moment estimate. Set as The attenuation factor of the second-order moment estimation vector Set as Numerical stability constant Set as The learning rate is set to During each update of the internal weights, the adaptive moment estimation optimizer adaptively adjusts the weight coefficients of the orthogonality penalty term in the overall optimization objective based on the historical gradient variance of the orthogonality penalty term. The adaptive adjustment is as follows: The variance of the gradient values ​​of the orthogonality penalty term in the current iteration step and the previous ten consecutive iteration steps is calculated. The gradient value of the orthogonality penalty term in the current iteration step refers to the L2 norm of the vector composed of the partial derivatives of the orthogonality penalty term with respect to the elements of the shared dictionary matrix. The variance of the gradient value of the orthogonality penalty term in the current iteration step is compared with that in the previous iteration step. If the variance of the gradient value of the orthogonality penalty term in the current iteration step is greater than that in the previous iteration step, then the weight coefficients are adjusted. Multiply by the attenuation factor Reduce the weighting coefficient; if the variance of the gradient value of the orthogonality penalty term in the current iteration step is less than or equal to the variance of the gradient value of the orthogonality penalty term in the previous iteration step, then adjust the weighting coefficient. Multiply by the magnification factor Amplification, the amplified weighting coefficient Not exceeding the preset upper limit value .

[0062] Repeat the above update process, performing alternating direction multiplier iterations after each internal weight update to obtain the updated feature encoding vector, and recalculating the absolute cosine similarity between each pair of feature encoding vectors for all heavy metals. The maximum absolute cosine similarity between the feature encoding vector of each heavy metal and the feature encoding vectors of all other heavy metals is taken as the separation score for that heavy metal. Check all... Are the resolution values ​​of all heavy metals less than the preset resolution threshold? Separation threshold Set as The setting is based on the fact that in the test of mixed heavy metal samples with standard concentrations, when the resolution value is lower than... At this time, the average relative error between the concentration estimate output by the concentration regression branch and the actual concentration value is less than 10%. This is when the resolution values ​​of all heavy metals are less than the resolution threshold. Stop iterating when the time is right.

[0063] After the iteration stops, the feature encoding vector at the time of stopping is obtained. This feature encoding vector is then input into the concentration regression branch to obtain the concentration estimate for each heavy metal. The concentration regression branch internally stores multiple reference feature encoding vectors, each corresponding to a known heavy metal concentration value. The correspondence between the reference feature encoding vectors and the known heavy metal concentration values ​​is pre-obtained through a calibration process. The calibration process involves preparing multiple calibration water samples containing a single heavy metal, with concentration values ​​calibrated using a standard method. For each calibration water sample, the same signal acquisition, feature mapping, and feature decoupling processes as for the test water sample are performed to obtain the reference feature encoding vector corresponding to that heavy metal in the calibration water sample. This reference feature encoding vector is then combined with the known heavy metal concentration value to form a reference data pair, which is stored in the concentration regression branch.

[0064] For the feature encoding vector corresponding to a certain heavy metal to be estimated, calculate the Euclidean distance between this feature encoding vector and all reference feature encoding vectors corresponding to this heavy metal in the concentration regression branch. Let the feature encoding vector... With the Reference feature encoding vectors The Euclidean distance is , Let L2 norm be used. Sort all Euclidean distances in ascending order, and find the three reference feature encoding vectors with the smallest Euclidean distances, denoted as [vectors to be inserted here]. , , The corresponding Euclidean distances are respectively , , The corresponding known heavy metal concentration values ​​are as follows: , , The three known heavy metal concentration values ​​are weighted and averaged, with the weight being the reciprocal of their respective Euclidean distances, to obtain the concentration estimate. The calculation method is as follows The weighted average calculation described above is performed on the feature encoding vector corresponding to each heavy metal, and the concentration estimates of all heavy metals are output.

[0065] Example 5:

[0066] In practice, after outputting the estimated concentration value for each heavy metal, the control unit in the intelligent sensor array compares the estimated concentration value for each heavy metal with a preset concentration alarm threshold. The concentration alarm thresholds are stored in the non-volatile memory of the intelligent sensor array. Each concentration alarm threshold contains a list of thresholds corresponding to a specific heavy metal being detected, and the alarm threshold for each heavy metal is set according to the limits in relevant water quality standards. The control unit reads the concentration alarm threshold list from the non-volatile memory and, for the first output value... Concentration estimates of several heavy metals Read the first item in the concentration alarm threshold list. Concentration alarm thresholds for various heavy metals Perform numerical comparison operations. When the estimated concentration of any heavy metal... Greater than the corresponding concentration alarm threshold When the comparison result is true, the intelligent sensor array is triggered to switch to continuous sampling mode.

[0067] The specific process of switching the intelligent sensor array to continuous sampling mode is as follows: the control unit sends a mode switching command to the sampling timing controller in the intelligent sensor array, and the sampling timing controller adjusts the default discrete sampling period to a continuous sampling period. The discrete sampling period refers to performing a complete spectral response sequence and electrochemical response sequence acquisition once at preset regular sampling time intervals. The continuous sampling period refers to immediately performing multiple complete acquisitions after receiving the mode switching command; the number of continuous acquisitions is set to... , The value is There is no time interval between continuous sampling; the next sampling begins immediately after the previous one is completed. Each complete sampling process is identical to the previous complete sampling process before the trigger switch, including: continuously acquiring the spectral and electrochemical response sequences of the water body through the intelligent sensor array. The spectral acquisition of the spectral response sequence is performed according to the preset wavelength range of the spectral acquisition module in the intelligent sensor array, and the potential scan of the electrochemical response sequence is performed according to the preset potential waveform of the potentiostat. In continuous sampling mode, the newly acquired spectral and electrochemical response sequences are stored in the buffer memory of the intelligent sensor array according to the sampling order.

[0068] In continuous sampling mode, after each complete acquisition, the new spectral response sequence and the new electrochemical response sequence are re-input into the cross-modal feature decoupling network to obtain updated concentration estimates. The processing flow for re-inputting into the cross-modal feature decoupling network is as follows: For the new spectral response sequence, following the same processing method as the initial spectral response sequence, a spectral time matrix is ​​first constructed, and then a Kronecker product is performed with the electrochemical time matrix constructed from the corresponding new electrochemical response sequence to obtain an updated water background feature tensor. Based on the updated water background feature tensor, the optimized excitation parameters are recalculated. However, in continuous sampling mode, the most recently used optimized excitation parameters before the trigger switch are directly used to drive active excitation, and the dynamic adjustment step of excitation parameters is not repeated. For the new delayed spectral response signal and new pulsed electrochemical response signal induced by heavy metals acquired through active excitation in continuous sampling, new spectral detail coefficients are obtained by wavelet transform decomposition, and new intrinsic mode function components are obtained by empirical mode decomposition. These are then mapped through spectral feature mapping subnetwork and electrochemical feature mapping subnetwork to form new spectral latent feature matrices and new electrochemical latent feature matrices. Feature decoupling is then performed through alternating direction multiplier iteration and shared dictionary matrix and orthogonal sparse coding matrix to obtain the updated feature coding vector for each heavy metal. Finally, the updated concentration estimate is obtained through the concentration regression branch. The internal weights of the cross-modal feature decoupling network involved in the above process remain at the weight values ​​at the time of stopping iteration and are not updated iteratively.

[0069] The updated concentration estimate is compared with the concentration alarm threshold. The comparison method is as follows: for each updated concentration estimate obtained by re-inputting the cross-modal feature decoupling network, the updated concentration estimate of each heavy metal is compared with the corresponding concentration alarm threshold in the concentration alarm threshold list one by one. The Boolean value of the comparison result is recorded. A Boolean value of true indicates that the concentration estimate exceeds the concentration alarm threshold, and a Boolean value of false indicates that the concentration estimate does not exceed the concentration alarm threshold.

[0070] The updated concentration estimate is compared with the concentration alarm threshold, along with the corresponding timestamp, and then encapsulated into an alarm data packet. The timestamp is provided by the real-time clock module in the intelligent sensor array. The real-time clock module latches the current time as the timestamp each time a comparison result is generated, with a timestamp accuracy in milliseconds. The alarm data packet encapsulation format uses a predefined binary frame structure. The frame structure sequentially includes a frame header field, an alarm type field, a timestamp field, a heavy metal species field, an updated concentration estimate field, a comparison result flag field, and a frame tail check field. The frame header field is a fixed two-byte synchronization word. The alarm type field indicates that the alarm type is concentration exceeding the limit. The timestamp field contains year, month, day, hour, minute, second, and millisecond information. The heavy metal species field indicates the number of heavy metal species involved in the current alarm. The updated concentration estimate field concatenates the updated concentration estimates of all heavy metals in sequence. The comparison result flag field concatenates the Boolean values ​​of the comparison results for each heavy metal bit by bit. The frame tail check field is a cyclic redundancy check value from the frame header to the comparison result flag field.

[0071] The encapsulated alarm data packet is sent to the remote monitoring platform via the wireless communication module of the intelligent sensor array. The wireless communication module uses a low-power wide-area network (LPWAN) communication protocol. Before transmission, the radio frequency circuit of the wireless communication module is activated to establish a secure transmission layer connection with the remote monitoring platform. The alarm data packet is then transmitted in transparent transmission mode through this connection. After transmission, the control unit of the intelligent sensor array receives a transmission confirmation response from the wireless communication module. If no transmission confirmation response is received within the preset retransmission timeout period, the alarm data packet is retransmitted. The maximum number of retransmissions is set to [limited to a specified number]. If any one of the multiple updated concentration estimates obtained in continuous sampling mode triggers an alarm, an independent alarm data packet is generated and sent for that data packet, and different alarm data packets are sent sequentially in the order of generation.

[0072] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A method for detecting heavy metals in water quality based on intelligent sensors, characterized in that, include: The initial spectral response sequence and initial electrochemical response sequence of the water body are continuously collected by an array of smart sensors deployed at the sampling points; A water background feature tensor is constructed based on the initial spectral response sequence and the initial electrochemical response sequence. The excitation parameters of the smart sensor array are then dynamically adjusted based on this water background feature tensor to obtain optimized excitation parameters. Specifically: The initial spectral response sequence is arranged according to the acquisition time to form a spectral time matrix, and the initial electrochemical response sequence is arranged according to the acquisition time to form an electrochemical time matrix. The Kronecker product is performed on the spectral time matrix and the electrochemical time matrix to obtain the water body background feature tensor. Extract the main diagonal slice from the water body background feature tensor, calculate the energy distribution centroid of the main diagonal slice, and determine the excitation wavelength adjustment and excitation potential adjustment of the smart sensor array based on the energy distribution centroid. The optimized excitation parameters are obtained by superimposing the excitation wavelength adjustment and the excitation potential adjustment onto the default excitation wavelength and default excitation potential of the smart sensor array, respectively. The optimized excitation parameters are used to drive the intelligent sensor array to actively excite the water body, and heavy metal-induced delayed spectral response signal and pulsed electrochemical response signal are obtained. The delayed spectral response signal and the pulsed electrochemical response signal are input into a pre-trained cross-modal feature decoupling network to separate the feature encoding vector corresponding to each heavy metal, specifically: The delayed spectral response signal is decomposed by wavelet transform to obtain spectral detail coefficients at multiple scales, and the pulsed electrochemical response signal is decomposed by empirical mode to obtain multiple intrinsic mode function components. The spectral detail coefficients at the multiple scales and the multiple intrinsic mode function components are respectively mapped to the same latent space dimension to form a spectral latent feature matrix and an electrochemical latent feature matrix; Alternating direction multiplier iterations are performed on the spectral latent feature matrix and the electrochemical latent feature matrix. In each iteration, the components corresponding to the same heavy metal in the spectral latent feature and the electrochemical latent feature are forced to align in the same direction. At the same time, orthogonal constraints are applied to the components corresponding to different heavy metals. The feature encoding vector corresponding to each heavy metal is output after convergence. Based on the orthogonality constraint among the feature encoding vectors corresponding to all heavy metals, the internal weights of the cross-modal feature decoupling network are iteratively updated until the feature encoding vector of each heavy metal satisfies the preset separation criterion, and the concentration estimate of each heavy metal is output, specifically: Calculate the cosine similarity between each pair of feature encoding vectors corresponding to all heavy metals, and use the sum of the absolute values ​​of the cosine similarity as the orthogonality penalty term. Calculate the weighted sum of the reconstruction loss of the cross-modal feature decoupling network and the orthogonality penalty term as the overall optimization objective. The gradient of the internal weights of the cross-modal feature decoupling network is calculated based on the overall optimization objective, and the internal weights are updated along the gradient descent direction using an adaptive moment estimation optimizer. Repeat the above update process until the absolute value of the cosine similarity between the feature encoding vector of each heavy metal and the feature encoding vectors of all other heavy metals is less than the preset separation threshold. Then stop the iteration and input the feature encoding vector at the time of stopping the iteration into the concentration regression branch to obtain the concentration estimate of each heavy metal.

2. The method for detecting heavy metals in water based on a smart sensor according to claim 1, characterized in that, The optimized excitation parameters are used to drive the intelligent sensor array to actively excite the water body, and the heavy metal-induced delayed spectral response signal and pulsed electrochemical response signal are obtained as follows: According to the optimized excitation wavelength in the optimized excitation parameters, the light source module in the smart sensor array is controlled to emit pulsed excitation light to the water body. The echo spectrum of the water body is collected within the first delay time window after the pulsed excitation light stops, which is used as the delayed spectral response signal. According to the optimized excitation potential in the optimized excitation parameters, the electrochemical probe in the smart sensor array is controlled to apply a square wave pulse voltage to the water body. The current decay curve of the water body is collected within the second delay time window after the square wave pulse voltage stops, which is used as the pulsed electrochemical response signal. The start times of the first and second delay time windows are determined by the principal eigenvalues ​​of the water body background feature tensor.

3. The method for detecting heavy metals in water based on a smart sensor according to claim 2, characterized in that, The adaptive moment estimation optimizer adaptively adjusts the weight coefficient of the orthogonality penalty term in the overall optimization objective each time it updates the internal weights, based on the historical gradient variance of the orthogonality penalty term.

4. The method for detecting heavy metals in water based on a smart sensor according to claim 1, characterized in that, Extracting the main diagonal slice from the water body background feature tensor, calculating the energy distribution centroid of the main diagonal slice, and determining the excitation wavelength adjustment and excitation potential adjustment of the smart sensor array based on the energy distribution centroid are specifically as follows: Elements at the same index positions in the first and second dimensions of the water body background feature tensor are extracted sequentially to form the main diagonal slice. The element in the main diagonal slice is squared and normalized to obtain the energy probability distribution sequence. Using the index position of the energy probability distribution sequence as discrete coordinates, the first-order moment of the energy probability distribution sequence is calculated as the energy distribution centroid. The difference between the energy distribution centroid and the preset background reference centroid is multiplied by a first proportional coefficient to obtain the excitation wavelength adjustment amount. The difference between the energy distribution centroid and the background reference centroid is multiplied by a second proportional coefficient to obtain the excitation potential adjustment amount, wherein the first proportional coefficient and the second proportional coefficient are determined by the adjustable range of the light source and the adjustable range of the potential of the smart sensor array, respectively.

5. The method for detecting heavy metals in water based on a smart sensor according to claim 2, characterized in that, The start times of the first and second delay time windows are determined by the principal eigenvalues ​​of the water background feature tensor, specifically as follows: The background feature tensor of the water body is subjected to high-order singular value decomposition, and the largest singular value is extracted as the main background feature value. The main background feature value is multiplied by a preset feature value to time mapping coefficient to obtain the basic delay time. The basic delay time is used as the starting time of the first delay time window, and half of the basic delay time is used as the starting time of the second delay time window. The duration of the first delay time window and the duration of the second delay time window are respectively preset by the excitation pulse width and square wave pulse width in the optimized excitation parameters.

6. The method for detecting heavy metals in water based on a smart sensor according to claim 1, characterized in that, Alternating direction multiplier iterations are performed on the spectral latent feature matrix and the electrochemical latent feature matrix. In each iteration, the components corresponding to the same heavy metal in the spectral and electrochemical latent features are forced to align in a common direction, while orthogonal constraints are applied to the components corresponding to different heavy metals. After convergence, the feature encoding vector corresponding to each heavy metal is output as follows: Initialize a shared dictionary matrix and an orthogonal sparse coding matrix. Fix the shared dictionary matrix and solve the orthogonal sparse coding matrix to minimize the difference between the spectral latent feature matrix and the product of the shared dictionary matrix and the orthogonal sparse coding matrix, while also minimizing the difference between the electrochemical latent feature matrix and the product of the shared dictionary matrix and the orthogonal sparse coding matrix. Fix the orthogonal sparse coding matrix, update the shared dictionary matrix to minimize the weighted sum of the two differences, and force the inner product between different columns of the shared dictionary matrix to be zero after updating the shared dictionary matrix; The above fixing and updating steps are performed alternately until the change in the orthogonal sparse coding matrix is ​​less than a preset convergence threshold. Each row of the converged orthogonal sparse coding matrix is ​​then used as a feature coding vector corresponding to a heavy metal.

7. The method for detecting heavy metals in water based on a smart sensor according to claim 1, characterized in that, Inputting the feature encoding vector at the point of stopping iteration into the concentration regression branch yields the concentration estimate for each heavy metal as follows: Obtain the feature encoding vector at the time of stopping iteration, and calculate the Euclidean distance between the feature encoding vector and multiple reference feature encoding vectors pre-stored in the concentration regression branch. Each reference feature encoding vector corresponds to a known heavy metal concentration value. Find the three reference feature encoding vectors with the smallest Euclidean distance, and take a weighted average of the known heavy metal concentration values ​​corresponding to these three reference feature encoding vectors. The weight is the reciprocal of the Euclidean distance of each vector. The result of the weighted average is used as the estimated value of the heavy metal concentration corresponding to the feature encoding vector. Perform the above calculations on the feature encoding vector corresponding to each heavy metal, and output the estimated concentration values ​​of all heavy metals.

Citation Information

Patent Citations

  • Electronic potential arithmetic unit, electronic potential arithmetic method, electronic potential arithmetic program, and physical property predicted value arithmetic unit

    JP2009087315A

  • Method and apparatus for optimization of wireless multipoint electromagnetic communication networks

    US20040095907A1