Contrastive learning based feature decoupled millimeter wave radar cardiac signal detection method
By employing a feature decoupling framework based on contrastive learning and physical constraints, the problem of nonlinear mixed signals and noise interference in millimeter-wave radar cardiac signal detection is solved. This enables stable, interpretable, and robust feature extraction of cardiac signals, improving the model's generalization ability and feature separation performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA JILIANG UNIV
- Filing Date
- 2026-05-07
- Publication Date
- 2026-06-05
AI Technical Summary
Existing millimeter-wave radar methods for detecting heart signals have insufficient generalization ability when dealing with nonlinear mixed signals and noise interference. Furthermore, deep learning methods lack an understanding of physiological mechanisms and are prone to learning false features, leading to failure on out-of-distribution samples.
A feature decoupling framework based on contrastive learning is adopted, combined with physical prior constraints. Through multi-scale feature extraction, attention module, dual-path feature decoupling and physical constraint module, rhythm and morphological features in cardiac signals are separated. Adaptive filtering and data augmentation are used to generate positive and negative samples, and the feature extraction and decoupling model is optimized.
Stable, interpretable, and robust feature extraction of cardiac signals was achieved. The model exhibited excellent generalization performance and a sustained convergence trend. Rhythm and morphological features were successfully decoupled, providing a high-quality feature base for cardiac physiological analysis.
Smart Images

Figure CN122153405A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of non-contact vital sign monitoring technology, and more specifically to a method for detecting cardiac signals using a feature-decoupled millimeter-wave radar based on contrastive learning. Background Technology
[0002] Millimeter-wave radar, as a non-contact sensing technology, has shown great potential in the field of cardiac health monitoring due to its high resolution, strong anti-interference capabilities, and privacy protection characteristics. It indirectly extracts vital signs such as heartbeat and respiration by transmitting frequency-modulated continuous wave (FMCW) and receiving echo signals caused by subtle movements of the human chest cavity. The core task of cardiac signal detection is to separate minute cardiac activities (displacement of approximately 0.2–0.5 mm) from the radar echo and accurately estimate heart rate (HR), heart rate variability (HRV), or reconstruct an electrocardiogram (ECG) for clinical applications such as arrhythmia detection.
[0003] Existing millimeter-wave radar methods for detecting cardiac signals mainly fall into two categories: methods based on traditional signal processing and methods based on deep learning. However, both of these methods face significant challenges in practical applications.
[0004] Traditional methods primarily rely on physical models and manually designed feature engineering to extract meaningful vital sign information from raw signals. In the signal preprocessing stage, common techniques include accelerometer filters to eliminate low-frequency interference such as respiration, for example, separating respiratory and heartbeat components through bandpass filtering. Blind source separation methods such as Independent Component Analysis (ICA) are used to extract independent heartbeat sources from mixed signals; however, these methods often assume that the signal sources are linearly mixed, and in reality, the nonlinear coupling between cardiac activity and noise reduces the separation effect. For feature extraction, heart rate can be estimated based on power spectral density analysis, while using the physical relationship between pulse wave conduction time (PTT) and blood pressure to infer blood pressure values is a common model-driven approach.
[0005] However, these methods have significant limitations. First, they rely heavily on expert knowledge, the feature design process is cumbersome and scenario-specific, resulting in poor generalization ability. For example, bandpass filters suffer performance degradation when dealing with irregular heartbeats in patients with arrhythmias because the heartbeat frequency exceeds the preset range. Second, traditional methods struggle to handle nonlinear mixed signals: harmonics of heartbeat and respiration overlap in the frequency domain, especially respiratory harmonics which may fall into the heartbeat frequency band, causing separation distortion. Furthermore, they are sensitive to noise and motion artifacts; when low-quality signals constitute a high proportion of the training set, the model's robustness decreases sharply because manually added features cannot adaptively filter out interference from complex environments.
[0006] Deep learning methods automatically learn features through data-driven approaches, avoiding the limitations of manual design. Commonly used models include Convolutional Neural Networks (CNNs), which treat radar time-frequency maps as images, but the limited receptive field of convolutional kernels makes it difficult to capture long-term heartbeat dependencies; Recurrent Neural Networks (RNNs) or their variants, such as Long Short-Term Memory Neural Networks (LSTMNs), are used for sequence modeling and can handle time-series data, but the vanishing gradient problem limits their ability to memorize extremely long sequences (such as heartbeat cycles lasting several seconds); Generative models, such as Conditional Generative Adversarial Networks (cGANs), are used for electrocardiogram (ECG) synthesis, attempting to map radar signals to physiological signals, but in cases of abnormal heartbeats (such as atrial fibrillation), the distribution shift can easily lead to mapping distortion.
[0007] The main problems with deep learning methods include their black-box nature: the model lacks an understanding of the physiological mechanisms of the heart and may learn spurious features, such as mistaking environmental noise for heartbeat patterns, leading to failure on out-of-distribution samples. The weakness of strong data dependence is also prominent; supervised learning requires a large amount of labeled data, but labeling cardiac signals is costly, and the model's generalization ability is insufficient with small samples. Furthermore, inconsistent signal quality is a common challenge; low-quality signals (such as motion-disturbed segments) account for more than 30% in publicly available datasets, making model training unstable and prone to overfitting to noisy patterns.
[0008] Therefore, how to provide a feature decoupling framework driven by contrastive learning, combined with physical prior constraints, to solve the problem of extracting pure, interpretable and robust cardiac physiological features from complex radar signals is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0009] In view of the above problems, the present invention is proposed to provide a cardiac signal detection method for millimeter-wave radar based on contrastive learning to overcome or at least partially solve the above problems.
[0010] To achieve the above objectives, the present invention adopts the following technical solution:
[0011] A method for detecting cardiac signals using millimeter-wave radar based on contrastive learning and feature decoupling includes the following steps: S1. Obtain the original millimeter-wave radar signal, perform enhancement processing, and obtain positive samples; S2. Use the original millimeter-wave radar signal as a negative sample; S3. Construct a feature extraction and decoupling model, including a multi-scale feature extraction module, an attention module, a feedforward network, a dual-path feature decoupling module, and a physical constraint module; input positive and negative samples into the multi-scale feature extraction module to obtain multi-scale feature maps; S4. Input the multi-scale feature map into the attention module and the feedforward network to obtain the enhanced multi-scale feature map; S5. Input the enhanced multi-scale feature map into the dual-path feature decoupling module, output enhanced rhythmic features through the rhythmic path, and output enhanced morphological features through the morphological path. S6. Perform feature splicing and gating interaction on the enhanced rhythmic features and enhanced morphological features to obtain the final rhythmic output and the final morphological output; S7. Input the final rhythm output and the final morphological output to the physical constraint module; execute the physical rhythm constraint and the physical morphological constraint respectively, and output the constraint rhythm characteristics and constraint morphological characteristics. S8. By calculating the contrast loss between constraint rhythm features and constraint morphological features, the feature extraction and decoupling model is trained and optimized to obtain the final feature extraction and decoupling model.
[0012] Preferably, the original millimeter-wave radar signal in S1 is enhanced by adaptive filtering. The adaptive filtering is implemented by a one-dimensional convolutional neural network to perform sliding window smoothing filtering on the input millimeter-wave radar signal.
[0013] Preferably, the enhancement process in S2 includes: The original millimeter-wave radar signal is extracted independently along the channel dimension, and adaptive filtering is applied to the millimeter-wave radar signal. All the original millimeter-wave radar signals after adaptive filtering are spliced along the channel dimension to output an enhanced millimeter-wave radar signal with the same dimension as the original millimeter-wave radar signal. The enhanced millimeter-wave radar signal is then subjected to data augmentation processing. By performing nonlinear time stretching on the enhanced millimeter-wave radar signal, rhythmic enhancement samples are obtained. By adding Gaussian noise to the enhanced millimeter-wave radar signal and distorting the time axis, morphological enhancement samples are obtained.
[0014] Preferably, the multi-scale feature extraction module extracts multi-granularity temporal features of the signal in parallel using convolutional kernels of different sizes; The attention module is used to establish global temporal dependencies; Feedforward networks introduce nonlinear transformations through two fully connected layers; The dual-path feature decoupling module takes input to the rhythm path, uses a bidirectional long short-term memory neural network to process temporal features, processes them through a dimension rearrangement layer, and then reduces the dimensionality to a specified dimension through a feature projection layer to extract rhythm enhancement features; it takes input to the morphology path, uses a convolutional network to process morphological features, and reduces the dimensionality to a specified dimension through a feature projection layer to extract morphological enhancement features.
[0015] Preferably, the dual-path feature decoupling module further includes a feature enhancement and gating interaction submodule, which is used to enhance rhythmic features and morphological features, and to control the information interaction between features through the gating interaction module.
[0016] Preferably, the physical constraint module includes: The rhythm constraint submodule is used to limit heart rate characteristics within a preset physiological range.
[0017] The shape constraint submodule is used to limit the number of major peaks and valleys in the waveform and to smooth overly complex waveforms using Gaussian filtering.
[0018] Preferably, the rhythm constraint submodule estimates the heart rate by peak detection, and if the heart rate exceeds a preset range, the heart rate feature is linearly scaled; the morphology constraint submodule detects the number of waveform peaks and valleys, and if the number of waveform peaks and valleys exceeds a threshold, the heart signal is Gaussian filtered.
[0019] Preferably, the contrastive loss adopts a contrastive learning loss function, which includes positive sample pairs representing similar samples and negative sample pairs representing dissimilar samples, used to measure the similarity between positive and negative sample pairs, maximizing the similarity between positive sample pairs and minimizing the similarity between negative samples, and optimizing the training of rhythmic features and morphological features respectively.
[0020] As can be seen from the above technical solutions, compared with the prior art, the present invention discloses a method for detecting cardiac signals using millimeter-wave radar based on feature decoupling through contrastive learning. The beneficial effects of the above technical solutions provided by the embodiments of the present invention include at least the following: 1. The model exhibits a highly stable optimization process and a continuous convergence trend.
[0021] 2. The dual-path contrastive learning mechanism successfully separated rhythmic and morphological features. During training, the losses of both the rhythmic and morphological paths decreased synchronously, demonstrating that the dual-task optimization strategy effectively avoided feature confusion and provided a well-decoupled feature foundation for subsequent cardiac signal analysis.
[0022] 3. The model exhibits excellent generalization performance, and the ratio of training loss to validation loss remains within a healthy range. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0024] Figure 1This is a schematic diagram of the main process provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the dynamic adaptive filtering process provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the sample generation process provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the feature extraction and decoupling module structure provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the dual-path feature decoupling process provided in an embodiment of the present invention; Figure 6 This is a schematic diagram of the feature enhancement and gating interaction submodule processing flow provided in the embodiments of the present invention; Figure 7 This is a schematic diagram of the physical constraint flowchart for rhythmic features provided in an embodiment of the present invention; Figure 8 This is a schematic diagram of the physical constraint flowchart for morphological features provided in an embodiment of the present invention; Figure 9 This is a schematic diagram of the contrastive learning loss calculation process provided in an embodiment of the present invention. Detailed Implementation
[0025] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0026] like Figure 1 As shown in the figure, this invention discloses a method for detecting cardiac signals using a millimeter-wave radar based on feature decoupling through contrastive learning, comprising the following steps: S1. Acquire the original millimeter-wave radar signal, extract signal segments independently according to the channel dimension of the original millimeter-wave radar signal, perform adaptive filtering on the millimeter-wave radar signal, and splice all the original millimeter-wave radar signals after adaptive filtering along the channel dimension to output an enhanced millimeter-wave radar signal with the same dimension as the original millimeter-wave radar signal.
[0027] Traditional signal processing (such as the Butterworth bandpass filter) requires manually specifying parameters such as the cutoff frequency. In complex scenarios involving a mixture of heartbeats and breathing, determining the optimal parameters becomes difficult. Adaptive filters, through a data-driven approach, allow the model to learn the optimal filtering characteristics from the data itself.
[0028] Raw millimeter-wave radar signals contain significant amounts of environmental noise, equipment noise, and interference from irrelevant physiological activities (such as subtle body movements). Dynamic adaptive filters: The filtered signal waveform is smoother, with reduced random jitter, facilitating more stable detection of periodic patterns such as heartbeats. The filter's function is to smooth the signal, remove high-frequency noise, and potentially suppress low-frequency interference such as breathing to some extent, providing a cleaner input for subsequent feature decoupling modules.
[0029] like Figure 2 As shown, the multi-channel timing input signal of millimeter-wave radar is first separated according to the channel dimension, and signal segments are extracted independently for each channel; then, a sliding window filtering operation is performed through a one-dimensional convolutional layer, where the convolution kernel smooths the signal on the time axis and suppresses high-frequency noise and interference; the filtered result of each channel maintains the original timing length, and finally, the filtered outputs of all channels are reassembled to form an enhanced signal with the same dimension as the input.
[0030] S2. Perform data augmentation processing on the enhanced millimeter-wave radar signal to output rhythm-enhanced samples and morphological-enhanced samples, which are used as positive samples in contrastive learning.
[0031] Contrastive learning requires constructing positive sample pairs (semantically similar but superficially different). The sample generator ensures that the generated samples have the same physiological semantics as the original samples but different surface features through controlled signal transformations. In real-world scenarios, cardiac signals exhibit individual differences and noise interference; simulating these variations improves the model's generalization ability. By generating rhythm-enhanced and morphology-enhanced samples separately, the model is forced to separate these two types of features. Rhythm-enhanced samples help the model learn features invariant to heart rate changes, while morphology-enhanced samples help the model learn features invariant to waveform deformations.
[0032] like Figure 3 As shown, the sample generator is a data augmentation module that generates two types of augmented samples from the original signal by simulating physiological changes in heart signals: Rhythm enhancement samples: Simulate heart rate changes (such as tachycardia / bradycardia).
[0033] Morphological enhancement samples: simulate waveform morphological changes (such as noise interference, slight deformation).
[0034] Generate rhythm enhancement samples: Rhythm samples are designed to simulate heart rate changes (such as tachycardia or bradycardia) through nonlinear time stretching. The input is the output signal of a dynamic adaptive filter. The signal is processed sequentially by channel, and a stretching factor alpha is randomly sampled from a preset range (default rhythm_range=(0.8,1.2)). alpha>1 indicates stretching (simulating a slower heart rate), and alpha<1 indicates compression (simulating a faster heart rate). An original time axis t_original (a linear space from 0 to 1) and a stretched time axis t_stretched (length adjusted to original length × alpha) are created. If alpha>1 (stretching): the signal is first interpolated to the longer t_stretched axis, and then interpolated back to the original length to avoid edge distortion. If alpha≤1 (compression): cubic spline interpolation is used to directly compress the signal, maintaining waveform smoothness.
[0035] Generating morphological enhancement samples: Morphological samples aim to simulate waveform morphological changes (such as noise interference or physiological variations) by adding noise and time warping. The input is the output signal of a dynamic adaptive filter. The signal is processed channel by channel, and Gaussian noise with a mean of 0 and a default standard deviation of 0.05 is added to the original input signal to simulate sensor noise or environmental interference. A sinusoidal offset is applied to the original time axis t_original: This causes slight fluctuations in the time axis, simulating physiological waveform variations (such as respiratory artifacts). The noisy signal is then re-interpolated from the warped time axis t_warped back to the standard time axis t_original, ensuring the sequence length remains unchanged. If repetitions occur after the time axis warping (e.g., overlap caused by the sine function), the noisy signal is directly returned to avoid interpolation errors.
[0036] The enhanced millimeter-wave radar signal is input into the feature extraction and decoupling module. The original millimeter-wave radar signal is used as a negative sample in the contrastive learning. The positive and negative samples are added to convolutional layers of different scales for multi-scale feature extraction. Rhythmic and morphological features are extracted from the convolutional layers of different scales. The rhythmic and morphological features are concatenated along the channel dimension to obtain a multi-scale feature map.
[0037] Cardiac signals contain information at different time scales, such as rhythm (e.g., heart rate variability) and morphology (e.g., PQRST waves). A single-scale convolutional kernel cannot simultaneously capture long-cycle rhythm patterns and short-time waveform features. Multi-scale fusion can provide a more comprehensive feature representation, laying the foundation for subsequent decoupling.
[0038] Multi-scale feature extraction uses convolutional kernels of different sizes to process the input signal in parallel, capturing multi-granular temporal features ranging from the interval between heartbeats to waveform details.
[0039] like Figure 4As shown, the input signal is the original signal that has passed through an AdaptiveFilter only once. In contrastive learning, this signal serves as a negative sample, and the generated signal serves as a positive sample. Three parallel one-dimensional convolutional layers (kernel sizes of 31, 15, and 7) are used to process the input signal. First, mesoscale features (31-point convolution) are extracted to capture inter-heartbeat patterns, large-scale features (15-point convolution) are used to emphasize rhythmic periodicity, and small-scale features (7-point convolution) are used to capture morphological details. Finally, the three sets of features are concatenated along the channel dimension to form a multi-scale feature map.
[0040] S3. Construct a feature extraction and decoupling model; the feature extraction and decoupling model includes a multi-scale feature extraction module, an attention module, a feedforward network, a dual-path feature decoupling module, and a physical constraint module.
[0041] Positive and negative samples are input into the multi-scale feature extraction module for multi-scale feature extraction. Rhythmic and morphological features are extracted from convolutional layers of different scales. The rhythmic and morphological features are then concatenated along the channel dimension to obtain a multi-scale feature map.
[0042] Cardiac signals exhibit long-range dependencies (such as the relationship between heartbeat intervals). Traditional convolution has a limited receptive field. Self-attention can capture non-local dependencies, identify key events and temporal patterns in heartbeat sequences, and enhance the model's adaptability to irregular heart rhythms (such as arrhythmias). By establishing global temporal dependencies through a multi-head self-attention mechanism, the model can focus on the correlations between any time points in the sequence.
[0043] S4. Input the multi-scale feature maps into the attention module to establish the temporal dependencies of the multi-scale feature maps.
[0044] First, the features are rearranged into a temporal format. Then, a multi-head self-attention mechanism is applied. Finally, residual connections and layer normalization are used to stabilize the training, resulting in a multi-scale feature map after training.
[0045] The multi-scale feature map is input into the feedforward network, and a nonlinear transformation is introduced to enhance the feature representation capability. The network is trained using residual connections and layer normalization to obtain the enhanced multi-scale feature map.
[0046] The self-attention mechanism primarily uses linear transformations, while the feedforward network provides nonlinear enhancements, increasing model capacity and improving feature representation capabilities. Residual connections prevent gradient vanishing, and layer normalization stabilizes the training process. A two-layer fully connected network introduces nonlinear transformations to further enhance feature representation capabilities.
[0047] First, a two-layer fully connected network (containing a ReLU activation function layer and a Dropout random deactivation layer) is used, and finally, residual connections and layer normalization are used to obtain the enhanced multi-scale feature map.
[0048] S5. The enhanced multi-scale feature map is input into the dual-path feature decoupling module to perform dual-path feature decoupling. A bidirectional long short-term memory neural network is used to process the temporal features. After dimensionality rearrangement layer processing, the feature projection layer is used to reduce the dimensionality to the specified dimension to extract rhythm enhancement features. The feature map is input into the morphological path, where a convolutional network is used to process the morphological features. The feature projection layer is used to reduce the dimensionality to the specified dimension to extract morphological enhancement features. The enhanced rhythm features are output through the rhythm path. The enhanced morphological features are output through the morphological path.
[0049] The temporal feature dimension structure output by the Long Short-Term Memory Neural Network model is (batch, time step, feature dimension), while the morphological feature dimension structure output by the convolution is (batch, channel, height, width). The dimensional layouts of the two are inherently incompatible, and direct fusion will lead to information misalignment. Dimensional rearrangement can be achieved by adjusting the dimensional order (converting channels to time steps and time steps to channels) to match the two types of features in terms of dimensional quantity and semantics, thus adjusting the structure for subsequent fusion.
[0050] like Figure 5 As shown, this is the core decoupling step, which separates the features into two independent parts: rhythm and morphology.
[0051] Path 1: Rhythmic Path (Long Short-Term Memory Neural Network Branch) Long Short-Term Memory (LSTM) neural networks excel at processing sequential data and can effectively model the time-dependent relationships between heartbeats. Bidirectional LSTM neural networks consider contextual information and can better capture heart rate variability (HRV) rhythm paths, focusing on temporal patterns and decoupling from morphological features.
[0052] Specifically, a bidirectional long short-term memory (LSTM) neural network is used to extract heart rhythm features, focusing on periodic patterns over time. The LTM network processes temporal features, ultimately forming an internal state vector that condenses all temporal context information after processing the entire input temporal signal. The goal is to extract a fixed-dimensional feature vector from the LTM network that globally represents the heart rhythm pattern of the input signal, using this as a rhythm feature representation. This representation is then reduced to a specified dimension (32-dimensional) through a projection layer.
[0053] Path 2: Morphological Path (Convolutional Branch) Convolutional operations excel at capturing local patterns and are suitable for extracting the morphological features of PQRST waves. By compressing the sequence length through adaptive pooling layers, important morphological information can be preserved and separated from the rhythmic path, ensuring that the morphological features are not affected by the time scale.
[0054] Specifically, convolutional networks are used to extract local morphological features of the waveform, focusing on the shape details of the heartbeat waveform.
[0055] Features are processed using convolutional networks, and adaptive max pooling is applied to compress the sequence length. The sequence is then projected onto a morphological feature space (32-dimensional) through fully connected layers.
[0056] S6. Perform feature concatenation operation on the decoupled enhanced rhythmic features and enhanced morphological features, and control the feature interaction intensity through Sigmoid gating weights to obtain the final rhythmic output and the final morphological output.
[0057] Enhanced networks can further improve feature discrimination, while gating mechanisms can prevent feature contamination, ensure decoupling purity, and controllably balance feature independence and complementarity.
[0058] like Figure 6 As shown, the decoupled features are enhanced and optimized, and the information flow between rhythm and morphological features is controlled by a gating mechanism.
[0059] The enhanced rhythmic and morphological features are first concatenated along their feature dimensions to form a 64-dimensional combined feature vector. This combined feature is then input into a shared gating network, which consists of a fully connected layer (64-dimensional input to 64-dimensional output) and a sigmoid activation function to generate 64-dimensional gating weights. This weight vector is uniformly divided into two independent sets of gating signals: a 32-dimensional rhythmic gating signal and a 32-dimensional morphological gating signal. Finally, through two parallel element-wise multiplication operations, the rhythmic gating signal is modulated with the original rhythmic features to output the final rhythmic feature, and the morphological gating signal is modulated with the original morphological features to output the final morphological feature. This achieves adaptive, selective weighted fusion and interactive control of the two features.
[0060] S7. Input the final rhythm output and the final morphological output to the physical constraint module; for rhythm characteristics, execute the preset physical rhythm constraint method to check the heart rate range of the original millimeter-wave radar signal and output the constrained rhythm characteristics; for morphological characteristics, execute the preset physical morphological constraint method to detect the number of waveform peaks and valleys and output the constrained morphological characteristics.
[0061] Physical constraints are a post-processing mechanism that introduces domain knowledge (such as physiological priors) into deep learning models to ensure that the features output by the model conform to the physical laws of the real world. Here, constraints are imposed on rhythmic features (such as heart rate) and morphological features (such as waveform peaks and troughs). The heart rate is constrained within a reasonable range of 50-120 BPM, and the complexity of the waveform morphology is controlled (e.g., limiting the number of major peaks and troughs to no more than two). This constraint does not directly participate in the backpropagation of model training but serves as a feature optimization layer, correcting the results after feature extraction to enhance the physiological plausibility of the features.
[0062] The main purpose of introducing physical constraints is to improve the generalization ability and interpretability of the model, and to prevent the model from learning spurious features that violate physiological laws. Cardiac signals have clear physiological boundaries (e.g., heart rate will not be lower than 50 BPM or higher than 120 BPM), but purely data-driven models may output outliers due to noise or overfitting. Physical constraints can force features to fall within reasonable ranges, reducing reliance on specific noise patterns in the training data, while making the features more consistent with clinical understanding, providing more reliable input for subsequent tasks (such as arrhythmia detection).
[0063] like Figure 7 As shown, rhythm constraint estimates the heart rate of the original signal using a physical rhythm constraint method (using peak detection). If the heart rate exceeds the 50-120 BPM range, the feature value is scaled proportionally. Figure 8 As shown, morphological constraints detect the number of peaks and valleys in the waveform using physical morphological constraint methods. If the number exceeds a threshold, a Gaussian filter is applied to smooth the signal. Crucially, this does not affect gradient backpropagation; it is only used as a post-processing step. During the training loop, the constrained features are used to calculate an additional contrastive loss (weight 0.1), which is combined with the original loss to balance the constraint strength.
[0064] Physical rhythm constraint method: The heart rate is calculated by peak detection using an estimated heart rate method, and linear scaling is used instead of hard truncation to preserve the relative relationship of features.
[0065] Physical morphological constraint method: First, detect the main peaks and valleys in the feature sequence, then use Gaussian filtering (sigma=1) to smooth the overly complex waveform, and set the threshold to 2. Based on the physiological characteristics of a typical heartbeat, the number of main peaks and valleys should not exceed two.
[0066] Heart rate estimation method: This method first extracts the first channel from the input signal (assuming it is an ECG signal), uses the peak detection function of the scipy library to identify the R wave peak (the peak height is required to exceed 60% of the maximum signal value and the minimum interval is 1 / 3 of the sampling rate to avoid false peaks), and calculates the average of R intervals when multiple peaks are detected. Finally, the average interval is converted into a heart rate value (BPM). If there is an abnormality in the processing or the number of peaks is insufficient, the default heart rate of 80 BPM is returned.
[0067] S8. By calculating the contrast loss between constraint rhythm features and constraint morphological features, the feature extraction and decoupling model is trained and optimized to obtain the final feature extraction and decoupling model.
[0068] The contrastive loss employs a contrastive learning loss function, which includes positive sample pairs representing similar samples and negative sample pairs representing dissimilar samples. This function measures the similarity between positive and negative sample pairs, maximizing the similarity between positive sample pairs and minimizing the similarity between negative sample pairs. This is used to optimize the training of rhythmic and morphological features, respectively.
[0069] like Figure 9 As shown, the InfoNCE contrastive loss (InfoNCELoss class) is used to calculate the contrastive learning loss between features and is the core of contrastive learning. InfoNCELoss is a contrastive learning loss function based on InfoNCE.
[0070] In contrastive learning, it is used to measure the similarity between positive sample pairs (similar samples) and negative sample pairs (dissimilar samples). The InfoNCE loss is based on the principle of noise contrastive estimation, and its mathematical expression is:
[0071] in: Anchor sample, assuming it corresponds to feature 1, i.e., the feature of the original sample.
[0072] Positive samples are similar to anchor samples (e.g., different augmented views of the same data). They correspond to Feature 2, but note that when calculating the loss, we pair positive samples at corresponding positions (i.e., the same index) in Feature 1 and Feature 2.
[0073] Negative samples, which include all other samples in a batch. In the code, j From 1 to N, where N is the batch size. Note that the summation in the denominator includes positive samples (when...). j (When corresponding to positive samples) and negative samples.
[0074] The feature extraction function maps samples to a feature space. Input features 1 and 2 are already feature vectors obtained by the feature extractor.
[0075] Temperature parameter controls the sharpness of similarity distribution; a smaller temperature value makes the loss function more sensitive to difficult negative samples.
[0076] expect In practice, the mean of a small batch of samples is used to approximate the expectation, that is, the loss of all anchor samples in the batch is averaged.
[0077] After the feature normalization layer, the similarity matrix between feature 1 and feature 2 is calculated as (feature 1 · feature 2) T The core calculation is matrix multiplication (Feature 1, Feature 2). TSince the features have been normalized, this result directly yields the cosine similarity matrix. Subsequently, all elements of this matrix are divided by the temperature coefficient τ to perform scaling. Finally, a similarity matrix S of shape [B, B] is output, where each element S(i, j) represents the scaled similarity score between the i-th anchor sample and the j-th positive sample.
[0078] This step aims to quantify the correlation between the original features and the positive sample features, providing a basis for subsequent comparative learning. The specific process is as follows: The input consists of two feature tensors that have undergone feature normalization, namely original feature 1 and positive sample feature 2, and a temperature coefficient τ used to adjust the distribution sensitivity.
[0079] Then, generate labels (diagonal indices represent positive samples). This step aims to construct a supervisory signal for contrastive learning and define the correct matching relationships. Its core logic is based on a fundamental assumption: within the same training batch, only anchor samples derived from the same anchor sample constitute true positive sample pairs. Therefore, in the similarity matrix composed of feature 1 and feature 2, only the position (i, i) on the main diagonal represents the positive sample pairs that should be brought closer. Specifically, this is achieved by generating an integer sequence [0, 1, 2, ..., B-1] from 0 to B-1 as a label vector. This label indicates that for the original feature 1 [i], the index of the corresponding positive sample in feature 2 is precisely i. Finally, this label tensor of shape [B] is output, which will be used to guide the loss function, enabling the model to learn to distinguish between positive sample pairs on the diagonal and negative sample pairs off-diagonally.
[0080] Cross-entropy loss is used in the loss calculation, and its expression is as follows:
[0081] in: Number of samples in the batch.
[0082] Number of categories :sample The true label.
[0083] Model prediction samples Category The probability of.
[0084] The loss function employs an in-batch implicit negative sample generation design, calculating the cosine similarity between anchor samples (such as raw ECG signals) and positive samples (such as corresponding signals after rhythm stretching or morphological enhancement). Other samples within the batch are used as negative samples, and the sharpness of the similarity distribution is adjusted using a temperature parameter. Finally, cross-entropy loss is applied to maximize the similarity of positive sample pairs and minimize the similarity of negative sample pairs. During training, the framework calculates the contrastive losses for the rhythmic and morphological paths separately, and balances their contributions through dynamic weights (e.g., increasing the morphological loss weight with each training epoch). This ensures the model simultaneously learns rhythmic features invariant to heart rate changes and morphological features invariant to waveform deformation, thereby achieving high-quality feature decoupling.
[0085] The current model exhibits a highly stable optimization process and a continuous convergence trend through the method of this invention. The validation loss steadily decreased from the initial 2.7219 to the optimal 0.3013 (Epoch 77), a reduction of 88.9%. The loss curve was smooth during training without drastic oscillations, indicating that the learning rate scheduling (cosine annealing decreased from 0.00005 to 0.000043) and gradient control strategy were effective. The optimal validation loss remained stable after reaching 0.3013 in Epoch 77, demonstrating that the model achieved a high-quality convergence state.
[0086] The dual-path contrastive learning mechanism successfully separated rhythmic and morphological features. Looking at the loss composition, the rhythmic loss (0.1488) and morphological loss (0.1525) reached equilibrium at the optimal epoch, indicating that the model equally focuses on both types of features. During training, the losses of the rhythmic and morphological paths decreased synchronously, demonstrating that the dual-task optimization strategy effectively avoided feature confusion and provided a well-decoupled feature foundation for subsequent cardiac signal analysis.
[0087] The model exhibits excellent generalization performance, with the training loss to validation loss ratio consistently remaining within a healthy range (optimal at approximately 1.3:1). Continuous improvement on the validation set (from 2.7219 in Epoch 1 to 0.3013 in Epoch 77) indicates that the feature representations learned by the model are highly discriminative. This performance improvement provides a reliable technical foundation for practical applications such as arrhythmia detection and HRV analysis.
[0088] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0089] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for detecting cardiac signals using millimeter-wave radar based on contrastive learning and feature decoupling, characterized in that, Includes the following steps: S1. Obtain the original millimeter-wave radar signal, perform enhancement processing, and obtain positive samples; S2. Use the original millimeter-wave radar signal as a negative sample; S3. Construct a feature extraction and decoupling model; It includes a multi-scale feature extraction module, an attention module, a feedforward network, a dual-path feature decoupling module, and a physical constraint module; the positive samples and the negative samples are input into the multi-scale feature extraction module to obtain a multi-scale feature map; S4. Input the multi-scale feature map into the attention module and the feedforward network to obtain the enhanced multi-scale feature map; S5. Input the enhanced multi-scale feature map into the dual-path feature decoupling module, and output enhanced rhythmic features through the rhythmic path and enhanced morphological features through the morphological path. S6. Perform feature splicing and gating interaction on the enhanced rhythm features and the enhanced morphological features to obtain the final rhythm output and the final morphological output; S7. Input the final rhythm output and the final morphological output to the physical constraint module; execute the physical rhythm constraint and the physical morphological constraint respectively, and output the constraint rhythm feature and the constraint morphological feature. S8. By calculating the contrast loss between the constraint rhythm features and the constraint morphological features, the feature extraction and decoupling model is trained and optimized to obtain the final feature extraction and decoupling model.
2. The cardiac signal detection method based on feature decoupling millimeter-wave radar using contrastive learning according to claim 1, characterized in that, The original millimeter-wave radar signal described in S1 is enhanced through adaptive filtering, which is implemented by a one-dimensional convolutional neural network to perform sliding window smoothing filtering on the input millimeter-wave radar signal.
3. The cardiac signal detection method based on feature decoupling millimeter-wave radar using contrastive learning according to claim 1, characterized in that, The enhancement process described in S2 includes: The original millimeter-wave radar signal is extracted independently along the channel dimension, and adaptive filtering is applied to the millimeter-wave radar signal. All the original millimeter-wave radar signals after adaptive filtering are then spliced along the channel dimension to output an enhanced millimeter-wave radar signal with the same dimension as the original millimeter-wave radar signal. The enhanced millimeter-wave radar signal is then subjected to data augmentation processing. By performing nonlinear time stretching on the enhanced millimeter-wave radar signal, rhythmic enhancement samples are obtained. By adding Gaussian noise to the enhanced millimeter-wave radar signal and distorting the time axis, morphological enhancement samples are obtained.
4. The cardiac signal detection method based on feature decoupling millimeter-wave radar using contrastive learning according to claim 1, characterized in that, The multi-scale feature extraction module extracts multi-granularity temporal features of the signal in parallel using convolution kernels of different sizes; The attention module is used to establish global temporal dependencies; The feedforward network introduces a nonlinear transformation through two fully connected layers; The dual-path feature decoupling module is input to the rhythm path, uses a bidirectional long short-term memory neural network to process temporal features, processes them through a dimension rearrangement layer, and then reduces the dimensionality to a specified dimension through a feature projection layer to extract rhythm enhancement features. The input is fed into the morphological path, and the morphological features are processed using a convolutional network. The dimensionality is reduced to a specified dimension through a feature projection layer to extract morphological enhancement features.
5. The cardiac signal detection method based on feature decoupling millimeter-wave radar using contrastive learning according to claim 4, characterized in that, The dual-path feature decoupling module also includes a feature enhancement and gating interaction submodule, which is used to enhance rhythmic features and morphological features, and controls the information interaction between features through the gating interaction submodule.
6. The cardiac signal detection method based on feature decoupling millimeter-wave radar using contrastive learning according to claim 1, characterized in that, The physical constraint module includes: The rhythm constraint submodule is used to limit heart rate characteristics within a preset physiological range; The shape constraint submodule is used to limit the number of major peaks and valleys in the waveform and to smooth overly complex waveforms using Gaussian filtering.
7. The cardiac signal detection method based on feature decoupling millimeter-wave radar using contrastive learning according to claim 6, characterized in that, The rhythm constraint submodule estimates the heart rate through peak detection. If the heart rate exceeds a preset range, the heart rate feature is linearly scaled. The morphological constraint submodule detects the number of waveform peaks and valleys, and if the number of waveform peaks and valleys exceeds a threshold, it performs Gaussian filtering on the cardiac signal.
8. The cardiac signal detection method based on feature decoupling millimeter-wave radar using contrastive learning according to claim 1, characterized in that, The contrastive loss described in S8 employs a contrastive learning loss function, which includes positive sample pairs representing similar samples and negative sample pairs representing dissimilar samples. This function measures the similarity between positive and negative sample pairs, maximizing the similarity between positive sample pairs and minimizing the similarity between negative samples. This optimizes the training of rhythmic and morphological features, respectively.