SO2 detection device and concentration inversion method based on ultraviolet fluorescence spectrum and deep learning
By combining xenon lamps and spectral dispersive structures with deep learning, an inversion model of the relationship between SO2 concentration and ultraviolet fluorescence spectrum was established, which solved the problems of real-time and accuracy in SO2 detection in ship exhaust gas, and achieved efficient and accurate SO2 concentration monitoring.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- QINGDAO JIERUI IND CONTROL TECH CO LTD
- Filing Date
- 2026-05-21
- Publication Date
- 2026-07-10
AI Technical Summary
Existing technologies for detecting SO2 in ship exhaust gas suffer from insufficient real-time performance, inadequate measurement accuracy, reliance on fluorescence intensity, and complex maintenance.
A xenon lamp was used as the excitation source. The fluorescence of SO2 was collected by combining the spectral dispersive structure and the ultraviolet camera. A deep learning-based inversion model of the relationship between SO2 concentration and ultraviolet fluorescence spectrum was established. The CNN-Attention-PCR algorithm was used for feature extraction and concentration regression.
It enables ppm-level monitoring of SO2 concentration in ship exhaust gas, with a detection limit of 0.79 µg/m³, strong anti-interference ability, and independence from fluorescence intensity, thus reducing maintenance complexity.
Smart Images

Figure CN122361383A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a technology for detecting SO2 content in ship exhaust gas, and more particularly to a device and method for detecting SO2 concentration based on ultraviolet fluorescence spectroscopy and deep learning. Background Technology
[0002] The rapid growth of the global economy, while driving the booming shipping industry, has also brought serious pollution problems to the marine and atmospheric environment. Ship fuel mainly consists of heavy oil and diesel, byproducts of crude oil refining, which generally have high sulfur and carbon content, resulting in large amounts of sulfur dioxide (SO2) in ship exhaust. SO2 combines with rainwater to form acid rain, which not only disrupts the soil's pH balance and affects plant nutrient absorption but also directly corrodes buildings. Furthermore, acid rain entering water bodies causes changes in water quality, leading to continuous damage to the aquatic ecosystem.
[0003] Chemical analysis of fuel samples to determine their sulfur content is currently the most authoritative and direct monitoring method for SO2 content in exhaust gases. However, this method is not real-time and has a time lag, limiting its application to random sampling. Drone-based thermal imaging technology can also detect SO2 concentration, suitable for rapid real-time monitoring, but its measurement accuracy is insufficient. Differential absorption spectroscopy can also be used to detect the SO2 to CO2 concentration ratio in exhaust gases. By calculating the sulfur-to-carbon ratio of the fuel, the sulfur content of the fuel oil used can be deduced; however, wind speed, wind direction, and background atmospheric concentration can affect the detection accuracy and effectiveness.
[0004] Studies have found that SO2 has a characteristic absorption peak in the ultraviolet region of 190-230 nm, and the fluorescence emitted after excitation is in the range of 240-420 nm. The intensity of the excitation fluorescence has a good linear relationship with the SO2 concentration. However, traditional devices use photomultiplier tubes (PMTs) as receivers and detectors, and a single-wavelength bandpass filter is used to detect the light intensity at that wavelength. In concentration inversion calculations, inversion can only be performed based on intensity, so the accuracy of concentration detection depends on the baseline light intensity. Some devices can perform measurements using dual cells to eliminate the influence of the baseline, but this still relies on a standard gas, and the PMT requires professional maintenance such as protection from light and shock, and cleaning of the mirror surface. Summary of the Invention
[0005] To address the aforementioned technical problems, this invention provides an SO2 detection device and concentration inversion method based on ultraviolet fluorescence spectroscopy and deep learning. This invention uses a xenon lamp as the excitation source to irradiate SO2-containing exhaust gas in a sample cell. The fluorescence excited by SO2 is then collected using a combination of spectral dispersive structure and an ultraviolet camera. An inversion model relating SO2 concentration is established through spectral feature analysis. Subsequently, the SO2 concentration can be estimated in actual measurements based on the acquired spectral data using the established inversion model. This method enables ppm-level monitoring of SO2 content in ship exhaust gas.
[0006] The technical solution of this invention is: an SO2 concentration detection device based on ultraviolet fluorescence spectroscopy and deep learning, comprising: Xenon lamps serve as the excitation light source; A focusing lens is positioned along the light propagation path of the xenon lamp; The air chamber has a light inlet and is opposite to the exit surface of the focusing lens; The dispersive unit is located at the light outlet of the gas chamber; An ultraviolet CCD array is positioned on the emission path of the dispersive unit, with the photosensitive surface facing the dispersive unit. The computer is connected to an ultraviolet CCD array.
[0007] Based on the above, the dispersive unit further comprises a slit, a collimating lens, a prism group, a focusing lens, and a plano-cylindrical mirror; the slit is located at the light outlet of the air chamber, and the collimating lens, prism group, focusing lens, and plano-cylindrical mirror are arranged sequentially after the slit. The slit width can be adjusted from 10μm to 3mm. The collimating lens is an aspherical collimating lens, which collimates the light beam into parallel light. The prism assembly consists of three stacked glass prisms.
[0008] Building upon the above, a total reflection film is further coated on the inner wall of the gas chamber. A sampling probe is installed on the gas chamber for extracting the gas to be tested from within the chamber.
[0009] The present invention also provides a method for SO2 concentration inversion using the above-mentioned device. The method is to first establish an inversion model of the relationship between SO2 gas concentration and excited ultraviolet fluorescence spectrum, and then use the model to invert the concentration of measured SO2 gas through spectral data. The establishment of the inversion model includes the following steps: 1.1) Obtain correlation data between SO2 concentration and ultraviolet fluorescence spectrum; 1.2) UV fluorescence spectrum preprocessing: including smoothing filtering, baseline correction, and normalization; 1.3) Inversion model design and training: The CNN-Attention-PCR algorithm model was used to extract features and regress concentrations from the SO2 ultraviolet fluorescence spectrum.
[0010] Furthermore, in 1.1), dense sampling is used in relatively small SO2 concentration ranges, and sparse sampling is used in relatively large SO2 concentration ranges; In 1.2), the smoothing filter uses Savitzky-Golay smoothing and low-pass filtering. The baseline correction uses the no-signal region averaging method combined with global statistics to perform baseline subtraction. The spectrum after baseline subtraction is normalized to [0,1] by the maximum intensity.
[0011] Furthermore, in 1.3), the specific training steps are as follows: 1.3.0) Model Parameter Initialization Convolutional layer weights and biases: The first convolutional layer has 64 convolutional kernels, each with a size of 5×1, and weights... Random samples are taken from a truncated normal distribution with a mean of 0; bias The initial value is 0; the second convolutional layer has 128 convolutional kernels, each kernel size is 3×64, and the weights are... The mean is 0; the bias is 0. The initial value is 0; Attention layer weights and biases: Attention layer weight vector From uniform distribution Random sampling; bias The initial value is 0; Fully Connected Layer Weights and Bias: Fully Connected Layer Weight Matrix Random samples are taken from a truncated normal distribution with a mean of 0; bias The initial value is 0; Output layer weights and biases: Output layer weight vector From uniform distribution Random sampling, bias The initial value is 0; PCR linear regression coefficient: , the number of principal components, initialized to 0, intercept Initialize to 0; 1.3.1) Input of SO2 UV fluorescence spectrum data Let the input ultraviolet fluorescence spectrum data be... , The number of spectral data points, where elements Indicates the corresponding number i Fluorescence intensity at each wavelength; organized into a three-dimensional tensor The first dimension represents the number of samples, the second dimension represents the spectral data points, and the third dimension represents the number of feature channels, simplified as follows: ; 1.3.2) First-level convolution and pooling enter Perform the first-level convolution to obtain the... k The output value of each convolution kernel is: ; in For the sequence number Spectral data, For the first k The first convolutional kernel mEach weight, m =0…4, , The first feature map is obtained by calculating 64 convolutional kernels. ;right Max pooling, outputting the first pooled feature map. ; 1.3.3) Second-level convolution and pooling enter Perform a second-level convolution to obtain k The output value of each convolution kernel is: ; Among them Sequence number Line 1 c The value of the channel, For the first k Each convolutional kernel at the offset m Input Channel c The weights at each location are used to calculate the second feature map. ;right Max pooling, output the second pooling feature map. ; 1.3.4) Attention Weighting The second pooling feature map Each row is considered as a feature representation of a wavelength position, denoted as the first row. t The feature vector of each wavelength position index is ; For wavelength position t Calculate its energy fraction : ; It is the hyperbolic tangent function. , for The j One portion, For feature vectors The j One component; The attention weights at each wavelength position are obtained by normalizing the energy fractions described above. : ; The feature vectors at each wavelength position are weighted and summed according to their attention weights to obtain the spectral context feature vector that fuses information from the entire wavelength range. : ; 1.3.5) Principal Component Regression S5.1 Feature Centralization Will As input, principal component regression is performed on the training set. N From samples, the feature matrix is obtained. , No. i Behavior Calculate the mean of each column. And centralized: ; Obtain the centered feature matrix ; S5.2 Principal Component Analysis Calculate the covariance matrix: ; right Perform eigenvalue decomposition to obtain eigenvalues. and the corresponding unit eigenvector Before selection K The principal components constitute the projection matrix. Projecting the centered features onto the principal component space: , in Each row is a principal component score vector ; S5.3 Linear Regression Let the SO2 concentration vector in the training set be... The least squares method was used to fit the linear relationship between the score matrix and the concentration. ; in , .
[0012] Furthermore, for SO2 samples with the concentration to be measured, the method for predicting the concentration using an inversion model is as follows: First, the ultraviolet fluorescence spectrum of the SO2 concentration to be measured was obtained and preprocessed. The spectral data is then input into the inversion model to obtain the fluorescence spectral context feature vector. ; Then centralization is implemented: ; in The mean of the features in the training set; Projecting the centered features onto the principal component space yields: ; Perform linear regression prediction: ; Anti-normalization: Using the mean SO2 concentration in the training set and standard deviation Will Convert to actual concentration: ; ; The number of samples in the training set. For the training set i SO2 concentration values.
[0013] This invention employs a hardware structure combining a xenon lamp ultraviolet light source, a spectral dispersion structure, and an ultraviolet array CCD camera as the detection device. It collects ultraviolet fluorescence spectra corresponding to different SO2 exhaust gas concentrations and establishes an inversion model relating SO2 concentration to ultraviolet fluorescence spectra. This invention utilizes ultraviolet fluorescence detection, resulting in a short sampling time and accurate measurement of SO2 concentration. Ultraviolet fluorescence has strong detection capabilities for low-concentration SO2, with a detection limit as low as 0.79 µg / m³, meeting the requirements of ambient air quality standards and monitoring low-concentration emissions from ship exhaust. Furthermore, ultraviolet fluorescence is not easily quenched or interfered with by gases such as NO, CO2, and O2, making it particularly suitable for ship exhaust gas detection. This invention also compresses the rectangular linear spectrum emitted from the prism group into a linear form by adding plano-convex cylindrical mirrors, which are then received by a linear ultraviolet CCD array. Compared to traditional full-spectrum systems using area array CCD cameras, this significantly increases spectral reception efficiency and achieves efficient and economical detection.
[0014] In establishing an inversion model for the precise relationship between SO2 concentration and ultraviolet fluorescence spectrum, this invention employs the CNN-Attention-PCR algorithm for nonlinear feature extraction of ultraviolet fluorescence spectrum and SO2 principal component concentration regression. Compared with existing detection technologies, this invention has significant advantages such as rich information, strong anti-interference, independence from fluorescence intensity, and no need for standard gas calibration. Attached Figure Description
[0015] Figure 1 This is a simplified structural diagram of the SO2 concentration detection device of the present invention; Figure 2 This is a flowchart of the SO2 concentration inversion method of the present invention. Detailed Implementation
[0016] The present invention will now be described in detail with reference to the embodiments. Those skilled in the art should know that the following embodiments are not the only limitation on the technical solution of the present invention. Any equivalent transformations or modifications made under the spirit and essence of the technical solution of the present invention should be considered as falling within the protection scope of the present invention.
[0017] First, this invention provides an SO2 concentration detection device based on ultraviolet fluorescence spectroscopy and deep learning. The device uses a xenon lamp as the ultraviolet excitation source, focusing the excitation light onto a gas sample cell via a focusing lens. The SO2 gas in the sample cell absorbs ultraviolet light and emits fluorescence. The fluorescence signal is collected through a slit to a spectral dispersion system and received by an ultraviolet camera. The data is then processed by a computer to form spectral data. After a series of SO2 concentration fittings, a standard spectral database is formed in the computer. In later applications, the SO2 concentration (content) can be directly inverted from the collected spectral signals using a standard inversion model. This method does not rely on fluorescence intensity but rather on the shape of the fluorescence spectrum to invert the SO2 concentration, thus avoiding inherent errors caused by inaccurate fluorescence intensity measurements.
[0018] like Figure 1 As shown, an SO2 concentration detection device based on ultraviolet fluorescence spectroscopy and deep learning is provided. The device comprises: a xenon lamp 1, a focusing lens 2, a gas chamber 3, a dispersive unit 4, an ultraviolet CCD array 5, and a computer 12.
[0019] Xenon lamp 1 serves as the excitation source, and focusing lens 2 is positioned along the propagation path of the excitation light. The incident surface of the focusing lens is opposite to xenon lamp 1, ideally with xenon lamp 1 and focusing lens 2 on the same center line. The exit surface of the focusing lens is opposite to the light inlet of gas chamber 3. In this invention, xenon lamp 1 acts as the ultraviolet excitation source, and focusing lens 2 concentrates the excitation light into gas chamber 3. Gas chamber 3 contains ship exhaust gas, including SO2 gas. SO2 gas absorbs ultraviolet light and emits fluorescence.
[0020] In this invention, the xenon lamp 1 serves to provide excitation light, with an effective spectral range of 190-400 nm. Using the full spectrum of the xenon lamp as the ultraviolet excitation light eliminates the need for a monochromator to achieve excitation in a single ultraviolet band, resulting in higher excitation efficiency across the entire spectrum.
[0021] In this invention, the function of the focusing lens 2 is to focus the excitation light of the xenon lamp 1 onto a single point in the gas chamber 3, a tiny area, which can greatly enhance the excitation intensity at that point and is beneficial for detecting weak SO2 fluorescence signals.
[0022] In this invention, the gas chamber 3 is made of quartz glass and has light inlet and outlet windows. The inner wall of the gas chamber is coated with a total reflection film, which can reflect fluorescence multiple times to increase the fluorescence detection intensity. The light outlet of the gas chamber 3 is opposite to the dispersive unit 4. After absorbing excitation light, the gas in the gas chamber 3 emits fluorescence. The fluorescence emitted by the gas enters the dispersive unit 4 through the light outlet of the gas chamber 3, and after being transformed by the dispersive unit 4, it is captured by the ultraviolet CCD array 5.
[0023] The dispersion unit 4 of the present invention consists of a slit 6, a collimating lens 7, a prism group 8, a focusing lens 9, and a plano cylindrical mirror 10.
[0024] Slit 6 is located at the light outlet of gas cell 3. Slit 6 acts as an aperture to collect the fluorescence emitted by the gas cell. The width of the slit is adjustable, ranging from 10 μm to 3 mm, and the height is 10 mm.
[0025] The collimating lens 7 is located at the light exit of the slit 6. The collimating lens is an aspherical collimating lens with a diameter of 15mm, which can collimate the light beam into parallel light.
[0026] Prism group 8 is positioned at the light-emitting end of collimating lens 7. The prism group consists of three stacked glass prisms with an effective aperture of 30mm × 36mm. The first prism is made of fused silica with a low refractive index, the second prism is made of ultraviolet flint glass with a high refractive index, and the third prism, like the first prism, is made of fused silica with a low refractive index. This prism group disperses polychromatic fluorescence into a resolvable, continuous linear spectrum, with a rectangular light spot on the sagittal plane.
[0027] The focusing lens 9 is set at the light-emitting end of the prism group 8, which gradually focuses the dispersed spectrum onto the plano-convex cylindrical mirror 10, and the rectangular light spot is gradually focused.
[0028] The plano-convex cylindrical mirror 10 is set at the light-emitting end of the focusing lens 9. The plano-convex cylindrical mirror 10 has focusing capability in the direction perpendicular to the generatrix, but no light focusing in the direction parallel to the generatrix. It keeps the direction of light propagating in the meridional direction parallel to the generatrix unchanged, while focusing the light propagating in the sagittal direction perpendicular to the generatrix, compressing the rectangular light spot on the original sagittal surface into a line shape, and finally imaging it onto the photosensitive surface of the ultraviolet array CCD 5.
[0029] The fluorescence emitted by the gas in gas chamber 3 is dispersed by dispersive unit 4 and then imaged onto the photosensitive surface of ultraviolet CCD 5 by plano-convex cylindrical mirror 10. Ultraviolet CCD 5 sends the image to computer 12, which processes the acquired fluorescence signal and displays the fluorescence spectrum. Furthermore, ultraviolet CCD 5 is an ultraviolet-sensitive linear CCD, such as the Hamamatsu S15257 thin back-illuminated CCD image sensor with electronic shutter function.
[0030] Furthermore, the present invention includes a sampling probe 11 mounted on the gas chamber 3. The sampling probe 11 can be a domestically produced JES-301E1SV flue gas sampling probe. The sampling probe can continuously and stably extract the test gas, thereby preventing the condensation of water vapor in the exhaust gas and the resulting SO2 dissolution loss. Its integrated heating device can heat the test gas to above 180°C, ensuring that the analyte remains in a gaseous state during transmission. The probe is made of high-temperature and corrosion-resistant materials, and a coarse filter is installed at the front end for preliminary removal of large particles of smoke and oil.
[0031] Secondly, based on the aforementioned device, this invention provides a method for detecting SO2 concentration using the device. The main idea of this method is to first use the device to capture the ultraviolet fluorescence spectrum of SO2 across the entire concentration range in ship exhaust gas; then, a computer algorithm is used to establish a mapping relationship between the SO2-excited ultraviolet fluorescence spectrum and the concentration; finally, using this relationship, the concentration of SO2-containing exhaust gas is inverted through the spectral signal. Therefore, the core of this invention is to establish an inversion model of the relationship between SO2 concentration and the excited ultraviolet fluorescence spectrum.
[0032] 1. Establishment of the inversion model The establishment of the inversion model includes the following steps: 1.1) Acquisition of SO2 concentration-UV fluorescence spectrum correlation data use Figure 1 The apparatus was used to establish an inversion model relating SO2 UV fluorescence spectra to its concentration. In establishing the inversion model, a series of SO2 gases with known concentrations were first excited with UV light to obtain the corresponding UV fluorescence spectra.
[0033] A mapping relationship between SO2 gas concentration and ultraviolet fluorescence spectrum was established, collecting samples of the gas at different concentrations. The applicable concentration range varies depending on the gas environment. For example, in establishing the mapping relationship between SO2 concentration in ship exhaust and ultraviolet fluorescence spectrum, the applicable concentration range for collection is 0-2000 ppm. Testing revealed that in the low concentration range of 0-100 ppm, the fluorescence signal of SO2 is weak, and concentration changes are highly sensitive to the spectral shape, thus requiring relatively dense sampling points. In the high concentration range of 100-2000 ppm, the fluorescence signal of SO2 is strong, possibly approaching saturation or the linear region; the sampling points can be relatively sparse, but need to cover potential nonlinear changes. Therefore: In the concentration range of 0-100 ppm, 11 calibration points (0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 ppm) can be set in increments of 10 ppm. In the concentration range of 100-200 ppm, six calibration points (100, 120, 140, 160, 180, 200 ppm) can be set in steps of 20 ppm. Within the concentration range of 200–500 ppm, seven calibration points (200, 250, 300, 350, 400, 450, 500 ppm) can be set in steps of 50 ppm. In the concentration range of 500–1000 ppm, six calibration points (500, 600, 700, 800, 900, 1000 ppm) can be set in increments of 100 ppm. In the concentration range of 1000–2000 ppm, six calibration points (1000, 1200, 1400, 1600, 1800, 2000 ppm) can be set in steps of 200 ppm.
[0034] In this invention, it is recommended to collect gas at each concentration multiple times (e.g., 5-10 times) in order to train a better model.
[0035] 1.2) UV fluorescence spectroscopy pretreatment The obtained raw ultraviolet fluorescence spectra need to be preprocessed, including smoothing filtering, baseline correction, and normalization.
[0036] The smoothing filter employs Savitzky-Golay smoothing and low-pass filtering to remove high-frequency electrical noise and random interference.
[0037] For ultraviolet fluorescence spectra, the baseline is usually relatively flat. A flat or slightly tilted baseline may occur due to the dark current of the ultraviolet CCD and fluctuations in the light source. The non-zero baseline detected by the ultraviolet camera when there is no light input or the excitation source is blocked is the dark current baseline. This baseline may change slowly with temperature, integration time, and pixel position. This invention uses a signal-free region averaging method combined with global statistics for baseline subtraction. Based on the fluorescence emission range of SO2, light intensity values are collected in the 220–235 nm and 430–450 nm channels to calculate the average intensity. Signal intensity was collected and weighted across the entire ultraviolet CCD fluorescence emission range of 200–450 nm. A robust baseline is obtained by taking the median of the two. Let the original spectral signal be... Fluorescence spectrum after baseline correction For negative values, set their value to zero.
[0038] The spectrum after baseline subtraction is normalized to [0,1] by maximum intensity to accelerate model convergence and improve generalization ability. Normalized spectra retain the shape characteristics of the spectrum (such as peak position, peak width, and peak ratio).
[0039] 1.3) Model Design and Training This invention employs a CNN-Attention-PCR algorithm to invert and regress SO2 concentration. Specifically, CNN-Attention is used for ultraviolet fluorescence spectral feature extraction, and PCR is used for SO2 concentration regression. This method uses a one-dimensional convolutional kernel that slides across the spectrum, learning to extract nonlinear local features of the position, shape, and width of fluorescence peaks (corresponding to characteristic peaks of SO2), while the PCR module establishes a linear regression model in a low-dimensional principal component space.
[0040] The designed model includes a deep learning module, comprising convolutional layers, attention layers, fully connected layers, an output layer, and a linear regression module. The training process is as follows: 1.3.0) Model Parameter Initialization Convolutional layer weights and biases: The first convolutional layer is designed with 64 convolutional kernels, each kernel being 5×1 in size, and weights... Random samples are taken from a truncated normal distribution with a mean of 0; bias is applied. The initial value is 0; The second convolutional layer is designed with 128 convolutional kernels, each kernel being 3×64 in size, and weights... Random samples are taken from a truncated normal distribution with a mean of 0; bias is applied. The initial value is 0.
[0041] Attention layer weights and biases: Designing the attention layer weight vector Each element is from a uniform distribution Independent sampling in the middle; bias Initialize to 0.
[0042] Fully Connected Layer Weights and Bias: Designing the Weight Matrix for Fully Connected Layers Each element is randomly sampled from a truncated normal distribution with a mean of 0; bias Initialize to 0.
[0043] Output layer weights and biases: Designing the output layer weight vector Each element is from a uniform distribution Mid-sampling, bias Initialize to 0.
[0044] Design PCR linear regression coefficients: ( The number of principal components is initialized to 0, and the intercept is set to 0. Initialize to 0.
[0045] During training, the Adam optimizer is used to iteratively update all learnable parameters, where the learning rate can be set to 0.001 and the first-order moment decay coefficient can be set to... Second-order moment attenuation coefficient The model is iteratively updated to minimize the mean squared error loss function. PCR regression is used to fix the feature extraction model parameters, and the training set spectral data is input into the model to obtain the corresponding feature vector set. Principal component analysis is then performed on this feature vector set, and linear regression coefficients are fitted. and intercept .
[0046] 1.3.1) Input of SO2 UV fluorescence spectrum data Let the input ultraviolet fluorescence spectrum data be... , of which elements Indicates the corresponding number i Normalized fluorescence intensity at each wavelength, This refers to the number of spectral data points (each point corresponds to one wavelength). This invention preferably uses an ultraviolet CCD array, and the number of spectral data points... The value is 2048. The following calculations use 2048 pixels as an example. It contains information about the peak positions and shapes of the spectrum, which is organized into a three-dimensional tensor of shape (1, 2048, 1). The first dimension "1" represents the number of samples, the second dimension "2048" represents the spectral data points, and the third dimension "1" represents the number of feature channels. Let be a real number, and for simplicity, denoted as . .
[0047] 1.3.2) First-level convolution and pooling S2.1 One-dimensional convolution operation Will Inputting into the first convolutional layer, taking 64 one-dimensional convolutional kernels with a length of 5 and a stride of 1 as an example, the weights of each convolutional kernel are represented as follows: bias , k =1,…,64. To ensure the length of the input sequence remains unchanged before and after convolution, two zeros are padded to the left and right ends of the input sequence. The convolution kernel slides from left to right with a stride of 1, and for each output position… t =1,…,2048, No. k The output value of each convolution kernel is: ; in For the first part of the padded sequence Spectral data, For the first k The first convolutional kernel m Each weight, m =0…4 represents the number of sequence replacements. All 64 convolutional kernels are computed in parallel to obtain the first feature map. .
[0048] S2.2 Max Pooling Operation right Applying one-dimensional max pooling, taking a pooling window size of 2 and a stride of 2 as an example, for each channel and the starting position of the pooling window... n =1,2,5,…,2047, calculate: ; Output the first pooling feature map .
[0049] 1.3.3) Second-level convolution and pooling S3.1 One-dimensional convolution operation enter That is, each position has 64 channels. 128 one-dimensional convolutional kernels of length 3 are used, each with a weight of [value missing]. bias , To maintain the same output length, a zero is padded at both ends of the input sequence. The convolution kernel slides from left to right with a stride of 1, and for each output position... t =1,…,1024, No. k The output of each convolutional kernel is: ; in For the padded sequence number Line 1 c The value of the channel, For the first k Each convolutional kernel at the offset m Input Channel c The weights at each location are calculated to obtain the second feature map. .
[0050] S3.2 Max Pooling Operation right Apply max pooling with a window size of 2 and a stride of 2 for each channel and starting position. n =1,3,5,…,1023, calculate: ; Output the second pooling feature map .
[0051] 1.3.4) Attention Weighting The second pooling feature map Each row is considered a feature representation of a wavelength position. Let the first row be... t Wavelength position index ( t The eigenvectors of the region (i = 1, 2, ..., 512) are: .
[0052] S4.1 Calculate the energy fraction Through learnable attention weight vectors and bias For each wavelength position, calculate its energy fraction. as follows: ; It is the hyperbolic tangent function. .in for The j One portion, For feature vectors The j Each component.
[0053] S4.2 Normalized Attention Weights The energy fractions mentioned above are normalized as follows to obtain the attention weights at each wavelength position. : ; S4.3 Weighted generation of spectral context feature vectors The feature vectors at each wavelength position are weighted and summed according to their attention weights to obtain the spectral context feature vector that fuses information from the entire wavelength range. : ; 1.3.5) Principal Component Regression (PCR) spectral context feature vector Principal component regression is performed using the input features.
[0054] S5.1 Feature Centralization For the training set N From samples, the feature matrix is obtained. , its first i Behavior Calculate the mean of each column. And centralized: ; Obtain the centered feature matrix .
[0055] S5.2 Principal Component Analysis (PCA) Calculate the covariance matrix: ; right Perform eigenvalue decomposition to obtain eigenvalues. and the corresponding unit eigenvector Before selection K Principal components ( K Determined by the cumulative variance contribution rate (e.g., 99%), forming the projection matrix. .
[0056] Project the centered features onto the principal component space: ; in Each row is a principal component score vector .
[0057] S5.3 Linear Regression Let the SO2 concentration vector in the training set be... The least squares method was used to fit the linear relationship between the score matrix and the SO2 concentration. ; in , .
[0058] Step 2: Concentration prediction using the inversion model 2.1) For the SO2 sample to be measured, first input the spectral data into the model. After the model parameters are initialized, calculate its spectral context vector according to steps 1.3.1) to 1.3.4). Then calculate according to step 1.3.5): ; in The mean of the features in the training set.
[0059] 2.2) will Projecting onto the principal component space yields: ; 2.3) Linear regression prediction: ; The model can predict the results. This is a value on a standardized scale (mean is 0, standard deviation is 1).
[0060] 2.4) Inverse normalization: Using the mean SO2 concentration in the model training set and standard deviation Will Convert to actual concentration : ; ; The number of samples in the training set. For the training set i SO2 concentration values.
[0061] The innovative features of this invention lie in using SO2 concentration prediction as a supervisory signal to update parameters such as weight bias during the CNN-Attention stage, ensuring a high correlation between the extracted UV fluorescence spectral features and SO2 concentration. In the PCR regression stage, linear least squares is used to solve the regression coefficients, avoiding the defect of the PCR principal component direction being interfered with by the regression target and reducing model overfitting. The computation time for PCR concentration prediction in this method is almost negligible compared to the prediction time of the CNN-Attention module. The overall real-time performance is mainly determined by the CNN-Attention. This method achieves the lowest possible real-time latency while maintaining accuracy by jointly inverting SO2 concentration through nonlinear feature extraction and linear regression.
Claims
1. A device for detecting SO2 concentration based on ultraviolet fluorescence spectroscopy and deep learning, characterized in that, Including: Xenon lamp (1) is used as an excitation source; A focusing lens (2) is positioned on the light propagation path of the xenon lamp (1); The air chamber (3) is provided with a light inlet, which is opposite to the exit surface of the focusing lens (2); The dispersion unit (4) is located at the light outlet of the gas chamber (3); An ultraviolet CCD (5) is set on the emission path of the dispersive unit (4), with the photosensitive surface facing the dispersive unit (4); The computer (12) is connected to the ultraviolet array CCD (5).
2. The detection device according to claim 1, characterized in that, The dispersive unit (4) consists of a slit (6), a collimating lens (7), a prism group (8), a focusing lens (9), and a plano cylindrical mirror (10); The slit (6) is located at the light outlet of the air chamber (3), and collimating lens (7), prism group (8), focusing lens (9) and plano cylindrical mirror (10) are arranged sequentially after the slit (6).
3. The detection device according to claim 2, characterized in that, The width of the slit (6) is adjustable from 10μm to 3mm; The collimating lens (7) is an aspherical collimating lens that collimates the light beam into parallel light; The prism assembly (8) is composed of three stacked glass prisms.
4. The detection device according to claim 1, characterized in that, The inner wall of the air chamber (3) is coated with a total reflection film.
5. The detection device according to claim 1, characterized in that, A sampling probe (11) is installed on the gas chamber (3) to extract the gas to be tested from the gas chamber (3).
6. A method for SO2 concentration inversion using the detection device according to any one of claims 1-5, characterized in that, First, an inversion model is established to determine the relationship between SO2 gas concentration and the excited ultraviolet fluorescence spectrum. Then, this model is used to invert the concentration of measured SO2 gas using spectral data. The establishment of the inversion model includes the following steps: 1.1) Obtain correlation data between SO2 concentration and ultraviolet fluorescence spectrum; 1.2) UV fluorescence spectrum preprocessing: including smoothing filtering, baseline correction, and normalization; 1.3) Inversion model design and training: The CNN-Attention-PCR algorithm model was used to extract features and regress concentrations from the SO2 ultraviolet fluorescence spectrum.
7. The SO2 concentration inversion method according to claim 6, characterized in that, In 1.1), dense sampling is used in relatively small SO2 concentration ranges, and sparse sampling is used in relatively large SO2 concentration ranges; In 1.2), the smoothing filter uses Savitzky-Golay smoothing and low-pass filtering. The baseline correction uses the no-signal region averaging method combined with global statistics to perform baseline subtraction. The spectrum after baseline subtraction is normalized to [0,1] by the maximum intensity.
8. The SO2 concentration inversion method according to claim 6, characterized in that, In section 1.3), the specific training steps are as follows: 1.3.0) Model Parameter Initialization Convolutional layer weights and biases: The first convolutional layer has 64 convolutional kernels, each with a size of 5×1, and weights... Random samples are taken from a truncated normal distribution with a mean of 0; bias The initial value is 0; the second convolutional layer has 128 convolutional kernels, each kernel size is 3×64, and the weights are... The mean is 0; the bias is 0. The initial value is 0; Attention layer weights and biases: Attention layer weight vector From uniform distribution Random sampling in the middle; bias The initial value is 0; Fully Connected Layer Weights and Bias: Fully Connected Layer Weight Matrix Random samples are taken from a truncated normal distribution with a mean of 0; bias The initial value is 0; Output layer weights and biases: Output layer weight vector From uniform distribution Random sampling, bias The initial value is 0; PCR linear regression coefficient: , The number of principal components is initialized to 0, and the intercept is... Initialize to 0; 1.3.1) Input of SO2 UV fluorescence spectrum data Let the input ultraviolet fluorescence spectrum data be... , The number of spectral data points, where elements Indicates the corresponding number i Fluorescence intensity at each wavelength; organized into a three-dimensional tensor The first dimension represents the number of samples, the second dimension represents the spectral data points, and the third dimension represents the number of feature channels, simplified as follows: ; 1.3.2) First-level convolution and pooling enter Perform the first-level convolution to obtain the... k The output value of each convolution kernel is: ; in For the sequence number Spectral data, For the first k The first convolutional kernel m Each weight, m =0…4, , The first feature map is obtained by calculating 64 convolutional kernels. ;right Max pooling, outputting the first pooled feature map. ; 1.3.3) Second-level convolution and pooling enter Perform a second-level convolution to obtain k The output value of each convolution kernel is: ; in For the sequence number Line number c The value of the channel, For the first k Each convolutional kernel at the offset m Input Channel c The weights at each location are used to calculate the second feature map. ;right Max pooling, output the second pooling feature map. ; 1.3.4) Attention Weighting The second pooling feature map Each row is considered as a feature representation of a wavelength position, denoted as the first row. t The feature vector of each wavelength position index is ; For wavelength position t Calculate its energy fraction : ; It is the hyperbolic tangent function. , for The j One portion, For feature vectors The j One component; The attention weights at each wavelength position are obtained by normalizing the energy fractions described above. : ; The feature vectors at each wavelength position are weighted and summed according to their attention weights to obtain the spectral context feature vector that fuses information from the entire wavelength range. : ; 1.3.5) Principal Component Regression S5.1 Feature Centralization Will As input, principal component regression is performed on the training set. N From samples, the feature matrix is obtained. , No. i Behavior Calculate the mean of each column. And centralized: ; Obtain the centered feature matrix ; S5.2 Principal Component Analysis Calculate the covariance matrix: ; right Perform eigenvalue decomposition to obtain eigenvalues. and the corresponding unit eigenvector Before selection K The principal components constitute the projection matrix. Projecting the centered features onto the principal component space: , in Each row is a principal component score vector ; S5.3 Linear Regression Let the SO2 concentration vector in the training set be... The least squares method was used to fit the linear relationship between the score matrix and the concentration. ; in , .
9. The method for inverting SO2 concentration in ship exhaust gas according to claim 8, characterized in that, For a SO2 sample with a known concentration, the method for predicting concentration using an inversion model is as follows: First, the ultraviolet fluorescence spectrum of the SO2 concentration to be measured was obtained and preprocessed. The spectral data is then input into the inversion model to obtain the fluorescence spectral context feature vector. ; Then centralization is implemented: ; in The mean of the features in the training set; Projecting the centered features onto the principal component space yields: ; Perform linear regression prediction: ; Anti-normalization: Using the mean SO2 concentration in the training set and standard deviation Will Convert to actual concentration: ; ; The number of samples in the training set. For the training set i SO2 concentration values.