A remote heart rate detection method based on domain adaptation

By employing a domain-adaptive Teacher-Student framework and multi-scale spatiotemporal graph processing, the problem of domain variability in remote heart rate detection is solved, enabling efficient and accurate heart rate detection in complex scenarios.

CN120635935BActive Publication Date: 2026-11-24HEFEI UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510497875.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-21
Publication Date
2026-11-24
Estimated Expiration
2045-04-21

AI Technical Summary

Technical Problem

Existing remote heart rate monitoring technologies struggle to adapt effectively to domain differences when faced with varying environments, equipment, and postures, resulting in decreased accuracy and robustness, and failing to meet the requirements of practical applications.

Method used

A domain-adaptive Teacher-Student framework is adopted. The Teacher network generates pseudo-labels for the target domain and the Student network is used for training. Combined with multi-scale spatiotemporal graphs and denoisers, cross-domain heart rate detection is achieved.

Benefits of technology

It improves the model's performance in new fields, reduces the need for labeled data, enhances robustness to noise, adapts to complex scenarios, and improves the stability and accuracy of heart rate prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120635935B_ABST
    Figure CN120635935B_ABST
Patent Text Reader

Abstract

This invention discloses a domain-adaptive remote heart rate detection method, relating to the fields of deep learning and remote heart rate detection technology. It utilizes a source domain dataset to train a domain-adaptive Teacher network, which outputs a predicted rPPG signal based on the input noisy rPPG signal and a face video. The trained Teacher network then generates the predicted rPPG signal corresponding to the face video in the target domain, serving as a pseudo-label for the target domain and constructing a target domain dataset. Next, it uses the target domain dataset to train a domain-adaptive Student network, which outputs a predicted rPPG signal based on the input noisy rPPG signal and the face video. Finally, the trained Student network is used for remote heart rate detection, generating the predicted rPPG signal for the face video to be detected. This invention exhibits better adaptability, accuracy, and efficiency in cross-domain heart rate detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of deep learning and remote heart rate detection technology, and in particular to a remote heart rate detection method based on domain adaptation. Background Technology

[0002] In the application of modern technology, remote heart rate monitoring technology plays an indispensable role in healthcare and sports monitoring. Traditional heart rate monitoring mainly relies on contact devices, such as ECG electrodes and pulse sensors. In routine ECG monitoring scenarios in hospitals, patients need to connect multiple leads to ECG electrodes, which not only restricts their freedom of movement but can also cause psychological stress and physical discomfort. In sports scenarios, such as running or exercising, wearing these contact devices can severely affect the exercise experience and may even cause monitoring interruptions due to device shaking or detachment.

[0003] With the rapid development of computer vision technology, video-based remote heart rate detection technology has emerged and become a research hotspot. This technology detects heart rate by analyzing subtle changes in a person's face in a video, freeing it from the constraints of contactless devices and theoretically enabling real-time, non-invasive heart rate monitoring in various scenarios. However, in practical applications, this technology faces the significant challenge of domain variability.

[0004] Video data collected from different environments and devices exhibits significant differences across multiple dimensions. Regarding lighting, the uniform, soft lighting indoors contrasts sharply with the strong, variable sunlight and dappled shade outdoors, causing substantial variations in how faces appear in videos. In low-light indoor environments, facial details may be blurry; while under direct outdoor sunlight, reflections and shadows may appear on the face, making key features difficult to identify. In terms of equipment, cameras with different resolutions capture videos with varying clarity. Low-resolution videos may lose important facial details, while high-resolution videos may place a burden on subsequent processing due to their large data volume. Furthermore, differences in frame rates between different devices also affect the accuracy of capturing facial changes in videos. Regarding posture, the position and angle of the face in videos constantly change in various dynamic postures, including frontal, side, head-down, head-up, and more, posing significant challenges to video-based heart rate detection.

[0005] This domain difference leads to significant performance variations for video-based heart rate detection models across different datasets. Source domain video data collected in a laboratory environment typically features stable lighting, fixed resolution, and relatively standardized human poses, allowing heart rate detection models trained on this data to perform well in such environments. However, when applied to real-world outdoor scenes (the target domain), the model's detection accuracy can drop dramatically due to variations in environment, equipment, and pose. For example, under strong outdoor light, facial reflections may make some features difficult to recognize, causing the model to misjudge heart rate; when a person is moving rapidly, frequent changes in pose may prevent the model from accurately tracking facial features, thus affecting the accuracy of heart rate detection.

[0006] Existing heart rate detection methods have several shortcomings when dealing with domain variability issues. Traditional methods based on handcrafted features and machine learning, such as those based on skin color models and signal processing algorithms, are poorly adaptable to changes in environment and device, making it difficult to accurately extract heart rate-related features in complex scenarios. While deep learning-based methods can automatically learn features to some extent, deep neural networks are highly sensitive to data distribution. When there is a significant domain difference between the test and training data, the model is prone to overfitting or underfitting, leading to performance degradation. For example, some heart rate detection models based on convolutional neural networks (CNNs) may fail to effectively adjust the learning of color and texture features when faced with video data under different lighting conditions, thus affecting the accuracy of heart rate detection.

[0007] Furthermore, in related video analysis fields, such as facial video-based physiological measurements, remote photoplethysmography (rPPG) technology aims to non-contactly measure cardiac activity and physiological signals using facial video, possessing significant potential application value in areas such as medical and health monitoring. Early research primarily employed classical signal processing methods, analyzing subtle color changes in facial regions of interest (ROIs) to obtain heart rate information; some studies utilized color subspace transformation methods, employing all skin pixels for rPPG measurement. In recent years, with the rapid development of deep learning technology, deep learning-based rPPG measurement methods have gradually become dominant. However, traditional methods often focus only on spatiotemporal rPPG features between adjacent frames, ignoring the interrelationships of quasi-periodic rPPG features over longer time periods. While pure end-to-end deep learning methods directly use facial video frames as input to predict rPPG and other physiological signals, this approach is easily affected by complex scenes and struggles to effectively exclude features unrelated to rPPG, leading to significant performance degradation on real-world datasets.

[0008] In summary, existing technologies in remote heart rate monitoring and facial video-based physiological measurements struggle to effectively address domain variability issues, failing to meet the stringent requirements of accuracy, robustness, and adaptability in practical applications. Therefore, developing new methods that effectively address these challenges is of significant practical importance, not only driving technological advancements in these fields but also providing more reliable technical support for related applications. In remote heart rate monitoring technology, resolving domain variability and improving model performance across different scenarios is crucial for achieving accurate and convenient heart rate monitoring and promoting the development of industries such as healthcare and sports monitoring. Summary of the Invention

[0009] To overcome the shortcomings of the prior art, this invention provides a domain-adaptive remote heart rate detection method, which has better adaptability, accuracy and efficiency in cross-domain heart rate detection, while maintaining low requirements for labeled data, and is suitable for remote health monitoring in real-world scenarios.

[0010] To achieve the above objectives, the present invention adopts the following technical solution, including:

[0011] A domain-adaptive remote heart rate detection method includes the following steps:

[0012] S1. A domain-adaptive Teacher network is trained using the source domain dataset. The Teacher network is used to output a predicted rPPG signal based on the input noisy rPPG signal and face video. The source domain dataset includes source domain face videos and their corresponding source domain real labels, i.e., source domain real rPPG signals.

[0013] S2. Use the trained Teacher network to generate the predicted rPPG signal corresponding to the target domain face video, and use it as the target domain pseudo-label to construct the target domain dataset; the target domain dataset includes the target domain face video and its corresponding target domain pseudo-label.

[0014] S3, using the target domain dataset to train a domain-adaptive Student network, which is used to output a predicted rPPG signal based on the input noisy rPPG signal and face video;

[0015] S4 utilizes the trained Student network to perform remote heart rate detection and generate a predicted rPPG signal for the face video to be detected.

[0016] Preferably, the training process of the Teacher network in step S1 is as follows:

[0017] S11, x, the i-th source domain face video i s The corresponding source domain real label yi s Let y0 be the initial signal. Noise is added at each time step to obtain the noise signal after adding noise at each time step.

[0018] S12, for the i-th source domain face video x i s Feature extraction is performed, and the resulting multi-scale spatiotemporal map is obtained.

[0019] S13, fuses the noise signal with the multi-scale spatiotemporal map to obtain fused data;

[0020] S14, the fused data is input into a denoiser P conditioned on the initial signal y0 and the time step to reconstruct a noise-free rPPG signal.

[0021] S15, reconstruct the noise-free rPPG signal After embedding E in the source domain s After processing, the i-th source domain face video x is obtained. i s The corresponding multiple predicted rPPG signals, i.e. multiple pseudo-labels First, based on the mean square error loss of the power spectral density (PSD), pseudo-labels closest to the initial signal y0 are selected. Reconstruct source domain embedding E s For the i-th source domain face video x i s The source domain real tag y i s and predicting rPPG signals Negative Pearson related losses Through negative Pearson related losses Reverse optimization of denoiser P and source domain embedding E s .

[0022] Preferably, for any given data X, the source domain is embedded into E. s Generate a deviation B bias The generated deviation B bias The output data of the denoiser is used to reconstruct the noise-free rPPG signal. Adding them together, we get the source domain embedding E. s Output data

[0023] The mean square error loss of the power spectral density (PSD) is calculated as follows:

[0024]

[0025] Among them, PSD pred [i] and PSD true[i] are respectively The i-th element in the predicted PSD signal and the real PSD signal obtained after processing y0, where l represents the length of the signal and N represents the number of elements.

[0026] Preferably, in step S2, the inference process of the Teacher network, that is, using the trained Teacher network to generate target domain pseudo-labels corresponding to the target domain face video, is as follows:

[0027] S21, randomly generate noise signals;

[0028] S22, for the j-th target domain face video x j t Feature extraction is performed, and the resulting multi-scale spatiotemporal map is obtained.

[0029] S23, the randomly generated noise signal is fused with the multi-scale spatiotemporal map to obtain fused data;

[0030] S24, the fused data is processed by denoiser P and embedded with the source domain E. s After processing, the face video x of the j-th target domain is obtained. j t The corresponding predicted rPPG signal is the target domain pseudo-label.

[0031] Preferably, the training process of the Student network in step S3 is as follows:

[0032] S31, target domain face video x j t Corresponding target domain pseudo-labels Noise is added at time steps to obtain the noise signal after noise addition at each time step;

[0033] S32, for the j-th target domain face video x j t Feature extraction is performed, and the resulting multi-scale spatiotemporal map is obtained.

[0034] S33 fuses the noise signal with the multi-scale spatiotemporal map to obtain fused data;

[0035] S34, the fused data is input into the denoiser P, and then processed by the target domain embedding E. t After processing, the j-th target domain face video x is obtained. j t Corresponding predicted rPPG signal

[0036] S35, Construct the target domain embedding E t For the j-th target domain face video Target domain pseudo-labels and predicting rPPG signals Negative Pearson related losses Through negative Pearson related losses Inverse optimization of the target domain embedding E in the Student network t .

[0037] Preferably, a low-rank adaptation mechanism (LoRA) is embedded in the linear layer of the denoiser P. The low-rank adaptation mechanism is as follows:

[0038]

[0039] Where W represents the updated weight matrix, W0 represents the fixed original weight matrix, α is the scaling factor, and the low-rank matrix A∈R m×r B∈R r×n r is the rank of the low-rank matrix and r≤min(m,n), where m represents the input dimension of the weight matrix and n represents the output dimension of the weight matrix;

[0040] Two pairs of low-rank matrix groups (A) are introduced during the training process. tea B tea ) and (A stu B stu ), and the two pairs of low-rank matrix groups (A tea B tea ) and (A stu B stu The weights W0 and W0 are introduced as trainable parameters into the Teacher and Student networks, respectively. During training, the weight matrix W0 corresponding to the key parts of the denoiser P is decomposed and updated in low rank, while other parts remain unchanged. During forward propagation (adding noise), the updated weight matrix W is calculated according to the low-rank adaptation mechanism. During backpropagation (removing noise), the low-rank matrix group (A) is calculated. tea B tea ) and (A stu B stu The gradients of each low-rank matrix in the matrix are calculated and updated based on the gradients, while the original weight matrix W0 remains unchanged.

[0041] Preferably, in step S4, the inference process of the Student network, that is, using the trained Student network to perform remote heart rate detection and generate the predicted rPPG signal of the face video to be detected, is as follows:

[0042] S41, sample noise signals from a Gaussian distribution to obtain H initial heart rate data points, assuming y 0:H,0|T ;

[0043] S42, feature extraction is performed on the video of the face to be detected, and the multi-scale spatiotemporal map is obtained;

[0044] S43, assuming H initial heart rate data are y 0:H,0|T By fusing with a multi-scale spatiotemporal map, H fused data points are obtained;

[0045] S44, input H fused data points into the denoiser P to predict feasible heart rate data hypotheses.

[0046] S45, making feasible heart rate data assumptions Noisy heart rate data generated using a diffusion model. As the input to the denoiser P at the next time step, the process is represented as:

[0047]

[0048] Where t and t′ are the current and next time steps, respectively, and initially t = T, ∈ ~N(0,I) is y 0:H,t Independent standard Gaussian noise;

[0049]

[0050] Where, ∈ t It is noise at time step t; σ t Used to control the randomness of the diffusion process; The cumulative noise scaling factor from time step 0 to t;

[0051] Step S45 iterates K times, starting from T. The time step of each iteration is represented as:

[0052]

[0053] Preferably, during the training of the Teacher and Student networks, a denoiser P is used to denoise the fused data. The denoiser P is an STHD (Spatial-Hybrid Denoising) denoiser, as detailed below:

[0054] A multi-scale spatiotemporal map and a noisy rPPG signal are concatenated into a matrix for dimension alignment; then, the resulting matrix is ​​projected onto a high-dimensional embedding layer through an embedding layer. middle;

[0055] Map the high-dimensional embedding x to a query key Sum Then they are divided into spatial groups along the channel dimension. and time group Where n represents the number of regions of interest (ROIs) on the face, J represents the number of frames in the video data, C represents the number of channels, and D represents the dimension of the high-dimensional embedding after projection through the embedding layer.

[0056] Spatial correlation Z between facial regions of interest (ROIs) in the same frame S Calculate using the following formula:

[0057] Z S =MSA S (Q S ,K S V S )

[0058] Among them, MSA S It is a spatial multi-head self-attention mechanism;

[0059] Temporal correlation Z among facial regions of interest (ROIs) within the same frame T Calculate using the following formula:

[0060] Z T =MSA T (Q T ,K T V T )

[0061] Among them, MSA T It is a time-multi-head self-attention mechanism.

[0062] The present invention also provides a readable storage medium having a computer program stored thereon, which, when executed, implements the aforementioned domain-adaptive remote heart rate detection method.

[0063] The present invention also provides a computer program product comprising a computer program / instructions that, when executed by a processor, implement the aforementioned domain-adaptive remote heart rate detection method.

[0064] The advantages of this invention are:

[0065] (1) This invention improves the domain adaptation capability. Through the Teacher-Student framework and pseudo-label generation, it effectively reduces the distribution difference between the source domain and the target domain, improves the performance of the model in the new domain (target domain), and does not require a large amount of labeled data.

[0066] (2) Noise is added during the training process and the signal is reconstructed through a denoiser to make the model more robust to input noise and adapt to various interferences that may exist in practical applications.

[0067] (3) During the training phase, noise is added step by step and the signal is reconstructed to make the model adapt to complex noise such as lighting changes and motion blur in the actual scene. During the inference phase, noise is denoised iteratively through the diffusion model (gradually refined from time step T to 0), and multiple candidate signals are generated by combining the Gaussian initial assumption to improve the stability of heart rate prediction.

[0068] (4) Use multi-scale spatiotemporal maps to capture spatiotemporal changes of the face at different levels, and improve the accuracy of rPPG signal extraction, especially in complex environments or when there are changes between different individuals.

[0069] (5) Introducing the LoRA mechanism reduces the number of training parameters, speeds up training, and maintains model performance, making it suitable for situations with limited resources.

[0070] (6) The PSD loss and Pearson correlation loss are combined to optimize the signal in both the frequency and time domains, ensuring that the predicted heart rate signal is close to the true value in terms of frequency and waveform. The Teacher network uses PSD mean square error loss to screen pseudo-labels and combines it with negative Pearson correlation loss to optimize signal correlation, ensuring that the generated pseudo-labels are close to the true signal in both the frequency and time domains, and reducing noise interference to the training of the target domain.

[0071] (7) Use a diffusion model to gradually denoise during the inference stage to generate more reliable heart rate data and improve the stability and accuracy of the detection results.

[0072] (8) This invention combines diffusion model with domain adaptation. The source domain and target domain embedding modules learn domain-specific features respectively. Implicit feature alignment is achieved through pseudo-labels, solving the problem of cross-domain data distribution offset and breaking through the dependence of traditional methods on strongly labeled data.

[0073] (9) A temporal-space hybrid denoising (STHD) is adopted. Through spatial and temporal attention grouping mechanisms, the spatial correlation (relationship between different ROIs in the same frame) and temporal dynamic changes (temporal evolution across frames) of facial ROI regions are modeled respectively, thereby improving feature fusion efficiency and optimizing signal reconstruction accuracy. Attached Figure Description

[0074] Figure 1 This is a flowchart of a remote heart rate detection method based on domain adaptation according to the present invention.

[0075] Figure 2 This is a process diagram of a remote heart rate detection method based on domain adaptation according to the present invention. Detailed Implementation

[0076] 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.

[0077] Depend on Figure 1 and Figure 2 As shown, this invention provides a remote heart rate detection method based on domain adaptation, the specific process of which is as follows:

[0078] S1, Training of the Domain-Adaptive Teacher Network, is detailed below:

[0079] A domain-adaptive Teacher network is trained using a source domain dataset. This Teacher network outputs a predicted rPPG signal based on the input noisy rPPG signal and face video. The source domain dataset includes source domain face videos and their corresponding source domain ground truth labels, i.e., source domain ground truth rPPG signals.

[0080] S2. The trained Teacher network is used to generate the predicted rPPG signal corresponding to the target domain face video, which is used as the target domain pseudo-label to construct the target domain dataset. The target domain dataset includes the target domain face video and its corresponding target domain pseudo-label.

[0081] S3, Domain-Adaptive Student Network Training, is detailed below:

[0082] A domain-adaptive Student network is trained using a target domain dataset. The Student network is used to output a predicted rPPG signal based on the input noisy rPPG signal and face video.

[0083] S4 utilizes the trained Student network to perform remote heart rate detection and generate a predicted rPPG signal for the face video to be detected.

[0084] In this embodiment, the dataset is specifically shown below:

[0085] The source domain dataset is S = {(x i s ,y i s | i = 1, 2, ..., n s The target domain dataset is T = {(x} j t |j=1,2,...,n t}. Where x i sLet y represent the i-th source domain face video. i s x represents i s The corresponding source domain true label (i.e., the source domain true rPPG signal), n s x represents the total number of samples in the source domain dataset S. j t Let n represent the face video of the j-th target domain. t This represents the total number of samples in the target domain dataset T.

[0086] In this embodiment, the training process of the Teacher-Student network in steps S1-S3 is as follows:

[0087] S1, the training process of the Teacher network.

[0088] S11, x, the i-th source domain face video i s The corresponding source domain real label y i s Let y0 be the initial signal. Gaussian noise is added step-by-step at each time step, resulting in the noise signal after noise addition at each time step. In the forward process (noising process), a noise signal with variance β is gradually added at each time step t. t Gaussian noise ∈ [0,1] ∈ ~N(0,I) is used to obtain the noise signal y after adding noise at each time step t. t The formula is as follows:

[0089]

[0090] In the formula, q(y t |y t-1 ) represents the probability distribution of the forward diffusion process, describing the noise signal y from time step t-1. t-1 The noise signal y at time step t t The noise addition process; N(·) represents the Gaussian distribution sign with a mean of 1 / 2. The covariance matrix is ​​β t I; I is the identity matrix, representing that the noise is independent in each dimension and has the same variance.

[0091] Using the properties of Markov chains, y in the above formula t We can directly sample using only the original signal y0 as a condition, as shown in the following formula:

[0092]

[0093] In the formula, q(y t |y0) represents the probability distribution of the forward diffusion process, describing the noise signal y from the original signal y0 to time step t.t The noise addition process; The cumulative noise scaling factor from time step 0 to t is defined as follows: The mean of the Gaussian distribution represents the mean shift of the original signal y0 after t steps of noise addition; Let I be the covariance matrix of the Gaussian distribution, representing the variance of the cumulative noise, where I is the identity matrix, indicating that the noise is independent and has the same variance in each dimension.

[0094] S12, for the i-th source domain face video x i s Feature extraction is performed, and the resulting multi-scale spatiotemporal map is obtained.

[0095] S13 fuses the noise signal with the multi-scale spatiotemporal map to obtain fused data.

[0096] S14, during remote heart rate monitoring, the fused data is input into a denoiser P conditioned on the initial signal y0 and time step t to reconstruct a noise-free rPPG signal.

[0097]

[0098] S15, reconstruct the noise-free rPPG signal After embedding E in the source domain s After processing, the i-th source domain video x is obtained. i s The corresponding multiple predicted rPPG signals, i.e. multiple pseudo-labels First, based on the mean square error loss of the power spectral density (PSD), pseudo-labels closest to the initial signal y0 are selected. Reconstruct source domain embedding E s For the i-th source domain face video x i s The source domain real tag y i s and predicting rPPG signals Negative Pearson related losses Through negative Pearson related losses Reverse optimization of denoiser P and source domain embedding E s .

[0099] Reconstructed noiseless rPPG signal After embedding E in the source domain s The specific process for handling this is as follows:

[0100] During the training phase of the Teacher network, for any given data X, the source domain embedding E is used... sIt will generate a bias B with dimensions determined by the input data. bias The generated deviation B bias and the intermediate output y of the noise denoiser middle (This is the reconstructed noise-free rPPG signal) Add them together to get the final output data result:

[0101] The mean square error loss based on the power spectral density (PSD) is calculated as follows:

[0102]

[0103] Among them, PSD pred [i] and PSD true [i] are respectively The i-th element in the predicted PSD signal and the real PSD signal obtained after processing y0, where l represents the length of the signal and N represents the number of elements.

[0104] The specific calculation of power spectral density (PSD) is shown below:

[0105]

[0106] Among them, one-dimensional signal The sampling rate is f Hz, and l represents the signal length; PSD(f,y) n ) represents the power spectral density at frequency f; y n f is the value of the nth sampling point of y; s is the sampling frequency; n is the index of the signal on the time axis, ranging from 0 to l-1;

[0107] S2, the reasoning process of the Teacher network, that is, using the trained Teacher network to generate target domain pseudo-labels corresponding to the target domain face video.

[0108] S21, collect random noise signals from a Gaussian distribution.

[0109] S22, for the j-th target domain face video x j t First, feature extraction is performed on the sample, and then the extracted features are processed into a multi-scale spatiotemporal graph.

[0110] S23, the randomly generated noise signal is fused with the multi-scale spatiotemporal map to obtain fused data.

[0111] S24, the fused data is input into the Teacher network, which then processes the fused data through a denoiser P and embeds it with the source domain E. s Processing yields the face video x of the j-th target domain.j t The corresponding predicted rPPG signal is the target domain pseudo-label. At the same time, the parameters in the Teacher network are fixed so that they do not participate in gradient updates during the subsequent training of the Student network.

[0112] S3, the training process of the Student network.

[0113] S31, target domain face video Corresponding pseudo tags The signal is fed into the Student network, and Gaussian noise is added at each time step to obtain the noise signal after adding noise at each time step.

[0114] S32, for the j-th target domain face video x j t Feature extraction is performed, and the resulting multi-scale spatiotemporal map is obtained.

[0115] S33 fuses the noise signal with the multi-scale spatiotemporal map to obtain fused data.

[0116] S34, the fused data is input into the denoiser P, and then processed by the target domain embedding E. t After processing, the target domain embedding E is obtained. t For the j-th target domain face video Predicted rPPG signal

[0117] Target domain embedding E t The processing procedure is as follows:

[0118] During the training phase of the Student network, for any given data X, the target domain embedding E is used. s It will generate a bias B with dimensions determined by the input data. bias The generated deviation B bias and the intermediate output y of the noise denoiser middle (This is the j-th face video in the target domain) Target domain pseudo-labels Add them together to get the final output data result:

[0119] S35, Construct the target domain embedding E t For the j-th target domain face video Target domain pseudo-labels and predicting rPPG signals Negative Pearson related losses Through negative Pearson related losses Inverse optimization of the target domain embedding E in the Student networkt Furthermore, a low-rank adaptation mechanism (LoRA) is embedded in the linear layer of the denoiser P to accelerate the computation process and optimize the denoiser P with fixed parameters.

[0120] Negative Pearson related losses The calculation method is as follows:

[0121]

[0122] Cov(x,y) represents the covariance of variables x and y.

[0123] The low-rank adaptation mechanism is as follows:

[0124]

[0125] Where W represents the updated weight matrix, W0 represents the fixed original weight matrix, α is a scaling factor, and the low-rank matrix A∈R m×r B∈R r×n r is the rank of the low-rank matrix and r≤min(m,n), m represents the input dimension of the weight matrix (such as the dimension of the query or key), and n represents the output dimension of the weight matrix (such as the dimension of the value).

[0126] Two pairs of low-rank matrix groups (A) are introduced during the training process. tea B tea ) and (A stu B stu ), and the two pairs of low-rank matrix groups (A tea B tea ) and (A stu B stu The parameters (A, B, C, and D) are introduced as trainable parameters into the Teacher and Student network models, respectively. During training, the weight matrix W0 corresponding to some key components in the denoiser P is decomposed and updated in low rank, while other parts remain unchanged. In forward propagation (adding noise), the updated weight matrix W is calculated according to the low-rank adaptation mechanism; in back propagation (removing noise), only the low-rank matrix group (A) is calculated. tea B tea ) and (A stu B stu The gradients of each low-rank matrix in the matrix are calculated, and their values ​​are updated based on the gradients, while the original weight matrix W0 remains unchanged.

[0127] In this embodiment, the inference process of the Student network in step S4, namely, using the trained Student network to perform remote heart rate detection and generate the predicted rPPG signal of the face video to be detected, is as follows:

[0128] S41, obtain H initial heart rate data by sampling noise from a unit Gaussian distribution, assuming y 0:H,0|T .

[0129] S42 extracts features from the video of the face to be detected and processes them to obtain a multi-scale spatiotemporal map.

[0130] S43, assuming H initial heart rate data are y 0:H,0|T By fusing with a multi-scale spatiotemporal map, H fused data points are obtained.

[0131] S44, input H fused data points into the denoiser P to predict feasible heart rate data hypotheses.

[0132] By y 0:H,T Input denoising to predict feasible heart rate data hypotheses

[0133] Each hypothesis y 0:H,T Each hypothesis is divided into G segments with no overlap, and the sum of the differences in PSD values ​​between adjacent segments is used as the score for each hypothesis. H The specific steps are as follows:

[0134]

[0135] Among them, score H The assumed fraction; w represents the segment number; ||·|| represents the L2 norm.

[0136] The hypothesis with the highest score is used as a feasible hypothesis for heart rate data.

[0137] S45, making feasible heart rate data assumptions Noisy heart rate data is generated using a diffusion model (specifically the DDIM model). As the input to the next time step of the denoiser, the process is represented as:

[0138]

[0139] Where t and t′ are the current and next time steps, respectively, and initially t = T, ∈ ~N(0,I) is y 0:H,t Independent standard Gaussian noise;

[0140]

[0141] Where, ∈ t It is noise at time step t; σ t Used to control the randomness of the diffusion process; The cumulative noise scaling factor from time step 0 to t;

[0142] Step S45 iterates K times, starting from T. The time step of each iteration is represented as:

[0143]

[0144] In this embodiment, during the training of the Teacher-Student network, a denoiser P is used to denoise the fused data, i.e., backdiffusion. The denoiser P adopts STHD, i.e., spatiotemporal hybrid denoiser. The specific denoising steps are as follows:

[0145] A multi-scale spatiotemporal map and a noisy rPPG signal are concatenated into a matrix for dimension alignment; then, the resulting matrix is ​​projected onto a high-dimensional embedding layer through an embedding layer. middle.

[0146] Map the high-dimensional embedding x to a query key Sum Then they are divided into spatial groups along the channel dimension. and time group Where n represents the number of regions of interest (ROIs) on the face, J represents the number of frames in the video data, C represents the number of channels, and D represents the dimension of the high-dimensional embedding after projection through the embedding layer.

[0147] Spatial correlation Z between facial regions of interest (ROIs) in the same frame S Calculate using the following formula:

[0148] Z S =MSA S (Q S ,K S V S )

[0149] Among them, MSA S It is a spatial multi-head self-attention mechanism;

[0150] Temporal correlation Z among facial regions of interest (ROIs) within the same frame T Calculate using the following formula:

[0151] Z T =MSA T (Q T ,K T V T )

[0152] Among them, MSA T It is a time-multi-head self-attention mechanism.

[0153] During the inference process of the Student network, the fused data is denoised by a denoiser P. After K iterations of denoising, the denoised data is finally output. The denoising expression during the inference process is shown below:

[0154] b k =STHD(b k+1 )+b k+1 .

[0155] In this embodiment, features are extracted from the face video to obtain a multi-scale spatiotemporal map, as shown below:

[0156] The face video is divided into multiple segments based on the number of frames, with each segment containing M video images;

[0157] The video image is detected, and the face is divided into n regions of interest (ROIs).

[0158] Combining n ROIs yields a total of 2 combinations consisting of a single ROI and combinations formed by different ROIs. n-1 A combination;

[0159] For each combination, calculate the average pixel value of all ROIs in each color channel; the color channels are RGB and YUV, totaling 6.

[0160] Finally, we obtain a dimension of 6×(2). n-1 A vector of size M is used as a multi-scale spatiotemporal graph.

[0161] In this embodiment, the fusion of the noisy rPPG signal and the multi-scale spatiotemporal map is as follows:

[0162] The dimension of the noise rPPG signal is 1×M, and the dimension of the noise rPPG signal is expanded to 1×(2). n-1 The expanded noisy rPPG signal is concatenated with the multi-scale spatiotemporal map along the channel dimension to obtain fused data. The dimension of the fused data is 7×(2). n-1 )×M.

[0163] In this embodiment, the source domain is embedded in E. s and target domain embedding E t Each module contains a different Transformer block, used to process the previously passed-in fused data and output the fused data as heart rate data. The specific content is as follows:

[0164] The embedding layer maps the channel (input data dimension, the number of features at each time step of the input sequence) to the embedd_dim (embedding dimension, which maps the input sequence to a high-dimensional continuous space), as follows:

[0165] R E =W e X+B bias

[0166] Where X is the input data, W e It is the weight matrix of the embedding layer, with shape (channel, embed_dim), R E It is the embedded output data.

[0167] The position of the output is recorded using position encoding in the embedding layer: position information is calculated using sine and cosine functions and added to the embedding sequence, allowing the model to perceive the position of the element.

[0168] In the Transformer encoder layer, a multi-head self-attention mechanism is first used to compute the attention scores of multiple heads in parallel, focusing on different parts of the sequence; then, a feedforward network consisting of two linear layers and an activation function is used to further process the features; finally, the input is fed into the decoder layer, which maps the encoder output from the embed_dim dimension back to the channel dimension, as shown in the formula:

[0169] O = W d H T +b d

[0170] Where O is the decoded output, W d It is the weight matrix of the decoding layer, with shape (channel, embed_dim)H T This is the output of the Transformer encoder, b d It is a bias vector with shape (channel).

[0171] Then, a masking mechanism is used to generate subsequent masks to prevent the model from seeing future information during prediction. Finally, the forward propagation is performed, and the input is embedded, positionally encoded, processed by a multi-layer encoder, decoded, and finally averaged to obtain the output.

[0172] In this embodiment, taking the Teacher network as an example, the LoRA embedding denoiser and the changes to the internal dimensions are as follows:

[0173] The code uses a lookup function to locate the module in the denoiser model that needs to be embedded with LoRA.

[0174] Embedded LoRA module:

[0175] For the modules that need to be embedded with LoRA, perform the following operations:

[0176] Linear layer processing: If it is a linear layer, replace it with the previously defined LoraInjectedLinear module. During the replacement process, copy the weights and biases of the original linear layer to the original linear layer part of the new module.

[0177] Convolutional layer processing: If it is a convolutional layer, replace it with the LoraInjectedConv2d module, and copy the weights and biases of the original convolutional layer to the original convolutional layer part of the new module.

[0178] The dimensions of the embedding change as follows:

[0179] Dimensional changes when embedding LoRA into a linear layer:

[0180] Original linear layer input: B n Indicates the batch size, I represents the number of input features, and the input dimension is (B n ,I);

[0181] Output: O represents the number of output features. After linear transformation, the output dimension is (B n ,O);

[0182] After embedding the LoRA module:

[0183] First, low-rank downsampling (lora_down) input (B) n The output dimension becomes (B, I), and I becomes (B). n ,R)), where R is the rank of the low-rank matrix; then, after passing through the selector, the input is entered into (B n The output dimension remains unchanged (R) (B) n ,R); then upsample (lora_up) the input into (B) n After R), output and transform the dimension back to B. n ,O);

[0184] The original linear layer output (B) n ,O) and low-rank processing output (B) n Adding O and B together, the final output dimension is still (B). n ,O);

[0185] Dimensional changes when embedding LoRA into convolutional layers:

[0186] Original convolutional layer:

[0187] Input: B n For batch size, C in H is the number of input channels. in W in These are the height and width of the feature map, respectively, with an input dimension of (B). n C in Hin W in Output: C out H represents the number of output channels. out W out To output the height and width of the feature map, the output dimension is (B n C out H out W out );

[0188] After embedding the LoRA module:

[0189] In low-rank downsampling convolution (lora_down), the input is fed into (B n C in H in W in Then the output dimension becomes (B) n ,R,H out W out Then input through the selector (B) n ,R,H out W out The output is still (B) n ,R,H out W out Then, the input (B) is sampled from the low-rank upsampled convolution (lora_up). n ,R,H out W out After that, the output dimension is changed back to (B). n C out H out W out Then merge the outputs, returning the original convolutional layer output (B). n C out H out W out ) and low-rank processing output (B n C out H out W out Adding them together, the final output dimension is still (B). n C out H out W out ).

[0190] The above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A remote heart rate detection method based on domain adaptation, characterized in that, Includes the following steps: S1. A domain-adaptive Teacher network is trained using the source domain dataset. The Teacher network is used to output a predicted rPPG signal based on the input noisy rPPG signal and face video. The source domain dataset includes source domain face videos and their corresponding source domain real labels, i.e., source domain real rPPG signals. S2. Use the trained Teacher network to generate the predicted rPPG signal corresponding to the target domain face video, and use it as the target domain pseudo-label to construct the target domain dataset; the target domain dataset includes the target domain face video and its corresponding target domain pseudo-label. S3, using the target domain dataset to train a domain-adaptive Student network, which is used to output a predicted rPPG signal based on the input noisy rPPG signal and face video; S4. Use the trained Student network to perform remote heart rate detection and generate the predicted rPPG signal of the face video to be detected. In step S1, the training process of the Teacher network is as follows: S11, the first i Individual facial video x i s Corresponding source domain real tags y i s Let it be the initial signal. y 0. Add noise at each time step to obtain the noise signal after adding noise at each time step; S12, for the first i Individual facial video x i s Feature extraction is performed, and the resulting multi-scale spatiotemporal map is obtained. S13, fuses the noise signal with the multi-scale spatiotemporal map to obtain fused data; S14, input the fused data to the initial signal Denoising conditioned on time steps In order to reconstruct noise-free rPPG signals ; S15, reconstruct the noise-free rPPG signal After source domain embedding After processing, the first... i Individual facial video x i s The corresponding multiple predicted rPPG signals, i.e. multiple pseudo-labels First, based on the mean square error loss of the power spectral density (PSD), select signals that are similar to the initial signal. closest pseudo-tag ; Reconstruct source domain embedding For the i Individual facial video x i s The source domain real tags y i s and predicting rPPG signals Negative Pearson related losses Through negative Pearson related losses Reverse optimization denoiser and source domain embedding ; In step S2, the inference process of the Teacher network, that is, using the trained Teacher network to generate target domain pseudo-labels corresponding to the target domain face video, is as follows: S21, randomly generate noise signals; S22, for the first j Face video of the target domain x j t Feature extraction is performed, and the resulting multi-scale spatiotemporal map is obtained. S23, the randomly generated noise signal is fused with the multi-scale spatiotemporal map to obtain fused data; S24, the fused data is processed by a denoiser. Embedded with source domain After processing, the first result is obtained. j Face video of the target domain x j t The corresponding predicted rPPG signal is the target domain pseudo-label. ; In step S3, the training process of the Student network is as follows: S31, target domain face video x j t Corresponding target domain pseudo-labels Noise is added at time steps to obtain the noise signal after noise addition at each time step; S32, for the first j Face video of the target domain x j t Feature extraction is performed, and the resulting multi-scale spatiotemporal map is obtained. S33 fuses the noise signal with the multi-scale spatiotemporal map to obtain fused data; S34 inputs the fused data into the denoiser. Then, after target domain embedding... After processing, the first... j Face video of the target domain x j t Corresponding predicted rPPG signal ; S35, Construct target domain embedding For the j Face video of the target domain Target domain pseudo-labels and predicting rPPG signals Negative Pearson related losses Through negative Pearson related losses Backward optimization of target domain embedding in Student network ; In noise denoiser The linear layer in the model incorporates the low-rank adaptation mechanism LoRA, which is shown below: ; in, This represents the updated weight matrix. This represents a fixed original weight matrix. Let A be the scaling factor, and let A ∈ R be the low-rank matrix. m×r B∈R r×n , r The rank of a low-rank matrix and , m This represents the input dimension of the weight matrix. n Indicates the output dimension of the weight matrix; Two pairs of low-rank matrix groups are introduced during the training process. and Two pairs of low-rank matrices and These parameters are introduced as trainable parameters into the Teacher and Student networks respectively, and the denoising mechanism is adjusted during training. Weight matrix corresponding to the key part The weight matrix is ​​calculated and updated using a low-rank decomposition and update process, while other parts remain unchanged. During forward propagation, i.e., when noise is introduced, the updated weight matrix is ​​obtained by following the low-rank adaptation mechanism. During backpropagation, i.e., noise removal, the low-rank matrix group is calculated. and The gradients of each low-rank matrix are calculated, and the matrix is ​​updated based on these gradients, while the original weight matrix... It remains unchanged.

2. The remote heart rate detection method based on domain adaptation according to claim 1, characterized in that, For any given data embedding through source domain Generate a deviation The generated deviation The output data of the denoiser is used to reconstruct the noise-free rPPG signal. Adding them together yields the source domain embedding. Output data ; The mean square error loss of the power spectral density (PSD) is calculated as follows: ; in, and They are respectively and The processed predicted PSD signal and the real PSD signal are the first... i One element, Indicates the length of the signal. N Indicates the number of elements.

3. The remote heart rate detection method based on domain adaptation according to claim 1, characterized in that, In step S4, the inference process of the Student network, namely, using the trained Student network to perform remote heart rate detection and generate the predicted rPPG signal of the face video to be detected, is as follows: S41, sample noise signals from a Gaussian distribution to obtain H initial heart rate data points, assuming y 0:H,0|T ; S42, extract features from the video of the face to be detected and process it to obtain a multi-scale spatiotemporal map; S43, assuming H initial heart rate data are y 0:H,0|T By fusing with a multi-scale spatiotemporal map, H fused data points are obtained; S44, input H fused data points into the denoiser. In the middle, the hypotheses for predicting feasible heart rate data. ; S45, making feasible heart rate data assumptions Noisy heart rate data generated using a diffusion model. As the input to the denoiser P at the next time step, the process is represented as: ; in, and These are the current and next time steps, initially. t=T , It is y 0:H,t Independent standard Gaussian noise; in, It is a time step t noise; Used to control the randomness of the diffusion process; From time step 0 to t The cumulative noise scaling factor; Step S45 process iteration K Next, from T Initially, the time step for each iteration is represented as: 。 4. The remote heart rate detection method based on domain adaptation according to claim 3, characterized in that, During the training of the Teacher and Student networks, a denoiser P is used to denoise the fused data. The denoiser P adopts STHD, i.e., spatiotemporal hybrid denoiser, as shown below: A multi-scale spatiotemporal map and a noisy rPPG signal are concatenated into a matrix for dimension alignment; then, the resulting matrix is ​​projected onto a high-dimensional embedding layer through an embedding layer. middle; Embedding high dimensions x Mapped to query ,key Sum Then, they are divided into spatial groups along the channel dimension. and time group ,in n The number of Regions of Interest (ROIs) representing the face. J Represents the number of frames in the video data. D This represents the dimension of the high-dimensional embedding after projection through the embedding layer; Spatial correlation between facial regions of interest (ROIs) within the same frame Calculate using the following formula: in, It is a spatial multi-head self-attention mechanism; Temporal correlation between facial regions of interest (ROIs) within the same frame Calculate using the following formula: in, It is a time-multi-head self-attention mechanism.

5. A readable storage medium, characterized in that, It stores a computer program, which, when executed, implements a remote heart rate detection method based on domain adaptation as described in any one of claims 1 to 4.

6. A computer program product, characterized in that, It includes a computer program / instruction that, when executed by a processor, implements the domain-adaptive remote heart rate detection method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Remote heart rate monitoring method based on face video analysis in random frame loss scene

    CN118887718A

  • Remote physiological signal estimation method and system based on diffusion model

    CN119670022A