Water turbidity classification method and system based on multi-scale spectral feature extraction network

By introducing multi-scale spectral feature extraction networks in traditional spectral method, using technologies such as Fourier transform, recursive graph transformation and Gram angle field transformation to extract multi-scale features of domestic wastewater spectral data, the traditional method is solved in classification accuracy The shortcomings have achieved higher accuracy in water turbidity classification.

CN118736337BActive Publication Date: 2025-02-11FOSHAN UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411231947.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-04
Publication Date
2025-02-11
Estimated Expiration
2044-09-04

AI Technical Summary

Technical Problem

When traditional ultraviolet visible light spectroscopy is difficult to effectively capture the detailed characteristics of spectral information on multiple scales when dealing with domestic sewage, resulting in low classification accuracy.

Method used

Using a multi-scale spectral feature extraction method, the multi-scale feature information of domestic wastewater spectral data is extracted through the Fourier transform network module, the recursive graph transform network module and the Gram Angle Field Transform network module, and the multi-scale feature information of domestic wastewater spectral data is extracted through the attention mechanism. Enhance feature extraction capability.

Benefits of technology

The characteristic distinction and extraction ability of domestic sewage spectral data has been improved, and the accuracy of water turbidity classification has been significantly improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118736337B_ABST
    Figure CN118736337B_ABST
Patent Text Reader

Abstract

The present invention discloses a water pollution turbidity classification method and system based on a multi-scale spectral feature extraction network, the method comprising: obtaining spectral data of domestic sewage samples; preprocessing the spectral data of domestic sewage samples; introducing a Fourier transform network module, a recursive graph transform network module and a Gram angular field transform network module to construct a multi-scale spectral feature extraction network; performing feature classification processing on the spectral data of the pre-treated domestic sewage samples based on the multi-scale spectral feature extraction network to obtain domestic sewage turbidity classification results. The embodiment of the present invention improves the accuracy of water pollution turbidity classification by improving the discrimination of one-dimensional data features of domestic sewage spectra and enriching the spectral feature information of domestic sewage. As a water pollution turbidity classification method and system based on a multi-scale spectral feature extraction network, the present invention can be widely used in the technical field of domestic sewage spectral detection and classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of domestic sewage spectral detection and classification, and in particular to a water pollution turbidity classification method and system based on a multi-scale spectral feature extraction network. Background Art

[0002] UV-visible spectroscopy is an analytical method based on the spectral absorption or reflection characteristics of material molecules. It has the advantages of being fast, reagent-free, and capable of online analysis. It is widely used in online detection of abnormal water quality. Its basic principle is to use the different absorption peaks of pollutants under the UV-visible spectrum to detect spectral changes to determine whether the water quality is abnormal. Traditional methods usually extract features from UV spectra and input them into conventional classifiers such as SVM for detection. However, due to the dependence of spectral data on time and space scales, traditional machine learning methods are poor in feature extraction capabilities and cannot capture the detailed features of spectral information at multiple scales. Summary of the invention

[0003] In order to solve the above technical problems, the purpose of the present invention is to provide a water turbidity classification method and system based on a multi-scale spectral feature extraction network, which improves the accuracy of water turbidity classification by improving the discrimination of one-dimensional data features of domestic sewage spectra and enriching the spectral feature information of domestic sewage.

[0004] The first technical solution adopted by the present invention is: a water pollution turbidity classification method based on a multi-scale spectral feature extraction network, comprising the following steps:

[0005] Acquire domestic sewage sample data and perform absorbance detection processing to obtain spectral data of the domestic sewage sample;

[0006] Preprocessing the spectral data of the domestic sewage sample to obtain the spectral data of the pretreated domestic sewage sample;

[0007] Fourier transform network module, recursive graph transform network module and Gram angular field transform network module are introduced to construct a multi-scale spectral feature extraction network;

[0008] Based on the multi-scale spectral feature extraction network, the spectral data of the pretreated domestic sewage samples were subjected to feature classification processing to obtain the domestic sewage turbidity classification results.

[0009] Furthermore, the step of obtaining the domestic sewage sample data and performing absorbance detection processing to obtain the spectral data of the domestic sewage sample specifically includes:

[0010] Acquiring domestic sewage sample data, wherein the domestic sewage sample data includes domestic sewage that meets cleaning standards and unclassified domestic sewage;

[0011] Constructing a transmittance measurement bracket, wherein the transmittance measurement bracket includes a light source, a quartz cuvette and an ultraviolet-visible spectrometer;

[0012] Turn off the light source and perform transmission measurement on an empty quartz cuvette using a UV-visible spectrometer to obtain background light data;

[0013] Turn on the light source and perform transmission measurement on an empty quartz cuvette using a UV-visible spectrometer to obtain reference light data;

[0014] Turning on the light source, and performing transmission measurement on a quartz cuvette filled with domestic sewage that meets the cleaning standard by using an ultraviolet-visible spectrometer to obtain first sample light data;

[0015] Turn on the light source, and perform transmission measurement on a quartz cuvette containing unclassified domestic sewage using a UV-visible spectrometer to obtain light data of a second sample;

[0016] Calculating according to the background light data, the reference light data and the first sample light data to obtain the spectrum data of the domestic sewage that meets the cleaning standard;

[0017] Calculation is performed based on background light data, reference light data, and second sample light data to obtain spectrum data of unclassified domestic sewage;

[0018] The spectral data of domestic sewage that meets the cleaning standard and the spectral data of unclassified domestic sewage are integrated to obtain the spectral data of the domestic sewage sample.

[0019] Furthermore, the step of preprocessing the spectral data of the domestic sewage sample to obtain the spectral data of the pretreated domestic sewage sample specifically includes:

[0020] Assigning labels to the spectral data of the domestic sewage sample to obtain the spectral data of the domestic sewage sample with labels;

[0021] The data length of the labeled domestic sewage sample spectral data is unified by using the segmented aggregation approximation method to obtain the unified domestic sewage sample spectral data;

[0022] Performing noise reduction processing on the unified spectral data of domestic sewage samples to obtain spectral data of domestic sewage samples after noise reduction;

[0023] The spectral data of the domestic sewage sample after noise reduction is divided and processed to obtain the spectral data of the domestic sewage sample after pretreatment.

[0024] Furthermore, the multi-scale spectral feature extraction network includes a Fourier transform network module, a recursive graph transform network module, a Gram's angular field transform network module, a connection layer, a convolutional network module, an attention mechanism module, a pooling layer, a flattening layer, a fully connected layer and an activation function layer, wherein the convolutional network module includes several convolutional layers, and the output end of the Fourier transform network module, the output end of the recursive graph transform network module and the output end of the Gram's angular field transform network module are all connected to the input end of the connection layer, and the connection layer, the convolutional network module, the attention mechanism module, the pooling layer, the flattening layer, the fully connected layer and the activation function layer are connected in sequence.

[0025] Furthermore, the step of performing feature classification processing on the spectral data of the pretreated domestic sewage sample based on the multi-scale spectral feature extraction network to obtain the domestic sewage turbidity classification result specifically includes:

[0026] The spectral data of the pretreated domestic sewage sample is input into a multi-scale spectral feature extraction network;

[0027] Based on the Fourier transform network module of the multi-scale spectral feature extraction network, the spectral data of the pre-treated domestic sewage samples are subjected to Fourier transform processing to obtain the Fourier transform image features of the domestic sewage that meets the cleaning standard and the Fourier transform image features of the unclassified domestic sewage;

[0028] Based on the recursive graph transformation network module of the multi-scale spectral feature extraction network, the spectral data of the pre-treated domestic sewage samples are subjected to recursive graph transformation processing to obtain the recursive transformation image features of the domestic sewage that meets the cleaning standard and the recursive transformation image features of the unclassified domestic sewage;

[0029] Based on the Gram's angle field transform network module of the multi-scale spectral feature extraction network, the spectral data of the pre-treated domestic sewage samples are processed by Gram's angle field transform to obtain the Gram's angle field transform image features of the domestic sewage that meets the cleaning standard and the Gram's angle field transform image features of the unclassified domestic sewage;

[0030] Based on the connection layer of the multi-scale spectral feature extraction network, the Fourier transform image features of the domestic sewage that meets the cleaning standard, the recursive transform image features of the domestic sewage that meets the cleaning standard, and the Gram's angular field transform image features of the domestic sewage that meets the cleaning standard are spliced, and the Fourier transform image features of the unclassified domestic sewage, the recursive transform image features of the unclassified domestic sewage, and the Gram's angular field transform image features of the unclassified domestic sewage are spliced ​​to obtain the multi-scale image features of the domestic sewage that meets the cleaning standard and the multi-scale image features of the unclassified domestic sewage;

[0031] A convolution network module based on a multi-scale spectral feature extraction network performs convolution processing on the multi-scale image features of domestic sewage that meets the cleaning standard and the multi-scale image features of unclassified domestic sewage, respectively, to obtain the convolved multi-scale image features of domestic sewage that meets the cleaning standard and the convolved multi-scale image features of unclassified domestic sewage;

[0032] Based on the attention mechanism module of the multi-scale spectral feature extraction network, spatial channel attention extraction processing is performed on the multi-scale image features of the domestic sewage that meets the cleaning standard after convolution and the multi-scale image features of the unclassified domestic sewage after convolution, so as to obtain the extracted multi-scale image features of the domestic sewage that meets the cleaning standard and the extracted multi-scale image features of the unclassified domestic sewage;

[0033] Based on the pooling layer and flattening layer of the multi-scale spectral feature extraction network, the multi-scale image features of the extracted domestic sewage that meets the cleaning standard and the multi-scale image features of the extracted unclassified domestic sewage are pooled and flattened respectively to obtain the flattened multi-scale image features of the domestic sewage that meets the cleaning standard and the flattened multi-scale image features of the unclassified domestic sewage;

[0034] The feature vector distance is calculated by using the Euclidean formula for the flattened multi-scale image features of the domestic sewage that meets the cleaning standard and the flattened multi-scale image features of the unclassified domestic sewage to obtain the feature vector distance;

[0035] Based on the fully connected layer and activation function layer of the multi-scale spectral feature extraction network, the similarity value judgment is processed according to the feature vector distance to obtain the turbidity classification result of domestic sewage.

[0036] Furthermore, the calculation expression of the Fourier transform network module is specifically as follows:

[0037] ;

[0038] In the above formula, represents the window function, represents the angular frequency, represents the original signal, represents the distance of window function displacement, Represents the spectrum.

[0039] Furthermore, the calculation expression of the recursive graph transformation network module is specifically as follows:

[0040] ;

[0041] In the above formula, Indicates a The square array, represents the norm, Represents the distance threshold such that , express function, , represents any two states in phase space, represents any number in the sequence, represents any number in the sequence, Represents the number of elements in the sequence.

[0042] Further, the calculation expression of the Gram angular field transformation network module is specifically as follows:

[0043] ;

[0044] In the above formula, represents a sequence signal, The first elements, represents the cosine of the angle, Indicates a point in time, represents a constant factor, , represents the normalized sequence data, represents the normalized set of all sequence data, Represents the polar axis.

[0045] The second technical solution adopted by the present invention is: a water turbidity classification system based on a multi-scale spectral feature extraction network, comprising:

[0046] An acquisition module is used to acquire domestic sewage sample data and perform absorbance detection processing to obtain spectral data of the domestic sewage sample;

[0047] A preprocessing module, used for preprocessing the spectral data of the domestic sewage sample to obtain the spectral data of the pretreated domestic sewage sample;

[0048] A construction module is used to introduce a Fourier transform network module, a recursive graph transform network module and a Gram angular field transform network module to construct a multi-scale spectral feature extraction network;

[0049] The classification module is used to perform feature classification processing on the spectral data of the pretreated domestic sewage samples based on the multi-scale spectral feature extraction network to obtain the domestic sewage turbidity classification results.

[0050] The beneficial effects of the method and system of the present invention are as follows: the present invention obtains domestic sewage sample data and performs absorbance detection processing and preprocessing, further introduces a Fourier transform network module, a recursive graph transform network module and a Gram angular field transform network module, extracts three feature information with different feature scales from the original one-dimensional spectral data, and improves the discrimination of the spectral one-dimensional data features and the ability to extract data features by splicing the three feature information into a significant and discriminative multi-scale feature information, and utilizes a variety of feature extraction techniques to obtain richer spectral feature information, and evaluates whether the cleaning condition of domestic sewage meets the standard based on the comparison of the calculated feature information similarity with the cleaning standard threshold value, thereby improving the classification accuracy of domestic sewage. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 It is a flow chart of the steps of the water pollution turbidity classification method based on the multi-scale spectral feature extraction network of the present invention;

[0052] Figure 2 It is a structural block diagram of the water pollution turbidity classification system based on the multi-scale spectral feature extraction network of the present invention;

[0053] Figure 3 is a schematic diagram of a two-dimensional time series curve of one-dimensional time series data provided by a specific embodiment of the present invention;

[0054] Figure 4 is a schematic diagram of a spectrum of one-dimensional time series data after Fourier transformation provided by a specific embodiment of the present invention;

[0055] Figure 5 It is a schematic diagram of encoding of one-dimensional time series data after Gram angular field transformation provided by a specific embodiment of the present invention;

[0056] Figure 6 It is a schematic diagram of encoding of one-dimensional time series data after recursive graph transformation provided by a specific embodiment of the present invention;

[0057] Figure 7 It is a schematic diagram of the structure of a multi-scale spectral feature extraction network provided by a specific embodiment of the present invention;

[0058] Figure 8 It is a schematic diagram of the water turbidity classification data processing flow provided by a specific embodiment of the present invention. DETAILED DESCRIPTION

[0059] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. The step numbers in the following embodiments are only provided for the convenience of explanation and description, and the order between the steps is not limited in any way. The execution order of each step in the embodiment can be adaptively adjusted according to the understanding of those skilled in the art.

[0060] The embodiment of the present invention preprocesses one-dimensional spectral data through multiple signal decomposition methods, decomposes it into feature information of three different scales, and fuses the obtained features into multi-scale feature information with high discrimination, which significantly improves the discrimination and extraction capabilities of one-dimensional spectral data features. Finally, similarity calculation is performed based on these spectral feature information, thereby realizing classification detection of water turbidity.

[0061] Based on this, refer to Figure 1 and Figure 8 The present invention provides a water pollution turbidity classification method based on a multi-scale spectral feature extraction network, the method comprising the following steps:

[0062] S100, obtaining domestic sewage sample data and performing absorbance detection processing to obtain spectral data of the domestic sewage sample;

[0063] Specifically, domestic sewage sample data is obtained, and the domestic sewage sample data includes domestic sewage that meets the cleaning standard and unclassified domestic sewage; a transmittance measurement bracket is constructed, and the transmittance measurement bracket includes a light source, a quartz cuvette and a UV-visible spectrometer; the light source is turned off, and the transmittance measurement of the empty quartz cuvette is performed through the UV-visible spectrometer to obtain background light data; the light source is turned on, and the transmittance measurement of the empty quartz cuvette is performed through the UV-visible spectrometer to obtain reference light data; the light source is turned on, and the transmittance measurement of the quartz cuvette filled with domestic sewage that meets the cleaning standard is performed through the UV-visible spectrometer. Perform transmission measurement to obtain first sample light data; turn on the light source, perform transmission measurement on a quartz cuvette containing unclassified domestic sewage through an ultraviolet-visible spectrometer to obtain second sample light data; calculate based on background light data, reference light data and the first sample light data to obtain spectral data of domestic sewage that meets the cleaning standard; calculate based on background light data, reference light data and the second sample light data to obtain spectral data of unclassified domestic sewage; integrate the spectral data of domestic sewage that meets the cleaning standard with the spectral data of unclassified domestic sewage to obtain spectral data of the domestic sewage sample.

[0064] In this embodiment, based on the transmittance measurement bracket of the UV-visible spectrometer, the light source in the transmittance measurement bracket of the UV-visible spectrometer is isolated to obtain background light data; an empty quartz cuvette is placed in the transmittance measurement bracket of the UV-visible spectrometer to obtain reference light data; a quartz cuvette with a domestic sewage sample is placed in the transmittance measurement bracket of the UV-visible spectrometer to obtain sample light data; and the background light data, the reference light data, and the sample light data are combined for calculation to obtain the spectral data of the domestic sewage sample.

[0065] S200, preprocessing the spectral data of the domestic sewage sample to obtain the spectral data of the pretreated domestic sewage sample;

[0066] Specifically, labels are assigned to the spectral data of domestic sewage samples to obtain spectral data of domestic sewage samples with labels; the data length of the spectral data of domestic sewage samples with labels is unified through the segmented aggregation approximation method to obtain unified spectral data of domestic sewage samples; the unified spectral data of domestic sewage samples is denoised to obtain spectral data of domestic sewage samples after denoising; the spectral data of domestic sewage samples after denoising is divided to obtain spectral data of pretreated domestic sewage samples.

[0067] In this embodiment, labels are constructed for the collected data according to the sample category, the spectral data of different lengths are segmented and aggregated to unify the data length, and the spectral data are denoised. The length of the first spectral data is used as the standard to unify the length of all data. In order to achieve supervised learning, the data set is amplified and randomly divided into a training set, a validation set, and a test set in a ratio of 8:1:1 to ensure that they have the same data distribution.

[0068] The data processing process of the segmented aggregation approximation method is to convert the length Spectral time series data Approximately any length Vector , where each The calculation process is as follows:

[0069] ;

[0070] In the above formula, is the length of the initial spectral data, is the length of the spectral data after segmented aggregation approximation, is the first elements, The spectral data after segmented aggregation approximation elements.

[0071] S300, introduce Fourier transform network module, recursive graph transform network module and Gram angular field transform network module to build a multi-scale spectral feature extraction network;

[0072] Specifically, Figure 7As shown, the multi-scale spectral feature extraction network includes a Fourier transform network module, a recursive graph transform network module, a Gram's angular field transform network module, a connection layer, a convolutional network module, an attention mechanism module, a pooling layer, a flattening layer, a fully connected layer and an activation function layer, wherein the convolutional network module includes several convolutional layers, the output end of the Fourier transform network module, the output end of the recursive graph transform network module and the output end of the Gram's angular field transform network module are all connected to the input end of the connection layer, and the connection layer, the convolutional network module, the attention mechanism module, the pooling layer, the flattening layer, the fully connected layer and the activation function layer are connected in sequence.

[0073] In this embodiment, the pytorch deep learning framework is used to build a multi-scale feature extraction neural network. The neural network follows the basic structure of VGG-16, and the input layer is a multi-scale feature information spliced ​​from the feature information obtained after three transformations. The three transformations are Fourier transform, recursive graph transform, and Gram angular field transform, which can obtain better feature extraction effects. Among them, the embodiment of the present invention adds a channel attention mechanism and a spatial attention mechanism between each convolutional layer and pooling layer in a VGG-16-like network to highlight significant features and suppress irrelevant features. The two sub-networks are twin neural networks with the same weights and structures.

[0074] S400, performing feature classification processing on the spectral data of the pretreated domestic sewage sample based on a multi-scale spectral feature extraction network to obtain a domestic sewage turbidity classification result.

[0075] S410. Input the spectral data of the pretreated domestic sewage sample into a multi-scale spectral feature extraction network; based on the Fourier transform network module of the multi-scale spectral feature extraction network, perform Fourier transform processing on the spectral data of the pretreated domestic sewage sample to obtain the Fourier transform image features of the domestic sewage that meets the cleaning standard and the Fourier transform image features of the unclassified domestic sewage.

[0076] Specifically, in this embodiment, Figure 4 As shown in the figure, this module analyzes the one-dimensional time series data in the frequency domain to reveal the periodicity, periodic changes and oscillation characteristics of the data. After converting the one-dimensional time series data into a two-dimensional image, useful features can be extracted through the spectral structure of the image, thereby obtaining a better feature extraction effect.

[0077] Among them, the calculation expression of the Fourier transform network module is as follows:

[0078] ;

[0079] In the above formula, represents the window function, represents the angular frequency, represents the original signal, represents the distance of window function displacement, Represents the spectrum.

[0080] S420, based on the recursive graph transformation network module of the multi-scale spectral feature extraction network, performing recursive graph transformation processing on the spectral data of the pre-treated domestic sewage sample to obtain the recursive transformation image features of the domestic sewage that meets the cleaning standard and the recursive transformation image features of the unclassified domestic sewage;

[0081] In this embodiment, if Figure 6 As shown, the module can represent one-dimensional time series data by retaining key image features by compressing and reducing the dimension of the one-dimensional time series data.

[0082] Among them, the calculation expression of the recursive graph transformation network module is as follows:

[0083] ;

[0084] In the above formula, Indicates a The square array, represents the norm, Represents the distance threshold such that , express function, , represents any two states in phase space, represents any number in the sequence, represents any number in the sequence, Represents the number of elements in the sequence.

[0085] S430, performing Gram's angle field transform processing on the spectral data of the pre-treated domestic sewage sample based on the Gram's angle field transform network module of the multi-scale spectral feature extraction network to obtain Gram's angle field transform image features of the domestic sewage that meets the cleaning standard and Gram's angle field transform image features of the unclassified domestic sewage;

[0086] In this embodiment, if Figure 5 As shown in FIG. 1 , this module provides an image-based similarity analysis method. By comparing the Gram angle field images of different one-dimensional time series data, the similarity between them can be measured and similarity analysis can be performed.

[0087] Among them, the calculation expression of the Gram angular field transformation network module is as follows:

[0088] ;

[0089] In the above formula, represents a sequence signal, The first elements, represents the cosine of the angle, Indicates a point in time, represents a constant factor, , represents the normalized sequence data, represents the normalized set of all sequence data, Represents the polar axis.

[0090] In summary, the image of the general one-dimensional time series data after the above Fourier transform, recursive graph transform and Gram angular field transform is as follows Figure 3 shown.

[0091] S440, based on the connection layer of the multi-scale spectral feature extraction network, the Fourier transform image features of the domestic sewage that meets the cleaning standard, the recursive transform image features of the domestic sewage that meets the cleaning standard, and the Gram's angular field transform image features of the domestic sewage that meets the cleaning standard are spliced, and the Fourier transform image features of the unclassified domestic sewage, the recursive transform image features of the unclassified domestic sewage, and the Gram's angular field transform image features of the unclassified domestic sewage are spliced ​​to obtain multi-scale image features of the domestic sewage that meets the cleaning standard and multi-scale image features of the unclassified domestic sewage;

[0092] S450, a convolution network module based on a multi-scale spectral feature extraction network, performing convolution processing on the multi-scale image features of the domestic sewage that meets the cleaning standard and the multi-scale image features of the unclassified domestic sewage, respectively, to obtain the convolved multi-scale image features of the domestic sewage that meets the cleaning standard and the convolved multi-scale image features of the unclassified domestic sewage;

[0093] S460, an attention mechanism module based on a multi-scale spectral feature extraction network, performing spatial channel attention extraction processing on the multi-scale image features of the domestic sewage that meets the cleaning standard after convolution and the multi-scale image features of the unclassified domestic sewage after convolution, to obtain the extracted multi-scale image features of the domestic sewage that meets the cleaning standard and the extracted multi-scale image features of the unclassified domestic sewage;

[0094] In this embodiment, a channel attention mechanism and a spatial attention mechanism are added between each convolution layer and pooling layer. (Number of channels width height), the channel attention mechanism will calculate a feature vector , the spatial attention mechanism calculates a feature vector The overall calculation process is as follows:

[0095] ;

[0096] In the above formula, represent Activation function, is the fully connected layer, represents element-wise multiplication, represents the average pooling operation, represents the maximum pooling operation, represent Convolution operation. represents the feature map after channel attention refinement, Represents the final feature map after channel and spatial attention refinement. Its size is still .

[0097] The calculation formula for the feature map size of general convolution is as follows:

[0098] ;

[0099] In the above formula, is the width of the output feature map, is the height of the output feature map, is the width of the input feature map, is the height of the input feature map, represents the size of the convolution kernel, Indicates the number of fills, Indicates the step length.

[0100] S470, based on the pooling layer and the flattening layer of the multi-scale spectral feature extraction network, respectively performing pooling and flattening processing on the multi-scale image features of the domestic sewage that meets the cleaning standard and the multi-scale image features of the unclassified domestic sewage that are extracted, to obtain the flattened multi-scale image features of the domestic sewage that meets the cleaning standard and the flattened multi-scale image features of the unclassified domestic sewage;

[0101] S480, calculating the feature vector distance between the flattened multi-scale image features of the domestic sewage that meets the cleaning standard and the flattened multi-scale image features of the unclassified domestic sewage by using the Euclidean formula to obtain the feature vector distance;

[0102] In this embodiment, the domestic sewage data that meets the cleaning standard and the unclassified domestic sewage data are simultaneously subjected to the twin neural network with the same weight and structure, and the one-dimensional feature vector of the domestic sewage that meets the cleaning standard and the one-dimensional feature vector of the unclassified domestic sewage are obtained respectively, and the two feature vectors are calculated using the Euclidean formula to obtain the distance between the two feature vectors, where the Euclidean formula is as follows:

[0103] ;

[0104] In the above formula, To meet the cleaning standards of domestic sewage dataset, For the data set The one-dimensional feature vector of samples, is an unclassified domestic sewage dataset. This is the first The one-dimensional feature vector of samples.

[0105] S490, based on the fully connected layer and activation function layer of the multi-scale spectral feature extraction network, performs similarity value judgment processing according to the feature vector distance to obtain the turbidity classification result of domestic sewage.

[0106] In this embodiment, after the fully connected layer, an output feature vector of size 1 is obtained, and finally a sigmoid function layer is performed to obtain a similarity value between 0 and 1. The similarity value is compared with the cleaning standard threshold to determine whether the cleaning meets the standard, and the turbidity classification and identification are performed.

[0107] In summary, the calculation and derivation process of the input data size of the network model of the embodiment of the present invention is as follows: the initial spectral data input size is 1×7000 (dimension×length), after extracting features by Fourier transform, Gram's angular field transform or recursive graph transform, the output feature size is 224×224 (image width×image height), after dimensionality increase processing, the output feature size is 1×224×224 (number of channels×image width×image height), the output feature size after concatenation by the Concatenate layer is 3×224×224, after extracting features through the first convolutional network, the output feature size is 64×112×112, after extracting features through the second convolutional network, the output feature size is The size of the feature vector is 128×56×56. After the third convolutional network extracts features, the output feature size is 256×28×28. After the fourth convolutional network extracts features, the output feature size is 512×14×14. After the fifth convolutional network extracts features, the output feature size is 512×7×7. Finally, it is flattened by the Flatten layer, and the output feature size is 1×25088 (dimension × length). After the first fully connected layer, the output feature size is 1×512. After the second fully connected layer, the output feature size is 1×256. After the third fully connected layer, the output feature size is 1×1. Finally, the sigmoid function is used to obtain a similarity value between 0 and 1.

[0108] Finally, the divided training set is used to train the constructed multi-scale feature extraction neural network, and the validation set is used to estimate the performance and generalization ability of the model. During the training process, the BCEWithLogitsLoss loss function is used to train the network, the learning rate of the network is set to 0.0001, and the Adam optimizer is used to optimize the network parameters. After 200 iterations of training, the network parameters are saved, the model parameters obtained by training are loaded, and the multi-scale spectral feature extraction neural network of the embodiment of the present invention is instantiated. The spectral data in the test set is tested to obtain the classification results of the spectral data.

[0109] In summary, first, the embodiment of the present invention collects spectral data through an ultraviolet-visible spectrometer, establishes corresponding true category labels, and divides the data set into a training set, a validation set, and a test set. In order to improve the quality of the data set and simplify the training process, the data is length-normalized and denoised. Next, the embodiment of the present invention designs a twin neural network model structure for multi-scale spectral feature extraction, which includes a multi-scale feature extraction module for obtaining rich semantic information and accurate feature information, and introduces spatial attention and channel attention mechanism modules to improve the ability to extract data features. Finally, the two output feature vectors are calculated using the Euclidean formula to obtain a similarity value, which is compared with the cleaning standard threshold result to determine whether the cleaning meets the standard and to perform turbidity classification and identification. Compared with related methods, the method proposed in the embodiment of the present invention has a stronger feature extraction capability. The method of the invention can be widely used in spectral recognition and classification, domestic sewage treatment and other related fields. A multi-scale spectral feature extraction network is proposed. At the same time, in order to solve the problem that the feature discrimination of spectral one-dimensional data is not obvious and it is difficult to effectively classify, three efficient signal decomposition methods of Fourier transform, Gram angular field transform and recursive graph transform are introduced. Feature information of three different feature scales is extracted from the original one-dimensional spectral data. The three feature information are spliced ​​into a significant and distinguishable multi-scale feature information; and the attention mechanism is introduced to highlight the significant features and suppress the irrelevant features. Finally, the similarity of two output feature vectors is calculated, and it is judged whether the cleaning of domestic sewage meets the standard according to the comparison result of the similarity value and the cleaning standard threshold value, so as to classify the spectral data.

[0110] Reference Figure 2 , a water turbidity classification system based on multi-scale spectral feature extraction network, including:

[0111] The acquisition module 201 is used to acquire the domestic sewage sample data and perform absorbance detection processing to obtain the spectral data of the domestic sewage sample;

[0112] A preprocessing module 202 is used to preprocess the spectral data of the domestic sewage sample to obtain the spectral data of the pretreated domestic sewage sample;

[0113] A construction module 203 is used to introduce a Fourier transform network module, a recursive graph transform network module and a Gram angular field transform network module to construct a multi-scale spectral feature extraction network;

[0114] The classification module 204 is used to perform feature classification processing on the spectral data of the pre-treated domestic sewage sample based on a multi-scale spectral feature extraction network to obtain a domestic sewage turbidity classification result.

[0115] The contents of the above method embodiments are all applicable to the present system embodiments. The functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0116] The above is a specific description of the preferred implementation of the present invention, but the invention is not limited to the embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.

Claims

1. A water pollution turbidity classification method based on a multi-scale spectral feature extraction network, characterized in that: The following steps are involved: Acquiring domestic sewage sample data, wherein the domestic sewage sample data includes domestic sewage that meets cleaning standards and unclassified domestic sewage; Constructing a transmittance measurement bracket, wherein the transmittance measurement bracket includes a light source, a quartz cuvette and an ultraviolet-visible spectrometer; Turn off the light source and perform transmission measurement on an empty quartz cuvette using a UV-visible spectrometer to obtain background light data; Turn on the light source and perform transmission measurement on an empty quartz cuvette using a UV-visible spectrometer to obtain reference light data; Turning on the light source, and performing transmission measurement on a quartz cuvette filled with domestic sewage that meets the cleaning standard by using an ultraviolet-visible spectrometer to obtain first sample light data; Turn on the light source, and perform transmission measurement on a quartz cuvette containing unclassified domestic sewage using a UV-visible spectrometer to obtain light data of a second sample; Calculating according to the background light data, the reference light data and the first sample light data to obtain the spectrum data of the domestic sewage that meets the cleaning standard; Calculation is performed based on background light data, reference light data, and second sample light data to obtain spectrum data of unclassified domestic sewage; Integrate the spectral data of domestic sewage that meets the cleaning standard and the spectral data of unclassified domestic sewage to obtain the spectral data of the domestic sewage sample; Preprocessing the spectral data of the domestic sewage sample to obtain the spectral data of the pretreated domestic sewage sample; Fourier transform network module, recursive graph transform network module and Gram angular field transform network module are introduced to construct a multi-scale spectral feature extraction network; The multi-scale spectral feature extraction network includes a Fourier transform network module, a recursive graph transform network module, a Gram's angular field transform network module, a connection layer, a convolutional network module, an attention mechanism module, a pooling layer, a flattening layer, a fully connected layer and an activation function layer, wherein the convolutional network module includes a plurality of convolutional layers, the output end of the Fourier transform network module, the output end of the recursive graph transform network module and the output end of the Gram's angular field transform network module are all connected to the input end of the connection layer, and the connection layer, the convolutional network module, the attention mechanism module, the pooling layer, the flattening layer, the fully connected layer and the activation function layer are connected in sequence; The spectral data of the pretreated domestic sewage sample is input into a multi-scale spectral feature extraction network; Based on the Fourier transform network module of the multi-scale spectral feature extraction network, the spectral data of the pre-treated domestic sewage samples are subjected to Fourier transform processing to obtain the Fourier transform image features of the domestic sewage that meets the cleaning standard and the Fourier transform image features of the unclassified domestic sewage; Based on the recursive graph transformation network module of the multi-scale spectral feature extraction network, the spectral data of the pre-treated domestic sewage samples are subjected to recursive graph transformation processing to obtain the recursive transformation image features of the domestic sewage that meets the cleaning standard and the recursive transformation image features of the unclassified domestic sewage; Based on the Gram's angle field transform network module of the multi-scale spectral feature extraction network, the spectral data of the pre-treated domestic sewage samples are processed by Gram's angle field transform to obtain the Gram's angle field transform image features of the domestic sewage that meets the cleaning standard and the Gram's angle field transform image features of the unclassified domestic sewage; Based on the connection layer of the multi-scale spectral feature extraction network, the Fourier transform image features of the domestic sewage that meets the cleaning standard, the recursive transform image features of the domestic sewage that meets the cleaning standard, and the Gram's angular field transform image features of the domestic sewage that meets the cleaning standard are spliced, and the Fourier transform image features of the unclassified domestic sewage, the recursive transform image features of the unclassified domestic sewage, and the Gram's angular field transform image features of the unclassified domestic sewage are spliced ​​to obtain the multi-scale image features of the domestic sewage that meets the cleaning standard and the multi-scale image features of the unclassified domestic sewage; A convolution network module based on a multi-scale spectral feature extraction network performs convolution processing on the multi-scale image features of domestic sewage that meets the cleaning standard and the multi-scale image features of unclassified domestic sewage, respectively, to obtain the convolved multi-scale image features of domestic sewage that meets the cleaning standard and the convolved multi-scale image features of unclassified domestic sewage; Based on the attention mechanism module of the multi-scale spectral feature extraction network, spatial channel attention extraction processing is performed on the multi-scale image features of the domestic sewage that meets the cleaning standard after convolution and the multi-scale image features of the unclassified domestic sewage after convolution, so as to obtain the extracted multi-scale image features of the domestic sewage that meets the cleaning standard and the extracted multi-scale image features of the unclassified domestic sewage; Based on the pooling layer and flattening layer of the multi-scale spectral feature extraction network, the multi-scale image features of the extracted domestic sewage that meets the cleaning standard and the multi-scale image features of the extracted unclassified domestic sewage are pooled and flattened respectively to obtain the flattened multi-scale image features of the domestic sewage that meets the cleaning standard and the flattened multi-scale image features of the unclassified domestic sewage; The feature vector distance is calculated by using the Euclidean formula for the flattened multi-scale image features of the domestic sewage that meets the cleaning standard and the flattened multi-scale image features of the unclassified domestic sewage to obtain the feature vector distance; Based on the fully connected layer and activation function layer of the multi-scale spectral feature extraction network, the similarity value judgment is processed according to the feature vector distance to obtain the turbidity classification result of domestic sewage.

2. The water turbidity classification method based on multi-scale spectral feature extraction network according to claim 1 is characterized in that: The step of preprocessing the spectral data of the domestic sewage sample to obtain the spectral data of the pretreated domestic sewage sample specifically includes: Assigning labels to the spectral data of the domestic sewage sample to obtain the spectral data of the domestic sewage sample with labels; The data length of the labeled domestic sewage sample spectral data is unified by using the segmented aggregation approximation method to obtain the unified domestic sewage sample spectral data; Performing noise reduction processing on the unified spectral data of domestic sewage samples to obtain spectral data of domestic sewage samples after noise reduction; The spectral data of the domestic sewage sample after noise reduction is divided and processed to obtain the spectral data of the domestic sewage sample after pretreatment.

3. The water turbidity classification method based on multi-scale spectral feature extraction network according to claim 2 is characterized in that: The calculation expression of the Fourier transform network module is specifically as follows: ; In the above formula, represents the window function, represents the angular frequency, represents the original signal, represents the distance of window function displacement, Represents the spectrum.

4. The water turbidity classification method based on multi-scale spectral feature extraction network according to claim 3 is characterized in that: The calculation expression of the recursive graph transformation network module is specifically as follows: ; In the above formula, Indicates a The square array, represents the norm, Represents the distance threshold such that express function, represents any two states in the phase space, represents any number in the sequence, represents any number in the sequence, Represents the number of elements in the sequence.

5. The water turbidity classification method based on multi-scale spectral feature extraction network according to claim 4 is characterized in that: The calculation expression of the Gram angular field transformation network module is specifically as follows: ; In the above formula, represents a sequence signal, The first elements, represents the cosine of the angle, Indicates a point in time, represents a constant factor, represents the normalized sequence data, represents the normalized set of all sequence data, Represents the polar axis.

6. A water pollution turbidity classification system based on a multi-scale spectral feature extraction network, characterized in that: Includes the following modules: An acquisition module, used for acquiring domestic sewage sample data, wherein the domestic sewage sample data includes domestic sewage that meets the cleaning standard and unclassified domestic sewage; Constructing a transmittance measurement bracket, wherein the transmittance measurement bracket includes a light source, a quartz cuvette and an ultraviolet-visible spectrometer; Turn off the light source and perform transmission measurement on an empty quartz cuvette using a UV-visible spectrometer to obtain background light data; Turn on the light source and perform transmission measurement on an empty quartz cuvette using a UV-visible spectrometer to obtain reference light data; Turning on the light source, and performing transmission measurement on a quartz cuvette filled with domestic sewage that meets the cleaning standard by using an ultraviolet-visible spectrometer to obtain first sample light data; Turn on the light source, and perform transmission measurement on a quartz cuvette containing unclassified domestic sewage using a UV-visible spectrometer to obtain light data of a second sample; Calculating according to the background light data, the reference light data and the first sample light data to obtain the spectrum data of the domestic sewage that meets the cleaning standard; Calculation is performed based on background light data, reference light data, and second sample light data to obtain spectrum data of unclassified domestic sewage; Integrate the spectral data of domestic sewage that meets the cleaning standard and the spectral data of unclassified domestic sewage to obtain the spectral data of the domestic sewage sample; A preprocessing module, used for preprocessing the spectral data of the domestic sewage sample to obtain the spectral data of the pretreated domestic sewage sample; A construction module is used to introduce a Fourier transform network module, a recursive graph transform network module and a Gram angular field transform network module to construct a multi-scale spectral feature extraction network; The multi-scale spectral feature extraction network includes a Fourier transform network module, a recursive graph transform network module, a Gram's angular field transform network module, a connection layer, a convolutional network module, an attention mechanism module, a pooling layer, a flattening layer, a fully connected layer and an activation function layer, wherein the convolutional network module includes a plurality of convolutional layers, the output end of the Fourier transform network module, the output end of the recursive graph transform network module and the output end of the Gram's angular field transform network module are all connected to the input end of the connection layer, and the connection layer, the convolutional network module, the attention mechanism module, the pooling layer, the flattening layer, the fully connected layer and the activation function layer are connected in sequence; A classification module, used for inputting the spectral data of the pre-treated domestic sewage sample into a multi-scale spectral feature extraction network; Based on the Fourier transform network module of the multi-scale spectral feature extraction network, the spectral data of the pre-treated domestic sewage samples are subjected to Fourier transform processing to obtain the Fourier transform image features of the domestic sewage that meets the cleaning standard and the Fourier transform image features of the unclassified domestic sewage; Based on the recursive graph transformation network module of the multi-scale spectral feature extraction network, the spectral data of the pre-treated domestic sewage samples are subjected to recursive graph transformation processing to obtain the recursive transformation image features of the domestic sewage that meets the cleaning standard and the recursive transformation image features of the unclassified domestic sewage; Based on the Gram's angle field transform network module of the multi-scale spectral feature extraction network, the spectral data of the pre-treated domestic sewage samples are processed by Gram's angle field transform to obtain the Gram's angle field transform image features of the domestic sewage that meets the cleaning standard and the Gram's angle field transform image features of the unclassified domestic sewage; Based on the connection layer of the multi-scale spectral feature extraction network, the Fourier transform image features of the domestic sewage that meets the cleaning standard, the recursive transform image features of the domestic sewage that meets the cleaning standard, and the Gram's angular field transform image features of the domestic sewage that meets the cleaning standard are spliced, and the Fourier transform image features of the unclassified domestic sewage, the recursive transform image features of the unclassified domestic sewage, and the Gram's angular field transform image features of the unclassified domestic sewage are spliced ​​to obtain the multi-scale image features of the domestic sewage that meets the cleaning standard and the multi-scale image features of the unclassified domestic sewage; A convolution network module based on a multi-scale spectral feature extraction network performs convolution processing on the multi-scale image features of domestic sewage that meets the cleaning standard and the multi-scale image features of unclassified domestic sewage, respectively, to obtain the convolved multi-scale image features of domestic sewage that meets the cleaning standard and the convolved multi-scale image features of unclassified domestic sewage; Based on the attention mechanism module of the multi-scale spectral feature extraction network, spatial channel attention extraction processing is performed on the multi-scale image features of the domestic sewage that meets the cleaning standard after convolution and the multi-scale image features of the unclassified domestic sewage after convolution, so as to obtain the extracted multi-scale image features of the domestic sewage that meets the cleaning standard and the extracted multi-scale image features of the unclassified domestic sewage; Based on the pooling layer and flattening layer of the multi-scale spectral feature extraction network, the multi-scale image features of the extracted domestic sewage that meets the cleaning standard and the multi-scale image features of the extracted unclassified domestic sewage are pooled and flattened respectively to obtain the flattened multi-scale image features of the domestic sewage that meets the cleaning standard and the flattened multi-scale image features of the unclassified domestic sewage; The feature vector distance is calculated by using the Euclidean formula for the flattened multi-scale image features of the domestic sewage that meets the cleaning standard and the flattened multi-scale image features of the unclassified domestic sewage to obtain the feature vector distance; Based on the fully connected layer and activation function layer of the multi-scale spectral feature extraction network, the similarity value judgment is processed according to the feature vector distance to obtain the turbidity classification result of domestic sewage.

Citation Information

Patent Citations

  • Vital sign data separation method and device, electronic equipment and storage medium

    CN115444379A

  • Spectral data model construction and classification detection method and device, equipment and medium

    CN116956143A