Lightning waveform classification method based on multi-scale residual network
Through the combination of multi-scale residual network and self-attention mechanism, the problem of insufficient accuracy in lightning waveform classification of traditional methods is solved, and high-precision and robust lightning waveform classification is achieved.
Patent Information
- Application Number
- CN202510795619.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-16
- Publication Date
- 2025-07-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, traditional lightning waveform classification methods are difficult to capture complex lightning waveform information in a comprehensive and accurate manner, resulting in insufficient classification accuracy and reliability, and insufficient generalization capabilities of deep learning algorithms when facing diversity and complex waveform features.
The multi-scale residual network (MSRES-SA) model is used, combined with the multi-scale residual feature extraction module and the self-attention mechanism, and the multi-scale residual feature extraction module captures the features on different time scales, and uses the self-attention mechanism for dynamic weighting, and uses the full connection layer and softmax function for classification, and the cross-entropy function optimizes the model parameters.
It improves the accuracy and robustness of lightning waveform classification, enhances the selective attention to key features, reduces the impact of irrelevant or redundant data, and achieves high-precision lightning type recognition.
Smart Images

Figure CN120337011A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of lightning detection and signal processing, and in particular to a lightning waveform classification method based on a multi-scale residual network. Background Art
[0002] The recognition and classification of lightning waveforms are of great significance in the fields of lightning protection and meteorology. By identifying different types of lightning waveforms, the characteristics, development process of lightning and its impact on the environment can be better understood. A large number of cloud-to-ground flashes indicate regional thunderstorms, and accurately identifying the lightning type can improve the safety of aircraft navigation. The distinction of lightning types mainly relies on identifying the waveform of specific discharge events unique to different types of lightning. Traditional lightning waveform classification methods usually adopt statistical rules. The advantage of using statistical methods is that it can utilize the similarity of each class of signals, which belongs to a high-probability classification method, with a simple calculation process and a relatively fast classification speed. However, the disadvantage of this method is that different statistical methods or based on different data sources may lead to differences in statistical results. In addition, statistical rules usually are difficult to comprehensively and accurately express all the characteristics of waveforms, so it may not be able to fully capture complex lightning waveform information, affecting the accuracy and reliability of classification.
[0003] In recent years, machine learning algorithms can learn from data and make predictions or decisions, and have also been widely used in lightning waveform recognition. Compared with the traditional method of identifying and classifying lightning characteristics defined by humans, machine learning has a higher accuracy for lightning identification and classification. However, traditional machine learning methods rely on simple linear mathematical models, which perform well in identifying single waveforms and cannot effectively capture the deep structure of data.
[0004] Deep learning can better handle large-scale and complex non-linear relationships compared with traditional machine learning methods. Deep learning methods can automatically extract key features, improve the classification accuracy, and significantly reduce manual intervention. However, due to the problems of data diversity and complex waveform features faced by lightning type recognition, the accuracy and generalization ability of deep learning algorithms for identifying lightning waveforms are insufficient in the prior art. Summary of the Invention
[0005] In order to overcome the above problems existing in the prior art, the present invention proposes a lightning waveform classification method based on a multi-scale residual network.
[0006] The technical solution adopted by the present invention to solve its technical problems is: a lightning waveform classification method based on a multi-scale residual network, including the following steps: Step 1, obtain a lightning waveform data set containing multiple types, and preprocess the data set; Step 2: Construct the MSRES-SA model, and use the dataset obtained in Step 1 to train the MSRES-SA model to obtain a lightning waveform classification model; Step 3: Extract the features of the lightning waveform at different time scales through the multi-scale residual feature extraction module; introduce the self-attention mechanism to dynamically weight the extracted features, use the fully connected layer and the softmax function for classification, and output the probability distribution of each lightning type; Step 4: Adopt the cross-entropy function as the optimization objective function in the training process to update the model parameters; The MSRES-SA model includes an input layer, a multi-scale residual feature extraction module, a self-attention mechanism, a pooling layer, and a fully connected layer. The multi-scale residual feature extraction module includes convolution kernels of various different sizes. The small convolution kernel is used to capture the local details of the lightning features, and the large convolution kernel is used to understand the context information.
[0007] For the above-mentioned lightning waveform classification method based on the multi-scale residual network, Step 1 specifically includes: Step A: The selected lightning waveforms include five waveforms: positive cloud-to-ground flash, negative cloud-to-ground flash, NBE, M component, and pre-breakdown; Step B: The splitting ratio of the training dataset and the test dataset in the entire dataset is 7:3; Step C: The data preprocessing method adopts normalization processing; The normalization processing adopts maximum absolute value normalization, which reduces the range of all data values to between [-1, 1]. For each feature x in the data, the calculation formula is as follows: ; where represents the maximum absolute value of the feature.
[0008] For the above-mentioned lightning waveform classification method based on the multi-scale residual network, the specific working process of the self-attention mechanism in Step 3 is as follows: For a given set of features Z = , the feature is transformed into a high-dimensional feature vector through a linear transformation, denoted as , is a learnable embedding weight matrix, is the embedded feature vector; the embedded feature is mapped to the query, key, and value spaces through three independent linear layers, denoted as , , , , and are learnable weight matrices; the dot product similarity between the query and the key, and use the scaling factor Normalize to calculate the attention score matrix A; apply the softmax function to normalize each row to obtain the attention weight matrix; use the attention weights to weighted sum the value vectors to obtain the final features.
[0009] For the above lightning waveform classification method based on a multi-scale residual network, the formula for the attention weight matrix Attention(A) is: ; Where is the scaling factor, , .
[0010] For the above lightning waveform classification method based on a multi-scale residual network, in step 4, the probability distribution ability of lightning waveform classification based on the CEL metric model is specifically calculated by the formula: ; Where is the true label that the i-th sample belongs to the c-th class, is the probability that the model predicts the i-th sample belongs to the c-th class, N is the size of the dataset, and C is the number of classes.
[0011] The beneficial effects of the present invention are that the design of the multi-scale residual block of the present invention allows the model to simultaneously learn feature representations at different scales, ensuring high robustness and generalization ability even in complex and variable lightning waveform data. The attention mechanism enhances the model's selective attention ability to key features in the waveform features, enabling the model to more effectively capture the feature information crucial for classification while reducing the influence of irrelevant or redundant data. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 is the schematic flow diagram of the present invention; Figure 2 is the enlarged diagram of the ground flash return stroke waveform in the embodiment of the present invention; Figure 3 is the waveform example in the embodiment of the present invention, where (a) is NBE, (b) is the M component, and (c) is pre-breakdown; Figure 4 is the structural diagram of the multi-scale residual block of the present invention; Figure 5 is the training curves of two deep learning models in the embodiment of the present invention, where (a) is the loss curve on the test set during training, and (b) is the accuracy change curve on the test set during training; Figure 6This is the training curve of MSRES-SA and its variants in the embodiments of the present invention, where (a) is the loss curve of each variant during the iteration process, and (b) is the accuracy change curve of each variant during the iteration process. Detailed implementation manners
[0013] To enable those skilled in the art to better understand the technical solutions of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific implementation manners.
[0014] As Figure 1 shown, this embodiment discloses a lightning waveform classification method based on a multi-scale residual network, specifically including: Step 1: Obtain lightning waveform datasets of multiple types, and then preprocess the datasets, and use the preprocessed data as the datasets for training and predicting the MSRES-SA model.
[0015] The selected lightning waveforms include positive cloud-to-ground flash, negative cloud-to-ground flash, NBE, M component, and pre-breakdown waveforms; the splitting ratio of the training dataset and the test dataset in the entire dataset is 7:3; the data preprocessing method uses normalization processing. In this embodiment, the obtained dataset is from the Nanjing Lightning Location Network self-built by Nanjing University of Information Science and Technology in 2015. In 2018, the station network was upgraded from five stations to seven stations, corresponding to Nanjing University of Information Science and Technology, Xianlin Campus of Nanjing University, Pukou District Meteorological Bureau, Liuhe District Meteorological Bureau, Jiangning District Meteorological Bureau, Yizheng City Meteorological Bureau, and Jurong City Meteorological Bureau respectively. The distribution of the station locations is relatively concentrated. The baseline length between each observation sub-station is between 21 km and 60 km, and the altitude does not exceed 60 m. All 7 observation stations are equipped with 10 kHz small magnetic antennas, 100 kHz small magnetic antennas, 10 kHz large magnetic antennas, and fast electric fields. All 7 stations are equipped with orthogonal magnetic antennas and lightning fast electric field change detectors (referred to as fast antennas) and low-speed large-capacity data acquisition systems to detect the magnetic field of lightning. Each sub-station sets different trigger thresholds according to the surrounding noise environment. The bandwidth of the magnetic antenna is 10 Hz to 500 kHz, and the data sampling rate is 1 MHz.
[0017] 5 types of lightning waveforms were selected from the waveform data detected by the 10 kHz small magnetic antenna received by the Nanjing station network on July 24, 2018, with a total of 5,487, including 1,198 positive cloud-to-ground flashes, 870 negative cloud-to-ground flashes, 1,210 NBEs, 1,330 M components, and 879 pre-breakdowns. The entire dataset is divided into a training dataset and a test dataset, and the splitting ratio is 7:3. Figure 2 This is an enlarged view of the cloud-to-ground lightning return stroke waveform. Figure 3 This is for NBE ( Figure 3 in (a)), M component ( Figure 3 in (b)), pre-breakdown ( Figure 3Waveform schematic diagram in (c).
[0018] Data normalization is the process of mapping data to a specified range using a certain algorithm, removing unit limitations, and converting it into a dimensionless pure value. Normalizing the data before training the model can accelerate the convergence of the model and ensure the stability of the numerical values. To maintain the waveform characteristics of lightning, this paper uses maximum absolute value normalization to narrow the range of all data values to between [-1, 1]. For each feature x in the data, the calculation formula is as follows: ; where represents the maximum absolute value of the feature.
[0019] Step 2: Extract the features of the lightning waveform at different time scales through the multi-scale residual feature extraction module.
[0020] The introduction of the multi-scale residual block MSRES in Step 2 enables it to capture the features of the input signal from different scales, which is particularly important for lightning waveform data because different types of lightning may exhibit unique patterns at different time scales. Through multi-scale feature fusion, the model can comprehensively understand the lightning waveform features from fine-grained to coarse-grained to improve the classification accuracy. The residual connection can effectively solve the problem of gradient disappearance or explosion by directly passing the input to the subsequent layers, enabling the network to better learn and optimize. The internal structure of MSRES is as Figure 4 shown.
[0021] In the MSRES module, four different sizes of convolutional kernels are designed, namely , , , . For smaller convolutional kernels such as and , they can well capture the local details of the lightning features, while larger convolutional kernels such as and help to understand more extensive context information. The formula of the multi-scale residual module is shown in (2)-(7): ; ; ; ; ; ; where is the weight of the convolutional kernel, is the input at the One feature, is the bias, is the -th output after convolution by a convolutional kernel of size , and is the activation function.
[0022] Step 3: Introduce the self-attention mechanism to dynamically weight the extracted features to capture long-range dependencies in the waveform sequence. Use a fully connected layer and the softmax function for classification to output the probability distribution of each class.
[0023] To effectively capture long-range dependencies in lightning waveform data and enhance the model's ability to understand the global context, we introduce the attention module SA in the network. The attention mechanism enables the model to dynamically focus on the most critical parts of the input sequence by calculating the correlation between each feature in the waveform features and all other features, thereby improving the quality of feature representation.
[0024] For a given set of features Z = , where each feature represents a feature. First, linearly transform the feature into a high-dimensional feature vector, denoted as , where is the learnable embedding weight matrix, is the embedded feature vector. Second, map the embedded features to the query (Query), key (Key), and value (Value) spaces through three independent linear layers, denoted as , , , where , and are the learnable weight matrices. Then calculate the dot product similarity between the query and the key, and use a scaling factor for normalization to calculate the attention score matrix A, as shown in Equation (8): ; where is the scaling factor. Then apply the softmax function to normalize each row to obtain the attention weight matrix Attention(A): ; Finally, weight and sum the value vectors using the attention weights to obtain the final feature.
[0025] Step 4: Adopt the cross-entropy loss function as the objective function to be optimized during training to learn and update the model parameters.
[0026] In step 4, in order to learn and update the parameters in the model, the present invention adopts the cross-entropy loss function as the objective function to be optimized during the training process. CEL is widely used in multi-classification problems due to its effective measurement ability for the difference in probability distributions.
[0027] For a dataset of size N, each sample has C possible classes. For the i-th sample, the true label is represented using one-hot encoding as , where only one element is 1 and the rest are 0. The predicted output of the model for this sample is a probability vector of length C . CEL is defined as follows: ; where, is the true label (0 or 1) that the i-th sample belongs to the c-th class, is the probability that the model predicts the i-th sample belongs to the c-th class.
[0028] Step 5, conduct experimental result analysis.
[0029] The training of the MSRES-SA model is completed under the Pytorch 12.6 deep learning framework, and the hardware system is a Windows system. During training, the Adam optimizer with a fast convergence speed is selected, the initial learning rate is set to 0.001, the number of iterations is 100 rounds, and the training batch size is set to 16.
[0030] To verify the performance of the proposed MSRES-SA model, this embodiment uses the classification accuracy, average accuracy, and F1-Score of each category to evaluate the performance of the model. Five machine learning models including SVM, K-nearest neighbor, decision tree, random forest, and MLP, and a deep learning model proposed by Wang in 2020 (specifically recorded in Sensors, journal number 2020, 20(4): 1030, named Classification of VLF / LF Lightning Signals Using Sensors and Deep Learning Methods, and this embodiment uses Wang to represent this deep learning model) are selected as the baseline models in this article.
[0031] Figure 5 For the loss curve ( Figure 5 (a) in Figure 5In (a)). As shown in the figure, during the entire training phase, MSRES-SA exhibited a relatively low initial loss value, and as the number of iterations increased, its loss value continued to decline to a relatively stable level, indicating that the model could effectively fit the training data while avoiding overfitting. In contrast, although Wang also experienced a process of loss reduction, its convergence speed was slower and the accuracy at the final stable state was lower than that of MSRES-SA. This indicates that MSRES-SA has significant advantages in processing complex one-dimensional lightning feature extraction.
[0032] To comprehensively evaluate the performance of the proposed MSRES-SE model in the lightning waveform classification task, a comparative experiment was conducted with a baseline model. Table 1 summarizes the classification accuracies of different models in each category and the overall performance metrics.
[0033] Table 1 Comparison of Classification Accuracies between Baseline Methods and the MSRES-SE Model
[0034] As can be seen from Table 1, MSRES-SA achieved the highest classification accuracy in all five classification sub-tasks, and its average accuracy was 99.35%, significantly better than all other baseline models. In addition, MSRES-SE also showed the best overall F1 score of 0.987, indicating that it not only has high precision but also performs excellently in terms of balance among different categories. Especially for the recognition of the NBE category, MSRES-SA achieved an accuracy of 99.34%, which was approximately 3 percentage points higher than the closest Wang. This result emphasizes the unique advantages of MSRES-SA in dealing with complex pattern recognition problems, especially for features that are difficult to effectively distinguish by traditional methods.
[0035] To further verify the effectiveness of each key component in MSRES-SA, ablation experiments were conducted. Specifically, the performance of the model was tested after removing the multi-scale residual module (-MSRES), removing the self-attention module (-SA), and removing both components simultaneously (-MSRES-SA).
[0036] Figure 6 The loss curves of each variant during the iteration process ( Figure 6 in (a)) and the accuracy change curves ( Figure 6As shown in Fig. (b), it can be seen that the complete MSRES-SA can achieve the lowest loss and the highest accuracy after convergence, but its convergence speed is a bit slower compared to other variants. This is because both the MSRES module and the SA module increase the computational complexity of the model. After removing these components, the computational amount of the model decreases, the feature space of the model is simplified, the mutual dependence between features is reduced, and the time required for each training iteration is shorter, thus accelerating the convergence process.
[0037] Table 2 Comparison of Classification Accuracy between Baseline Methods and MSRES-SE Model
[0038] Table 2 shows the accuracy, average accuracy, and F1-score of these variants on each classification subtask. It can be seen that the complete version of the MSRES-SA model shows the highest accuracy on all classification subtasks, and its average accuracy reaches 99.35% and the F1-score is 0.987, significantly outperforming any other variant. This indicates that both the multi-scale module and the self-attention mechanism are crucial for improving the overall performance of the model. The functions of each component are analyzed as follows: (1) - MSRES: When the multi-scale module is removed, the average accuracy of the model drops to 97.54% and the F1-score drops to 0.948. Especially in the NBE category, the accuracy drops from 99.34% to 95.48%, showing the importance of the multi-scale module in processing complex features.
[0039] (2) - SA: After removing the self-attention mechanism alone, the average accuracy of the model is 98.79% and the F1-score is 0.974. Although this variant performs well in some categories (such as +CG reaching 99.50%), its overall performance is still lower than that of the complete MSRES-SA model. This indicates that the self-attention mechanism plays a key role in capturing important information in the sequence.
[0040] (3) - MSRES-SA: When both components are removed, the performance of the model drops significantly, with the average accuracy only being 96.98% and the F1-score being 0.922. Because after removing the multi-scale residual block, the model loses its ability to capture lightning waveform features across different resolutions; after removing the attention block, the model's ability to focus on key information in the waveform is weakened, resulting in a significant drop in the model's performance.
[0041] From the results of the above ablation experiments, it can be found that both the multi-scale module and the self-attention mechanism play crucial roles in MSRES-SA. The multi-scale module can capture features at different scales, thereby enhancing the model's ability to recognize complex signal patterns. By extracting features at multiple scales, the model can better process lightning waveform data with different frequencies and time scales, thus improving the model's robustness and generalization ability. The self-attention mechanism can dynamically focus on important parts of the input sequence, enabling the model to more efficiently capture key information when processing long sequences. This mechanism allows the model to perform information interaction between different positions, enhancing the model's understanding of local and global features, and thus improving the accuracy of the classification task.
[0042] The above embodiments are only exemplary embodiments of the present invention and are not used to limit the present invention. Those skilled in the art can make various modifications or equivalent replacements to the present invention within the essence and protection scope of the present invention, and such modifications or equivalent replacements should also be regarded as falling within the protection scope of the present invention.
Claims
1. A lightning waveform classification method based on a multi-scale residual network, characterized in that, It includes the following steps: Step 1: Obtain a lightning waveform dataset containing multiple types and preprocess the dataset; Step 2: Build an MSRES-SA model, and use the dataset obtained in Step 1 to train the MSRES-SA model to obtain a lightning waveform classification model; Step 3: Extract the features of the lightning waveform at different time scales through a multi-scale residual feature extraction module; introduce a self-attention mechanism to dynamically weight the extracted features, and use a fully connected layer and a softmax function for classification to output the probability distribution of each lightning type; Step 4: Adopt the cross-entropy function as the optimization objective function during the training process to update the model parameters; The MSRES-SA model includes an input layer, a multi-scale residual feature extraction module, a self-attention mechanism, a pooling layer, and a fully connected layer. The multi-scale residual feature extraction module includes convolution kernels of various different sizes. Small convolution kernels are used to capture local details of lightning features, and large convolution kernels are used to understand context information.
2. The lightning waveform classification method based on a multi-scale residual network according to claim 1, wherein, The specific content of Step 1 includes: Step A: The selected lightning waveforms include positive cloud-to-ground flash, negative cloud-to-ground flash, NBE, M component, and pre-breakdown waveforms; Step B: The splitting ratio of the training dataset and the test dataset in the entire dataset is 7:3; Step C: The data preprocessing method adopts normalization processing; The normalization processing adopts maximum absolute value normalization to narrow the range of all data values to between [-1, 1]. For each feature x in the data, the calculation formula is as follows: ; Among them, represents the maximum absolute value of the feature.
3. A lightning waveform classification method based on a multi-scale residual network according to claim 1, characterized in that, The specific working process of the self-attention mechanism in step 3 is as follows: For a given set of features Z = , the feature is transformed into a high-dimensional feature vector through a linear transformation, denoted as , is a learnable embedding weight matrix, is the embedded feature vector; the embedded features are mapped to the query, key, and value spaces through three independent linear layers, denoted as , , , , and are learnable weight matrices; the dot product similarity between the query and the key is calculated, and the attention score matrix A is normalized using a scaling factor ; the softmax function is applied to normalize each row to obtain the attention weight matrix; Use the attention weight to weight the sum value vector to obtain the final feature.
4. A lightning waveform classification method based on a multi-scale residual network according to claim 3, characterized in that, The formula for the attention weight matrix Attention(A) is: ; Among them, is the scaling factor, , .
5. A lightning waveform classification method based on a multi-scale residual network according to claim 1, characterized in that, In Step 4, based on the CEL metric model, the probability distribution ability of lightning waveform classification is specifically calculated by the formula: ; where, is the true label that the i-th sample belongs to the c-th class, is the probability that the model predicts the i-th sample belongs to the c-th class, N is the size of the dataset, and C is the number of classes.
Citation Information
Patent Citations
Motor imagery electroencephalogram signal classification method based on multi-scale convolution and self-attention
CN118349906A
Low-bit-rate video coding method based on sparse representation
CN119520808A