An air quality prediction method integrating data features from different domains
By designing the complex time-frequency module and time-frequency module, the time-frequency characteristics of air quality data and meteorological data are integrated, and the problem of low air quality prediction accuracy in the prior art is solved, achieving higher prediction accuracy.
Patent Information
- Application Number
- CN202410602392.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-15
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-05-15
AI Technical Summary
The existing air quality prediction methods have low accuracy when processing nonlinear and non-stationary air quality data, and it is difficult to effectively integrate data characteristics in different domains, resulting in low prediction accuracy.
An air quality prediction method is designed to integrate data characteristics of different domains. By obtaining air quality data and meteorological data in real time, and after preprocessing, the data is input into the trained air quality prediction model. The model includes complex time-frequency modules and time-domain modules, and uses technologies such as STFT processing, channel attention mechanisms and jump connections to integrate time-domain and time-frequency characteristics.
By fusing the characteristics of different domains, the air quality prediction model can better learn the deep characteristics of air quality data, improve the accuracy of the prediction results, and obtain better prediction results.
Smart Images

Figure CN118551336B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of air quality prediction, and in particular relates to an air quality prediction method integrating features of data from different domains. Background Art
[0002] Air pollution has become an urgent environmental problem facing the global population, especially for developing countries, where air quality is an important issue of concern to the people. In recent years, social progress and rapid industrial development have led to serious environmental pollution problems, especially the intensification of air pollution, which is mainly manifested in the increase of inhalable particulate matter (PM2.5 and PM10) in the air, which has a serious impact on human health and living environment. The quality of air quality can reflect the degree of pollution in the environment, and accurate air quality forecasts can provide timely air quality alerts to help relevant departments intervene in high-pollution events to protect people's health. People can refer to air quality forecasts to choose appropriate outdoor activity time and address. Therefore, analyzing and predicting air quality is of great significance to reducing pollutants and reducing the harm of pollutants to the human body, and can also help the country to better achieve carbon neutrality goals to a certain extent.
[0003] Existing air quality forecasting methods are mainly divided into numerical analysis and statistical forecasting. Numerical analysis is suitable for forecasting in large-scale areas and has the advantage of revealing pollution mechanisms. However, the forecasting cost of this method is high, the requirements for the required data are relatively strict, and it is impossible to achieve real-time online air quality forecasting. The statistical forecasting method is suitable for short-term and small-scale forecasting tasks and has the advantage of low cost. However, this method cannot meet the needs of long-term air quality forecasting and has low forecasting accuracy. Traditional forecasting methods have low accuracy when processing nonlinear and non-stationary air quality data. At the same time, air quality is affected by many factors and has uncertainty and complexity. Traditional artificial neural networks, back propagation neural networks and regression forecasting methods are difficult to accurately predict and learn the internal laws between different air quality indicators.
[0004] In recent years, artificial intelligence and machine learning have been widely used in the fields of environmental protection and air quality forecasting, becoming a research hotspot and development trend in the global environmental protection field. As an emerging machine learning algorithm, deep learning methods learn from a large amount of data to discover the intrinsic characteristics, thereby improving the accuracy of classification and prediction. Compared with traditional machine learning models such as artificial neural networks and support vector machines, prediction models based on deep learning perform better in data feature capture and prediction accuracy. Deep learning technology has advantages in extracting time series information from sequence data, and can improve prediction accuracy compared to traditional machine learning methods. However, the current air quality prediction methods based on deep learning are usually modeled in one domain, lacking the exploration of the fusion of features from different domains. Summary of the invention
[0005] In view of the shortcomings of the prior art, the present invention proposes an air quality prediction method that integrates data features from different domains. The method comprises: acquiring air quality data and meteorological data in real time, preprocessing the air quality data and meteorological data to obtain input data, and inputting the input data into a trained air quality prediction model to obtain an air quality prediction result;
[0006] The training process of the air quality prediction model includes:
[0007] S1: Acquire air quality data and meteorological data, pre-process the air quality data and meteorological data to obtain input data;
[0008] S2: Perform STFT processing on the input data to obtain time-frequency features, input the time-frequency features into the first complex time-frequency module for processing to obtain time-frequency feature masking, and multiply the input data and the time-frequency feature masking to obtain the first feature vector;
[0009] S3: Use the time domain module to process the input data to obtain the time domain feature vector; perform STFT processing on the time domain feature vector to obtain the second feature vector;
[0010] S4: Use the channel attention mechanism to process the time-frequency features, the first eigenvector and the second eigenvector to obtain the fusion features;
[0011] S5: Input the fusion feature into the second complex time-frequency module for processing to obtain the second time-frequency feature; multiply the input vector and the second time-frequency feature, perform iSTFT processing on the multiplication result, and obtain the air quality prediction result;
[0012] S6: Calculate the total model loss and adjust the model parameters according to the total model loss to obtain a trained air quality prediction model.
[0013] Preferably, the air quality data includes concentration data of six atmospheric pollutants: PM2.5, PM10, SO2, NO2, O3, and CO; the meteorological data includes six data: precipitation, wind speed, wind direction, air pressure, temperature, and humidity.
[0014] Preferably, the process of preprocessing the air quality data and the meteorological data includes: filling the missing values in the air quality data and the meteorological data using a linear interpolation method; and normalizing the filled data to obtain input data.
[0015] Preferably, the complex time-frequency module includes six encoders, two LSTM layers, a fully connected layer and six decoders arranged in sequence; the encoder is composed of a convolution layer, a batch normalization layer and an activation function, and the decoder is composed of a deconvolution layer, a batch normalization layer and an activation function; the input of the complex time-frequency module is multiplied by the output of the last decoder as the output of the complex time-frequency module; the complex time-frequency module also includes a skip connection.
[0016] Furthermore, the jump connection method is as follows: the first encoder output and the fifth decoder output are fused by jump connection, the second encoder output and the fourth decoder output are fused by jump connection, the third encoder output and the third decoder output are fused by jump connection, the fourth encoder output and the second decoder output are fused by jump connection, the fifth encoder output and the first decoder output are fused by jump connection, and the sixth encoder output and the output of the fully connected layer are fused by jump connection.
[0017] Preferably, the time domain module includes 12 downsampling blocks, two convolutional layers, 12 upsampling blocks, and 13 Concat layers; the first convolutional layer is located between the last downsampling block and the first upsampling block, and the second convolutional layer is located after the last upsampling block; each downsampling block is composed of a convolutional layer and a downsampling layer, and each upsampling block is composed of a convolutional layer and an upsampling layer; the Concat layer is used to splice the output of the downsampling block with the output of its corresponding upsampling block in reverse order.
[0018] Preferably, the channel attention mechanism processes the time-frequency feature, the first feature vector and the second feature vector as follows:
[0019] G(X)=β(Conv2(Re(β(Conv1(g(X))))))
[0020] L(X)=β(Conv2(Re(β(Conv1(X)))))
[0021]
[0022] Among them, G(X) represents global channel context information, L(X) represents local channel context information, β represents batch normalization operation, g() represents global average pooling, Conv1 represents the first convolution operation, Conv2 represents the second convolution operation, and X represents the feature vector after the first feature vector, time-frequency feature and the second feature vector are concatenated in the channel dimension; represents element-wise multiplication, represents broadcast addition, sig represents the sigmoid function, Represents fusion features.
[0023] Preferably, the total loss is the sum of the mean square error losses of the time domain module and the two complex time-frequency modules.
[0024] The beneficial effects of the present invention are as follows: the present invention designs a complex time-frequency module and a time domain module, which fuses the time domain features and time-frequency features of air quality data and meteorological data, while considering the time domain and frequency domain information of the data, and fuses the features of different domains, so that the air quality prediction model can better learn the deep features of the air quality data, improve the accuracy of the model prediction results, and thus obtain better prediction results. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 is a training flow chart of the air quality prediction model in the present invention;
[0026] Figure 2 It is a schematic diagram of the structure of the air quality prediction model in the present invention;
[0027] Figure 3 It is a schematic diagram of the structure of the complex time-frequency module in the present invention;
[0028] Figure 4 It is a schematic diagram of the structure of the time domain module in the present invention;
[0029] Figure 5 Schematic diagram of the channel attention mechanism structure in the present invention. DETAILED DESCRIPTION
[0030] The technical scheme in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is only a part of the embodiment of the present invention, not all of the embodiments. Based on the embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0031] The present invention proposes an air quality prediction method that integrates data features from different domains. The method comprises: acquiring air quality data and meteorological data in real time, where the meteorological data may be a forecast value of a weather forecast, preprocessing the air quality data and the meteorological data to obtain input data, and inputting the input data into a trained air quality prediction model to obtain an air quality prediction result.
[0032] like Figure 1 As shown in Figure 1, the training process of the air quality prediction model includes:
[0033] S1: Acquire air quality data and meteorological data, pre-process the air quality data and meteorological data, and obtain input data.
[0034] Preferably, the air quality data is the concentration data of six kinds of atmospheric pollutants, namely PM2.5, PM10, SO2, NO2, O3 and CO; the meteorological data is the six kinds of data, namely, the predicted precipitation, wind speed, wind direction, air pressure, temperature and humidity. Among them, the temperature unit is ℃, the air pressure unit is hectopascal (hPa), the humidity unit is percentage (%), the wind direction unit is defined as the angle clockwise from the north, the wind speed unit is m / s, and the precipitation index is millimeter (mm).
[0035] Use this data to construct training and test data sets for model training and evaluation. The training data set will contain historical air quality and meteorological data records, where each sample includes air quality and meteorological data for a period of time in the past, as well as the corresponding target variable, i.e., the air quality of the period to be predicted. The test data set is used to evaluate the prediction performance and accuracy of the training model. During training, the above 12 types of data need to be input into the model at the same time for training.
[0036] Preprocess air quality data and meteorological data:
[0037] Since air quality data is obtained through sensors, there may be special circumstances or human interference that lead to inaccurate data or the sensor stops collecting data, which will lead to missing values in the air quality data. If the missing values are not supplemented, the prediction accuracy of the model will be affected. Therefore, linear interpolation is used to fill the missing values in the air quality data and meteorological data. In order to make the model more generalizable to different data, the filled data is normalized:
[0038]
[0039] Among them, X is the original data, X min It represents the minimum value in the original data, X max It represents the maximum value in the original data. The processed historical data is divided into 90% training set and 10% test set according to the proportion.
[0040] S2: Perform STFT processing on the input data to obtain time-frequency features, input the time-frequency features into the first complex time-frequency module for processing to obtain time-frequency feature masking, and multiply the input data and the time-frequency feature masking to obtain the first feature vector;
[0041] At present, the air quality prediction model based on deep learning is usually carried out in one domain (time domain or time-frequency domain). However, no matter it is the time domain or the time-frequency domain, each domain will provide different feature information, which can enhance the performance of the air quality prediction model at different levels. Therefore, the present invention scientifically integrates the features of different domains by using a parallel structure and a channel attention mechanism to improve the accuracy of air quality prediction. The structure of the air quality prediction model is as follows: Figure 2 As shown in the figure, the model consists of two parts: a parallel part and a cascade part for further modeling the parallel output, where the parallel part includes a complex time-frequency module and a time domain module. The cascade part is a complex time-frequency module. The input data is 12 channels of air quality and meteorological data, and the data processing process in the model is:
[0042] Perform short-time Fourier transform on the input data, specifically:
[0043] The data of each channel is processed by STFT (short-time Fourier transform) respectively, and then the data of each channel is spliced to the channel dimension as the input of the complex time-frequency module, and the short-time Fourier transform is the convolution short-time Fourier transform (Conv-STFT), and Conv-STFT converts the time domain signal into the real and imaginary parts of the Cartesian coordinate system. For the Conv-STFT operation, the present invention uses a Hanning window, sets the window length to 400 sampling points, and sets the window movement to 100 sampling points. The real and imaginary parts obtained from this process are spliced together along the channel dimension as the input of the subsequent module.
[0044] The time-frequency features of the input data are input into the first complex time-frequency module for processing to obtain a time-frequency feature mask; the input data and the time-frequency feature mask are multiplied to obtain a first feature vector. The first complex time-frequency module designed by the present invention is mainly based on a causal convolutional encoder-decoder architecture, and two LSTM layers are inserted between the encoder and the decoder. Its structure is as follows Figure 3 As shown in the figure, the complex time-frequency module includes six encoders, two LSTM layers, a fully connected layer and six decoders arranged in sequence. Both the encoder and the decoder are Conv2d blocks. The encoder consists of a convolution layer, a batch normalization layer and an activation function, which is responsible for extracting high-dimensional features from the input signal and reducing its resolution. The number of output channels of each layer in the encoder is 16, 32, 64, 128, 128, and 256 respectively. The convolution kernel size and stride of the Conv2d block are set to (5, 2) and (2, 1) respectively. The decoder consists of a deconvolution layer, a batch normalization layer and an activation function. The decoder decodes the low-resolution features processed by the encoder and reconstructs them to the original size. The LSTM unit has 256 hidden layers. The input of the complex time-frequency module is multiplied by the output of the last decoder as the output of the complex time-frequency module. The complex time-frequency module also includes a jump connection, which enhances the efficiency of gradient transfer through the jump connection and plays a key role in establishing a connection between the encoder and the decoder, so that the model has a higher learning efficiency and can output more accurate prediction results.
[0045] Preferably, the jump connection method is: the first encoder output and the fifth decoder output are fused by jump connection, the second encoder output and the fourth decoder output are fused by jump connection, the third encoder output and the third decoder output are fused by jump connection, the fourth encoder output and the second decoder output are fused by jump connection, the fifth encoder output and the first decoder output are fused by jump connection, and the sixth encoder output and the output of the fully connected layer are fused by jump connection.
[0046] S3: Use the time domain module to process the input data to obtain a time domain feature vector; perform STFT processing on the time domain feature vector to obtain a second feature vector.
[0047] like Figure 4 As shown in the figure, the time domain module includes 12 downsampling blocks, two convolutional layers, 12 upsampling blocks and 13 Concat layers; the first convolutional layer is located between the last downsampling block and the first upsampling block, and the second convolutional layer is located after the last upsampling block; each downsampling block is composed of a convolutional layer and a downsampling layer, and each upsampling block is composed of a convolutional layer and an upsampling layer; the Concat layer is used to splice the output of the downsampling block with the output of the corresponding upsampling block in reverse order, and the Concat layer splices the high-dimensional features processed in the current stage with more local features. This splicing is crucial for modeling the global and local features of the input signal at the same time, ensuring that a more comprehensive feature representation can be obtained.
[0048] The time domain module uses downsampling blocks to extract high-dimensional features in the time dimension. By gradually increasing the number of downsampling blocks, the network is able to learn signal features at different time scales. These high-dimensional features are then integrated with local, high-resolution features calculated in the early stages. This integration is achieved through upsampling blocks, which effectively combine these diverse features. The time domain network structure of the present invention includes a total of 12 levels, and the time resolution of each subsequent level is half of the previous level. This hierarchical structure enables the network to learn information at multiple time scales and enhances the module's ability to make accurate predictions. The downsampling block plays a key role in the architecture, effectively halving the time dimension resolution by discarding a feature every other time step. In contrast, the upsampling block upsamples in the time direction through linear interpolation, which doubles the time resolution, and the entire structure presents a symmetrical relationship.
[0049] S4: The channel attention mechanism is used to process the time-frequency features, the first eigenvector and the second eigenvector to obtain the fused features.
[0050] In order to efficiently fuse the features of different channels in the parallel structure, the present invention adopts a channel attention mechanism in the input part of the cascade module, which can assign different weights to the time domain, time-frequency domain and original input data, so that the network can autonomously determine the best fusion method. Figure 5 As shown in Figure 1, the channel attention mechanism includes several key components: Global Average Pooling (GAP) is used to learn the global context information of the channel, and a two-dimensional convolution with a kernel size of 1x1 is used to learn local channel context information. This method uses a bottleneck structure to calculate two types of channel context information: global channel context and local channel context Where C, T and F represent the dimensions of channel, time and frequency respectively.
[0051] The channel attention mechanism processes the time-frequency features, the first eigenvector and the second eigenvector as follows:
[0052] G(X)=β(Conv2(Re(β(Conv1(g(X))))))
[0053] L(X)=β(Conv2(Re(β(Conv1(X)))))
[0054]
[0055] Among them, G(X) represents the global channel context information, L(X) represents the local channel context information, β represents the batch normalization operation, g() represents the global average pooling, and Conv1 represents the number of channels from C to Convolution; Conv2 indicates that the number of channels is increased from becomes the convolution of C; X represents the feature vector after the time-frequency feature, the first feature vector and the second feature vector are concatenated in the channel dimension; represents element-wise multiplication, represents broadcast addition, sig represents the sigmoid function, Represents fusion features.
[0056] S5: Input the fused features into the second complex time-frequency module for processing to obtain the second time-frequency features; multiply the input data and the second time-frequency features, perform iSTFT (inverse short-time Fourier transform) processing on the multiplication result to obtain the air quality prediction result.
[0057] The second complex time-frequency module has the same structure as the first complex time-frequency module.
[0058] S6: Calculate the total model loss and adjust the model parameters according to the total model loss to obtain a trained air quality prediction model.
[0059] Preferably, the air quality prediction model is trained for 100 epochs, with a batch size of 30 for each training. During the training process, the initial learning rate is set to 0.001 and is reduced by half when the loss of the validation set increases. The model uses PyTorch as a deep learning framework. The loss function used by the model adopts the mean square error (MSE). The total loss of the model is the sum of the mean square error losses of the time domain module and the two complex time-frequency modules. The calculation formula of MSE is:
[0060]
[0061] Among them, L represents the total loss of the model, o i represents the actual value of the target air quality at the i-th moment, p i It represents the air quality prediction value output by the module at the i-th moment, and n represents the total duration.
[0062] According to the total loss of the model, back propagation is performed, the model parameters are adjusted, and the optimal model parameters are saved to obtain a trained air quality prediction model. Air quality data and meteorological data are obtained in real time, and the air quality data and meteorological data are preprocessed to obtain input data, and the input data is input into the trained air quality prediction model to obtain air quality prediction results.
[0063] Evaluation of the present invention:
[0064] The present invention is compared with the "regression model for self-built point air quality data calibration" in the prior art, and the results are shown in Table 1:
[0065] Table 1 Error comparison between the present invention and the comparative model
[0066]
[0067] It can be seen from Table 1 that the present invention has better prediction performance, which proves that scientifically integrating features from different domains can better help the model achieve better modeling effects, thereby obtaining better prediction values.
[0068] The above embodiments further illustrate the purpose, technical solutions and advantages of the present invention in detail. It should be understood that the above embodiments are only preferred implementation modes of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made to the present invention within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An air quality prediction method integrating data features from different domains, characterized in that: include: Acquire air quality data and meteorological data in real time, pre-process the air quality data and meteorological data to obtain input data, input the input data into the trained air quality prediction model to obtain air quality prediction results; The training process of the air quality prediction model includes: S1: Acquire air quality data and meteorological data, pre-process the air quality data and meteorological data to obtain input data; S2: Perform STFT processing on the input data to obtain time-frequency features, input the time-frequency features into the first complex time-frequency module for processing to obtain time-frequency feature masking, and multiply the input data and the time-frequency feature masking to obtain the first feature vector; the first complex time-frequency module includes six encoders, two LSTM layers, a fully connected layer and six decoders arranged in sequence; the encoder is composed of a convolution layer, a batch normalization layer and an activation function, and the decoder is composed of a deconvolution layer, a batch normalization layer and an activation function; the input of the complex time-frequency module is multiplied by the output of the last decoder as the output of the complex time-frequency module; the complex time-frequency module also includes a jump connection; the jump connection method is: the output of the first encoder is fused with the output of the fifth decoder by a jump connection, the output of the second encoder is fused with the output of the fourth decoder by a jump connection, the output of the third encoder is fused with the output of the third decoder by a jump connection, the output of the fourth encoder is fused with the output of the second decoder by a jump connection, the output of the fifth encoder is fused with the output of the first decoder by a jump connection, and the output of the sixth encoder is fused with the output of the fully connected layer by a jump connection; S3: Use the time domain module to process the input data to obtain the time domain feature vector; perform STFT processing on the time domain feature vector to obtain the second feature vector; the time domain module includes 12 downsampling blocks, two convolutional layers, 12 upsampling blocks, and 13 Concat layers; the first convolutional layer is located between the last downsampling block and the first upsampling block, and the second convolutional layer is located after the last upsampling block; each downsampling block is composed of a convolutional layer and a downsampling layer, and each upsampling block is composed of a convolutional layer and an upsampling layer; the Concat layer is used to concatenate the output of the downsampling block with the output of the corresponding upsampling block in reverse order; S4: Use the channel attention mechanism to process the time-frequency features, the first eigenvector and the second eigenvector to obtain the fusion features; S5: Input the fusion feature into the second complex time-frequency module for processing to obtain the second time-frequency feature; multiply the input data and the second time-frequency feature, perform iSTFT processing on the multiplication result, and obtain the air quality prediction result; the structure of the second complex time-frequency module is the same as that of the first complex time-frequency module; S6: Calculate the total model loss and adjust the model parameters according to the total model loss to obtain a trained air quality prediction model.
2. The air quality prediction method for integrating data features from different domains according to claim 1 is characterized in that: The air quality data include concentration data of six atmospheric pollutants: PM2.5, PM10, SO2, NO2, O3 and CO; the meteorological data include six data: precipitation, wind speed, wind direction, air pressure, temperature and humidity.
3. The air quality prediction method for integrating data features from different domains according to claim 1 is characterized in that: The process of preprocessing the air quality data and the meteorological data includes: filling the missing values in the air quality data and the meteorological data by using the linear interpolation method; and normalizing the filled data to obtain the input data.
4. The air quality prediction method for integrating data features from different domains according to claim 1 is characterized in that: The channel attention mechanism processes the time-frequency features, the first eigenvector and the second eigenvector as follows: G(η)=β(Conv2(Re(β(Conv1(g(η)))))) L(η)=β(Conv2(Re(β(Conv1(X))))) Among them, G(X) represents global channel context information, L(X) represents local channel context information, β represents batch normalization operation, g() represents global average pooling, Conv1 represents the first convolution operation, Conv2 represents the second convolution operation, and η represents the feature vector after the first feature vector, time-frequency feature and second feature vector are concatenated in the channel dimension; represents element-wise multiplication, represents broadcast addition, sig represents the sigmoid function, Represents fusion features.
5. The air quality prediction method for integrating data features from different domains according to claim 1 is characterized in that: The total loss of the model is the sum of the mean square error losses of the time domain module and the two complex time-frequency modules.
Citation Information
Patent Citations
Sound source separation method based on double attention mechanism and multi-stage hybrid convolutional network
CN113241092A
Audio enhancement method and apparatus, and electronic device and readable storage medium
WO2023226839A1