Water pollutant feature extraction and recognition method, device and equipment and storage medium
By dividing the fluorescence spectral data into quasi-single-peak intervals and fusing features, the problems of accuracy and robustness in pollutant identification under complex water quality conditions were solved, achieving efficient and accurate pollutant identification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHIJIAZHUANG UNIVERSITY
- Filing Date
- 2026-04-24
- Publication Date
- 2026-05-26
AI Technical Summary
Existing fluorescence spectroscopy analysis methods lack accuracy and robustness under complex water quality conditions, making it difficult to meet the needs of practical applications.
By acquiring fluorescence spectral data, preprocessing it, dividing it into quasi-single-peak intervals, calculating local statistical features and global spectral features, combining it with a lightweight cross-attention module to perform feature fusion, constructing a comprehensive feature vector, and inputting it into a preset water pollutant identification model.
It improves the accuracy and stability of pollutant identification under complex water quality conditions, suppresses turbidity and noise interference, and enhances discriminativeness and robustness.
Smart Images

Figure CN122084591A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of water pollution detection technology, and in particular to a method, apparatus, equipment and storage medium for extracting and identifying features of water pollutants. Background Technology
[0002] Rapid economic development is accompanied by environmental degradation, with water pollution being the most prominent issue. Therefore, the development of water quality testing technology is of paramount importance.
[0003] Traditional water quality testing techniques are usually single-point water quality testing, which means that water samples are collected and sent back to the laboratory for analysis using standard methods and precision instruments. This testing method provides accurate and authoritative results and is suitable for full analysis, arbitration, and precision research. However, the process is complex, the testing time is long, and it is easy to cause secondary pollution. Therefore, in order to explore efficient, accurate, and green water quality testing methods, the use of laser-induced fluorescence spectroscopy to retrieve water quality parameters of inland small water bodies has become one of the research hotspots in recent years.
[0004] However, in natural aquatic environments, water bodies are typically in a complex state of turbidity variation, water flow, and the coexistence of multiple pollutants, making fluorescence spectral signals susceptible to interference and hindering accurate extraction of pollutant characteristics. Existing fluorescence spectroscopy analysis methods are mostly designed for ideal conditions, relying primarily on global statistics or simple peak detection. Under complex water quality conditions, they are easily affected by noise, baseline drift, and spectral overlap, resulting in poor feature stability, weak discriminative power, and insufficient identification accuracy and robustness, making it difficult to meet practical application needs. Summary of the Invention
[0005] This invention provides a method, apparatus, device, and storage medium for extracting and identifying features of water pollutants, in order to solve the problem of insufficient accuracy and robustness of existing fluorescence spectroscopy analysis methods under complex water quality conditions.
[0006] In a first aspect, embodiments of the present invention provide a method for extracting and identifying features of water pollutants, including: Acquire fluorescence spectral data of the water body under specific laser excitation conditions; The fluorescence spectral data is preprocessed, and the preprocessed fluorescence spectral data is divided into quasi-single-peak intervals. The local statistical features of each quasi-single-peak interval are calculated. The local statistical features include the normalized skewness product, which is obtained based on the skewness and kurtosis of the fluorescence intensity of each quasi-single-peak interval, as well as the interval width of each quasi-single-peak interval. Spectral shape features were extracted from the preprocessed fluorescence spectral data to obtain global spectral shape features; The local statistical features and the global spectral features of each quasi-unimodal interval are fused to obtain a comprehensive feature vector; The comprehensive feature vector is input into a preset water pollutant identification model to obtain the pollutant type identification result of the water body to be tested.
[0007] In one possible implementation, the step of dividing the preprocessed fluorescence spectral data into quasi-single-peak intervals and calculating the local statistical characteristics of each quasi-single-peak interval includes: A second-order difference operation is performed on the fluorescence intensity sequence formed by the preprocessed fluorescence spectral data to obtain the second-order difference sequence corresponding to the preprocessed fluorescence spectral data. The quasi-unimodal interval is determined based on the zero-crossing points in the second-order difference sequence; For each quasi-single-peak interval, the robust mean of the M-estimate for each fluorescence intensity within the quasi-single-peak interval is calculated. Based on the skewness and kurtosis of the fluorescence intensity within the quasi-single-peak interval, and the interval width of the quasi-single-peak interval, the normalized skewness product of the quasi-single-peak interval is obtained. The robust mean of the M-estimate and the normalized skewness product are used as local statistical features of the quasi-single-peak interval.
[0008] In one possible implementation, obtaining the normalized skewness product of the quasi-single-peak interval based on the skewness and kurtosis of the fluorescence intensity of the quasi-single-peak interval, and the interval width of the quasi-single-peak interval, includes: Calculate the product of skewness and kurtosis of fluorescence intensity in this quasi-single-peak region; Dividing the product by the width of the quasi-unimodal interval yields the normalized skewed product of the quasi-unimodal interval.
[0009] In one possible implementation, the step of extracting spectral shape features from the preprocessed fluorescence spectral data to obtain global spectral shape features includes: Multi-scale peak detection is performed on the fluorescence intensity sequence composed of preprocessed fluorescence spectral data to obtain the peak values of fluorescence intensity at each scale and the wavelengths corresponding to the peak values in the preprocessed fluorescence spectral data, thus forming a multi-scale peak detection set. The maximum value of the fluorescence intensity peaks in the multi-scale peak detection set is determined and denoted as the strongest peak. The second strongest peak is determined based on the strongest peak, and the correlation features between the strongest peak and the second strongest peak are extracted. The cumulative curvature change of the fluorescence intensity sequence formed by the preprocessed fluorescence spectral data within a preset characteristic band range is used as the correlation feature and the cumulative curvature change as the global spectral shape feature.
[0010] In one possible implementation, determining the second strongest peak based on the strongest peak includes: Based on the strongest peak, the wavelength corresponding to the strongest peak is obtained and denoted as the strongest wavelength; Within a preset wavelength offset range of the strongest wavelength, the peak value of the fluorescence intensity that is less than the maximum value of the strongest peak is denoted as the second strongest peak.
[0011] In one possible implementation, the correlation features between the strongest peak and the second strongest peak are extracted, including: Calculate the ratio of the peak value corresponding to the strongest peak to the peak value corresponding to the second strongest peak, and denot it as the intensity ratio; Calculate the difference between the wavelength corresponding to the strongest peak and the wavelength corresponding to the second strongest peak, and denote it as the wavelength difference; Calculate the integral area within a preset interval centered on the wavelength corresponding to the strongest peak, and denot it as the first area. Calculate the integral area within a preset interval centered on the wavelength corresponding to the second strongest peak, and denot it as the second area. Calculate the ratio of the first area to the second area, and denot it as the integral area ratio. The intensity ratio, the wavelength difference, and the integral area ratio are used as correlation features between the strongest peak and the second strongest peak.
[0012] In one possible implementation, the local statistical features and the global spectral features of each quasi-unimodal interval are fused to obtain a comprehensive feature vector, including: The local statistical features of each quasi-unimodal interval are subjected to nonlinear transformation and preliminary dimensionality reduction to obtain a first feature vector; the global spectral features are subjected to nonlinear transformation and preliminary dimensionality reduction to obtain a second feature vector. The first feature vector and the second feature vector are fused using a lightweight cross-attention module to obtain a first fused feature vector and a second fused feature vector. The first feature vector, the second feature vector, the first fused feature vector, and the second fused feature vector are concatenated to obtain the comprehensive feature vector.
[0013] Secondly, embodiments of the present invention provide a device for extracting and identifying features of water pollutants, comprising: The acquisition module is used to acquire fluorescence spectral data of the water body under specific laser excitation conditions; The first feature extraction module is used to preprocess the fluorescence spectral data, divide the preprocessed fluorescence spectral data into quasi-single-peak intervals, and calculate the local statistical features of each quasi-single-peak interval. The local statistical features include the normalized skewness product, which is obtained based on the skewness and kurtosis of the fluorescence intensity of each quasi-single-peak interval and the interval width of each quasi-single-peak interval. The second feature extraction module is used to extract spectral features from the preprocessed fluorescence spectral data to obtain global spectral features. The feature fusion module is used to fuse the local statistical features and the global spectral features of each of the quasi-unimodal intervals to obtain a comprehensive feature vector; The pollutant identification module is used to input the comprehensive feature vector into a preset water pollutant identification model to obtain the pollutant type identification result of the water body to be tested.
[0014] Thirdly, embodiments of the present invention provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method described in the first aspect or any possible implementation thereof.
[0015] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in the first aspect or any possible implementation thereof.
[0016] In this embodiment of the invention, fluorescence spectral data of the water body under specific laser excitation conditions are acquired; the fluorescence spectral data are preprocessed, and the preprocessed fluorescence spectral data are divided into quasi-single-peak intervals. Then, the local statistical features of each quasi-single-peak interval are calculated. The local statistical features include the normalized skewness product, which is obtained based on the skewness and kurtosis of the fluorescence intensity of each quasi-single-peak interval, as well as the interval width of each quasi-single-peak interval. Thus, local statistical features are extracted within an adaptive interval based on the quasi-single-peak interval division. The local statistical features include the normalized skewness product. By combining the spectral distribution symmetry (characterized by skewness) and the spectral distribution steepness (characterized by kurtosis) with the interval width through scale normalization, a single feature quantity is used to comprehensively describe the overall contour information of local fluorescence peaks, including their tilt, sharpness, and width. This achieves a comprehensive quantification of the local spectral envelope morphology. Quantifying the local spectral envelope morphology through normalized skewness product enables the stable capture of the inherent fluorescence morphological fingerprint of pollutants, reducing the interference of turbidity, noise, and baseline drift on the features. This improves the discriminativeness and robustness of spectral features under complex water quality conditions, providing a highly reliable morphological basis for subsequent accurate pollutant identification. Based on this, spectral shape features are extracted from the preprocessed fluorescence spectral data to obtain global spectral shape features. Then, the local statistical features of each quasi-single-peak interval are fused with the global spectral shape features to obtain a comprehensive feature vector. This allows for a deeper exploration and association of the essential spectral fingerprint information of pollutants, constructing a more discriminative comprehensive feature vector. Finally, this comprehensive feature vector is used to obtain the pollutant type identification results for the tested water body, improving the accuracy, stability, and applicability of water pollutant identification. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the implementation of the water pollutant feature extraction and identification method provided in this embodiment of the invention; Figure 2 This is a schematic diagram of the water pollutant feature extraction and identification device provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0018] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0019] See Figure 1 The flowchart illustrating the implementation of the water pollutant feature extraction and identification method provided in this embodiment of the invention is described in detail below: Step 101: Obtain fluorescence spectral data of the water body under specific laser excitation conditions.
[0020] Specific laser excitation conditions refer to a series of key parameter combinations set for the laser source to efficiently and selectively excite the fluorescence signal of target pollutants (such as polycyclic aromatic hydrocarbons, petroleum hydrocarbons, etc.). These parameters include excitation wavelength, laser power or energy, pulse characteristics, beam and optical path parameters, etc. These conditions are not fixed values but can be optimized according to the optical characteristics of the target pollutant and the detection target. In this embodiment, the corresponding specific laser excitation conditions can be determined according to the target pollutants that may actually be contained in the water body to be tested.
[0021] Step 102: Preprocess the fluorescence spectral data, divide the preprocessed fluorescence spectral data into quasi-single-peak intervals, and calculate the local statistical features of each quasi-single-peak interval. The local statistical features include the normalized skewness product, which is obtained based on the skewness and kurtosis of the fluorescence intensity of each quasi-single-peak interval, as well as the interval width of each quasi-single-peak interval.
[0022] For example, preprocessing fluorescence spectral data may include denoising, baseline correction, and normalization to eliminate random noise and system drift.
[0023] For example, the preprocessed fluorescence spectral data can be divided into quasi-single-peak intervals using methods such as derivative spectroscopy, wavelet transform, peak fitting, or deconvolution.
[0024] Among them, derivative spectroscopy is the most direct method. By calculating the first or second derivative of the spectrum, the shoulder peaks, inflection points, and peak boundaries can be identified more clearly. Usually, the zero point of the first derivative corresponds to the peak or valley of the original spectrum, while the zero-crossing point of the second derivative corresponds to the inflection point of the original spectrum. These inflection points are often selected as the dividing points of quasi-single-peak intervals.
[0025] The wavelet transform method utilizes the multi-resolution analysis characteristics of wavelet transform to decompose spectral signals into different scales. At a specific scale, the modulus maxima or zero-crossings of the wavelet coefficients can effectively locate the boundaries of spectral peaks, thereby achieving automatic division of quasi-single-peak intervals.
[0026] Peak fitting or deconvolution methods assume that the measured spectrum is a superposition of multiple theoretical peak shape functions. By selecting an appropriate basic peak shape, a global fitting is performed using nonlinear least squares. Each fitted sub-peak corresponds to a quasi-single-peak interval.
[0027] This embodiment effectively locates points where the curvature of the original spectral curve changes significantly by dividing the preprocessed fluorescence spectral data into quasi-single-peak intervals, thereby achieving adaptive interval division of the spectrum. Based on this, by extracting the normalized skewness product of each quasi-single-peak interval, the spectral distribution symmetry represented by skewness and the spectral distribution steepness represented by kurtosis are fused with the interval width using scale normalization. This allows for a comprehensive description of the overall contour information of the local fluorescence peak, such as its tilt, sharpness, and width, using a single feature quantity. This enables the comprehensive quantification of the local spectral envelope morphology corresponding to each quasi-single-peak interval, and uses this as a robust statistical feature of the quasi-single-peak interval. This robust statistical feature effectively suppresses interference caused by turbidity changes, noise, and spectral overlap, improving the stability of the feature in complex environments.
[0028] Step 103: Extract spectral features from the preprocessed fluorescence spectral data to obtain global spectral features.
[0029] In this embodiment, the spectral shape features are the features that characterize the overall spectral topology of the fluorescence spectrum, which can usually be extracted based on the contour, extreme points and curvature changes of the entire spectrum or significant peak intervals.
[0030] Step 104: The local statistical features and global spectral features of each quasi-unimodal interval are fused to obtain a comprehensive feature vector.
[0031] For example, fusion can be achieved by directly concatenating the local statistical features and global spectral features of each quasi-unimodal interval, or by concatenating them according to feature attention.
[0032] In this embodiment, by fusing the local statistical features and global spectral features of each quasi-single-peak interval, robust statistical features (anti-noise, describing distribution) and spectral topological features (characterizing morphological structure) can be combined to comprehensively and stably characterize fluorescence spectra, providing a reliable information basis for subsequent qualitative and quantitative analysis.
[0033] Step 105: Input the comprehensive feature vector into the preset water pollutant identification model to obtain the pollutant type identification result of the water body to be tested.
[0034] For example, the preset water pollutant identification model can be a multilayer perceptron (MLP), which receives the aforementioned integrated feature vector and outputs the prediction result of the pollutant category.
[0035] In one embodiment, step 102 may include: A second-order difference operation is performed on the fluorescence intensity sequence formed by the preprocessed fluorescence spectral data to obtain the second-order difference sequence corresponding to the preprocessed fluorescence spectral data.
[0036] The quasi-single-peak interval is determined based on the zero-crossing points in the second-order difference sequence.
[0037] For each quasi-single-peak interval, the robust mean of the M-estimate for each fluorescence intensity within the quasi-single-peak interval is calculated. Based on the skewness and kurtosis of the fluorescence intensity within the quasi-single-peak interval, as well as the interval width of the quasi-single-peak interval, the normalized skewness product of the quasi-single-peak interval is obtained. The robust mean of the M-estimate and the normalized skewness product are used as local statistical features of the quasi-single-peak interval.
[0038] For example, the central difference method can be used to perform a first-order difference operation on the fluorescence intensity sequence composed of preprocessed fluorescence spectral data to obtain a first-order difference sequence. Then, the central difference method can be used to difference the first-order difference sequence again to obtain a second-order difference sequence.
[0039] After obtaining the second-order difference sequence, the positions where the signs of adjacent sampling points in the second-order difference sequence flip are determined as zero-crossings. Then, false zero-crossings caused by noise are eliminated using dual thresholds of amplitude and spacing, resulting in a set of valid zero-crossings arranged in ascending order of wavelength. For example, after obtaining the zero-crossings, the absolute values of the second-order difference values before and after each zero-crossing can be checked. A zero-crossing is considered valid and caused by a true spectral feature only if at least one of the absolute values of the second-order difference values before and after the zero-crossing is greater than the amplitude threshold, or if the change in the absolute value of the second-order difference values before and after the zero-crossing (such as the difference between the two) is greater than the amplitude threshold. Otherwise, it is considered noise fluctuation and eliminated. After applying the amplitude threshold, the remaining candidate zero-crossings can be further filtered in wavelength order. A minimum wavelength spacing D_th is set. When the wavelength difference between two adjacent candidate zero-crossings is less than D_th, they are considered too close together and may originate from the same feature change or noise. At this point, usually only the point with the more significant amplitude (or according to other rules, such as the first one) is retained, and the other is removed.
[0040] After obtaining the set of effective zero-crossings arranged in ascending order of wavelength, not every region between two adjacent zero-crossings is considered a quasi-single-peak interval. Instead, the effective zero-crossings are traversed in ascending order of wavelength, and adjacent "left boundary zero-crossing point where the second-order difference changes from positive to negative + right boundary zero-crossing point where the difference changes from negative to positive" are directionally paired. The wavelength region between the paired zero-crossing point pairs is a candidate quasi-single-peak interval.
[0041] After obtaining the candidate quasi-single-peak intervals, invalid intervals can be filtered and eliminated using interval width thresholds and peak intensity thresholds. For example, the wavelength span (i.e., right boundary wavelength - left boundary wavelength, also known as interval width) of each candidate quasi-single-peak interval can be calculated. A minimum width threshold W_th is set; if the interval width of a candidate quasi-single-peak interval is less than W_th, the interval is considered invalid and eliminated. Simultaneously, within each candidate quasi-single-peak interval, the maximum fluorescence intensity of the original spectrum (or pre-processed spectrum) is found, i.e., the "peak intensity" of that interval, and a minimum peak intensity threshold I_th is set. If the "peak intensity" of a candidate quasi-single-peak interval is lower than I_th, the interval is considered invalid and eliminated.
[0042] The aforementioned interval width threshold and peak intensity threshold can be set based on the specific spectrometer performance, noise level, and typical signal intensity of the pollutant to be measured. They can be fixed values set in advance based on experience, or adaptive thresholds dynamically calculated based on the statistical characteristics of the entire spectrum or local spectrum (such as the percentage of the global maximum peak intensity, the multiple of the average noise level, the distribution of the interval width of the quasi-single-peak intervals of all candidate regions, etc.).
[0043] Next, after removing invalid intervals, additional pairing processing can be performed on special scenarios such as overlapping peaks and spectral beginning and end boundaries as needed, ultimately achieving adaptive quasi-single-peak interval division of the spectrum.
[0044] Overlapping peaks refer to regions where peaks severely overlap, where the zero-crossings of the second-order difference sequence may be very dense or have disordered pairings (e.g., two consecutive "positive-to-negative" points without a "negative-to-positive" point in between). For overlapping peaks, a zero-crossing in the opposite direction can be matched based on the principle of closest wavelength distance to force the formation of a region. If the resulting region width is too small (below a width threshold), it can be merged with adjacent regions. Alternatively, in regions with dense zero-crossings, priority should be given to finding pairs for zero-crossings with larger absolute values of the second-order differences (representing more dramatic curvature changes). This usually corresponds to a more significant main peak, and the remaining zero-crossings can be considered minor fluctuations and ignored or merged into adjacent main regions.
[0045] Specifically, regarding the beginning and end boundaries of the spectrum, if the second-order difference value at the first data point of the spectrum is already negative, this means the spectrum begins in a "concave" state, without a clear left boundary transitioning from positive to negative. A possible approach is to create a virtual left boundary at the start of the spectrum (i.e., at the wavelength of the first data point), and then find the first right boundary transitioning from negative to positive to pair with it, forming the first interval. Conversely, if the second-order difference value at the last data point of the spectrum is still positive, this means the spectrum ends in an "upward-convex" state, without a clear right boundary transitioning from negative to positive. A similar approach is to create a virtual right boundary at the end of the spectrum (i.e., at the wavelength of the last data point), and then find the last left boundary transitioning from positive to negative to pair with it, forming the last interval.
[0046] In this embodiment, by screening zero-crossing points, screening quasi-single-peak intervals, and supplementing the pairing processing of overlapping peaks, spectral beginning and end boundaries, the entire spectral range is divided into a series of continuous "quasi-single-peak intervals" without omission and in a reasonable manner, providing stable analysis units for subsequent feature extraction.
[0047] After dividing the quasi-single-peak intervals, in order to extract robust statistical features within the quasi-single-peak intervals, the robust mean of the M-estimate for each fluorescence intensity within the quasi-single-peak intervals can be calculated to resist impulse noise interference.
[0048] For example, the robust mean of fluorescence intensity within each quasi-single-peak interval can be calculated using the M-estimation method based on the Huber loss function. The core idea is to first use the median of the fluorescence intensity sequence within the quasi-single-peak interval as the initial estimate of the robust mean, and the absolute deviation of the median as the initial estimate of the scale (dispersion). Then, the Huber weight function is used to assign weights to each fluorescence intensity value within the quasi-single-peak interval. Normal fluorescence intensities within a reasonable range are given full weights, while fluorescence intensities deviating from the normal range (i.e., impulse noise anomalies) are given reduced weights. Subsequently, the initial estimate is updated based on the weighted fluorescence intensity values. Through multiple iterations of optimization until the result converges, a robust mean that can resist impulse noise interference is finally obtained.
[0049] For example, the normalized skewness product of the quasi-single-peak interval is obtained based on the skewness and kurtosis of the fluorescence intensity of the quasi-single-peak interval, and the interval width of the quasi-single-peak interval, including: Calculate the product of skewness and kurtosis of fluorescence intensity in this quasi-single-peak region.
[0050] Divide the product by the width of the quasi-unimodal interval to obtain the normalized skewed product of the quasi-unimodal interval.
[0051] Skewness is used to measure the asymmetry of data distribution. It can usually be calculated using sample skewness, for example, by calculating the ratio of the third central moment of fluorescence intensity in a quasi-unimodal region to the cube of the standard deviation of fluorescence intensity in the quasi-unimodal region.
[0052] Kurtosis is used to measure the steepness or flatness of the top of a data distribution curve, as well as the thickness of the tail. It can usually be calculated using sample kurtosis or excess kurtosis.
[0053] The width of a quasi-single-peak interval, i.e., the span of the quasi-single-peak interval on the wavelength axis, can be obtained by subtracting the left boundary wavelength from the right boundary wavelength of the quasi-single-peak interval. After calculating the skewness and kurtosis of the fluorescence intensity of the quasi-single-peak interval, normalization can be performed by dividing the product of the skewness and kurtosis by the width of the quasi-single-peak interval. This eliminates the dimensional influence caused by the different wavelength ranges of different quasi-single-peak intervals, making this characteristic comparable between quasi-single-peak intervals of different widths, thereby quantifying the morphological comprehensive information of the local spectral envelope of each quasi-single-peak interval.
[0054] In one embodiment, step 103 may include: Multi-scale peak detection is performed on the fluorescence intensity sequence composed of preprocessed fluorescence spectral data to obtain the peak values of fluorescence intensity at each scale and the corresponding wavelengths of the peak values, thus forming a multi-scale peak detection set.
[0055] The maximum value of the fluorescence intensity peaks in the multi-scale peak detection set is determined and denoted as the strongest peak. The second strongest peak is determined based on the strongest peak, and the correlation features between the strongest peak and the second strongest peak are extracted.
[0056] The cumulative curvature change of the fluorescence intensity sequence formed by the preprocessed fluorescence spectral data within the preset characteristic band range is used as the correlation feature and the cumulative curvature change as the global spectral shape feature.
[0057] For example, multi-scale peak detection can be performed on the fluorescence intensity sequence composed of preprocessed fluorescence spectral data using continuous wavelet transform (CWT). The specific steps are as follows: 1. Select wavelet bases that match the peak shape of the fluorescence spectrum. This means that the waveform of the selected wavelet mother function in the time domain (i.e., the "wavelength domain" in spectral analysis) should be similar to the shape of an ideal, isolated fluorescence spectral peak. This can improve the interpretability of the transformed features and the detection sensitivity.
[0058] For example, for similar symmetrical, single-peak shapes in fluorescence spectra, the Mexican Hat wavelet (also known as the Ricker wavelet) or Gaussian wavelet series are commonly used choices. They are characterized by symmetry, smoothness, single peaks, and rapid sidelobe decay, which are well-matched to the Lorentz or Gaussian profiles of many fluorescence peaks.
[0059] 2. Perform Continuous Wavelet Transform (CWT) A continuous wavelet transform is performed on the preprocessed spectral sequence based on the selected wavelet basis to obtain a wavelet coefficient matrix that simultaneously contains wavelength position and multi-scale feature information.
[0060] This step involves matching the spectral signal with a series of stretched, specifically shaped wavelet basis functions to obtain a two-dimensional coefficient matrix. The rows (scale axis) of this matrix reveal the width information of signal features (such as peaks), and the columns (displacement axis) reveal the wavelength position information of the features, providing a multi-scale feature response map for the next step of stably identifying peak position and peak intensity through "ridge extraction".
[0061] 3. Ridge extraction and peak detection For the obtained wavelet coefficient matrix, local maxima at each scale along the wavelength dimension are searched as candidate peak points. By correlating the maxima across scales, continuous wavelet ridges are formed to eliminate false peaks caused by noise. Each ridge corresponds to a true characteristic peak in the spectrum. Then, the extreme point with the largest wavelet coefficient amplitude is located on each ridge, and the corresponding wavelength is the stable peak position of the characteristic peak. Finally, the peak position is mapped back to the original spectrum, and the fluorescence intensity value at the corresponding position is extracted to obtain the peak intensity of the characteristic peak, thus forming a complete set of peak positions and peak intensities (i.e., a multi-scale peak detection set).
[0062] For example, determining the second strongest peak based on the strongest peak includes: Based on the strongest peak, obtain the wavelength corresponding to the strongest peak, and denote it as the strongest wavelength.
[0063] Within a preset wavelength offset range of the strongest wavelength, the peak value of the fluorescence intensity that is less than the maximum value of the strongest peak is denoted as the second strongest peak.
[0064] For example, extracting the correlation features between the strongest peak and the second strongest peak includes: Calculate the ratio of the peak value corresponding to the strongest peak to the peak value corresponding to the second strongest peak, and denot it as the intensity ratio.
[0065] Calculate the difference between the wavelengths corresponding to the strongest peak and the second strongest peak, and denote it as the wavelength difference.
[0066] Calculate the integral area within a preset interval centered on the wavelength corresponding to the strongest peak, and denote it as the first area. Calculate the integral area within a preset interval centered on the wavelength corresponding to the second strongest peak, and denote it as the second area. Calculate the ratio of the first area to the second area, and denote it as the integral area ratio.
[0067] Intensity ratio, wavelength difference, and integral area ratio are used as correlation features between the strongest peak and the second strongest peak.
[0068] In this embodiment, by identifying the strongest peak and the second strongest peak, a dominant peak-satellite peak correlation descriptor is designed. The identified strongest peak is its dominant peak, and the second strongest peak, i.e. the satellite peak, is searched within its preset wavelength offset range. The intensity ratio, wavelength difference, and integral area ratio of the spectral band formed by the two peaks are calculated.
[0069] Simultaneously, the cumulative curvature change of the spectral curve within the characteristic band range is calculated as a robust measure of the overall curvature.
[0070] The characteristic band range can be the entire effective spectral range, or the band where the strongest peak and / or the second strongest peak obtained by the CWT multi-scale peak detection are located, or the specific wavelength range where the known characteristic fluorescence peaks of a specific target pollutant are located, etc. This embodiment does not limit this.
[0071] In one embodiment, step 104 may include: The local statistical features of each quasi-unimodal interval are subjected to nonlinear transformation and preliminary dimensionality reduction to obtain the first feature vector. The global spectral features are subjected to nonlinear transformation and preliminary dimensionality reduction to obtain the second feature vector.
[0072] The first feature vector and the second feature vector are fused using a lightweight cross-attention module to obtain a first fused feature vector and a second fused feature vector.
[0073] The first feature vector, the second feature vector, the first fused feature vector, and the second fused feature vector are concatenated to obtain the comprehensive feature vector.
[0074] In this embodiment, it can be specifically implemented using a hierarchical feature interaction fusion method: S4.1: All extracted features are divided into statistical feature groups (i.e., local statistical features of each quasi-unimodal interval, corresponding to path A) and spectral topology feature groups (i.e., global spectral features, corresponding to path B). These are then subjected to nonlinear transformation and preliminary dimensionality reduction through independent fully connected layers to obtain feature vectors. (i.e., the first eigenvector) and (That is, the second eigenvector).
[0075] S4.2: Introduces a lightweight cross-attention module. For Query, Using the key and value, a context vector incorporating information from pathway B is calculated. (That is, the first fused feature vector); similarly, with For Query, Given Key and Value, get (That is, the second fusion feature vector); to achieve mutual guidance and information complementarity between the two sets of features.
[0076] S4.3: Will , , , The concatenation is performed, and an adaptive weight is generated for each dimension of the concatenated vector through a learnable gating unit (which can use the sigmoid activation function), so as to realize the dynamic selection and emphasis of feature elements, and finally output a comprehensive feature vector.
[0077] The following specific embodiments illustrate the water pollutant feature extraction and identification method provided by the present invention: Actual water samples containing multiple pollutants and subject to turbidity variations and water flow disturbances were collected, and their fluorescence spectral data were acquired using a laser-induced fluorescence spectrometer. Subsequently, the fluorescence spectral data were first denoised using a Savitzky-Golay filter and then normalized using Standard Normal Variate (SNV).
[0078] Next, the core feature extraction and fusion process of this invention is executed: 1. Divide the spectrum into several intervals (i.e., quasi-unimodal intervals) based on the changes in spectral curvature (such as the second derivative of the spectrum), and calculate the robust mean of the M estimate and the normalized skewness product for each interval, which are denoted as statistical characteristics.
[0079] 2. Use CWT ridge extraction technology to determine the main peak position (i.e. the strongest peak), calculate the intensity ratio, wavelength difference and integral area ratio between the strongest peak and the adjacent second strongest peak, and calculate the cumulative curvature change within the preset characteristic band range, which is recorded as the spectral topological feature.
[0080] 3. The statistical features and spectral topological features mentioned above are divided into two groups, encoded separately, and then interacted through a cross-attention module to generate a context vector.
[0081] 4. The original encoded features (i.e. the statistical features and spectral topological features mentioned above) are concatenated with the context vector and then weighted and fused through learnable gating units to obtain the final comprehensive feature vector.
[0082] 5. Finally, the integrated feature vector is input into a pre-trained MLP classifier, and the MLP outputs the identification results of the types of pollutants in the water sample (such as polycyclic aromatic hydrocarbons, dissolved organic matter, pesticides, oil pollutants, etc.).
[0083] Experiments have verified that the comprehensive feature vector constructed using the embodiments of this invention significantly improves the accuracy of pollutant identification for complex water quality samples compared to traditional global features or simple concatenated features, under the same classification model. Furthermore, it exhibits better identification stability under different turbidity backgrounds, fully demonstrating the effectiveness and advancement of this invention.
[0084] This invention provides a method for laser-induced fluorescence spectral feature extraction and identification of water pollutants under complex water quality conditions. This method employs an innovative feature extraction and fusion strategy to stably extract highly discriminative features sensitive to the nature of pollutants from interfered spectra, thereby improving the accuracy, stability, and applicability of pollutant identification. It is suitable for various detection platforms. Specifically: 1. By using adaptive interval robust statistics and perturbation-resistant topological feature extraction, the interference caused by turbidity changes, noise and spectral overlap is effectively suppressed, and the stability of features in complex environments is improved.
[0085] 2. The innovative dominant peak-satellite peak descriptor and hierarchical feature interaction fusion method can more deeply mine and associate the essential spectral fingerprint information of pollutants, and construct a comprehensive feature vector with stronger discriminative power.
[0086] 3. This method does not rely on complex modifications to the backend model. Its core innovation lies in frontend feature engineering, making it easy to integrate into spectral detection platforms and classification models suitable for field applications, thereby improving their practical performance under complex water quality conditions.
[0087] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0088] The following are device embodiments of the present invention. For details not described in detail, please refer to the corresponding method embodiments described above.
[0089] Figure 2 A schematic diagram of the water pollutant feature extraction and identification device provided in an embodiment of the present invention is shown. For ease of explanation, only the parts related to the embodiment of the present invention are shown, and are described in detail below: like Figure 2 As shown, the water pollutant feature extraction and identification device includes: The acquisition module 21 is used to acquire fluorescence spectral data of the water body under specific laser excitation conditions.
[0090] The first feature extraction module 22 is used to preprocess the fluorescence spectral data, divide the preprocessed fluorescence spectral data into quasi-single-peak intervals, and calculate the local statistical features of each quasi-single-peak interval. The local statistical features include the normalized skewness product, which is obtained based on the skewness and kurtosis of the fluorescence intensity of each quasi-single-peak interval, as well as the interval width of each quasi-single-peak interval.
[0091] The second feature extraction module 23 is used to extract spectral features from the preprocessed fluorescence spectral data to obtain global spectral features.
[0092] The feature fusion module 24 is used to fuse the local statistical features and global spectral features of each quasi-unimodal interval to obtain a comprehensive feature vector.
[0093] The pollutant identification module 25 is used to input the comprehensive feature vector into the preset water pollutant identification model to obtain the pollutant type identification result of the water body to be tested.
[0094] In one possible implementation, the first feature extraction module 22 is specifically used for: A second-order difference operation is performed on the fluorescence intensity sequence formed by the preprocessed fluorescence spectral data to obtain the second-order difference sequence corresponding to the preprocessed fluorescence spectral data.
[0095] The quasi-single-peak interval is determined based on the zero-crossing points in the second-order difference sequence.
[0096] For each quasi-single-peak interval, the robust mean of the M-estimate for each fluorescence intensity within the quasi-single-peak interval is calculated. Based on the skewness and kurtosis of the fluorescence intensity within the quasi-single-peak interval, as well as the interval width of the quasi-single-peak interval, the normalized skewness product of the quasi-single-peak interval is obtained. The robust mean of the M-estimate and the normalized skewness product are used as local statistical features of the quasi-single-peak interval.
[0097] In one possible implementation, the first feature extraction module 22 is specifically used for: Calculate the product of skewness and kurtosis of fluorescence intensity in this quasi-single-peak region.
[0098] Divide the product by the width of the quasi-unimodal interval to obtain the normalized skewed product of the quasi-unimodal interval.
[0099] In one possible implementation, the second feature extraction module 23 is specifically used for: Multi-scale peak detection is performed on the fluorescence intensity sequence composed of preprocessed fluorescence spectral data to obtain the peak values of fluorescence intensity at each scale and the corresponding wavelengths of the peak values, thus forming a multi-scale peak detection set.
[0100] The maximum value of the fluorescence intensity peaks in the multi-scale peak detection set is determined and denoted as the strongest peak. The second strongest peak is determined based on the strongest peak, and the correlation features between the strongest peak and the second strongest peak are extracted.
[0101] The cumulative curvature change of the fluorescence intensity sequence formed by the preprocessed fluorescence spectral data within the preset characteristic band range is used as the correlation feature and the cumulative curvature change as the global spectral shape feature.
[0102] In one possible implementation, the second feature extraction module 23 is specifically used for: Based on the strongest peak, obtain the wavelength corresponding to the strongest peak, and denote it as the strongest wavelength.
[0103] Within a preset wavelength offset range of the strongest wavelength, the peak value of the fluorescence intensity that is less than the maximum value of the strongest peak is denoted as the second strongest peak.
[0104] In one possible implementation, the second feature extraction module 23 is specifically used for: Calculate the ratio of the peak value corresponding to the strongest peak to the peak value corresponding to the second strongest peak, and denot it as the intensity ratio.
[0105] Calculate the difference between the wavelengths corresponding to the strongest peak and the second strongest peak, and denote it as the wavelength difference.
[0106] Calculate the integral area within a preset interval centered on the wavelength corresponding to the strongest peak, and denote it as the first area. Calculate the integral area within a preset interval centered on the wavelength corresponding to the second strongest peak, and denote it as the second area. Calculate the ratio of the first area to the second area, and denote it as the integral area ratio.
[0107] Intensity ratio, wavelength difference, and integral area ratio are used as correlation features between the strongest peak and the second strongest peak.
[0108] In one possible implementation, the feature fusion module 24 is specifically used for: The local statistical features of each quasi-unimodal interval are subjected to nonlinear transformation and preliminary dimensionality reduction to obtain the first feature vector. The global spectral features are subjected to nonlinear transformation and preliminary dimensionality reduction to obtain the second feature vector.
[0109] The first feature vector and the second feature vector are fused using a lightweight cross-attention module to obtain a first fused feature vector and a second fused feature vector.
[0110] The first feature vector, the second feature vector, the first fused feature vector, and the second fused feature vector are concatenated to obtain the comprehensive feature vector.
[0111] Figure 3 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Figure 3As shown, the electronic device 3 of this embodiment includes a processor 30 and a memory 31. The memory 31 stores a computer program 32. When the processor 30 executes the computer program 32, it implements the steps in the various method embodiments described above. Alternatively, when the processor 30 executes the computer program 32, it implements the functions of each module / unit in the various device embodiments described above.
[0112] For example, computer program 32 may be divided into one or more modules / units, which are stored in memory 31 and executed by processor 30 to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of computer program 32 in electronic device 3.
[0113] Electronic device 3 may include, but is not limited to, processor 30 and memory 31. Those skilled in the art will understand that... Figure 3 This is merely an example of electronic device 3 and does not constitute a limitation on electronic device 3. It may include more or fewer components than shown, or combine certain components, or different components. For example, electronic device 3 may also include input / output devices, network access devices, buses, etc.
[0114] The processor 30 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.
[0115] The memory 31 can be an internal storage unit of the electronic device 3, such as a hard disk or memory of the electronic device 3. The memory 31 can also be an external storage device of the electronic device 3, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the electronic device 3. Furthermore, the memory 31 can include both internal and external storage units of the electronic device 3. The memory 31 is used to store the computer program 32 and other programs and data required by the electronic device 3. The memory 31 can also be used to temporarily store data that has been output or will be output.
[0116] For the sake of simplicity and clarity, only the above-described functional modules / units are used as examples. In practical applications, the functions described above can be assigned to different functional modules / units as needed. These modules / units can be implemented in hardware, software, or a combination of both.
[0117] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the methods described in the above-described method embodiments.
[0118] Computer programs include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. Computer-readable media can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0119] In the above embodiments, the descriptions of each embodiment have their own emphasis. Parts not detailed or described in a particular embodiment can be referred to in the relevant descriptions of other embodiments. Unless otherwise specified or in conflict with logic, the terminology and / or descriptions between different embodiments are consistent and can be referenced interchangeably. Technical features in different embodiments can be combined to form new embodiments based on their inherent logical relationships.
[0120] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for extracting and identifying features of water pollutants, characterized in that, include: Acquire fluorescence spectral data of the water body under specific laser excitation conditions; The fluorescence spectral data is preprocessed, and the preprocessed fluorescence spectral data is divided into quasi-single-peak intervals. The local statistical features of each quasi-single-peak interval are calculated. The local statistical features include the normalized skewness product, which is obtained based on the skewness and kurtosis of the fluorescence intensity of each quasi-single-peak interval, as well as the interval width of each quasi-single-peak interval. Spectral shape features were extracted from the preprocessed fluorescence spectral data to obtain global spectral shape features; The local statistical features and the global spectral features of each quasi-unimodal interval are fused to obtain a comprehensive feature vector; The comprehensive feature vector is input into a preset water pollutant identification model to obtain the pollutant type identification result of the water body to be tested.
2. The method for extracting and identifying water pollutant features according to claim 1, characterized in that, The step of dividing the preprocessed fluorescence spectral data into quasi-single-peak intervals and calculating the local statistical characteristics of each quasi-single-peak interval includes: A second-order difference operation is performed on the fluorescence intensity sequence formed by the preprocessed fluorescence spectral data to obtain the second-order difference sequence corresponding to the preprocessed fluorescence spectral data. The quasi-unimodal interval is determined based on the zero-crossing points in the second-order difference sequence; For each quasi-single-peak interval, the robust mean of the M-estimate for each fluorescence intensity within the quasi-single-peak interval is calculated. Based on the skewness and kurtosis of the fluorescence intensity within the quasi-single-peak interval, and the interval width of the quasi-single-peak interval, the normalized skewness product of the quasi-single-peak interval is obtained. The robust mean of the M-estimate and the normalized skewness product are used as local statistical features of the quasi-single-peak interval.
3. The method for extracting and identifying water pollutant features according to claim 2, characterized in that, The step of obtaining the normalized skewness product of the quasi-single-peak interval based on the skewness and kurtosis of the fluorescence intensity of the quasi-single-peak interval, and the interval width of the quasi-single-peak interval, includes: Calculate the product of skewness and kurtosis of fluorescence intensity in this quasi-single-peak region; Dividing the product by the width of the quasi-unimodal interval yields the normalized skewed product of the quasi-unimodal interval.
4. The method for extracting and identifying water pollutant features according to claim 1, characterized in that, The step of extracting spectral shape features from the preprocessed fluorescence spectral data to obtain global spectral shape features includes: Multi-scale peak detection is performed on the fluorescence intensity sequence composed of preprocessed fluorescence spectral data to obtain the peak values of fluorescence intensity at each scale and the wavelengths corresponding to the peak values in the preprocessed fluorescence spectral data, thus forming a multi-scale peak detection set. The maximum value of the fluorescence intensity peaks in the multi-scale peak detection set is determined and denoted as the strongest peak. The second strongest peak is determined based on the strongest peak, and the correlation features between the strongest peak and the second strongest peak are extracted. The cumulative curvature change of the fluorescence intensity sequence formed by the preprocessed fluorescence spectral data within a preset characteristic band range is used as the correlation feature and the cumulative curvature change as the global spectral shape feature.
5. The method for extracting and identifying water pollutant features according to claim 4, characterized in that, The second strongest peak is determined based on the strongest peak, including: Based on the strongest peak, the wavelength corresponding to the strongest peak is obtained and denoted as the strongest wavelength; Within a preset wavelength offset range of the strongest wavelength, the peak value of the fluorescence intensity that is less than the maximum value of the strongest peak is denoted as the second strongest peak.
6. The method for extracting and identifying water pollutant features according to claim 4, characterized in that, Extracting the correlation features between the strongest peak and the second strongest peak, including: Calculate the ratio of the peak value corresponding to the strongest peak to the peak value corresponding to the second strongest peak, and denot it as the intensity ratio; Calculate the difference between the wavelength corresponding to the strongest peak and the wavelength corresponding to the second strongest peak, and denote it as the wavelength difference; Calculate the integral area within a preset interval centered on the wavelength corresponding to the strongest peak, and denot it as the first area. Calculate the integral area within a preset interval centered on the wavelength corresponding to the second strongest peak, and denot it as the second area. Calculate the ratio of the first area to the second area, and denot it as the integral area ratio. The intensity ratio, the wavelength difference, and the integral area ratio are used as correlation features between the strongest peak and the second strongest peak.
7. The method for extracting and identifying water pollutant features according to claim 1, characterized in that, The local statistical features and global spectral features of each quasi-unimodal interval are fused to obtain a comprehensive feature vector, including: The local statistical features of each quasi-unimodal interval are subjected to nonlinear transformation and preliminary dimensionality reduction to obtain a first feature vector; the global spectral features are subjected to nonlinear transformation and preliminary dimensionality reduction to obtain a second feature vector. The first feature vector and the second feature vector are fused using a lightweight cross-attention module to obtain a first fused feature vector and a second fused feature vector. The first feature vector, the second feature vector, the first fused feature vector, and the second fused feature vector are concatenated to obtain the comprehensive feature vector.
8. A device for extracting and identifying the characteristics of pollutants in water bodies, characterized in that, include: The acquisition module is used to acquire fluorescence spectral data of the water body under specific laser excitation conditions; The first feature extraction module is used to preprocess the fluorescence spectral data, divide the preprocessed fluorescence spectral data into quasi-single-peak intervals, and calculate the local statistical features of each quasi-single-peak interval. The local statistical features include the normalized skewness product, which is obtained based on the skewness and kurtosis of the fluorescence intensity of each quasi-single-peak interval and the interval width of each quasi-single-peak interval. The second feature extraction module is used to extract spectral features from the preprocessed fluorescence spectral data to obtain global spectral features. The feature fusion module is used to fuse the local statistical features and the global spectral features of each of the quasi-unimodal intervals to obtain a comprehensive feature vector; The pollutant identification module is used to input the comprehensive feature vector into a preset water pollutant identification model to obtain the pollutant type identification result of the water body to be tested.
9. An electronic device, characterized in that, It includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 7.