AI-based rapid indoor air quality detection method
Using artificial intelligence to determine the noise intensity and feature expression intensity, and adaptively setting the order of the Savitzky-Golay filter, it solves the problem of noise interference affecting air quality judgment in infrared spectrum technology, and improves the accuracy of indoor air quality detection.
Patent Information
- Application Number
- CN202410788850.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-06-19
AI Technical Summary
Existing infrared spectroscopy technology causes baseline fluctuations due to noise interference in indoor air quality detection, which affects the intensity analysis of characteristic peaks. Inaccurate polynomial order settings affect the accuracy of air quality judgment.
Using an artificial intelligence-based method, the data baseline of the indoor air spectrum is obtained, the local noise intensity performance weight and noise intensity are determined, and the Savitzky-Golay filter with adaptive order settings is used to smooth the spectrum, combining the noise intensity and The characteristic expression intensity is squared and the adaptive order is determined to smooth the indoor air spectrum.
It improves the accuracy of indoor air quality judgment, avoids over-smoothing of data and loss of features when noise interference and feature intensity are both large, and distortion problems caused by insufficient noise interference, and obtains more accurate air composition characteristics and quality assessment.
Smart Images

Figure CN118366563B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of air quality detection, and in particular to a method for rapid detection of indoor air quality based on artificial intelligence. Background Art
[0002] In indoor air quality detection, key parameters for judging air quality include but are not limited to suspended particulate matter and carbon dioxide levels. The freshness of indoor air and formaldehyde content are determined based on the above parameters to judge air quality. Usually, existing infrared spectroscopy technology is used to detect and analyze air components and corresponding concentrations. The components in the air can selectively absorb infrared rays of different wavelengths, causing transitions in the vibrational energy levels and rotational energy levels in the molecules. The spectrum image of the air components can be obtained by detecting the absorption of infrared rays. Since the intensity of the characteristic peaks of various components of different concentrations and the corresponding wavelengths are different, the concentration of various components in the air can be analyzed by the characteristics of the absorption light of the known components, and then the indoor air quality can be judged. However, noise may cause random fluctuations in the baseline of the infrared spectrum, making the baseline uneven, which in turn affects the intensity of the characteristic peaks and the concentration analysis results of various components in the air. Therefore, it is particularly important to smooth the spectrum.
[0003] Related technologies often use infrared spectroscopy technology to collect indoor air spectral images, and use Savitzky-Golay (SG) filters to smooth the collected indoor spectral data to reduce the impact of noise on the characteristic peaks in the spectrum. According to the intensity of the characteristic peaks of different components in the spectrum, the actual content of each component is judged to judge the indoor air quality.
[0004] However, at present, the size of the polynomial order of the SG filter needs to be set manually. If the order is too high, the data in the spectrum will be over-smoothed and some data details will be lost. If the order is too low, the data in the spectrum will be over-fitted and distorted, and the degree of noise interference removal will be insufficient. Inaccurate order of the polynomial will affect the accuracy of the air quality judgment results. Summary of the invention
[0005] In order to solve the problem that the inaccurate order of the polynomial affects the accuracy of the air quality judgment result, the purpose of the present invention is to provide a rapid indoor air quality detection method based on artificial intelligence. The technical solution adopted is as follows:
[0006] The present invention provides a method for rapid detection of indoor air quality based on artificial intelligence, the method comprising:
[0007] Acquire an indoor air spectrum, wherein the indoor air spectrum is a spectrum of infrared light absorbed by indoor air collected at a frequency threshold as a collection frequency, and the indoor air spectrum comprises a curve of the intensity and wavelength of infrared light characteristic peaks of indoor air components, wherein the abscissa of the intensity data on the curve is the wavelength, and the ordinate is the absorption intensity;
[0008] Obtaining a data baseline of the intensity data in the indoor air spectrogram, a peak value in a curve of intensity and wavelength, and a wavelength corresponding to the peak value;
[0009] Based on the data baseline, determining a local noise intensity representation weight and a noise intensity;
[0010] Determining a characteristic expression intensity based on the local noise intensity expression weight, a peak value in the intensity-wavelength curve, and a wavelength corresponding to the peak value;
[0011] Performing a square ratio operation based on the noise intensity and the characteristic expression intensity to determine an adaptive order;
[0012] Smoothing the indoor air spectrum by using an SG filter whose order is set to the adaptive order to obtain a smoothed indoor air spectrum;
[0013] Performing chemometric analysis on the smoothed indoor air spectrum to obtain the components and corresponding contents of the indoor air;
[0014] The indoor air quality is determined based on the standard content of indoor air components and the components and corresponding contents of the indoor air.
[0015] In some embodiments, determining the local noise intensity representation weight and the noise intensity based on the data baseline includes:
[0016] Based on the data baseline, determining the instantaneous baseline slope corresponding to each intensity data;
[0017] Dividing the instantaneous baseline slope corresponding to the intensity data into data sets to obtain a plurality of ordered data sets with overlapping parts;
[0018] Segmenting each of the data sets to obtain a head data set, a middle data set, and a tail data set;
[0019] Determine the degree of data fluctuation based on the instantaneous baseline slopes in the first and last data sets;
[0020] Based on the central data set, the extent of local mutation was determined;
[0021] Determining a local noise intensity representation weight based on the data fluctuation degree and the local mutation degree;
[0022] The noise intensity is determined based on the local noise intensity representation weights of all data sets.
[0023] In some embodiments, the instantaneous baseline slope corresponding to the intensity data is divided into a data set to obtain a plurality of ordered data sets with overlapping parts, including:
[0024] A window with a first length is constructed with the instantaneous baseline slope corresponding to any intensity data as the center, and the window is translated in the direction of decreasing horizontal axis values to the leftmost side of the intensity and wavelength curve. The instantaneous baseline slope corresponding to the intensity data in the window is taken as a data set, and the instantaneous baseline slope corresponding to the intensity data at the center position in the window is the center instantaneous baseline slope data. The window is moved in the direction of increasing horizontal axis values until the window moves to the leftmost side of the intensity and wavelength curve, and a plurality of ordered data sets with overlapping parts and the center instantaneous baseline slope at the center position in each data set are obtained in turn, and the number of instantaneous baseline slopes in each data set is equal to the length of the window.
[0025] In some embodiments, the window includes a first local window, a second local window and a third local window, the lengths of the first local window and the third local window are the same, both are the second length, the length of the second local window is the third length, the third length is greater than the second length, the value of the second length is greater than or equal to the length threshold, the value of the first length is equal to twice the value of the second length plus the value of the third length, and the segmentation processing of each of the data sets to obtain the head data set, the middle data set and the tail data set includes:
[0026] Each of the data sets is segmented through the first local window, the second local window and the third local window to obtain a head data set corresponding to the first local window, a middle data set corresponding to the second local window and a tail data set corresponding to the third local window.
[0027] In some embodiments, determining the degree of data fluctuation based on the instantaneous baseline slopes in the head data set and the tail data set specifically includes:
[0028] Calculating the mean and variance of the instantaneous baseline slopes in the head data set and the tail data set;
[0029] Based on the mean and variance of the instantaneous baseline slopes in the head data set and the tail data set, a weighted slope mean of the head data set and a weighted slope mean of the tail data set are obtained;
[0030] Calculating the difference between the weighted slope mean of the head data set and the weighted slope mean of the tail data set to obtain the degree of data fluctuation;
[0031] Determine the degree of data fluctuation according to the following formula:
[0032] In the formula, Indicates the degree of data fluctuation. a Represents the first data set, b represents the tail data set, , They represent the mean of the instantaneous baseline slope in the first data set and the mean of the instantaneous baseline slope in the tail data set, respectively. , They represent the variance of the instantaneous baseline slope in the first data set and the variance of the instantaneous baseline slope in the tail data set, respectively. , They represent the weighted slope mean of the first data set and the weighted slope mean of the tail data set respectively. It represents the difference between the weighted slope mean of the first data set and the weighted slope mean of the tail data set, which is used to characterize the degree of data fluctuation. i It represents the sequence number of the center instantaneous baseline slope, starting from 1. Indicates the absolute value sign.
[0033] In some embodiments, the central instantaneous baseline slope divides the central data set in the data set corresponding to it into a central sub-data set 1 and a central sub-data set 2, wherein the central sub-data set 1 and the central sub-data set 2 do not include the central instantaneous baseline slope, and determining the degree of local mutation based on the central data set specifically includes:
[0034] Calculating the mean of the instantaneous baseline slopes in the first middle sub-dataset, the mean of the instantaneous baseline slopes in the second middle sub-dataset, and the standard deviation of the instantaneous baseline slopes in the middle data set;
[0035] The local mutation degree is determined based on the mean of the instantaneous baseline slopes in the first central sub-dataset, the mean of the instantaneous baseline slopes in the second central sub-dataset, and the standard deviation of the instantaneous baseline slopes in the central data set according to the following formula:
[0036] In the formula, Indicates the degree of local mutation, c represents the middle sub-dataset 1, d represents the middle sub-dataset 2, e represents the middle data set, represents the mean of the instantaneous baseline slope in the middle sub-dataset 1, represents the mean of the instantaneous baseline slope in the middle sub-dataset 2, represents the standard deviation of the instantaneous baseline slope in the middle data set, i It represents the sequence number of the center instantaneous baseline slope, starting from 1. Indicates the absolute value sign.
[0037] In some embodiments, the local noise intensity representation weight is determined based on the data fluctuation degree and the local mutation degree according to the following formula:
[0038]
[0039] In the formula, represents the weight of local noise intensity, Indicates the degree of local mutation, Indicates the degree of data fluctuation. i It represents the serial number of the central instantaneous baseline slope, starting from 1, and tanh represents the hyperbolic tangent function.
[0040] In some embodiments, determining the characteristic performance intensity based on the local noise intensity performance weight, the peak in the intensity-wavelength curve and the wavelength corresponding to the peak includes:
[0041] Based on the intensity data in the indoor air spectrum, determine the peak value and the wavelength corresponding to the peak value;
[0042] Based on the peak value in the intensity versus wavelength curve, the maximum intensity of the peak value and the half-peak width of the peak value are determined, wherein the half-peak width is the difference between two intersection points where a straight line parallel to the abscissa axis where the half value of the maximum intensity of the peak value is located and an intensity versus wavelength curve near the maximum intensity of the peak value intersect, the abscissa axis, a line parallel to the ordinate axis where the two intersection points are located, and the intensity versus wavelength curve form an area, and the intensity versus wavelength curve within the area includes multiple intensity values;
[0043] Based on the half-width of the peak in each of the regions, multiple intensity values and the weight of the local noise intensity representation, determining the characteristic value and characteristic peak at the wavelength corresponding to the peak in each of the regions, and then obtaining all the characteristic values and characteristic peaks of each of the indoor air spectrograms;
[0044] Based on all characteristic values and characteristic peaks of each of the indoor air spectrograms, characteristic expression intensities are determined.
[0045] In some embodiments, according to the following formula, based on the half-peak width of the peak in each area, multiple intensity values and the local noise intensity performance weight, the characteristic value at the wavelength corresponding to the peak in each area is determined, and then all the characteristic values of each indoor air spectrum are obtained;
[0046] In the formula, j represents the number of the peak in the intensity versus wavelength curve, For the j The characteristic value at the wavelength corresponding to the peak value, Indicates j The half-peak width corresponding to the peak is n represents the number of multiple intensity values in the region, r a label indicating the intensity value within the region, Indicates the area r The value of the intensity value, Indicates the first r The local noise intensity corresponding to the intensity value represents the weight, Indicates the area r The weighted value of the intensity value, Indicates that the area r The average intensity of the intensity values.
[0047] In some embodiments, the characteristic performance intensity is determined based on all characteristic values and characteristic peaks of each indoor air spectrum graph according to the following formula:
[0048] In the formula, Indicates the strength of feature expression, f Indicates the serial number of the wavelength corresponding to the characteristic peak appearing in the indoor air spectrum graph, and the serial numbers are the same if the wavelengths corresponding to the characteristic peak appearing in the indoor air spectrum graph are the same. N Represents the total number of times the characteristic peaks appear in all indoor air spectra. It indicates the number of times the characteristic peak at the same wavelength appears in all indoor air spectra. exp() indicates the exponential normalization function. x represents the serial number of the indoor air spectrogram, M represents the number of indoor air spectrograms, Indicates x The characteristic value at the same wavelength in the indoor air spectrum is Represents the mean of the eigenvalues at the same wavelength in all indoor air spectra.
[0049] The present invention has the following beneficial effects:
[0050] The invention provides an artificial intelligence-based rapid indoor air quality detection method. The method determines the local noise intensity performance weight and the noise intensity based on the baseline of the intensity data in the indoor air spectrogram. The local noise intensity performance weight and the noise intensity can reflect the interference degree of the noise in the indoor air spectrogram, so as to grasp the influence of the noise on the real intensity data in the indoor air spectrogram as a whole; based on the local noise intensity performance weight, the peak value in the curve of intensity and wavelength and the wavelength corresponding to the peak value, the characteristic performance intensity is determined. The obtained characteristic performance intensity takes the local noise interference into consideration, so that the performance of the characteristic peaks of each indoor air component in the indoor air spectrogram can be accurately determined. The present situation; the square ratio operation is performed on the noise intensity and the characteristic expression intensity, and the determined adaptive order takes into account the noise interference and the intensity of the characteristic itself, so as to avoid the problem of smoothing out the data details when the noise interference is large and the intensity of the characteristic itself is large and the set order is large, and it can also avoid the problem of insufficient removal of noise interference and data distortion when the noise interference is large, the intensity of the characteristic itself is small and the set order is small; the data in the indoor air spectrogram is smoothed by the SG filter with the adaptive order to obtain an indoor air spectrogram that accurately reflects the characteristics of indoor air components, thereby improving the accuracy of indoor air quality judgment. The present invention adaptively adjusts the order of the SG filter by the noise intensity and the characteristic expression intensity to obtain an accurate adaptive order, and the adaptive order makes the indoor air spectrogram that reflects the characteristics of indoor air components more accurate, thereby improving the accuracy of indoor air quality judgment. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are 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 work.
[0052] Figure 1 A method flow chart of an artificial intelligence-based rapid indoor air quality detection method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0053] 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.
[0054] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0055] The specific scheme of the indoor air quality rapid detection method based on artificial intelligence provided by the present invention is described in detail below with reference to the accompanying drawings.
[0056] Figure 1 This is a flowchart of a method for rapid detection of indoor air quality based on artificial intelligence provided by an embodiment of the present invention. Figure 1 , the method comprises the following steps:
[0057] Step 101, obtain an indoor air spectrum. The indoor air spectrum is a spectrum of infrared light absorbed by indoor air collected at a threshold frequency. The indoor air spectrum includes a curve of the intensity and wavelength of the infrared light characteristic peaks of each indoor air component. The horizontal axis of the intensity data on the curve is the wavelength, and the vertical axis is the absorption intensity.
[0058] The indoor air spectrum is the basis for indoor air quality detection. In some embodiments, the indoor air spectrum is obtained by installing an infrared spectrum acquisition device in a confined space.
[0059] Due to the influence of ambient light, in some embodiments, the threshold frequency may be collected once every hour. Within a day, when the indoor air circulation is negligible, the indoor air spectrogram is collected once every hour, and the number of indoor air spectrograms M obtained is 24.
[0060] In some embodiments, the collected indoor air spectrogram is preprocessed to eliminate irrelevant information in the image, restore useful real information, enhance the detectability of useful information and simplify the data to the maximum extent.
[0061] In some implementations, preprocessing can include grayscaling, geometric transformation, and image enhancement.
[0062] Step 102, obtaining a data baseline of intensity data in the indoor air spectrum, a peak value in a curve of intensity and wavelength, and a wavelength corresponding to the peak value.
[0063] When collecting spectra of various components in indoor air, each component usually appears as a characteristic peak in the spectrum. The peak value of the characteristic peak is the peak value in the intensity-wavelength curve. The peak value corresponds to the wavelength in the curve, that is, the peak value of the characteristic peak of a certain component in the room at the wavelength. The width and height of the characteristic peak are related to the mass and actual concentration of its component. The data baseline is the baseline of the curve used to measure the intensity and wavelength of the infrared light characteristic peak of each air component in the room. However, noise may cause random fluctuations in the middle of the indoor air spectrum.
[0064] In some embodiments, a data baseline of the intensity data in the indoor air spectrogram may be obtained by a wavelet transform algorithm.
[0065] Step 103: Determine the local noise intensity representation weight and the noise intensity based on the data baseline.
[0066] In some embodiments, the specific implementation of step 103 includes:
[0067] (1) Based on the data baseline, determine the instantaneous baseline slope corresponding to each intensity data.
[0068] Each intensity data has a corresponding instantaneous baseline slope, which can characterize the smoothness of the data baseline. The less smooth the baseline is, the more incoherent the instantaneous baseline slope is, which manifests as a sudden change in the baseline, that is, the baseline suddenly changes at a certain data point, and the instantaneous baseline slopes of other data points on both sides of the sudden change are similar.
[0069] (2) The instantaneous baseline slope corresponding to the intensity data is divided into data sets to obtain multiple ordered data sets with overlapping parts.
[0070] The instantaneous baseline slope corresponding to the intensity data is divided into data sets to obtain multiple ordered data sets with overlapping parts, which is convenient for the subsequent determination of the local data fluctuation degree in the indoor spectrogram.
[0071] In some embodiments, the instantaneous baseline slope corresponding to the intensity data is divided into data sets in the following manner to obtain a plurality of ordered data sets with overlapping portions: a window with a first length is constructed with the instantaneous baseline slope corresponding to any intensity data as the center, the window is translated in the direction of decreasing horizontal axis value to the leftmost side of the intensity versus wavelength curve, the instantaneous baseline slope corresponding to the intensity data in the window is taken as a data set, the instantaneous baseline slope corresponding to the intensity data at the center position in the window is the center instantaneous baseline slope data, the window is moved in the direction of increasing horizontal axis value until the window moves to the leftmost side of the intensity versus wavelength curve, and a plurality of ordered data sets with overlapping portions and a center instantaneous baseline slope at the center position in each data set are obtained in turn, and the number of instantaneous baseline slopes in each data set is equal to the length of the window.
[0072] By constructing a window with a first length, the instantaneous baseline slope corresponding to the intensity data is divided into data sets, and multiple ordered data sets with overlapping parts and a central instantaneous baseline slope at the center of each data set are obtained. The multiple ordered data sets can carry continuous local change information in the indoor spectrogram, which is convenient for subsequent comprehensive and orderly grasp of the fluctuation degree of the data near the intensity data corresponding to the central instantaneous baseline slope.
[0073] (3) Each data set is segmented to obtain the head data set, the middle data set and the tail data set.
[0074] In some embodiments, the window includes a first local window, a second local window and a third local window, the lengths of the first local window and the third local window are the same, both are the second length, the length of the second local window is the third length, the third length is greater than the second length, the value of the second length is greater than or equal to the length threshold, the value of the first length is equal to twice the value of the second length plus the value of the third length, and each data set is segmented and processed in the following manner to obtain a head data set, a middle data set and a tail data set, including:
[0075] Each data set is segmented through the first local window, the second local window and the third local window to obtain a head data set corresponding to the first local window, a middle data set corresponding to the second local window and a tail data set corresponding to the third local window.
[0076] The third length is greater than the second length, so that the number of instantaneous baseline slopes in the middle data set is greater than the number of instantaneous baseline slopes in the head data set and the number of instantaneous baseline slopes in the tail data set, thereby making the instantaneous baseline slope data in the middle data set richer, which is beneficial to the subsequent calculation of data fluctuation degree.
[0077] In order to obtain the local data fluctuation degree in the indoor spectrogram, it is necessary to segment each data set using three local windows.
[0078] In some embodiments, the length threshold may be 3. Setting the length threshold in this way can ensure that the number of data divided into the head data set and the tail data set of each data set is suitable for determining the degree of local data fluctuation.
[0079] In some embodiments, the first length may be 11, the second length may be 3, and the third length may be 5. In this way, the total length of the window is 11, the number of instantaneous baseline slopes in each data set is 11, the length of the first local window may be 3, the length of the second local window may be 5, and the length of the third local window may be 3, so that each data set is divided into a head data set containing 3 instantaneous baseline slope data, a middle data set containing 5 instantaneous baseline slope data, and a tail data set containing 3 instantaneous baseline slope data.
[0080] (4) Determine the degree of data fluctuation based on the instantaneous baseline slope in the first and last data sets.
[0081] In some embodiments, based on the instantaneous baseline slopes in the head data set and the tail data set, the degree of data fluctuation is determined, specifically including: calculating the mean and variance of the instantaneous baseline slopes in the head data set and the tail data set; based on the mean and variance of the instantaneous baseline slopes in the head data set and the tail data set, obtaining the weighted slope mean of the head data set and the weighted slope mean of the tail data set; calculating the difference between the weighted slope mean of the head data set and the weighted slope mean of the tail data set to obtain the degree of data fluctuation, the difference between the weighted slope mean of the head data set and the weighted slope mean of the tail data set can reflect the difference in the instantaneous baseline slope near the intensity data corresponding to the central instantaneous baseline slope, evaluate the possibility of a sudden change at the intensity data corresponding to the central instantaneous baseline slope, thereby obtaining the degree of data fluctuation, and then using the difference between the weighted slope mean of the head data set and the weighted slope mean of the tail data set to characterize the degree of data fluctuation; determining the degree of data fluctuation according to the following formula:
[0082] In the formula, Indicates the degree of data fluctuation. a Represents the first data set, b represents the tail data set, , They represent the mean of the instantaneous baseline slope in the first data set and the mean of the instantaneous baseline slope in the tail data set, respectively. , They represent the variance of the instantaneous baseline slope in the first data set and the variance of the instantaneous baseline slope in the tail data set, respectively. , They represent the weighted slope mean of the first data set and the weighted slope mean of the tail data set respectively. It represents the difference between the weighted slope mean of the first data set and the weighted slope mean of the tail data set, which is used to characterize the degree of data fluctuation. i It represents the sequence number of the center instantaneous baseline slope, starting from 1. Indicates the absolute value sign.
[0083] The degree of data fluctuation reflects the degree of local continuity of the intensity data corresponding to the data set, that is, the possibility of local mutation near the intensity data corresponding to the central instantaneous baseline slope. The smaller the data fluctuation, the more similar the instantaneous baseline slopes near the intensity data corresponding to the central instantaneous baseline slope are, and the possibility of mutation in the intensity data corresponding to the central instantaneous baseline slope is small, which may be judged as the actual change of intensity data. The greater the data fluctuation, the greater the difference in the instantaneous baseline slopes near the intensity data corresponding to the central instantaneous baseline slope, and the possibility of mutation in the intensity data corresponding to the central instantaneous baseline slope is large. The change of intensity data corresponding to this data set may be judged as data fluctuation caused by noise.
[0084] (5) Determine the degree of local mutation based on the central data set.
[0085] In some embodiments, the central instantaneous baseline slope divides the central data set in the data set corresponding to it into a central sub-dataset 1 and a central sub-dataset 2, and neither the central sub-dataset 1 nor the central sub-dataset 2 includes the central instantaneous baseline slope. Based on the central data set, determining the degree of local mutation specifically includes: calculating the mean of the instantaneous baseline slopes in the central sub-dataset 1, the mean of the instantaneous baseline slopes in the central sub-dataset 2, and the standard deviation of the instantaneous baseline slopes in the central data set; determining the degree of local mutation based on the mean of the instantaneous baseline slopes in the central sub-dataset 1, the mean of the instantaneous baseline slopes in the central sub-dataset 2, and the standard deviation of the instantaneous baseline slopes in the central data set according to the following formula:
[0086] In the formula, Indicates the degree of local mutation, c represents the middle sub-dataset 1, d represents the middle sub-dataset 2, e represents the middle data set, represents the mean of the instantaneous baseline slope in the middle sub-dataset 1, represents the mean of the instantaneous baseline slope in the middle sub-dataset 2, represents the standard deviation of the instantaneous baseline slope in the middle data set, i It represents the sequence number of the center instantaneous baseline slope, starting from 1. Indicates the absolute value sign.
[0087] Since the sudden change on the baseline is characterized by a steep increase followed by a steep decrease, the middle sub-dataset 1 and the middle sub-dataset 2 are data located on both sides of the central instantaneous baseline slope. The closer to the central instantaneous baseline slope, the more obvious the characteristic performance is near the intensity data. Therefore, the difference between the mean of the instantaneous baseline slope in the middle sub-dataset 1 and the mean of the instantaneous baseline slope in the middle sub-dataset 2 on both sides of the central instantaneous baseline slope is calculated first. The difference can reflect the high degree of local mutation of the central instantaneous baseline slope. The standard deviation of the instantaneous baseline slope in the central data set reflects the central data set. e The instantaneous baseline slope fluctuates. The larger the standard deviation, the higher the possibility that the intensity data corresponding to the instantaneous baseline slope in the central data set is noisy. and Multiply to get the local mutation degree This more accurately reflects the degree of local mutation near the intensity data corresponding to the instantaneous baseline slope close to the center.
[0088] (6) Determine the weight of local noise intensity based on the degree of data fluctuation and the degree of local mutation.
[0089] In some embodiments, the local noise intensity representation weight is determined based on the data fluctuation degree and the local mutation degree according to the following formula:
[0090]
[0091] In the formula, represents the weight of local noise intensity, Indicates the degree of local mutation, Indicates the degree of data fluctuation. i It represents the serial number of the central instantaneous baseline slope, starting from 1, and tanh represents the hyperbolic tangent function.
[0092] The hyperbolic tangent function is used to normalize the ratio of data fluctuation degree and local mutation degree to obtain the local noise intensity performance weight. The local noise intensity performance weight reflects the interference degree of local noise in the indoor air spectrum. The larger the local noise intensity performance weight, the greater the interference degree of local noise in the indoor air spectrum.
[0093] (7) Determine the noise intensity based on the local noise intensity representation weight of all data sets.
[0094] In some embodiments, the average value of the local noise intensity representation weights of all data sets is calculated to obtain the noise intensity, thereby understanding the overall noise interference degree of the indoor air spectrogram.
[0095] Step 104, determining the characteristic expression intensity based on the local noise intensity expression weight, the peak value in the intensity-wavelength curve, and the wavelength corresponding to the peak value.
[0096] It should be noted that for the entire indoor air spectrum, in the process of denoising it using the SG filter, since the actual intensity data of each component will produce the same local characteristic peaks as the noise, if only the overall noise intensity is considered to set the polynomial order of the SG filter, the polynomial order will be too large, resulting in overfitting of the data in the spectrum, smoothing out the data details, and causing data distortion. Therefore, it is necessary not only to consider and estimate the size of the noise intensity in the indoor air spectrum, but also to judge the performance of the characteristic peaks of various air components in the entire indoor air spectrum to avoid the influence of a single factor on the order adaptation. The actual intensity data of various air components in the indoor air spectrum are expressed as peaks. At the same time, since the air flow capacity of the indoor space can be ignored, the peak value of the intensity and wavelength curve in the spectrum of the same component changes little, while the intensity value of the noise changes greatly. At the same time, due to the indoor air spectrum Figure 1It will be affected by natural light to a certain extent, and the noise generated by it will also change to varying degrees in multiple detection processes, that is, in multiple indoor air spectra. Therefore, the actual numerical fluctuations of all intensity data can be combined, that is, the numerical influence of noise interference on the intensity data can be taken into account to judge the characteristic intensity of various air components in the indoor air spectra.
[0097] In some embodiments, determining the characteristic performance intensity based on the local noise intensity performance weight, the peak in the intensity-wavelength curve, and the wavelength corresponding to the peak includes:
[0098] (1) Based on the intensity data in the indoor air spectrum, determine the peak value and the wavelength corresponding to the peak value.
[0099] In some embodiments, a peak value of the intensity data in the indoor air spectrogram is obtained through a peak detection algorithm, and the position where the peak value appears, that is, the wavelength corresponding to the peak value, is recorded to facilitate analysis of which air component represents the peak value.
[0100] (2) Based on the peak value in the intensity versus wavelength curve, the maximum intensity of the peak and the half-peak width of the peak are determined, wherein the half-peak width is the difference between two intersection points where a straight line parallel to the abscissa axis at which the half value of the maximum intensity of the peak lies and the intensity versus wavelength curve near the maximum intensity of the peak intersect, the abscissa axis, the line parallel to the ordinate axis at which the two intersection points lie, and the intensity versus wavelength curve form an area, and the intensity versus wavelength curve within the area contains multiple intensity values.
[0101] The half-peak width of the peak is determined to subsequently determine the characteristic influence range represented by the characteristic value of the indoor air spectrum.
[0102] (3) Based on the half-width of the peak in each area, multiple intensity values, and the weight of the local noise intensity representation, the characteristic value and characteristic peak at the wavelength corresponding to the peak in each area are determined, and then all the characteristic values and characteristic peaks of each indoor air spectrum are obtained.
[0103] The half-width of the peak value in each area and multiple intensity values are combined with the local noise intensity expression weight. The obtained eigenvalue takes into account both the noise interference and the intensity of the feature itself, making the obtained eigenvalue more accurately reflect the characteristic peaks of various air components in the indoor air spectrum.
[0104] (4) Determine the characteristic intensity based on all the eigenvalues and characteristic peaks of each indoor air spectrum.
[0105] In some embodiments, according to the following formula, based on the half-peak width of the peak in each area, multiple intensity values and the local noise intensity performance weight, the characteristic value at the wavelength corresponding to the peak in each area is determined, thereby obtaining all the characteristic values of each indoor air spectrum map;
[0106] In the formula, j represents the number of the peak in the intensity versus wavelength curve, For the j The characteristic value at the wavelength corresponding to the peak value, Indicates j The half-peak width corresponding to the peak is n represents the number of multiple intensity values in the region, r a label indicating the intensity value within the region, Indicates the area r The value of the intensity value, Indicates the first r The local noise intensity corresponding to the intensity value represents the weight, Indicates the area r The weighted value of the intensity value, Indicates that the area r The average intensity of the intensity values.
[0107] No. j The half-peak width corresponding to the peak The larger the value is, the higher the indoor spectrum j The half-peak width corresponding to the peak The larger the wavelength range included in the intensity-wavelength curve within the region, the r The larger the weight of the intensity value, the greater the r The intensity data of the air components corresponding to the intensity values are highly expressed; r The greater the average intensity of the intensity values, the higher the performance of the intensity data of the air components in the area; j The characteristic value at the wavelength corresponding to the peak The larger it is, the more obvious the characteristics of the air component at the wavelength corresponding to the peak are.
[0108] In order to determine the characteristic expression intensity of the indoor air component at the same wavelength in all the collected indoor spectrograms, in some embodiments, the characteristic expression intensity is determined based on all the characteristic values and characteristic peaks of each indoor air spectrogram according to the following formula:
[0109] In the formula, Indicates the strength of feature expression, fIndicates the serial number of the wavelength corresponding to the characteristic peak appearing in the indoor air spectrum graph, and the serial numbers are the same if the wavelengths corresponding to the characteristic peak appearing in the indoor air spectrum graph are the same. N Represents the total number of times the characteristic peaks appear in all indoor air spectra. It indicates the number of times the characteristic peak at the same wavelength appears in all indoor air spectra. exp() indicates the exponential normalization function. x represents the serial number of the indoor air spectrogram, M represents the number of indoor air spectrograms, Indicates x The characteristic value at the same wavelength in the indoor air spectrum is Represents the mean of the eigenvalues at the same wavelength in all indoor air spectra.
[0110] express M The standard deviation of the characteristic value of the air component at a certain wavelength in the indoor air spectrum. The smaller the standard deviation, the less affected the characteristic peak of the air component at this wavelength is by time and environmental factors, the more obvious its characteristic performance is, and the higher its characteristic performance intensity is. Then, the exponential function is used for negative correlation mapping and normalization. The number of times the characteristic peak at the same wavelength appears in all indoor air spectra The larger the value, the higher the frequency of the characteristic peak at a certain wavelength in all indoor air spectra. The intensity data at this wavelength is likely to be the indoor air component, and then the The above standard deviation is weighted and the characteristic peaks appearing in all indoor air spectra are traversed to obtain the characteristic expression intensity. The obtained characteristic expression intensity takes local noise interference into account, so that the expression of the characteristic peaks of each indoor air component in the indoor air spectrum can be accurately determined.
[0111] Step 105, performing a square ratio operation based on the noise intensity and the feature representation intensity to determine the adaptive order.
[0112] The adaptive order determined by the above method takes into account both the noise interference and the strength of the feature itself, avoiding the problem of smoothing out data details when the noise interference is large and the strength of the feature itself is large and the set order is large. It can also avoid the problem of insufficient noise interference removal and data distortion when the noise interference is large, the strength of the feature itself is small and the set order is small.
[0113] In some embodiments, the adaptive order is determined by performing a square ratio operation based on the noise intensity and the feature representation intensity according to the following formula:
[0114] In the formula, represents the adaptive order, Represents the average value of the local noise intensity performance weights of all data sets, that is, the noise intensity, Indicates the strength of feature expression, C A numeric value indicating the order of the general setting.
[0115] It should be noted that when the noise interference is large and the strength of the feature itself is large, there is no need for excessive smoothing, that is, the polynomial order does not need to be too large. When the noise interference is large and the strength of the feature itself is small, it is necessary to filter out the noise interference to a greater extent, that is, it is necessary to increase the polynomial order.
[0116] The value of the conventional set order is weighted and adjusted by the square ratio of the noise intensity and the feature expression intensity, taking into account both the noise interference and the intensity of the feature itself, so that the determined adaptive order has adaptiveness.
[0117] In some embodiments, the conventional setting order C The value of can be 3, and the third order is a more conventional polynomial order that is convenient for adaptive adjustment.
[0118] In some embodiments, since the square ratio of the noise intensity and the feature expression intensity may be a decimal, when the square ratio is a decimal, it is rounded to the integer to obtain the final adaptive order.
[0119] Step 106 , smoothing the indoor air spectrum graph by using an SG filter whose order is set to an adaptive order to obtain a smoothed indoor air spectrum graph.
[0120] The data in the indoor air spectrum is smoothed by the SG filter with the adaptive order, so as to obtain the indoor air spectrum which accurately reflects the characteristics of indoor air components.
[0121] Step 107, performing chemometric analysis on the smoothed indoor air spectrum to obtain the components and corresponding contents of the indoor air.
[0122] Chemometric analysis can determine the various air components and their corresponding contents in the indoor spectrum, so as to provide a numerical basis for the assessment of air quality. The smoothed indoor air spectrum can make the contents of various air components more accurate.
[0123] In some embodiments, a calibration curve or calibration model is established using standard air components of known content. The calibration curve or calibration model can be associated with the intensity and wavelength curve in the indoor spectrogram and the known content to determine the composition and corresponding content of the indoor air.
[0124] In some embodiments, the chemometric analysis may be principal component analysis, partial least squares regression, or the like.
[0125] Step 108, determining the indoor air quality according to the standard content of the indoor air components and the components and corresponding contents of the indoor air.
[0126] The smoothed indoor air spectrum can make the content of various air components more accurate. By comparing the standard content of indoor air components with the indoor air component content obtained by analysis, the judgment result of indoor air quality can be obtained, thereby improving the accuracy of the determined indoor air quality.
[0127] In summary, the artificial intelligence-based rapid detection method for indoor air quality provided by the present invention determines the local noise intensity performance weight and the noise intensity based on the baseline of the intensity data in the indoor air spectrogram, grasps the interference degree of the noise in the indoor air spectrogram, and thereby grasps the influence of the noise on the real intensity data in the indoor air spectrogram as a whole; based on the local noise intensity performance weight, the peak value in the curve of intensity and wavelength and the wavelength corresponding to the peak value, the characteristic performance intensity is determined, so that the obtained characteristic performance intensity is adjusted by the local noise interference, so that the performance of the characteristic peaks of the determined indoor air components in the indoor air spectrogram can be made more accurate; the square ratio operation is performed on the noise intensity and the characteristic performance intensity, and the determined adaptive order takes into account the noise interference and the intensity of the feature itself, avoiding the problem of smoothing out the data details when the noise interference is large and the intensity of the feature itself is large and the set order is large, and it can also avoid the problem of insufficient removal of noise interference and data distortion when the noise interference is large, the intensity of the feature itself is small and the set order is small. The present invention adaptively adjusts the order of the SG filter by noise intensity and feature expression intensity to obtain an accurate adaptive order, and the adaptive order smoothes the indoor spectrum, making the indoor air spectrum reflecting the characteristics of indoor air components more accurate, thereby improving the accuracy of indoor air quality judgment.
[0128] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0129] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
Claims
1. A rapid indoor air quality detection method based on artificial intelligence, characterized in that: The method comprises: Acquire an indoor air spectrum, wherein the indoor air spectrum is a spectrum of infrared light absorbed by indoor air collected at a frequency threshold as a collection frequency, and the indoor air spectrum comprises a curve of the intensity and wavelength of infrared light characteristic peaks of indoor air components, wherein the abscissa of the intensity data on the curve is the wavelength, and the ordinate is the absorption intensity; Obtaining a data baseline of the intensity data in the indoor air spectrogram, a peak value in a curve of intensity and wavelength, and a wavelength corresponding to the peak value; Based on the data baseline, determining a local noise intensity representation weight and a noise intensity; Determining a characteristic expression intensity based on the local noise intensity expression weight, a peak value in the intensity-wavelength curve, and a wavelength corresponding to the peak value; Performing a square ratio operation on the noise intensity and the characteristic expression intensity to determine an adaptive order; Smoothing the indoor air spectrum by using an SG filter whose order is set to the adaptive order to obtain a smoothed indoor air spectrum; Performing chemometric analysis on the smoothed indoor air spectrum to obtain the components and corresponding contents of the indoor air; Determine the indoor air quality according to the standard content of indoor air components and the components and corresponding contents of the indoor air; The determining of the local noise intensity representation weight and the noise intensity based on the data baseline comprises: Based on the data baseline, determining the instantaneous baseline slope corresponding to each intensity data; Dividing the instantaneous baseline slope corresponding to the intensity data into data sets to obtain a plurality of ordered data sets with overlapping parts; Segmenting each of the data sets to obtain a head data set, a middle data set, and a tail data set; Determine the degree of data fluctuation based on the instantaneous baseline slopes in the first and last data sets; Based on the central data set, the extent of local mutation was determined; Determining a local noise intensity representation weight based on the data fluctuation degree and the local mutation degree; Determine the noise intensity based on the local noise intensity representation weights of all data sets; The instantaneous baseline slope corresponding to the intensity data is divided into a data set to obtain a plurality of ordered data sets with overlapping parts, including: A window with a first length is constructed with the instantaneous baseline slope corresponding to any intensity data as the center, and the window is translated in the direction of decreasing abscissa values to the leftmost side of the intensity-wavelength curve. The instantaneous baseline slope corresponding to the intensity data in the window is taken as a data set, and the instantaneous baseline slope corresponding to the intensity data at the center position in the window is the center instantaneous baseline slope data. The window is moved in the direction of increasing abscissa values until the window moves to the leftmost side of the intensity-wavelength curve, and a plurality of ordered data sets with overlapping parts and the center instantaneous baseline slope at the center position in each data set are obtained in sequence, and the number of instantaneous baseline slopes in each data set is equal to the length of the window; The window includes a first local window, a second local window and a third local window, the lengths of the first local window and the third local window are the same, both are the second length, the length of the second local window is the third length, the third length is greater than the second length, the value of the second length is greater than or equal to a length threshold, the value of the first length is equal to twice the value of the second length plus the value of the third length, and each of the data sets is segmented to obtain a head data set, a middle data set and a tail data set, including: Segmenting each of the data sets through the first local window, the second local window, and the third local window to obtain a head data set corresponding to the first local window, a middle data set corresponding to the second local window, and a tail data set corresponding to the third local window; Based on the instantaneous baseline slopes in the first and last data sets, the degree of data fluctuation is determined, including: Calculating the mean and variance of the instantaneous baseline slopes in the head data set and the tail data set; Based on the mean and variance of the instantaneous baseline slopes in the head data set and the tail data set, a weighted slope mean of the head data set and a weighted slope mean of the tail data set are obtained; Calculating the difference between the weighted slope mean of the head data set and the weighted slope mean of the tail data set to obtain the degree of data fluctuation; Determine the degree of data fluctuation according to the following formula: In the formula, Indicates the degree of data fluctuation, a represents the first data set, b represents the last data set, , They represent the mean of the instantaneous baseline slope in the first data set and the mean of the instantaneous baseline slope in the tail data set, respectively. , They represent the variance of the instantaneous baseline slope in the first data set and the variance of the instantaneous baseline slope in the tail data set, respectively. , They represent the weighted slope mean of the first data set and the weighted slope mean of the tail data set respectively. It represents the difference between the weighted slope mean of the first data set and the weighted slope mean of the tail data set, which is used to characterize the degree of data fluctuation. i represents the sequence number of the central instantaneous baseline slope, starting from 1. Indicates the absolute value sign; The central instantaneous baseline slope divides the central data set in the corresponding data set into a central sub-data set 1 and a central sub-data set 2, wherein the central sub-data set 1 and the central sub-data set 2 do not include the central instantaneous baseline slope. The determining of the local mutation degree based on the central data set specifically includes: Calculating the mean of the instantaneous baseline slopes in the first middle sub-dataset, the mean of the instantaneous baseline slopes in the second middle sub-dataset, and the standard deviation of the instantaneous baseline slopes in the middle data set; The local mutation degree is determined based on the mean of the instantaneous baseline slopes in the first central sub-dataset, the mean of the instantaneous baseline slopes in the second central sub-dataset, and the standard deviation of the instantaneous baseline slopes in the central data set according to the following formula: In the formula, Indicates the degree of local mutation, c represents the middle sub-dataset 1, d represents the middle sub-dataset 2, and e represents the middle data set. represents the mean of the instantaneous baseline slope in the middle sub-dataset 1, represents the mean of the instantaneous baseline slope in the middle sub-dataset 2, It represents the standard deviation of the instantaneous baseline slope in the central data set. i represents the serial number of the central instantaneous baseline slope, starting from 1. Indicates the absolute value sign; According to the following formula, the local noise intensity representation weight is determined based on the data fluctuation degree and the local mutation degree: In the formula, represents the weight of local noise intensity, Indicates the degree of local mutation, Indicates the degree of data fluctuation, i represents the serial number of the central instantaneous baseline slope, starting from 1, and tanh represents the hyperbolic tangent function; Determining a characteristic expression intensity based on the local noise intensity expression weight, a peak value in the intensity-wavelength curve, and a wavelength corresponding to the peak value includes: Determine a peak value and a wavelength corresponding to the peak value based on the intensity data in the indoor air spectrum; Based on the peak value in the intensity versus wavelength curve, the maximum intensity of the peak value and the half-peak width of the peak value are determined, wherein the half-peak width is the difference between two intersection points where a straight line parallel to the abscissa axis where the half value of the maximum intensity of the peak value is located and an intensity versus wavelength curve near the maximum intensity of the peak value intersect, the abscissa axis, a line parallel to the ordinate axis where the two intersection points are located, and the intensity versus wavelength curve form an area, and the intensity versus wavelength curve within the area includes multiple intensity values; Based on the half-width of the peak in each of the regions, multiple intensity values and the weight of the local noise intensity representation, determining the characteristic value and characteristic peak at the wavelength corresponding to the peak in each of the regions, and then obtaining all the characteristic values and characteristic peaks of each of the indoor air spectrograms; Determining characteristic expression intensity based on all characteristic values and characteristic peaks of each of the indoor air spectra; According to the following formula, based on the half-peak width of the peak in each area, multiple intensity values and the local noise intensity representation weight, the characteristic value at the wavelength corresponding to the peak in each area is determined, and then all the characteristic values of each indoor air spectrum are obtained; Wherein, j represents the index of the peak in the intensity versus wavelength curve, is the characteristic value at the wavelength corresponding to the j-th peak, represents the half-peak width corresponding to the j-th peak, n represents the number of multiple intensity values in the region, r represents the number of the intensity value in the region, represents the value of the r-th intensity value in the region, represents the local noise intensity representation weight corresponding to the r-th intensity value in the region, represents the weighted value of the rth intensity value in the region, represents the average intensity of r intensity values in the region; According to the following formula, the characteristic expression intensity is determined based on all characteristic values and characteristic peaks of each indoor air spectrum: In the formula, represents the characteristic performance intensity, f represents the serial number of the wavelength corresponding to the characteristic peak appearing in the indoor air spectrum, and the wavelengths corresponding to the characteristic peaks appearing in the indoor air spectrum are the same, and N represents the total number of occurrences of the characteristic peaks in all indoor air spectrums. represents the number of times the characteristic peak at the same wavelength appears in all indoor air spectra, exp() represents the exponential normalization function, x represents the sequence number of the indoor air spectra, M represents the number of the indoor air spectra, represents the characteristic value at the same wavelength in the x-th indoor air spectrum. Represents the mean of the eigenvalues at the same wavelength in all indoor air spectra.
