Gas composition detection method, device, equipment and medium based on spectral analysis
Through the gas composition detection method based on spectral analysis, the shortcomings of traditional methods in real-time monitoring, data processing and abnormal identification are solved, and efficient and accurate gas composition detection and abnormal detection are achieved.
Patent Information
- Application Number
- CN202510092984.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2045-01-21
AI Technical Summary
Traditional gas component detection methods are difficult to achieve real-time monitoring and rapid response, and in the gas storage device, it is difficult to accurately estimate the gas component content due to the aliasing and interference of hyperspectral data. The existing methods lack generalization capabilities when processing high-dimensional and nonlinear data, making it difficult to identify abnormal situations.
The gas component detection method based on spectral analysis is adopted to obtain hyperspectral image data through axial scanning, perform pre-processing and spectral standardization, select characteristic bands, conduct abundance estimation and optimization, and combine sparse component analysis and asymmetric mutual learning algorithm for abnormal detection.
The spatial resolution and spectral quality of gas component detection are significantly improved, the accuracy and robustness of gas component content estimation are enhanced, the ability to identify gas component anomalies is improved, and detailed anomaly detection reports are provided to support operational decisions.
Smart Images

Figure CN119534366B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of spectral analysis, and in particular to a gas composition detection method, device, equipment and medium based on spectral analysis. Background Art
[0002] Traditional gas composition detection methods mainly rely on offline sampling and analysis, which is not only time-consuming and labor-intensive, but also difficult to achieve real-time monitoring and rapid response. With the development of hyperspectral imaging technology, gas composition detection methods based on spectral analysis have gradually attracted attention, but they still face many challenges in practical applications.
[0003] The gas composition in the gas storage device is complex and changeable, and the spectral information has serious aliasing and interference. How to effectively extract characteristic bands from massive hyperspectral data and accurately estimate the content of each gas component is an urgent problem to be solved. Secondly, due to the influence of environmental factors and equipment errors, the acquired hyperspectral data often has noise and distortion, which seriously affects the accuracy and reliability of gas composition detection. In addition, during actual operation, the gas composition of the gas storage device may fluctuate abnormally. How to promptly detect and accurately identify these abnormal conditions is of great significance for preventing safety accidents and optimizing operation strategies. However, when dealing with high-dimensional and nonlinear gas composition data, existing detection methods often have problems such as insufficient generalization ability and low sensitivity to anomalies, which makes it difficult to meet the needs of practical applications. Summary of the invention
[0004] The present application provides a gas composition detection method, device, equipment and medium based on spectral analysis, thereby improving the accuracy of gas composition abnormality detection.
[0005] In a first aspect, the present application provides a gas component detection method based on spectral analysis, and the gas component detection method based on spectral analysis includes:
[0006] Axially scan the gas storage device to obtain hyperspectral image data;
[0007] Preprocessing and spectrally normalizing the hyperspectral image data to obtain preprocessed spectral data;
[0008] Performing band selection on the preprocessed spectral data to obtain a characteristic band;
[0009] Estimating the abundance of the characteristic band to obtain initial gas component content data;
[0010] Optimizing the initial gas component content data to obtain target gas component content data;
[0011] A gas composition abnormality detection is performed on the target gas component content data to obtain a gas composition abnormality detection report.
[0012] The second aspect of the present application provides a gas component detection device based on spectral analysis, and the gas component detection device based on spectral analysis includes:
[0013] A scanning module, used for axially scanning the gas storage device to obtain hyperspectral image data;
[0014] A preprocessing module, used for preprocessing and spectrally normalizing the hyperspectral image data to obtain preprocessed spectral data;
[0015] A selection module, used for performing band selection on the preprocessed spectral data to obtain a characteristic band;
[0016] An estimation module, used for estimating the abundance of the characteristic band to obtain initial gas component content data;
[0017] An optimization module, used for optimizing the initial gas component content data to obtain target gas component content data;
[0018] The detection module is used to perform gas composition anomaly detection on the target gas component content data to obtain a gas composition anomaly detection report.
[0019] The third aspect of the present application provides an electronic device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the electronic device executes the above-mentioned gas composition detection method based on spectral analysis.
[0020] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned gas composition detection method based on spectral analysis.
[0021] Compared with the prior art, the present application has the following beneficial effects: by adopting push-broom hyperspectral imaging technology and multi-step data preprocessing method, the spatial resolution and spectral quality of gas component detection are significantly improved. Based on the weighted fusion method of spectral angle matrix and spectral information divergence matrix, combined with density peak clustering algorithm, adaptive selection of characteristic bands is realized, which effectively reduces the data dimension and improves the computational efficiency. The fully constrained least squares method is used for abundance estimation, and the spectral interference threshold is introduced for correction, which significantly improves the accuracy and robustness of gas component content estimation. By introducing blind source separation technology based on sparse component analysis, the problem of high mixing of gas components is effectively solved, and the estimation results of gas component content are further optimized. The gas component anomaly detection method based on asymmetric mutual learning algorithm can not only accurately identify abnormal gas components, but also adaptively update the detection model, thereby improving the system's ability to recognize new abnormal patterns. By generating a detailed gas component anomaly detection report, including abnormal core component identification and risk level classification, intuitive and actionable decision support information is provided to operators. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0023] The structures, proportions, sizes, etc. illustrated in the drawings of this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with this technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantive technical significance. Any structural modification, change in proportion or adjustment of size, without affecting the effects and purposes that can be achieved by the present invention, should still fall within the scope of the technical contents disclosed by the present invention.
[0024] Figure 1 is a schematic flow chart of a gas component detection method based on spectral analysis provided by an embodiment of the present invention;
[0025] Figure 2 It is a schematic block diagram of the structure of a gas component detection device based on spectral analysis provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0027] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0028] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0029] It should be further understood that the term "and / or" used in the specification and appended claims of this application refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations. Figure 1 In the embodiments of the present application, an embodiment of the gas component detection method based on spectral analysis includes:
[0030] Step 100, axially scanning the gas storage device to obtain hyperspectral image data;
[0031] It is understandable that the execution subject of the present application may be a gas component detection device based on spectral analysis, or a terminal or a server, which is not specifically limited here. The present application embodiment is described by taking the server as the execution subject as an example.
[0032] Specifically, a predetermined scanning path is set for the gas storage device, and the path is arranged along the axial direction of the gas storage device, and the entire scanning path is divided into a number of equidistant scanning lines. The spectral resolution of the push-broom hyperspectral imager is adjusted to 10nm. In the entire spectral range, a spectral data point is recorded for each 10nm wavelength interval to ensure sufficient spectral detail resolution. At the same time, the wavelength range of the push-broom hyperspectral imager is set to 400nm to 2500nm, covering a wide spectral range from visible light to near infrared, which helps to capture the characteristic absorption spectra of different gas molecules, thereby improving the detection capability of multiple gas components. After setting the scanning path and instrument parameters, the push-broom hyperspectral imager moves along the predetermined scanning path. During the movement, data is collected for each predetermined equidistant scanning line in turn. The data collected by each scanning line is spatially aligned, and each spectral pixel point is mapped to its corresponding spatial position to form a two-dimensional data matrix containing spatial position information. The two-dimensional spatial data matrix is associated with the corresponding wavelength information to construct a three-dimensional data cube. The three dimensions of the three-dimensional data cube represent the spatial position of the gas storage device (determined by the scanning line and the scanning path), the spectral wavelength, and the corresponding spectral intensity information. The three-dimensional data cube reflects the spectral feature distribution inside and outside the gas storage device. At the same time, the temperature, pressure and other operating parameters of the gas storage device during the data acquisition process are recorded. Changes in temperature and pressure lead to changes in the state of gas molecules, thereby affecting the spectral absorption characteristics. The three-dimensional data cube is combined with the operating parameter data to construct hyperspectral image data containing spatial, spectral and operating information.
[0033] Step 200, preprocessing and spectral standardization are performed on the hyperspectral image data to obtain preprocessed spectral data;
[0034] Specifically, dark current correction is performed. Dark current is the background noise signal that still exists in the hyperspectral imaging device under lightless conditions, which has a great impact on the accuracy of the hyperspectral data. The collected hyperspectral image data is corrected using the pre-collected dark current image, and the dark current signal is deducted from the original spectral data to obtain the image data after dark current correction. In order to eliminate the spectral intensity fluctuation caused by uneven device response or light source changes, the image data after dark current correction is subjected to whiteboard correction. The corrected image data is subjected to whiteboard correction based on the pre-collected standard whiteboard reflectance data, and the actual measured spectral intensity is compared with the standard whiteboard reflectance to correct the system error of the device, and the spectral reflectance of each pixel is converted into a relative value to eliminate the influence of different measurement conditions on the spectral data, and the image data after whiteboard correction is obtained. In order to remove the stripe noise caused by mechanical movement of the hyperspectral imaging system or light source non-uniformity, the vertical least squares method is used to perform stripe removal processing on the image data after whiteboard correction, which effectively reduces the stripe noise in the hyperspectral image and makes the spectral data smoother and more uniform. After stripe removal processing, the obtained image data is significantly improved both visually and in data. The Savitzky-Golay filtering algorithm is applied to the image data after striping for smoothing. This algorithm can reduce the high-frequency noise in the data while retaining the details of the spectral data. In order to achieve the best smoothing effect, the filter window width is set to 9, and the parameter configuration with a polynomial order of 3 is selected. This configuration can effectively retain the spectral features during the smoothing process without introducing too much spectral distortion, and obtain the smoothed spectral data. The integral value of the smoothed spectral data in the wavelength dimension is calculated, that is, the area under the spectral curve is obtained. The smoothed spectral data is divided by the corresponding integral value so that the integral value of each spectral curve is normalized to 1, eliminating the influence caused by the overall change of spectral intensity (such as concentration difference), and obtaining the standardized spectral data. Outlier detection is performed on the standardized spectral data. The median absolute deviation method is used to identify outliers in the spectral data. By calculating the deviation value between each spectral point and the median of the wavelength interval in which it is located, and comparing the deviation value with the preset threshold, the outliers exceeding the threshold are identified. For these outliers, they are removed or replaced with the mean of adjacent wavelengths to reduce their influence on subsequent analysis, and the spectral data after outlier processing is obtained. The spectral data after outlier processing is subjected to correlation analysis between bands. By calculating the correlation coefficient between each band, redundant bands with too high correlation are identified. The redundant bands are removed to effectively reduce the data dimension and reduce the interference of redundant information on subsequent gas composition analysis, thus obtaining the preprocessed spectral data.
[0035] Step 300, performing band selection on the preprocessed spectral data to obtain a characteristic band;
[0036] It should be noted that the spectral angle is calculated between any two bands in the preprocessed spectral data. The spectral angle is an indicator used to measure the angle between two spectral vectors. The smaller its value, the more similar the spectral characteristics of the two bands are. By calculating the spectral angles between all bands, a spectral angle matrix is constructed, and each element in the matrix represents the spectral angle value between the corresponding bands. Based on the information entropy theory, the spectral information divergence is calculated between any two bands in the preprocessed spectral data. Information divergence is an indicator that measures the difference in the amount of information between two bands, reflecting the distribution characteristics of the spectral information between the bands. Using this indicator, the information difference between each pair of bands is quantified to construct the spectral information divergence matrix. The weight coefficients of the spectral angle matrix and the spectral information divergence matrix are set. The selection of the weight coefficient is based on the needs in the specific application scenario, for example, the weight is determined according to the importance of the spectral similarity and information difference between the bands. After setting the weight coefficient, the spectral angle matrix and the spectral information divergence matrix are weighted and fused to obtain the band similarity matrix. The local density and relative distance of each band in the band similarity matrix are calculated. The local density is the sum of the similarities between the band and its adjacent bands in the similarity matrix, reflecting the concentration of the band. The relative distance indicates the minimum distance between the band and the band with a greater density than itself. By calculating the local density and relative distance, the density-distance distribution map of the band is obtained. In this distribution map, each band corresponds to a density and distance value. Based on this distribution map, the density threshold and distance threshold are set to screen out the bands with higher density and larger relative distance, that is, the density peak point. The density peak point is located in the high-density area of the density-distance distribution map and far away from other bands, which serves as the initial clustering center of the band. The initial clustering center is used to cluster the remaining bands. Each band is assigned to the corresponding cluster according to the similarity with each initial clustering center, and the clustering result of the band is obtained. For each cluster, the average information entropy of all the bands inside it is calculated. The larger the information entropy, the more unique information the band carries. In each cluster, the band with the largest information entropy is selected as the representative band of the cluster to obtain the candidate feature band set. Calculate the correlation coefficient matrix between the bands in the candidate feature band set. The correlation coefficient matrix is used to measure the linear correlation between each pair of bands. Highly correlated bands often carry repeated information. To avoid information redundancy, set a correlation threshold. For the band pairs whose correlation coefficients exceed the set threshold, retain the bands with greater information content, remove the highly correlated redundant bands, and obtain the optimized feature band set. Calculate the target score for each band in the optimized feature band set. The target score comprehensively considers factors such as the band's ability to distinguish, the amount of information, and independence from other bands. According to the target score, sort all bands in descending order, and select the bands with the highest scores as the final feature bands.
[0037] Step 400, estimating the abundance of the characteristic band to obtain initial gas component content data;
[0038] Specifically, standard spectra of pure methane, ethane, propane and carbon dioxide are collected. The standard spectra are collected by hyperspectral imaging equipment under strictly controlled experimental conditions, which can accurately reflect the absorption and reflection characteristics of each gas in a specific spectral band. The standard spectral data are collected to construct an end-member spectral library. In order to eliminate the intensity differences between different gas spectra due to factors such as sampling conditions or equipment response, the spectral data in the end-member spectral library are normalized. Each spectral data is divided by its maximum value or area normalized to make the intensity range of all spectra consistent, and the normalized end-member spectrum is obtained, which effectively avoids the error caused by spectral intensity differences in the abundance estimation process. The spectral data of the characteristic band and the normalized end-member spectrum are simultaneously input into the fully constrained least squares model. This model is a spectral unmixing method that can estimate the abundance value of each gas component in the mixed spectrum under the conditions of satisfying non-negative constraints and the abundance sum being 1. The fully constrained least squares model calculates the initial abundance value of each gas component by minimizing the difference between the actual observed spectrum and the theoretical spectrum composed of the weighted linear combination of the endmember spectra, reflecting the proportion of each gas component in the mixed spectrum, and obtains the preliminary gas component content estimation result. The theoretical mixed spectrum is generated based on the initial abundance value. The theoretical mixed spectrum is a linear combination of the abundance value of each gas component and its corresponding normalized endmember spectrum. The generated theoretical mixed spectrum is compared with the actual observed characteristic band spectrum to calculate the spectral angle and spectral distance between the two. The spectral angle is used to measure the angular difference between the theoretical spectrum and the actual spectrum, while the spectral distance quantifies the distance between the two in the vector space. These two indicators are used to evaluate the degree of fit between the theoretical mixed spectrum and the actual spectrum. In order to improve the accuracy of abundance estimation, a spectral interference threshold is set, and the spectral angle and spectral distance are compared with the preset threshold. If the spectral angle or spectral distance of a certain gas component exceeds the preset threshold, it indicates that the abundance value of the gas component is affected by spectral interference, resulting in abundance estimation deviation. For the interfered gas component, its abundance value is iteratively adjusted. The iterative process uses gradient descent or other optimization algorithms to gradually correct the abundance value of the disturbed gas, recalculate the spectral angle and spectral distance until it meets the set threshold requirement or reaches the preset maximum number of iterations, and obtain the corrected abundance value. According to the corrected abundance value, the content percentage of each gas component is calculated. The percentage data constitutes the original gas component content data. The original gas component content data is normalized to avoid numerical deviations caused by calculation errors or rounding errors, and the initial gas component content data is obtained.
[0039] Step 500, optimizing the initial gas component content data to obtain target gas component content data;
[0040] Specifically, the initial gas component content data is constructed as a mixing matrix. The rows and columns of the mixing matrix represent different gas components and characteristic bands, respectively, and its element values are the initial abundance values of each gas component in the corresponding band. The sparsity analysis of the mixing matrix is performed, and the sparsity of the matrix is judged by measuring the proportion of zero or close-to-zero elements in the matrix. Most elements in the sparse matrix are zero or close to zero. Sparse representation helps to highlight the main characteristics of the gas components, reduce redundant information, and obtain a sparse representation matrix. Based on the sparse representation matrix, the orthogonal matching pursuit algorithm is used to decompose the mixing matrix. Orthogonal matching pursuit is a greedy algorithm for sparse signal reconstruction, which can gradually select the most representative endmember spectra from high-dimensional data to achieve matrix decomposition. Through this algorithm, the mixing matrix is decomposed into an initial endmember matrix and an initial abundance matrix. Each column in the initial endmember matrix represents the endmember spectral characteristics of a gas component, while each column in the initial abundance matrix represents the abundance distribution of the gas component in each characteristic band. The endmember spectrum of the initial endmember matrix is updated. Based on the existing endmember spectra, corrections are made according to the actual observation data to better match the characteristics of the mixed spectrum. Through the iterative optimization algorithm, each endmember spectrum in the initial endmember matrix is corrected to obtain the updated endmember matrix. On this basis, the initial abundance matrix is optimized by the multiplier alternating direction method. The multiplier alternating direction method can minimize the objective function under constraints. The optimization process aims to use the updated endmember matrix to correct the element values in the initial abundance matrix so that the abundance matrix can better reflect the distribution of gas components in the actual spectral data. After the optimization steps, the optimized abundance matrix has higher accuracy and robustness. The optimized abundance matrix is optimized for sparsity. Under the premise of ensuring that the abundance matrix can accurately express the content of gas components, unnecessary non-zero elements in the matrix are reduced. By applying the L1 norm constraint, that is, by penalizing the number of non-zero elements in the abundance matrix, the abundance matrix is kept sparse as much as possible, and a sparse abundance matrix is obtained. According to the spatial distribution characteristics of the sparse abundance matrix, a spatial correlation constraint function is constructed. The spatial correlation constraint function can optimize the spatial distribution of gas components in combination with the spatial distribution characteristics of spectral data. This constraint helps to eliminate spatial discontinuities or unreasonable abundance changes caused by noise or other factors, thereby introducing smoothness and consistency in the spatial distribution of the abundance matrix. Through spatial constraint optimization, the spatially optimized abundance matrix is obtained. The content percentage of each gas component is calculated using the spatially optimized abundance matrix. The optimized gas component content data is normalized to ensure that the sum of the content percentages of all gas components is equal to 100%, thereby avoiding the problem of total inconsistency caused by numerical errors or calculation deviations. The target gas component content data is obtained.
[0041] Step 600: Perform gas composition anomaly detection on target gas component content data to obtain a gas composition anomaly detection report.
[0042] Specifically, two deep learning models are constructed, the first model is used for normal gas composition pattern recognition, and the second model is used for abnormal gas composition detection. A large amount of historical normal gas composition data is used to train the first model. The historical data can reflect the concentration distribution and fluctuation range of different gas components under normal conditions. Through the training of the deep learning model, the model learns to identify the gas component combination and content characteristics under various normal conditions, and obtains a normal pattern recognition model that can accurately identify the normal gas composition pattern. The target gas component content data is input into the second model to initialize the model. The abnormal detection model can establish a preliminary understanding of the current gas component state and obtain an initial abnormal detection model. The target gas component content data is input into the trained normal pattern recognition model, and the normality score of each sample is obtained through model calculation. The normality score is an indicator to measure the degree of matching between the current sample and the normal pattern. The higher the score, the closer the sample is to the normal pattern. The normality score is judged based on the set threshold, and the samples with scores lower than the threshold are identified as potential abnormal samples, and a potential abnormal sample set is constructed. The potential abnormal samples are input into the initial abnormal detection model for analysis to obtain preliminary abnormal detection results. The anomaly detection model can identify which gas components have concentration combinations or change trends that are significantly different from the normal mode by extracting features and recognizing patterns on the potential anomaly sample set. Based on the preliminary detection results, the second model, the anomaly detection model, is updated. The update process continuously introduces new samples and adjusts model parameters so that the model can better adapt to the distribution characteristics of the current gas composition data, thereby obtaining an optimized anomaly detection model. The optimized anomaly detection model is applied to the entire target gas component content data set, and a comprehensive scan is performed to obtain the anomaly probability distribution of each sample. The anomaly probability distribution reflects the possibility of each sample being judged as abnormal. The higher the anomaly probability, the less the gas component combination of the sample conforms to the normal mode. Based on the anomaly probability distribution, an anomaly judgment threshold is set to divide the gas component samples into a normal sample set and an abnormal sample set. The selection of the threshold needs to be combined with the specific application scenario and fault tolerance requirements. A too high threshold leads to missed anomalies, while a too low threshold leads to false positives. Therefore, it is necessary to balance different requirements to determine the optimal threshold. For each sample in the identified abnormal sample set, a feature contribution analysis is performed to identify the core gas component that causes the sample to be judged as abnormal. This analysis process uses a gradient-based feature importance analysis method to calculate the contribution of each gas component concentration change to the anomaly score, thereby identifying the gas component that has the greatest impact on the anomaly determination. The abnormal samples are divided into risk levels based on the degree of abnormality of the core gas components and the historical data distribution. The risk level division determines the severity of the anomaly based on the degree of deviation of the gas components and the statistical characteristics of the historical abnormal data, and assigns a risk level, such as low risk, medium risk, or high risk, to each abnormal sample.All abnormal detection results are summarized to generate a gas composition abnormality detection report. The report includes the identification results and risk level of the abnormal samples, and a detailed description of the core gas composition and abnormality degree of each abnormal sample.
[0043] In the embodiment of the present application, by adopting push-broom hyperspectral imaging technology and multi-step data preprocessing methods, the spatial resolution and spectral quality of gas component detection are significantly improved. Based on the weighted fusion method of spectral angle matrix and spectral information divergence matrix, combined with the density peak clustering algorithm, the adaptive selection of characteristic bands is realized, which effectively reduces the data dimension and improves the calculation efficiency. The fully constrained least squares method is used for abundance estimation, and the spectral interference threshold is introduced for correction, which significantly improves the accuracy and robustness of gas component content estimation. By introducing the blind source separation technology based on sparse component analysis, the problem of high mixing of gas components is effectively solved, and the estimation results of gas component content are further optimized. The gas component anomaly detection method based on asymmetric mutual learning algorithm can not only accurately identify abnormal gas components, but also adaptively update the detection model, which improves the system's recognition ability of new abnormal patterns. By generating a detailed gas component anomaly detection report, including abnormal core component identification and risk level classification, intuitive and actionable decision support information is provided to operators.
[0044] In a specific embodiment, the process of executing step 100 may specifically include the following steps:
[0045] Setting a scanning path for the gas storage device, dividing the scanning path into a number of equally spaced scanning lines, adjusting the spectral resolution of the push-broom hyperspectral imager to 10 nm, and setting the wavelength range of the push-broom hyperspectral imager to 400 nm to 2500 nm;
[0046] Move the push-broom hyperspectral imager along the scanning path, collect data for each scanning line, and perform spatial registration on the data collected from each scanning line to form a two-dimensional spatial data matrix;
[0047] The two-dimensional spatial data matrix is associated with the corresponding wavelength information to construct a three-dimensional data cube, and the operating parameter data of the temperature and pressure of the gas storage device are recorded;
[0048] The three-dimensional data cube is combined with the operating condition parameter data to obtain hyperspectral image data containing spatial, spectral and operating condition information.
[0049] Specifically, a reasonable scanning path is set for the surface of the gas storage device to ensure that the scanning path can cover every part of the surface of the gas storage device and that the collected data has sufficient spatial resolution. Assume that the surface of the gas storage device is unfolded into a two-dimensional plane and divided into a number of equidistant scanning lines. Assume that the surface of the gas storage device is unfolded into a rectangular area with a length of , the width is The scanning path is divided into scan lines, and the interval between each scan line is , expressed as:
[0050] ;
[0051] in, Indicates the spacing between each scan line, is the total number of scan lines, is the total length of the surface of the gas storage device in the width direction. Adjust the parameters of the push-broom hyperspectral imager. The push-broom hyperspectral imager is a device that obtains two-dimensional spatial and spectral information by combining spectral splitting and push-broom motion. In order to capture the subtle spectral characteristics of the gas components, the spectral resolution of the imager is set to 10nm, and every 10nm wavelength interval in the entire spectral range will be sampled and recorded. The spectral resolution is set to 10nm, and the wavelength range is 2500nm-400nm, that is, 2100nm. At least 210 spectral channels are required to cover the entire wavelength range. The wavelength range of the imager is set to 400nm to 2500nm, covering a wide spectral range from visible light to near-infrared, so as to capture the characteristic absorption spectra of a variety of gas molecules. Move the hyperspectral imager along the set scanning path and collect data for each scan line. During the data collection process, the imager simultaneously obtains the spatial position and spectral information of each pixel. Assume that in one scan process, the imager collects pixels, of which Indicates the number of pixels on each scan line. is the number of scan lines. Get a The two-dimensional spatial data matrix of pixels is expressed as:
[0052] ;
[0053] in, Indicates Scan lines, The spectral data at each pixel point. The data collected by each scan line is spatially registered. The actual collected data is accurately aligned with the preset spatial coordinates to ensure that the spectral data of each pixel point corresponds to its actual position. After completing the spatial registration, the two-dimensional spatial data matrix is associated with the corresponding wavelength information to construct a three-dimensional data cube. The three-dimensional data cube is represented as:
[0054] ;
[0055] in, Indicated in Scan lines, Pixels, wavelength The spectral intensity value at is the number of spectral channels. The three-dimensional data cube records the spectral information at each position on the surface of the gas storage device and retains its spectral variation characteristics at different wavelengths. While collecting data, the operating parameters of the gas storage device such as temperature and pressure are recorded. These operating parameters are closely related to the spectral characteristics of the gas and significantly affect the absorption spectrum of the gas. Set a working parameter matrix to be expressed as:
[0056] ;
[0057] in, Indicates The temperature at the scan line, Indicates The pressure at the scan line. And the working condition parameter matrix By combining the spatial, spectral and working condition information, we can obtain hyperspectral image data. The data containing multi-dimensional information is represented as:
[0058] ;
[0059] in, Indicated in Scan lines, Pixels, wavelength Working parameters It is the combined data of temperature or pressure.
[0060] In a specific embodiment, the process of executing step 200 may specifically include the following steps:
[0061] Performing dark current correction on the hyperspectral image data using a pre-collected dark current image to obtain dark current corrected image data, and performing white board correction on the dark current corrected image data based on standard white board reflectivity data to obtain white board corrected image data;
[0062] The vertical least square method is used to remove the streaks from the image data after whiteboard correction to obtain the image data after streaking. The Savitzky-Golay filtering algorithm is applied to the image data after streaking, and the filter window width is set to 9 and the polynomial order is set to 3. The spectrum is smoothed to obtain the smoothed spectrum data.
[0063] Calculate the integral value of the smoothed spectral data in the wavelength dimension to obtain the area under the spectral curve, and divide the smoothed spectral data by the area under the spectral curve to perform area normalization processing to obtain standardized spectral data;
[0064] The standardized spectral data are subjected to outlier detection, and the median absolute deviation method is used to identify and remove spectral outliers to obtain the spectral data after outlier processing. The inter-band correlation analysis of the spectral data after outlier processing is performed to remove redundant bands to obtain the preprocessed spectral data.
[0065] Specifically, the dark current image data collected by the hyperspectral imaging system under lightless conditions is processed. Dark current is a signal generated by the thermal noise or electronic noise of the hyperspectral imaging sensor itself when there is no external light signal input, which will cause offset and error to the actual collected spectral data. Before processing the spectral data, it is corrected. Set the dark current image to ,in and represent the rows and columns of the image respectively, Represents a spectral band. For each spectral band , the dark current image reflects the background noise generated by the sensor itself in this band. The original hyperspectral image data is represented as , then the image data after dark current correction Calculated by the following formula:
[0066] ;
[0067] In the above formula, Represents the corrected spectral data, in which the influence of dark current is removed. Through the correction step, the bias noise caused by dark current is effectively eliminated, making the spectral data of each pixel more accurate. In order to eliminate the spectral intensity fluctuation caused by changes in imaging equipment and ambient lighting conditions, whiteboard correction is performed on the image data after dark current correction. Whiteboard correction uses a standard whiteboard with known reflectivity as a reference, and its spectral reflectivity is used as a correction coefficient to correct the spectral data of other samples. Assume that the standard whiteboard is in the band The reflectivity at , and the spectral data of the standard white plate collected is , then the image data after whiteboard correction Calculated by the following formula:
[0068] ;
[0069] In the above formula, Represents the image data after whiteboard correction. Through the correction steps, the influence of uneven device response and ambient light changes on the spectral data is eliminated, so that the spectral reflectance of each pixel is more accurate after comparison with the reflectance of the standard whiteboard. The image data is processed by the least squares method in the vertical direction to remove stripes. Assume that the image data after whiteboard correction is expressed as , then stripes are removed by:
[0070] ;
[0071] in, It represents the trend term obtained by the least squares fitting in the vertical direction, reflecting the distribution of stripe noise. By removing the trend term, we can get the image data after stripe removal. , significantly reducing the interference of streak noise on spectral analysis. The Savitzky-Golay filtering algorithm is applied to the image data after striping for spectral smoothing. This filtering algorithm smoothes the spectral data by fitting a polynomial to the data within a sliding window, reducing the influence of high-frequency noise on spectral characteristics. Assuming the filter window width is , the polynomial order is , then each band Smoothed data at It is expressed as:
[0072]
[0073] in, is the coefficient of the Savitzky-Golay filter, which is calculated by minimizing the polynomial fitting error. Through smoothing, the influence of noise is effectively reduced, making the spectral curve smoother and more coherent. In order to eliminate the spectral intensity changes caused by concentration differences or other factors, the smoothed spectral data is area normalized. The integral value of each spectral curve is normalized to 1 to facilitate comparison between different spectra. Assume that the integral value of the smoothed spectral data in the wavelength dimension is , expressed as:
[0074] ;
[0075] in, Indicates Line The area under the spectral curve of the column pixel, is the interval between spectral bands. Divide each spectral data by its integral value , and obtain the standardized spectral data:
[0076] ;
[0077] Through area normalization, the overall change of spectral intensity is eliminated, so that different spectral data can be directly compared. Outlier detection is performed on the standardized spectral data. The median absolute deviation method is used to identify and remove spectral outliers. The spectral data at , then the median and absolute deviation MAD It is expressed as:
[0078] ;
[0079] When the deviation of a spectral point from the median exceeds a certain threshold, it is considered an outlier and removed. The spectral data after outlier processing is subjected to inter-band correlation analysis. The correlation coefficient matrix between each band is calculated. , remove redundant bands. Combining the processing steps, the final pre-processed spectral data is obtained for subsequent gas composition analysis and detection.
[0080] In a specific embodiment, the process of executing step 300 may specifically include the following steps:
[0081] The spectral angle between any two bands in the preprocessed spectral data is calculated to construct a spectral angle matrix, and based on the information entropy theory, the spectral information divergence between any two bands in the preprocessed spectral data is calculated to construct a spectral information divergence matrix;
[0082] The weight coefficients of the spectral angle matrix and the spectral information dispersion matrix are set, and the spectral angle matrix and the spectral information dispersion matrix are weightedly fused to obtain the band similarity matrix;
[0083] The local density and relative distance of each band are calculated for the band similarity matrix to obtain the density-distance distribution of the band. Based on the density-distance distribution, the density threshold and distance threshold are set to identify the density peak point and obtain the initial cluster center.
[0084] The initial cluster center is used to cluster the remaining bands to obtain the band clustering results, and the average information entropy of the bands in each cluster is calculated. The band with the largest information entropy is selected as the representative band of the cluster to obtain the candidate feature band set.
[0085] Calculate the correlation coefficient matrix between the bands in the candidate feature band set, set the correlation threshold, remove the highly correlated redundant bands, and obtain the optimized feature band set;
[0086] The target score is calculated for each band in the optimized feature band set, and the bands are sorted in descending order according to the target score, and several bands with the highest scores are selected as feature bands.
[0087] Specifically, we define and calculate the spectral angle to measure the similarity between two spectral vectors. Assume that the preprocessed spectral data is a three-dimensional matrix ,in represents the row index of the spectral data, Represents the column index, Indicates the band index. In order to calculate any two bands and The spectral angle between the two bands is represented as vectors and The spectral angle is calculated by the following formula:
[0088] ;
[0089] in, For band and band Spectral angle between represents the dot product of two bands, and Represent the Euclidean norm of the two bands respectively. The smaller the spectral angle, the higher the spectral similarity between the two bands. By calculating the spectral angles between all bands, the spectral angle matrix is constructed. , where the matrix elements Indicates band and The spectral angle between the two bands. While calculating the spectral angle, the spectral information divergence is calculated based on the information entropy theory. Information divergence is used to measure the difference between two spectral distributions. and , the calculation formula of information divergence is:
[0090] ;
[0091] in, Indicates band and The spectral information divergence between and Respectively expressed in Pixels, band and band The probability distribution of is calculated by normalizing the spectral data into probability form. The smaller the information divergence value, the more similar the information distribution between the two bands. By calculating the spectral information divergence between all bands, a spectral information divergence matrix is constructed. , where the matrix elements Indicates band and The spectral information divergence between . Set the weight coefficients of the spectral angle matrix and the spectral information divergence matrix, denoted as and The weight coefficient is set taking into account the importance of spectral similarity and information distribution differences in specific applications. The spectral angle matrix and the spectral information divergence matrix are weighted and fused to obtain the band similarity matrix , and its calculation formula is:
[0092] ;
[0093] in, Indicates the fused band and The similarity between and Represent the weight coefficients of spectral angle and spectral information divergence respectively. The band similarity matrix comprehensively considers the differences in spectral similarity and information distribution, providing a basis for subsequent band selection. The band similarity matrix calculates the local density and relative distance of each band. Local density It refers to the band The sum of similarities with its adjacent bands in the band similarity matrix is calculated as:
[0094] ;
[0095] in, Indicates band The local density of is the set distance threshold, indicating the distance between Similarity is less than The number of bands. Relative distance It indicates the band The minimum distance to a band with a greater density than it, calculated as:
[0096] ;
[0097] in, Indicates band The minimum distance to the band with greater density than it. By calculating the local density and relative distance of each band, the density-distance distribution of the band is obtained. Based on the density-distance distribution, the density threshold and distance threshold are set, the density peak points are identified, and the initial clustering centers are obtained. The density peak points are bands with higher density and larger relative distances. These bands represent significant features in the data set. The initial clustering centers are used to cluster the remaining bands. Each band is assigned to the corresponding cluster according to its similarity with each clustering center to obtain the band clustering results. For each cluster, the average information entropy of the bands within the cluster is calculated. The larger the information entropy, the more information the band carries. The band with the largest information entropy is selected as the representative band of the cluster to obtain the candidate feature band set. The correlation coefficient matrix between the bands in the candidate feature band set is calculated. , whose elements Indicates candidate bands and The correlation coefficient between . Set the correlation threshold For the band pairs whose correlation coefficient exceeds the threshold, the bands with greater information content are retained, and the highly correlated redundant bands are removed to obtain the optimized feature band set. The target score is calculated for each band in the optimized feature band set. , whose target score comprehensively considers the discrimination ability, information content and independence of the band. The calculation of the target score is expressed as:
[0098] ;
[0099] in, For band The goal score, is the standard deviation of the band, indicating the degree of fluctuation of its spectral changes; Information entropy represents the amount of information in the band; To ensure independence from other bands, the bands are sorted in descending order according to the target scores, and the bands with the highest scores are selected as the final feature bands.
[0100] In a specific embodiment, the process of executing step 400 may specifically include the following steps:
[0101] Collect standard spectra of pure methane, ethane, propane and carbon dioxide, build an endmember spectrum library, and normalize the spectrum data in the endmember spectrum library to obtain normalized endmember spectra;
[0102] The spectral data of the characteristic band and the normalized endmember spectrum are input into the fully constrained least squares model to calculate the initial abundance value;
[0103] Based on the initial abundance value, a theoretical mixed spectrum is generated, and the spectral angle and spectral distance between the theoretical mixed spectrum and the actual characteristic band spectrum are calculated;
[0104] Set the spectral interference threshold, compare the spectral angle and spectral distance with the preset threshold, identify the interfered gas component, and iteratively adjust the abundance value of the interfered gas component, recalculate the spectral angle and spectral distance until the threshold requirement is met or the maximum number of iterations is reached, and obtain the corrected abundance value;
[0105] According to the corrected abundance value, the content percentage of each gas component is calculated to obtain the original gas component content data, and the original gas component content data is normalized to ensure that the sum of the content of each component is equal to 100%, so as to obtain the initial gas component content data.
[0106] Specifically, standard spectra of pure methane, ethane, propane and carbon dioxide are collected to construct an endmember spectral library. The endmember spectral library is a collection of standard spectra used to characterize various pure gas molecules, which can provide a reference for subsequent abundance estimation. The standard spectrum is set as and ,in Represents the spectral band index. These spectra reflect the characteristic absorption and reflection behavior of each gas at different wavelengths. The spectral data in the endmember spectral library are normalized to ensure that the intensity range of each spectrum is consistent, so as to facilitate comparison with the actual observed spectrum. The normalization process uses the method of dividing each spectral curve by its maximum value or integral value. Assume that the normalized spectrum is expressed as , , and The normalized formula is:
[0107] ;
[0108] in, represents the normalized gas The spectrum of is the maximum value of the gas spectrum curve. Through normalization processing, a relatively consistent standard endmember spectrum is obtained. The normalized endmember spectrum and the actually observed characteristic band spectrum are input into the fully constrained least squares model to estimate the abundance value of each gas component. The fully constrained least squares method is a spectral unmixing algorithm. Its goal is to minimize the error between the observed spectrum and the theoretical mixed spectrum under the conditions of satisfying the non-negative constraint (the abundance value cannot be negative) and the abundance sum being 1. Suppose the actually observed characteristic band spectrum is , the abundance value is , then the goal of the fully constrained least squares model is to solve the following optimization problem:
[0109] ;
[0110] in, Indicates gas For gas The solution to the optimization problem is the initial abundance value , that is, the relative proportion of each gas component in the mixed spectrum. Generate a theoretical mixed spectrum based on the initial abundance value. The theoretical mixed spectrum is obtained by linear combination of the abundance value of each gas component and its corresponding end member spectrum, and the formula is:
[0111] ;
[0112] in, represents the theoretical mixed spectrum, which should be compared with the actual observed spectrum As close as possible. Calculate the spectral angle and spectral distance between the theoretical mixed spectrum and the actual observed spectrum to evaluate the matching degree between the theoretical spectrum and the actual spectrum. The calculation formula of the spectral angle is similar to the above:
[0113] ;
[0114] in, It represents the spectral angle between the theoretical mixed spectrum and the actual observed spectrum. The smaller the angle, the higher the similarity between the two. At the same time, the spectral distance is used to measure the distance between the two in the vector space. The formula is:
[0115] ;
[0116] By calculating the spectral angle and spectral distance , judge the difference between the theoretical spectrum and the actual spectrum. If the spectral angle or spectral distance exceeds the set spectral interference threshold or , it indicates that the abundance value of a certain gas component is disturbed. In order to correct the abundance value of the disturbed gas component, it is iteratively adjusted. The abundance value is gradually adjusted through an optimization algorithm (such as the gradient descent method), and the spectral angle and spectral distance are recalculated until the spectral interference threshold requirement is met or the maximum number of iterations is reached. The formula is expressed as:
[0117] ;
[0118] in, is the learning rate, represents the number of iterations, is the abundance value after one update. Through multiple iterations, the abundance value is gradually optimized so that the difference between the theoretical mixed spectrum and the actual observed spectrum is reduced. After obtaining the corrected abundance value, the content percentage of each gas component is calculated. The calculation of the content percentage is based on the constraint that the sum of the abundance values of each gas is 1, and the formula is:
[0119] ;
[0120] in, Indicates gas The percentage of content, For gas The abundance value of each gas component is obtained through the calculation steps to form the original gas component content data. In order to ensure that the sum of the content of each component is equal to 100%, the original gas component content data is normalized. The normalization formula is as follows:
[0121] ;
[0122] Through the normalization step, the final initial gas component content data is obtained to ensure that the sum of the content percentages of all components is 100%, reflecting the relative contents of gas components such as methane, ethane, propane and carbon dioxide in the gas storage device.
[0123] In a specific embodiment, the process of executing step 500 may specifically include the following steps:
[0124] The initial gas component content data is constructed as a mixing matrix, and the sparsity analysis of the mixing matrix is performed to obtain a sparse representation matrix;
[0125] Based on the sparse representation matrix, the orthogonal matching pursuit algorithm is used to decompose the mixing matrix to obtain the initial end member matrix and the initial abundance matrix.
[0126] The endmember spectrum of the initial endmember matrix is updated to obtain an updated endmember matrix, and based on the updated endmember matrix, the initial abundance matrix is optimized by using the multiplier alternating direction method to obtain an optimized abundance matrix;
[0127] The optimized abundance matrix is optimized for sparsity to obtain a sparse abundance matrix, and according to the spatial distribution characteristics of the sparse abundance matrix, a spatial correlation constraint function is constructed to optimize the sparse abundance matrix with spatial constraints to obtain a spatially optimized abundance matrix;
[0128] The spatially optimized abundance matrix is used to calculate the content percentage of each gas component to obtain the optimized gas component content data, and the optimized gas component content data is normalized to ensure that the sum of the content of each component is equal to 100%, thereby obtaining the target gas component content data.
[0129] Specifically, all initial gas component content data are organized into a matrix form. Assume that samples, each containing The preliminary content data of the gas components are expressed as a The mixing matrix , where the matrix elements Indicates In the sample The content of gas components.
[0130] ;
[0131] in, Represents each element in the initial gas composition content data. For example, if the contents of methane, ethane, propane, and carbon dioxide in a sample are 0.4, 0.3, 0.2, and 0.1, respectively, then this row of data is represented as [0.4, 0.3, 0.2, 0.1]. Perform sparsity analysis to find out which components in the data are close to zero in most samples, that is, the parts where most elements are zero or close to zero. This is achieved by solving the following sparse representation model:
[0132] ;
[0133] in, is a dictionary matrix, representing a set of basis vectors; is a sparse representation matrix, is the sparsity control parameter, express norm, which represents the sum of the absolute values of the non-zero elements in the matrix. By minimizing the above objective function, while ensuring the reconstruction error ( ) is small, maximizing the sparse representation matrix The non-zero elements in are the least, and the sparse representation matrix is obtained . The orthogonal matching pursuit algorithm is used to solve the mixing matrix Decompose. The orthogonal matching pursuit algorithm is a greedy algorithm that iteratively selects the endmember spectrum most relevant to the current residual, adds it to the initial endmember matrix, and calculates the corresponding abundance matrix. Assume that the mixing matrix is represented by the endmember matrix and abundance matrix The product of:
[0134] ;
[0135] in, is the initial endmember matrix, is the initial abundance matrix, is the number of end members. The orthogonal matching pursuit algorithm updates and to minimize the mixing matrix Instead of reconstructing the matrix After this process, the initial end member matrix and abundance matrix are obtained. Update the endmember spectrum. Slightly adjust the endmember spectrum based on the actual observation data to better match the mixed spectral characteristics. The endmember spectrum update is achieved through the following formula:
[0136] ;
[0137] in, represents the updated endmember matrix, is the learning rate, represents the residual matrix, is the transpose of the abundance matrix. The updated endmember matrix better reflects the actual composition of the mixed spectrum. Based on the updated endmember matrix, the multiplier alternating direction method is used to optimize the initial abundance matrix, which maintains good convergence while decomposing complex optimization problems. The goal of the multiplier alternating direction method is to make the optimization result more accurate by decomposing the original problem into several sub-problems and optimizing each sub-problem alternately. For the optimization of the abundance matrix, it is decomposed into the following sub-problems: the endmember matrix is fixed, and the abundance matrix is optimized.
[0138] ;
[0139] Abundance matrix fixed, endmember matrix optimized
[0140] ;
[0141] By alternately optimizing these two sub-problems, the multiplier alternating direction method can gradually reduce the reconstruction error and obtain the optimized abundance matrix The optimized abundance matrix is optimized for sparsity to ensure that the number of non-zero elements in the abundance matrix is as small as possible, which is achieved through the following formula:
[0142] ;
[0143] in, Represents the sparse abundance matrix. By maximizing sparsity while keeping the abundance matrix close to the optimization result, a more concise abundance matrix is obtained. According to the spatial distribution characteristics of the sparse abundance matrix, a spatial correlation constraint function is constructed and spatial constraint optimization is performed on it. The spatial correlation constraint function is used to represent the smoothness and consistency of the abundance matrix in space, which is expressed as:
[0144] ;
[0145] in, is the spatial correlation constraint function, and They represent the number of and The abundance value of each sample, is the weight coefficient between adjacent samples. By minimizing this constraint function, we can obtain the spatially optimized abundance matrix The abundance matrix after spatial optimization is used to calculate the content percentage of each gas component. The formula is as follows:
[0146] ;
[0147] in, Indicates The percentage of gas components, Indicates In the sample In order to ensure that the sum of the content of each component is equal to 100%, the content percentage is normalized to finally obtain the target gas component content data.
[0148] In a specific embodiment, the process of executing step 600 may specifically include the following steps:
[0149] Two deep learning models are constructed, the first model is used for normal gas composition pattern recognition, and the second model is used for abnormal gas composition detection. The first model is trained with historical normal gas composition data to obtain a normal pattern recognition model.
[0150] Initializing the second model using target gas component content data to obtain an initial anomaly detection model;
[0151] Input the target gas component content data into the normal pattern recognition model to obtain a normality score, and judge the normality score based on a preset threshold to divide the potential abnormal sample set;
[0152] Applying the initial anomaly detection model to the potential anomaly sample set to obtain an anomaly detection result, and updating the second model based on the anomaly detection result to obtain an optimized anomaly detection model;
[0153] The optimized anomaly detection model is used to comprehensively scan the target gas component content data to obtain the anomaly probability distribution. Based on the anomaly probability distribution, the anomaly judgment threshold is set to classify the gas components to obtain a normal sample set and an abnormal sample set.
[0154] Perform feature contribution analysis on each sample in the abnormal sample set to identify the core gas components that cause the anomaly. Based on the degree of abnormality of the core gas components and the historical data distribution, classify the abnormal samples into risk levels and generate a gas composition anomaly detection report.
[0155] Specifically, two deep learning models are constructed, the first of which is used for normal gas composition pattern recognition, and the second model is used for abnormal gas composition detection. The first model is a classification model that recognizes and learns the distribution characteristics of historical normal gas composition data to form a normal gas composition pattern. The normal gas composition dataset is set to ,in represents the number of samples, Indicates the type and characteristics of gas components. Each sample Represents the gas component content under normal conditions. The first model is trained using historical normal data, and the cross entropy loss function is used to minimize the error between the predicted result and the true label. The cross entropy loss function is expressed as:
[0156] ;
[0157] in, is the loss function, It is a sample The true label indicates whether the sample is a normal mode (1 is normal, 0 is abnormal). is the predicted output of the model. Through the training process, the model can learn and recognize the characteristic patterns of normal gas components, and obtain a trained normal pattern recognition model After building and training the normal pattern recognition model, the second model for anomaly detection is initialized. Assume that the target gas component content data is ,in Represents the number of target data samples. The target gas component content data is input into the anomaly detection model for initialization. The loss function of the initial model uses the mean absolute error to measure the difference between the model prediction value and the actual target data. Its loss function is expressed as:
[0158] ;
[0159] in, is the loss function of the initial model, Indicates The actual gas composition content of the target sample, is the gas component content value predicted by the model. Through initialization training, the initial anomaly detection model is obtained . The target gas component content data Input to the trained normal pattern recognition model In the example, the model will output the normality score of each sample. The normality score is obtained through the model's softmax output layer and its calculation formula is:
[0160] ;
[0161] in, Indicates The normality score of the samples, It is The activation value of a sample in the normal pattern recognition model, Indicates the number of categories (here 2, normal and abnormal). Based on a preset normality score threshold , identify samples with normality scores below the threshold as potential abnormal samples, and construct a potential abnormal sample set . The potential abnormal sample set Input to the initial anomaly detection model In , the model outputs the anomaly detection result of each sample. The anomaly detection result is expressed as the anomaly probability of the sample , and its calculation formula is:
[0162] ;
[0163] in, Indicates The probability of abnormality of a sample is For the anomaly detection model Based on the anomaly detection results, the second model Update and optimize the model's anomaly detection capabilities. Use the optimized anomaly detection model For all target gas component content data Perform a comprehensive scan to obtain the abnormal probability distribution of each sample. Assume that the abnormal probability values of all samples are collected as a vector , according to the abnormal probability distribution, set the abnormality judgment threshold For abnormal probability greater than The samples are judged as abnormal sample sets , the rest of the samples are divided into normal sample sets Perform feature contribution analysis on each sample in the abnormal sample set to identify the core gas component that causes the anomaly. Assume that the feature vector of the abnormal sample is , the contribution of each gas component feature is calculated by back propagating the gradient of the model , and its calculation formula is:
[0164] ;
[0165] in, Indicates Among the abnormal samples The contribution of each gas component to the probability of abnormality. The higher the contribution, the more likely the gas component is to be the core factor causing the abnormality. According to the abnormal degree of the core gas component and the historical data distribution, the abnormal samples are divided into risk levels. By setting different contribution thresholds, the abnormal samples are divided into different risk levels. A gas component abnormality detection report is generated based on all abnormal detection results. The report includes the contribution of the specific gas component of each abnormal sample, the risk level, and the recommended treatment measures.
[0166] The above describes the gas component detection method based on spectral analysis in the embodiment of the present application. The following describes the gas component detection device 10 based on spectral analysis in the embodiment of the present application. Figure 2 In the embodiment of the present application, a gas component detection device 10 based on spectral analysis comprises:
[0167] A scanning module 11 is used to perform axial scanning on the gas storage device to obtain hyperspectral image data;
[0168] A preprocessing module 12 is used to preprocess and spectrally standardize the hyperspectral image data to obtain preprocessed spectral data;
[0169] A selection module 13, used for performing band selection on the preprocessed spectral data to obtain a characteristic band;
[0170] An estimation module 14 is used to estimate the abundance of the characteristic band to obtain initial gas component content data;
[0171] The optimization module 15 is used to optimize the initial gas component content data to obtain the target gas component content data;
[0172] The detection module 16 is used to perform gas component anomaly detection on the target gas component content data to obtain a gas component anomaly detection report.
[0173] Through the synergy of the above components, the push-broom hyperspectral imaging technology and multi-step data preprocessing methods have significantly improved the spatial resolution and spectral quality of gas component detection. The weighted fusion method based on the spectral angle matrix and the spectral information divergence matrix, combined with the density peak clustering algorithm, has realized the adaptive selection of characteristic bands, effectively reduced the data dimension, and improved the computational efficiency. The fully constrained least squares method is used for abundance estimation, and the spectral interference threshold is introduced for correction, which significantly improves the accuracy and robustness of gas component content estimation. By introducing the blind source separation technology based on sparse component analysis, the problem of high mixing of gas components is effectively solved, and the estimation results of gas component content are further optimized. The gas composition anomaly detection method based on the asymmetric mutual learning algorithm can not only accurately identify abnormal gas components, but also adaptively update the detection model, improving the system's ability to recognize new abnormal patterns. By generating a detailed gas composition anomaly detection report, including abnormal core component identification and risk level classification, it provides intuitive and actionable decision support information for operators.
[0174] The present application also provides an electronic device, which includes a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the steps of the gas composition detection method based on spectral analysis in the above-mentioned embodiments.
[0175] The present application also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein instructions are stored in the computer, and when the instructions are executed on a computer, the computer executes the steps of the gas composition detection method based on spectral analysis.
[0176] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0177] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable an electronic device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0178] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A gas component detection method based on spectral analysis, characterized in that: The method comprises: Axially scan the gas storage device to obtain hyperspectral image data; Preprocessing and spectrally normalizing the hyperspectral image data to obtain preprocessed spectral data; Performing band selection on the preprocessed spectral data to obtain a characteristic band; The abundance of the characteristic band is estimated to obtain initial gas component content data; specifically, the method includes: collecting standard spectra of pure methane, ethane, propane and carbon dioxide, constructing an end-member spectrum library, and normalizing the spectrum data in the end-member spectrum library to obtain normalized end-member spectra; inputting the spectrum data of the characteristic band and the normalized end-member spectrum into a fully constrained least squares model to calculate an initial abundance value; based on the initial abundance value, generating a theoretical mixed spectrum, and calculating the spectral angle and spectral distance between the theoretical mixed spectrum and the actual characteristic band spectrum; setting a spectral interference threshold, comparing the spectral angle and spectral distance with a preset threshold, identifying the interfered gas component, and iteratively adjusting the abundance value of the interfered gas component, recalculating the spectral angle and spectral distance until the threshold requirement is met or the maximum number of iterations is reached, and obtaining a corrected abundance value; according to the corrected abundance value, calculating the content percentage of each gas component to obtain original gas component content data, and normalizing the original gas component content data to ensure that the sum of the content of each component is equal to 100%, and obtaining initial gas component content data; The initial gas component content data is optimized to obtain target gas component content data; specifically comprising: constructing the initial gas component content data into a mixing matrix, and performing sparsity analysis on the mixing matrix to obtain a sparse representation matrix; based on the sparse representation matrix, using an orthogonal matching pursuit algorithm to decompose the mixing matrix to obtain an initial endmember matrix and an initial abundance matrix; performing endmember spectrum update on the initial endmember matrix to obtain an updated endmember matrix, and based on the updated endmember matrix, using a multiplier alternating direction method to optimize the initial abundance matrix to obtain an optimized The optimized abundance matrix is optimized for sparsity to obtain a sparse abundance matrix, and according to the spatial distribution characteristics of the sparse abundance matrix, a spatial correlation constraint function is constructed to perform spatial constraint optimization on the sparse abundance matrix to obtain a spatially optimized abundance matrix; the spatially optimized abundance matrix is used to calculate the content percentage of each gas component to obtain optimized gas component content data, and the optimized gas component content data is normalized to ensure that the sum of the content of each component is equal to 100%, thereby obtaining target gas component content data; A gas composition abnormality detection is performed on the target gas component content data to obtain a gas composition abnormality detection report.
2. The gas component detection method based on spectral analysis according to claim 1, characterized in that: The axial scanning of the gas storage device to obtain the hyperspectral image data includes: Setting a scanning path for the gas storage device, dividing the scanning path into a plurality of equally spaced scanning lines, adjusting the spectral resolution of the push-broom hyperspectral imager to 10 nm, and setting the wavelength range of the push-broom hyperspectral imager to 400 nm to 2500 nm; Moving the push-broom hyperspectral imager along the scanning path, collecting data for each scanning line, and spatially registering the data collected for each scanning line to form a two-dimensional spatial data matrix; Associating the two-dimensional spatial data matrix with the corresponding wavelength information to construct a three-dimensional data cube, and recording the operating parameter data of the temperature and pressure of the gas storage device; The three-dimensional data cube is combined with the operating condition parameter data to obtain hyperspectral image data containing spatial, spectral and operating condition information.
3. The gas component detection method based on spectral analysis according to claim 1, characterized in that: The preprocessing and spectral standardization of the hyperspectral image data to obtain preprocessed spectral data includes: Performing dark current correction on the hyperspectral image data using a pre-collected dark current image to obtain dark current corrected image data, and performing white board correction on the dark current corrected image data based on standard white board reflectivity data to obtain white board corrected image data; Using the least square method in the vertical direction to perform stripe removal processing on the image data after the whiteboard correction, to obtain stripe-free image data, and applying the Savitzky-Golay filtering algorithm to the stripe-free image data, setting the filter window width to 9 and the polynomial order to 3, performing spectral smoothing processing, to obtain smoothed spectral data; Calculating the integral value of the smoothed spectral data in the wavelength dimension to obtain the area under the spectral curve, and dividing the smoothed spectral data by the area under the spectral curve to perform area normalization processing to obtain standardized spectral data; The standardized spectral data is subjected to outlier detection, and the median absolute deviation method is used to identify and remove spectral outliers to obtain spectral data after outlier processing, and inter-band correlation analysis is performed on the spectral data after outlier processing to remove redundant bands to obtain preprocessed spectral data.
4. The gas component detection method based on spectral analysis according to claim 1, characterized in that: The step of performing band selection on the preprocessed spectral data to obtain a characteristic band includes: Calculating the spectral angle between any two bands in the preprocessed spectral data to construct a spectral angle matrix, and calculating the spectral information divergence between any two bands in the preprocessed spectral data based on information entropy theory to construct a spectral information divergence matrix; Setting weight coefficients of the spectral angle matrix and the spectral information divergence matrix, performing weighted fusion on the spectral angle matrix and the spectral information divergence matrix, and obtaining a band similarity matrix; Calculating the local density and relative distance of each band for the band similarity matrix to obtain the density-distance distribution of the band, and based on the density-distance distribution, setting the density threshold and the distance threshold, identifying the density peak point, and obtaining the initial cluster center; The initial cluster center is used to cluster the remaining bands to obtain a band clustering result, and the average information entropy of the bands in each cluster is calculated, and the band with the largest information entropy is selected as the representative band of the cluster to obtain a candidate feature band set; Calculating the correlation coefficient matrix between the bands in the candidate feature band set, setting a correlation threshold, removing highly correlated redundant bands, and obtaining an optimized feature band set; A target score is calculated for each band in the optimized characteristic band set, and the bands are sorted in descending order according to the target scores, and several bands with the highest scores are selected as characteristic bands.
5. The gas component detection method based on spectral analysis according to claim 1, characterized in that: The performing gas composition abnormality detection on the target gas component content data to obtain a gas composition abnormality detection report includes: Two deep learning models are constructed, the first model is used for normal gas composition pattern recognition, and the second model is used for abnormal gas composition detection. The first model is trained with historical normal gas composition data to obtain a normal pattern recognition model. Initializing the second model using the target gas component content data to obtain an initial anomaly detection model; Inputting the target gas component content data into the normal pattern recognition model to obtain a normality score, and judging the normality score based on a preset threshold to divide a potential abnormal sample set; Applying the initial anomaly detection model to the potential anomaly sample set to obtain an anomaly detection result, and updating the second model based on the anomaly detection result to obtain an optimized anomaly detection model; The optimized anomaly detection model is used to comprehensively scan the target gas component content data to obtain an abnormal probability distribution, and based on the abnormal probability distribution, an abnormal determination threshold is set to classify the gas components to obtain a normal sample set and an abnormal sample set; A feature contribution analysis is performed on each sample in the abnormal sample set to identify the core gas component that causes the abnormality, and the abnormal samples are classified into risk levels based on the abnormal degree and historical data distribution of the core gas component to generate a gas composition abnormality detection report.
6. A gas component detection device based on spectral analysis, characterized in that: Used to perform the gas component detection method based on spectral analysis as described in any one of claims 1 to 5, the gas component detection device based on spectral analysis comprises: A scanning module, used for axially scanning the gas storage device to obtain hyperspectral image data; A preprocessing module, used for preprocessing and spectrally normalizing the hyperspectral image data to obtain preprocessed spectral data; A selection module, used for performing band selection on the preprocessed spectral data to obtain a characteristic band; An estimation module, used for estimating the abundance of the characteristic band to obtain initial gas component content data; An optimization module, used for optimizing the initial gas component content data to obtain target gas component content data; The detection module is used to perform gas composition anomaly detection on the target gas component content data to obtain a gas composition anomaly detection report.
7. An electronic device, characterized in that: The electronic device comprises: a memory and at least one processor, wherein instructions are stored in the memory; The at least one processor calls the instructions in the memory so that the electronic device executes the gas component detection method based on spectral analysis as described in any one of claims 1-5.
8. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by the processor, the gas component detection method based on spectral analysis as described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Gas detection method based on hyperspectral infrared image processing
CN106018316A
Adaptive density peak clustering wave band selection method
CN116912522A
Online analysis method and system for malodorous substances in ambient air
CN117969426A