Respiration pattern recognition method fusing CNN, BiLSTM and Transform models
By using complex conjugate product and Hampel filter in the WiFi detection area, combined with CNN, BiLSTM and Transformer models, the accuracy and scenario applicability of wireless breath detection are solved, and efficient and accurate breathing pattern recognition is achieved.
Patent Information
- Application Number
- CN202510845411.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-23
- Publication Date
- 2025-08-19
AI Technical Summary
The existing wireless breath detection methods have insufficient contactless detection accuracy, single scene range, limited breathing rhythm characterization, and traditional equipment have problems such as inconvenient carrying, high cost, and interference with user activities.
The WiFi detection area of multi-antenna single transmitter-single receiver is adopted, and outliers are removed through complex conjugation product and Hampel filter, and data denoising is combined with discrete wavelet transformation to construct a subcarrier cosine similarity map, and breathing pattern recognition is used using CNN, BiLSTM and Transformer models to extract effective features and classify them.
It realizes efficient and accurate recognition and classification of respiratory signals, improves detection accuracy in indoor and outdoor environments, reaching 99.48% and 98.66%, solving the problems of single scene range and low detection accuracy of traditional models.
Smart Images

Figure CN120501413A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of wireless sensing technology, and in particular relates to a breathing pattern recognition method integrating CNN, BiLSTM and Transformer models. Background Art
[0002] With the aging population and the continued rise in chronic respiratory diseases, the demand for health monitoring is increasing, making respiratory health monitoring particularly important. Traditional respiratory monitoring methods primarily rely on specialized clinical equipment, such as chest and abdominal breathing belts and nasal airflow sensors. While these specialized medical devices are reliable, they have several limitations: they are bulky (such as medical respiratory monitors), interfering with the user's normal activities; they are expensive, limiting their widespread adoption; they require direct contact with the patient and often rely on professional medical staff; and these contact monitoring methods can alter the patient's natural breathing pattern, resulting in a "monitoring interference effect" that can lead to decreased sleep quality or abnormal breathing patterns. Therefore, traditional respiratory monitoring equipment struggles to achieve long-term, continuous respiratory monitoring in non-medical settings, often preventing users from accessing efficient and convenient health monitoring services.
[0003] Currently, existing respiratory detection methods are mainly divided into contact and non-contact. Contact respiratory detection methods are mainly based on motion, sound, airflow changes and temperature changes. Their measurement results are accurate, but the sensor needs to be in direct contact with the person being measured. The equipment is not very comfortable and is prone to slipping, causing measurement errors. If encountering special patients such as those with large-area burns or mental illnesses, it is difficult to achieve accurate and long-term measurements. Non-contact respiratory detection is mainly based on infrared thermal imaging, machine vision, bio-radar and wireless sensing. The first three have high existence but are easily affected by temperature, low privacy, or high accuracy but with radiation risks. Respiratory detection based on wireless sensing is simpler to deploy and has higher detection accuracy.
[0004] In this paper, we aim to address the shortcomings of existing contact and non-contact respiratory detection methods and propose a method for detecting abnormal respiratory patterns based on WiFi channel state information (CSI) in combination with the currently popular deep learning algorithm. This method has the following main features and advantages: (1) It uses WiFi wireless signals for non-contact detection, avoiding the inconvenience of carrying traditional equipment and interference with normal activities; (2) The CBT-Net model constructed by combining the deep learning algorithm can accurately classify respiratory signals and effectively identify normal breathing and various abnormal respiratory patterns; (3) Based on the existing WiFi network infrastructure, there is no need to purchase expensive professional medical equipment, which is low-cost and easy to deploy. The method is then tested on six datasets with different respiratory patterns and compared with other respiratory detection algorithms. The performance of the algorithm in respiratory detection is evaluated in terms of precision, recall, F1 score, number of samples, etc., and its scientific significance is further analyzed.
[0005] In related research, Zhu Xu used the CFAR peak-finding algorithm in "Research on Human Behavior Perception Technology Based on WiFi" to improve the respiratory rate detection accuracy to more than 87.76%; Li Haizhou achieved a respiratory classification detection accuracy of more than 90% through the FarBR respiratory detection system in "Research on Human Respiration Detection System Based on WIFI"; Dai Wanwan used a Fresnel zone-based respiratory detection model in "Research on Non-contact Human Respiration Detection Method Based on WiFi-CSI" to achieve a respiratory detection accuracy of 93.33%; Yu Xin achieved a respiratory detection accuracy of more than 95.6% based on an algorithm based on multidimensional features in "Research on Sleep Respiration Detection Algorithm Based on WiFi". Summary of the Invention
[0006] The purpose of the present invention is to provide a breathing pattern recognition method that integrates CNN, BiLSTM and Transformer models, which solves the problems of the existing wireless breathing pattern detection field having a single applicable scenario range and insufficient detection accuracy.
[0007] The present invention establishes a multi-antenna single-transmitter-single-receiver WiFi detection area to collect CSI data of different breathing patterns. The CSI amplitude data is preprocessed by first performing a complex conjugate product on the signal to extract CSI amplitude information, then using Hampel to remove outliers, and then performing discrete wavelet transform to achieve data denoising, and finally normalizing the data. The preprocessed CSI amplitude data is converted into a subcarrier cosine similarity map, and a data set is constructed and partitioned. The training set constructed from the subcarrier cosine similarity map is input into the breathing pattern recognition model CBT-Net for training, from which effective feature information of the breathing signal is extracted and classified.
[0008] Specifically, the specific implementation of the respiratory pattern recognition method integrating CNN, BiLSTM and Transformer models of the present invention includes:
[0009] Step 1: Build a multi-antenna single transmitter-single receiver WiFi detection area, set up multiple experimental scenarios, and collect multiple sets of CSI data with different breathing patterns in each experimental scenario;
[0010] Step 2: Preprocess the CSI data of the multiple groups of different breathing patterns collected in step 1, extract the CSI amplitude signal through a complex conjugate product operation, eliminate the phase offset, and perform denoising filtering and normalization to obtain CSI amplitude data;
[0011] Step 3: Convert the CSI amplitude data obtained in step 2 into a subcarrier cosine similarity matrix, generate a corresponding subcarrier cosine similarity map, construct a data set, and further divide the data set into a training set, a validation set, and a test set;
[0012] Step 4: Input the training set and validation set obtained in step 3 into the respiratory pattern recognition model CBT-Net, and use the convolutional neural network (CNN) to extract the respiratory signal features of the subcarrier cosine similarity matrix;
[0013] Step 5: Input the respiratory signal features obtained in step 4 into the bidirectional long short-term memory network BiLSTM to capture the bidirectional dependency of the time series to make up for the lack of time series modeling capabilities, and output a feature sequence containing positive and negative information;
[0014] Step 6: Input the feature sequence containing forward and reverse information obtained in step 5 into the Transformer model for feature analysis and merging to capture global and long-range dependencies, complete the training of breathing pattern recognition, and save the breathing pattern recognition model CBT-Net with the highest accuracy on the validation set;
[0015] In step 7, the test set is input into the optimal CBT-Net model obtained in step 6 for classification to complete the recognition of breathing patterns.
[0016] The beneficial effects of the present invention are as follows: the present invention proposes a non-contact abnormal breathing pattern detection method based on WiFi channel state information (CSI). By integrating a convolutional neural network (CNN), a bidirectional long short-term memory network (BiLSTM), and a Transformer model for breathing pattern recognition, efficient and accurate breathing signal recognition and classification are achieved. This method addresses the limitations of current breathing detection technology, such as insufficient non-contact detection accuracy, single scene restrictions, and limited respiratory rhythm representation. It builds a multi-antenna single-transmitter-single-receiver WiFi detection area, collects CSI data of different breathing patterns, and extracts CSI amplitude data from the original CSI data. By enhancing CSI amplitude information through complex conjugate product, the breathing-related components in the signal can be significantly improved, allowing subsequent processing to more accurately focus on the breathing signal rather than other interfering signals. The Hampel filter is used to remove local outliers, and the discrete wavelet transform is combined to achieve data denoising. The two steps work synergistically to effectively suppress high-frequency interference while retaining the subtle features of the breathing signal, providing a purer data foundation for subsequent feature extraction. The data is also normalized to a standard range (0 to 1) to obtain smoother and more stable breathing signal features. The preprocessed CSI amplitude data is converted into a subcarrier cosine similarity matrix, and a subcarrier cosine similarity map is plotted for dataset construction and partitioning. The training set constructed from the subcarrier cosine similarity matrix is then fed into the CBT-Net respiratory pattern recognition model for training. CBT-Net first uses a convolutional neural network incorporating a CBAM attention mechanism to extract respiratory signal features from the subcarrier similarity map. The CBAM attention mechanism dynamically adjusts the importance of each channel and spatial position in the feature map, enabling the model to more accurately capture features related to respiratory patterns, improving feature extraction efficiency and accuracy. The extracted valid features are then fed into a Bidirectional Long Short-Term Memory (BiLSTM) network to capture bidirectional dependencies in the time series, addressing limitations in time series modeling. The BiLSTM outputs a feature sequence containing forward and reverse information, enhancing respiratory pattern recognition. A Transformer model is then used for feature analysis and merging to capture global and long-range dependencies, further improving the model's ability to represent complex respiratory rhythms and enhancing recognition accuracy. During training, the model parameters that achieve the best recognition rate on the validation set are saved, resulting in a model that exhibits superior classification performance. Finally, the data output by the Transformer encoder is fed into a fully connected layer for classification, ultimately yielding the classification result. Experimental verification demonstrates that this method performs well on evaluation metrics such as precision, recall, and F1 score, achieving classification accuracy rates of 99.48% and 98.66% in indoor and outdoor environments, respectively. This significantly improves detection accuracy, addresses the limitations of traditional models, such as limited scene coverage and low detection accuracy, and demonstrates broad application prospects.The present invention further solves the problems of single scene range and low detection accuracy, and makes up for the shortcomings of traditional models. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is the overall framework diagram of the breathing pattern recognition model CBT-Net in the breathing pattern recognition method integrating CNN, BiLSTM and Transformer models described in the present invention;
[0018] Figure 2(a) shows the subcarrier cosine similarity graph when a person is in normal breathing;
[0019] Figure 2(b) shows the subcarrier cosine similarity graph when a person is experiencing shortness of breath;
[0020] Figure 3 It is a structural diagram of the breathing pattern recognition model based on deep learning of the present invention;
[0021] Figure 4(a) shows the confusion matrix of the detection results in indoor scenes;
[0022] Figure 4(b) shows the confusion matrix of the detection results in the corridor scene. DETAILED DESCRIPTION
[0023] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments so that the advantages and features of the present invention can be more easily understood by those skilled in the art.
[0024] The breathing pattern recognition method described in the present invention integrates CNN, BiLSTM, and Transformer models. The overall concept is as follows: establishing a multi-antenna single-transmitter-single-receiver WiFi detection area to collect CSI data of different breathing patterns; preprocessing the CSI amplitude data by first performing complex conjugate product multiplication on the signal to enhance the CSI amplitude information, then using Hampel to remove outliers, and then performing discrete wavelet transform to achieve data denoising, and finally normalizing the data; converting the preprocessed CSI amplitude data into a subcarrier cosine similarity map, constructing and partitioning the data set; and inputting the training set constructed from the subcarrier cosine similarity map into the breathing pattern recognition model CBT-Net for training, thereby extracting effective feature information of the breathing signal and performing classification.
[0025] Specifically, the present invention provides a respiratory pattern recognition method that integrates CNN, BiLSTM and Transformer models. Figure 1 As shown, the specific steps include:
[0026] Step 1: Build a Wi-Fi detection area with multiple antennas, a single transmitter, and a single receiver. Set up multiple experimental scenarios and collect multiple sets of CSI data with different breathing patterns in each experimental scenario.
[0027] The above step 1 completes the collection of multiple sets of CSI data with different breathing patterns in each experimental scenario, and each set of data will be preprocessed separately.
[0028] Step 1 specifically includes:
[0029] In step 1.1, when setting up an experimental platform for collecting channel state information (CSI) data, the receiving end and the transmitting end are each configured with multiple antennas. For example, the receiving end and the transmitting end are each configured with three antennas.
[0030] Optionally, the receiving end requires a high-performance desktop computer with an 802.11n-capable wireless network card, running the Linux operating system, and configured with the appropriate CSI data acquisition tool. The transmitting end uses a commercial router that complies with the 2.4GHz WiFi b / g / n standard. For example, the receiving end can be a desktop computer with performance that meets the experimental requirements, equipped with an 802.11n-capable wireless network card (such as an Intel 5300 network card), running the Linux operating system, and configured with the Linux802.11n CSI-Tool. The transmitting end can be a commercial router that complies with the 2.4GHz WiFi b / g / n standard (such as a TP-Link router), set to a 100Hz packet transmission frequency, with WiFi signal operating frequencies of IEEE 802.11n and 2.4GHz, and a bandwidth of 40MHz. This will allow capturing CSI data for complex matrices.
[0031] Step 1.2: Set up and arrange the experimental scenes, and collect CSI data corresponding to different breathing patterns in the line-of-sight path in n experimental scenes.
[0032] In the experiment, the distance between the person and the transmitter and the receiver was set to about 1 meter, and the person was located between the transmitter and the receiver.
[0033] Among them, CSI data is a two-dimensional matrix with N rows;
[0034] CSI data is represented by matrix A as:
[0035]
[0036] Among them, N tx is the number of antennas at the transmitting end, N rx is the number of antennas at the receiving end, tx represents the transmitting antenna, rx represents the receiving antenna, A ij is the CSI amplitude data from the i-th transmitting antenna to the j-th receiving antenna;
[0037] Aij Expressed as:
[0038]
[0039] a ij,1 is the CSI amplitude from the i-th transmitting antenna to the j-th receiving antenna on the first subcarrier. Similarly, The transmission distance from the i-th transmitting antenna to the j-th receiving antenna is the N-th s CSI amplitude on subcarriers;
[0040] N s is the number of subcarriers in the CSI signal. On the Intel 5300 wireless network card, N s is 30.
[0041] As can be seen from step 1.1, the receiving end and the transmitting end are each equipped with three antennas, so the received signal contains 9 data streams. The data contained in each data stream is as follows:
[0042] A1={a 1,1 ,a 1,2 ,a 1,3 ,……,a 1,29 ,a 1,30}
[0043] A2={a 2,1 ,a 2,2 ,a 2,3 ,……,a 2,29 ,a 2,30}
[0044] A3={a 3,1 ,a 3,2 ,a 3,3 ,……,a 3,29 ,a 3,30}
[0045] A4={a 4,1 ,a 4,2 ,a 4,3 ,……,a 4,29 ,a 4,30}
[0046] A5={a 5,1 ,a 5,2 ,a 5,3 ,……,a 5,29 ,a 5,30}
[0047] A6={a 6,1 ,a 6,2 ,a 6,3 ,……,a 6,29 ,a 6,30}
[0048] A7={a 7,1 ,a 7,2 ,a 7,3 ,……,a 7,29 ,a 7,30}
[0049] A8={a 8,1 ,a 8,2 ,a 8,3 ,……,a 8,29 ,a 8,30}
[0050] A9={a 9,1 ,a 9,2 ,a 9,3 ,……,a 9,29 ,a 9,30}.
[0051] This method addresses the limitations of current respiratory detection technology, such as insufficient non-contact detection accuracy, single scenario restrictions, and limited respiratory rhythm representation. A multi-antenna single-transmitter-single-receiver WiFi detection area is built to collect CSI data of different breathing patterns and extract CSI amplitude data from the original CSI data.
[0052] The respiratory pattern recognition method integrating CNN, BiLSTM and Transformer models of the present invention further includes:
[0053] Step 2: Preprocess the CSI data collected in step 1, extract the CSI amplitude signal through complex conjugate product operation, eliminate the phase offset, and perform denoising filtering and normalization to obtain CSI amplitude data.
[0054] Step 2 specifically includes the following steps:
[0055] Step 2.1: Collect multiple sets of CSI data of different breathing patterns in each experimental scenario through step 1, obtain a data stream file (e.g., a file with the suffix .dat), and use the read_bf_file function based on the Matlab software platform to read the data stream file.
[0056] As described in step 1.2, the CSI data is a two-dimensional matrix with N rows.
[0057] Step 2.2: The collected CSI data is a complex matrix, expressed as α+βi, where α represents the real part of the CSI data and has a value range of [-1, 1], and β represents the imaginary part of the CSI data and has a value range of [-1, 1]. Select all subcarriers of m (m>=3) receiving antennas on any transmitting antenna and calculate their original amplitude Z.
[0058] The CSI amplitude Z can be obtained from the complex calculation formula, which is as follows:
[0059]
[0060] Step 2.3: normalize the CSI amplitude calculated in step 2.2, including:
[0061] Step 2.3.1: Preprocess the CSI amplitude calculated in step 2.2 by first using the complex conjugate product to eliminate the phase difference between the signals and enhance the amplitude signal characteristics;
[0062] Step 2.3.2: Use the Hampel test to remove outliers in the amplitude after complex conjugate product. Identify outliers by calculating the median and median absolute deviation (MAD) of the data and replace the outliers with the median.
[0063] Step 2.3.3: Use discrete wavelet transform to remove the residual noise after Hampel detection, smooth the baseline, and highlight the waveform features;
[0064] Step 2.3.4: Use linear normalization to map the data to the standard range [0, 1].
[0065] This method enhances the CSI amplitude information through complex conjugate product, which can significantly improve the respiration-related components in the signal, so that subsequent processing can more accurately focus on the respiration signal rather than other interfering signals.
[0066] The respiratory pattern recognition method integrating CNN, BiLSTM and Transformer models of the present invention further includes:
[0067] Step 3: Convert the CSI amplitude data preprocessed in step 2 into a subcarrier cosine similarity matrix and generate a corresponding subcarrier cosine similarity graph. Then, construct a data set and divide the data set into a training set, a validation set, and a test set.
[0068] Step 3 specifically includes the following steps:
[0069] Step 3.1: Convert the CSI amplitude data preprocessed in step 2 into a subcarrier cosine similarity matrix. Each breathing signal is composed of CSI data from multiple transmit and receive antenna links. The CSI amplitude data from each transmit and receive antenna link is considered as an independent CSI feature map. The columns in the CSI feature map represent the CSI amplitude data from the transmit and receive antenna links, and the rows represent samples collected at different time points.
[0070] In step 3.2, select three receive links consisting of one transmit antenna and three receive antennas. Convert the CSI feature maps constructed on these three receive links into 30*30 subcarrier cosine similarity maps. Combine them vertically to form a 90*30 feature matrix, where 30 is the number of subcarriers in each receive link and 90 is the combined amplitude of the data obtained on the three receive links. This constructs the data set.
[0071] Figure 2(a) and Figure 2(b) are subcarrier cosine similarity graphs under different breathing modes. Figure 2(a) is the subcarrier cosine similarity graph when a person is in normal breathing, and Figure 2(b) is the subcarrier cosine similarity graph when a person is in rapid breathing.
[0072] Figure 2(a) shows that in the normal breathing mode, the color distribution of the similarity map is relatively uniform, with yellow and green regions (similarity 0.6-0.8) occupying a large proportion. This color distribution clearly indicates that in normal breathing, the breathing pattern has a high degree of similarity and is stable, without obvious fluctuations or abnormal changes. The breathing rhythm remains steady and regular, and the breathing depth is relatively constant, presenting an overall healthy and stable breathing state. Figure 2(b) shows that in the tachypnea mode, the color distribution of the similarity map becomes more complex. In this mode, orange, yellow, green, and blue regions appear alternately, with regions of varying shades intertwined. The similarity varies greatly, and the high volatility of the image indicates that the similarity varies significantly between regions. This is a direct reflection of the rapid changes in breathing rate and the instability of breathing depth in the tachypnea mode.
[0073] In step 3.3, divide the dataset obtained in step 3.2 into a ratio of 6:2:2: training set: validation set: test set. Randomly shuffle the dataset and allocate it proportionally, with 60% as the training set for model training, 20% as the validation set for hyperparameter adjustment and model evaluation, and the remaining 20% as the test set for final performance testing.
[0074] This division ratio can balance the needs of model training, verification, and testing, ensuring that the model can fully learn the complex patterns in the data, while effectively avoiding overfitting on the verification set, and evaluating the final performance on the test set to reduce performance evaluation bias.
[0075] This method uses a Hampel filter to remove local outliers and combines it with a discrete wavelet transform to achieve data denoising. These two steps work synergistically to effectively suppress high-frequency interference while preserving the subtle features of the respiratory signal, providing a cleaner data foundation for subsequent feature extraction. The data is then normalized to a standard range (0 to 1) to obtain smoother and more stable respiratory signal features. The preprocessed CSI amplitude data is converted into a subcarrier cosine similarity matrix, and a subcarrier cosine similarity graph is plotted for use in constructing and partitioning the dataset.
[0076] The respiratory pattern recognition method integrating CNN, BiLSTM and Transformer models of the present invention further includes:
[0077] In step 4, the training set and validation set obtained in step 3 are input into the respiratory pattern recognition model CBT-Net, and the convolutional neural network (CNN) is used to extract the respiratory signal features of the subcarrier cosine similarity matrix.
[0078] Among them, CNN integrates the CBAM attention module, which can focus on channels and spatial positions at the same time and capture feature information more comprehensively.
[0079] like Figure 3 As shown, the breathing pattern recognition model CBT-Net of the present invention is constructed by integrating convolutional neural network, bidirectional long short-term memory network and Transformer.
[0080] The CNN network contains two convolutional layers, the dimension of the input channel is [64, 3, 30, 30], and the output of the first convolutional layer is [64, 32, 30, 30]. Subsequently, the ReLu activation function is used after the first convolution layer, and the dropout technology is used to implement random inactivation of neurons to prevent overfitting, and the CBAM attention mechanism is used for weighting. The output of the first layer is [64, 32, 15, 15]; the output dimension of the second convolutional layer is [64, 64, 7, 7]. The output of the second convolutional layer is used as the input of BiLSTM. The loss function of the CNN network is cross entropy loss, the optimizer is Adam, the learning rate is 3e-4, the number of iterations is 50, and the batch size is 64.
[0081] The bidirectional long short-term memory network and Transformer include a BiLSTM layer, a Transformer encoder layer, and a fully connected layer. The first two layers extract time series features, and the output of the fully connected layer is normalized using a Softmax activation function. The combination of BiLSTM and Transformer can fully utilize the bidirectional and long-distance dependencies of time series data, effectively improving the accuracy and robustness of breathing pattern detection.
[0082] Step 4 specifically includes the following steps:
[0083] Step 4.1: Use the training set divided in step 3.3 as the input of the respiratory pattern recognition model CBT-Net, use the convolutional neural network CNN to convolve the training set, and extract the respiratory signal features of the training set. The first part of the respiratory pattern recognition model CBT-Net is the convolutional neural network CNN module.
[0084] Among them, the present invention uses a larger convolution kernel (such as 5x5) to capture a wider range of local features. For example, using a convolution kernel size of 5 and a padding of 2 can keep the size of the feature map unchanged, and uses a batch normalization layer to normalize the output of the convolution layer to stabilize the training process.
[0085] In step 4.2, the ReLU activation function is applied to introduce nonlinear characteristics to effectively alleviate the gradient vanishing problem. The size of the feature map is halved through the maximum pooling layer, and some neurons are randomly discarded through dropout to prevent overfitting.
[0086] In step 4.3, after the first layer of convolution processing is completed, the CBAM attention module is applied to first weight the importance of each channel through the channel attention mechanism, and then weight the spatial position of the feature map through the spatial attention mechanism, and output the feature dimension [B, 64, 15, 15], where the batch size B is 64.
[0087] The CBAM module can focus on important features in both channel and spatial dimensions, thereby improving the model's ability to capture key features, especially when processing signal data containing multipath interference, and can better identify and classify respiratory signals.
[0088] In step 4.4, a second convolution is performed to output a feature with a dimension of [B, 64, 7, 7]; the feature map is then flattened and rearranged to obtain the dimension of the output tensor x of [49, B, 64].
[0089] In the experiment, we tried and compared various feature map dimensions (such as [B, 32, 30, 30] or [B, 128, 7, 7]) and found that the model performance was optimal when the batch size was 64, the convolution kernel size was 5, the padding was 2, and the feature map size was 15×15.
[0090] This method uses a training set constructed from a subcarrier cosine similarity matrix as input to a breathing pattern recognition model, CBT-Net, for training. CBT-Net first uses a convolutional neural network integrated with the CBAM attention mechanism to extract respiratory signal features from the subcarrier similarity map. The CBAM attention mechanism dynamically adjusts the importance of each channel and spatial position in the feature map, enabling the model to more accurately capture features related to breathing patterns, improving the efficiency and accuracy of feature extraction.
[0091] The respiratory pattern recognition method integrating CNN, BiLSTM and Transformer models of the present invention further includes:
[0092] In step 5, the output tensor x after two CNN convolutions and CBAM attention mechanism processing in step 4.4 is input into the bidirectional long short-term memory network BiLSTM to capture the bidirectional dependency of the time series to make up for the lack of time series modeling capabilities and output a feature sequence containing positive and negative information.
[0093] The specific extraction method is as follows:
[0094] Step 5.1, use the permute() function to convert the respiratory signal features into a tensor format suitable for input to BiLSTM [49, B, 64], where 49 is the sequence length, B is the batch size, and 64 is the input feature dimension;
[0095] Then, a bidirectional long short-term memory (BiLSTM) layer is defined with an input feature dimension of 64 and a hidden layer dimension of 128 (the above parameters are the optimal values compared with multiple experiments with different dimension parameters), and it is set to bidirectional.
[0096] In step 5.2, the features extracted by BiLSTM are fused and the ReLU activation function is applied to perform nonlinear transformation on the output of BiLSTM to introduce nonlinear characteristics and enhance the expressive power of the model.
[0097] This method inputs the extracted effective features into the bidirectional long short-term memory network BiLSTM to capture the bidirectional dependency of the time series, make up for the lack of time series modeling capabilities, output feature sequences containing positive and negative information, and improve the ability to recognize breathing patterns.
[0098] The respiratory pattern recognition method integrating CNN, BiLSTM and Transformer models of the present invention further includes:
[0099] In step 6, the feature sequence containing forward and reverse information obtained in step 5 is input into the Transformer model for feature analysis and merging to capture global and long-distance dependencies, complete the training of breathing pattern recognition, and save the breathing pattern recognition model CBT-Net with the highest accuracy on the validation set.
[0100] Step 6 is as follows:
[0101] In step 6.1, define the Transformer encoder layer, with an input feature dimension of 256 (BiLSTM output dimension is 2*128), 16 attention heads, 512 feedforward network dimension, 4 layers, and the output feature dimension still being [49, B, 256].
[0102] It is worth noting that through experimental comparison of the controlled variable method, it was found that when the number of attention heads was set to 16, the performance of the model was significantly better than other common settings (such as 2, 4, 8, 32, etc.). The same applies to the selection of other parameters.
[0103] Step 6.2: Input the bidirectional feature sequence extracted in step 5 into the Transformer model, extract features for fusion, apply the ReLU activation function to perform nonlinear transformation on the Transformer output, and adjust the output features from [49, B, 256] to [B, 49×256];
[0104] In step 6.3, a fully connected layer is defined and normalized using the Softmax activation function. The fully connected layer maps the fused features to 6 categories to obtain the final breathing pattern classification results.
[0105] This method uses a Transformer model for feature analysis and merges feature analysis to capture global and long-range dependencies, further enhancing the model's ability to represent complex respiratory rhythms and improving recognition accuracy. During training, the model parameters that achieve the best recognition rate on the validation set are saved, thereby constructing a model with superior classification performance.
[0106] The respiratory pattern recognition method integrating CNN, BiLSTM and Transformer models of the present invention further includes:
[0107] In step 7, the test set is input into the optimal CBT-Net model obtained in step 6 for classification to complete the recognition of breathing patterns.
[0108] This method inputs the output of the Transformer encoder into a fully connected layer for classification, ultimately yielding the classification result. Experimental verification demonstrates that this method performs well on evaluation metrics such as precision, recall, and F1 score, achieving classification accuracy rates of 99.48% and 98.66% in indoor and outdoor environments, respectively. This significantly improves detection accuracy and addresses the limitations of traditional models, such as the limited scene coverage and low detection accuracy, demonstrating its broad application prospects.
[0109] Figures 4(a) and 4(b) show the confusion matrices for the classification of breathing pattern detection using the CBT-Net model in indoor and outdoor corridor scenarios, respectively. The horizontal and vertical axes, 0-5, represent normal breathing, bradypnea, tachypnea, apnea, Cheyne-Stokes respiration, and Kussmaul respiration, respectively. As can be seen in Figure 4(a), the main diagonal line is almost 1, but slight misidentification errors still occur when detecting breathing patterns such as apnea and Cheyne-Stokes respiration. All other cases are accurately predicted, with an accuracy of 99.48%. Figure 4(b) shows slight misidentification errors when detecting normal breathing, bradypnea, and tachypnea, with an accuracy of 98.66%, lower than in indoor environments. This is because the indoor space is relatively closed, the signal propagation path is more direct, and the multipath effect is relatively small. Therefore, the recognition rate is slightly higher.
[0110] Table 1 Comparison of the classification effects of the method of the present invention in different scenarios.
[0111] Scenario Accuracy Accuracy Recall F1 score indoor 0.994792 0.994 0.995 0.995 outdoor 0.986607 0.986 0.985 0.985
[0112] As shown in Table 1, the CBT-Net model achieves accuracies of 99.4792% and 98.6607% indoors and outdoors, respectively, using cosine similarity. Precision, recall, and F1 scores are all close to 1. This demonstrates that the respiratory classification achieved by the CBT-Net model using cosine similarity generalizes well across diverse environments.
[0113] Table 2 Comparison results of breathing pattern recognition rates of different algorithms and the CBT-Net model proposed in this invention.
[0114] literature Model Accuracy (%) Seong-Hoon Kim et al. 1D CNN 93.9 Dongyu Miao et al. Support Vector Machine 94.7 Yu Xin et al. XGBoost 95.6 The present invention CBT-Net 99.5
[0115] As shown in Table 2, the CBT-Net model achieves significantly higher accuracy than other existing models in the human respiration detection task. Seong-Hoon Kim et al.'s 1D CNN model achieves an accuracy of 93.9%, Dongyu Miao et al.'s SVM model achieves an accuracy of 94.7%, and Yu Xin et al.'s XGBoost model achieves an accuracy of 95.6%. Our CBT-Net model achieves an accuracy of 99.5%. This demonstrates that our CBT-Net model has higher accuracy and stability in respiratory signal detection, demonstrating superior performance and strong generalization capabilities in the human respiration detection task.
[0116] This paper proposes a non-contact abnormal breathing pattern detection method based on WiFi channel state information (CSI). By integrating a convolutional neural network (CNN), a bidirectional long short-term memory network (BiLSTM), and a Transformer model for breathing pattern recognition, it achieves efficient and accurate respiratory signal recognition and classification. This method addresses the limitations of current respiratory detection technologies, such as insufficient non-contact detection accuracy, single scenario restrictions, and limited respiratory rhythm representation. A multi-antenna single-transmitter-single-receiver WiFi detection area is established to collect CSI data of different breathing patterns and extract CSI amplitude data from the raw CSI data. Enhancing CSI amplitude information through complex conjugate product can significantly improve the breathing-related components in the signal, allowing subsequent processing to more accurately focus on the breathing signal rather than other interfering signals. A Hampel filter is used to remove local outliers, and data denoising is achieved in combination with a discrete wavelet transform. These two steps work synergistically to effectively suppress high-frequency interference while retaining the subtle features of the respiratory signal, providing a purer data foundation for subsequent feature extraction. The data is then normalized to a standard range (0 to 1) to obtain smoother and more stable respiratory signal features. The preprocessed CSI amplitude data is converted into a subcarrier cosine similarity matrix, and a subcarrier cosine similarity map is plotted for dataset construction and partitioning. The training set constructed from the subcarrier cosine similarity matrix is then fed into the CBT-Net respiratory pattern recognition model for training. CBT-Net first uses a convolutional neural network incorporating a CBAM attention mechanism to extract respiratory signal features from the subcarrier similarity map. The CBAM attention mechanism dynamically adjusts the importance of each channel and spatial position in the feature map, enabling the model to more accurately capture features related to respiratory patterns, improving feature extraction efficiency and accuracy. The extracted valid features are then fed into a Bidirectional Long Short-Term Memory (BiLSTM) network to capture bidirectional dependencies in the time series, addressing limitations in time series modeling. The BiLSTM outputs a feature sequence containing forward and reverse information, enhancing respiratory pattern recognition. A Transformer model is then used for feature analysis and merging to capture global and long-range dependencies, further improving the model's ability to represent complex respiratory rhythms and enhancing recognition accuracy. During training, the model parameters that achieve the best recognition rate on the validation set are saved, resulting in a model that exhibits superior classification performance. Finally, the data output by the Transformer encoder is fed into a fully connected layer for classification, ultimately yielding the classification result. Experimental verification demonstrates that this method performs well on evaluation metrics such as precision, recall, and F1 score, achieving classification accuracy rates of 99.48% and 98.66% in indoor and outdoor environments, respectively. This significantly improves detection accuracy, addresses the limitations of traditional models, such as limited scene coverage and low detection accuracy, and demonstrates broad application prospects.
[0117] The above is only one embodiment of the present invention. For those skilled in the art, several improvements and modifications made to the present invention without departing from the principle of the present invention should also be considered as the scope of protection of the present invention.
Claims
1. A respiratory pattern recognition method integrating CNN, BiLSTM and Transformer models, characterized by: The specific steps include: Step 1: Build a multi-antenna single transmitter-single receiver WiFi detection area, set up multiple experimental scenarios, and collect multiple sets of CSI data with different breathing patterns in each experimental scenario; Step 2: Preprocess the CSI data of the multiple groups of different breathing patterns collected in step 1, extract the CSI amplitude signal through a complex conjugate product operation, eliminate the phase offset, and perform denoising filtering and normalization to obtain CSI amplitude data; Step 3: Convert the CSI amplitude data obtained in step 2 into a subcarrier cosine similarity matrix, generate a corresponding subcarrier cosine similarity map, construct a data set, and further divide the data set into a training set, a validation set, and a test set; Step 4: Input the training set and validation set obtained in step 3 into the respiratory pattern recognition model CBT-Net, and use the convolutional neural network (CNN) to extract the respiratory signal features of the subcarrier cosine similarity matrix; Step 5: Input the respiratory signal features obtained in step 4 into the bidirectional long short-term memory network BiLSTM to capture the bidirectional dependency of the time series to make up for the lack of time series modeling capabilities, and output a feature sequence containing positive and negative information; Step 6: Input the feature sequence containing forward and reverse information obtained in step 5 into the Transformer model for feature analysis and merging to capture global and long-range dependencies, complete the training of breathing pattern recognition, and save the breathing pattern recognition model CBT-Net with the highest accuracy on the validation set; In step 7, the test set is input into the optimal CBT-Net model obtained in step 6 for classification to complete the recognition of breathing patterns.
2. The respiratory pattern recognition method integrating CNN, BiLSTM and Transformer models according to claim 1, characterized in that Step 1 is as follows: Step 1.1: When setting up an experimental platform for collecting channel state information data, configure multiple antennas at both the receiving and transmitting ends. Step 1.2: Set up and arrange the experimental scenes, and collect CSI data corresponding to different breathing patterns in the line-of-sight path in n experimental scenes.
3. The respiratory pattern recognition method integrating CNN, BiLSTM and Transformer models according to claim 2, characterized in that: In step 1.2, CSI data is a two-dimensional matrix with N rows; CSI data matrix Expressed as: ; in, is the number of antennas at the transmitting end, is the number of antennas at the receiving end, represents the transmitting antenna, represents the receiving antenna, The first The first antenna to the receiving antenna CSI amplitude data of the root antenna; Expressed as: ; is the CSI amplitude from the i-th transmitting antenna to the j-th receiving antenna on the first subcarrier. Similarly, The transmission distance from the i-th transmitting antenna to the j-th receiving antenna is CSI amplitude on subcarriers; The number of subcarriers in the CSI signal, on the Intel 5300 wireless network card is 30; The receiving and transmitting ends are each equipped with three antennas, so the received signal contains nine data streams. The data contained in each data stream is as follows:
4. The respiratory pattern recognition method integrating CNN, BiLSTM and Transformer models according to claim 1, characterized in that Step 2 specifically includes the following steps: Step 2.1: Collect multiple sets of CSI data of different breathing patterns in each experimental scenario through step 1, obtain a data stream file, and use the read_bf_file function based on the Matlab software platform to read the data stream file; In step 2.2, the collected CSI data is a complex matrix, expressed as ,in, Represents the real part of CSI data, with a value range of [−1, 1], Represents the imaginary part of the CSI data, with a value range of [−1, 1]. Select all subcarriers of m (m>=3) receiving antennas on any transmitting antenna and calculate their original amplitude Z. Among them, the amplitude of CSI can be obtained by the complex calculation formula , the calculation formula is as follows: ; In step 2.3, the CSI amplitude calculated in step 2.2 is normalized.
5. The respiratory pattern recognition method integrating CNN, BiLSTM and Transformer models according to claim 4, characterized in that: Step 2.3 specifically includes the following steps: Step 2.3.1: Preprocess the CSI amplitude calculated in step 2.2 by first using the complex conjugate product to eliminate the phase difference between the signals and enhance the amplitude signal characteristics; Step 2.3.2: Use the Hampel test to remove outliers in the amplitude after complex conjugate product. Identify outliers by calculating the median and median absolute deviation (MAD) of the data and replace the outliers with the median. Step 2.3.3: Use discrete wavelet transform to remove the residual noise after Hampel detection, smooth the baseline, and highlight the waveform features; Step 2.3.4: Use linear normalization to map the data to the standard range [0, 1].
6. The respiratory pattern recognition method integrating CNN, BiLSTM and Transformer models according to claim 1, characterized in that Step 3 specifically includes the following steps: Step 3.1: Convert the CSI amplitude data preprocessed in step 2 into a subcarrier cosine similarity matrix. Each breathing signal is composed of CSI data from multiple transmit and receive antenna links. The CSI amplitude data from each transmit and receive antenna link is considered as an independent CSI feature map. The columns in the CSI feature map represent the CSI amplitude data from the transmit and receive antenna links, and the rows represent samples collected at different time points. In step 3.2, select three receive links consisting of one transmit antenna and three receive antennas. Convert the CSI feature maps constructed on these three receive links into 30*30 subcarrier cosine similarity maps. Combine them vertically to form a 90*30 feature matrix, where 30 is the number of subcarriers in each receive link and 90 is the combined amplitude of the data obtained on the three receive links. This constructs the data set. In step 3.3, divide the dataset obtained in step 3.2 into a ratio of 6:2:2: training set: validation set: test set. Randomly shuffle the dataset and allocate it proportionally, with 60% as the training set for model training, 20% as the validation set for hyperparameter adjustment and model evaluation, and the remaining 20% as the test set for final performance testing.
7. The respiratory pattern recognition method integrating CNN, BiLSTM and Transformer models according to claim 1, characterized in that: Step 4 specifically includes the following steps: Step 4.1, using the training set divided in step 3.3 as input to a respiratory pattern recognition model CBT-Net, convolving the training set using a convolutional neural network (CNN), and extracting respiratory signal features from the training set. The first part of the respiratory pattern recognition model CBT-Net is a convolutional neural network (CNN) module; In step 4.2, the ReLU activation function is applied to introduce nonlinear characteristics to effectively alleviate the gradient vanishing problem. The size of the feature map is halved through the maximum pooling layer, and some neurons are randomly discarded through dropout to prevent overfitting. Step 4.3: After the first layer of convolution is completed, the CBAM attention module is applied to first weight the importance of each channel through the channel attention mechanism, and then weight the spatial position of the feature map through the spatial attention mechanism, and output the feature dimension [B, 64, 15, 15], where the batch size B is 64; In step 4.4, a second convolution is performed to output a feature with a dimension of [B, 64, 7, 7]; the feature map is then flattened and rearranged to obtain the dimension of the output tensor x of [49, B, 64].
8. The respiratory pattern recognition method integrating CNN, BiLSTM and Transformer models according to claim 1, characterized in that: Step 5 specifically includes the following steps: Step 5.1, use the permute() function to convert the respiratory signal features into a tensor format suitable for input to BiLSTM [49, B, 64], where 49 is the sequence length, B is the batch size, and 64 is the input feature dimension; Then, a bidirectional long short-term memory (BiLSTM) layer is defined with an input feature dimension of 64 and a hidden layer dimension of 128 (the above parameters are the optimal values compared with multiple experiments with different dimension parameters), and it is set to bidirectional. In step 5.2, the features extracted by BiLSTM are fused and the ReLU activation function is applied to perform nonlinear transformation on the output of BiLSTM to introduce nonlinear characteristics and enhance the expressive power of the model.
9. The respiratory pattern recognition method integrating CNN, BiLSTM and Transformer models according to claim 1, characterized in that: Step 6 specifically includes the following steps: Step 6.1, define the Transformer encoder layer, with an input feature dimension of 256, 16 attention heads, 512 feedforward network dimensions, 4 layers, and the output feature dimension still being [49, B, 256]; Step 6.2: Input the bidirectional feature sequence extracted in step 5 into the Transformer model, extract features for fusion, apply the ReLU activation function to perform nonlinear transformation on the Transformer output, and adjust the output features from [49, B, 256] to [B, 49×256]; In step 6.3, a fully connected layer is defined and normalized using the Softmax activation function. The fully connected layer maps the fused features to 6 categories to obtain the final breathing pattern classification results.