A face video heart rate estimation system and method based on token learning

Through the face video heart rate estimation system based on token learning, the multi-scale spatiotemporal map and Transformer encoder are used to integrate global features, which solves the problems of low heart rate estimation accuracy and noise influence in the existing technology, and achieves higher accuracy. and robustness.

CN114821439BActive Publication Date: 2024-10-25HEFEI ZHONGJUYUAN INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210506179.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-10
Publication Date
2024-10-25
Estimated Expiration
2042-05-10

AI Technical Summary

Technical Problem

Existing heart rate measurement methods based on remote photoplethysmography (rPPG) signals are greatly affected by illumination and head motion noise when estimating heart rate in face videos, and the limited spatiotemporal receptive fields of convolutional neural networks lead to poor estimation accuracy. Poor and difficult to adapt to complex scenes.

Method used

A face video heart rate estimation system based on token learning is adopted, including a facial key point detection module, a feature extraction module, an rPPG signal prediction module and a heart rate calculation module. It detects facial key points through OpenFace, generates a multi-scale spatio-temporal map, and uses a command-based facial key point detection module. The card-learning neural network model is used for rPPG signal prediction, combined with the Transformer encoder and rPPG signal predictor, to integrate the global features of multi-scale spatio-temporal graphs.

Benefits of technology

It improves the accuracy and robustness of heart rate estimation in face videos, can be applied to various light intensity and head movement noise scenes, reduces errors, and enhances the ability to extract weak heart rate signals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114821439B_ABST
    Figure CN114821439B_ABST
Patent Text Reader

Abstract

The present invention discloses a face video heart rate estimation system and method based on token learning, the method comprising: 1. inputting a face video, and performing facial key point detection on each frame of the video; 2. using the facial key points to obtain a facial region of interest, and extracting a multi-scale spatiotemporal graph of the face video through color space conversion and pixel average pooling operations; 3. constructing a neural network model based on token learning to learn the multi-scale spatiotemporal graph, and using the trained neural network model based on token learning to predict the rPPG signal of the face video; 4. performing peak point detection on the rPPG signal of the face video, and calculating the corresponding average heart rate value. The present invention uses a neural network model based on token learning to realize face video heart rate estimation, thereby improving the accuracy and robustness of face video heart rate estimation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of physiological signal processing, and relates to technologies such as computer vision, deep learning and signal processing, and specifically is a face video heart rate estimation system and method based on token learning. Background Art

[0002] Early heart rate estimation methods were mainly based on electrocardiogram technology and contact photoplethysmography signals. These methods require professional equipment to collect heart rate data by contacting the patient's skin. However, the use of these contact sensors may make patients very uncomfortable, especially for those with sensitive skin such as patients with skin burns and newborns. Therefore, heart rate estimation based on non-contact facial video has attracted more and more attention.

[0003] In recent years, the technology of measuring heart rate based on remote photoplethysmography (rPPG) signals has developed rapidly. This technology can obtain the heart rate from the face video without any skin contact through an ordinary camera. The principle is that the absorption of light by the skin changes with the periodic changes of blood volume caused by the heartbeat. Therefore, the heart rate can be estimated by capturing the periodic changes in skin color. However, this change in skin color is very weak and is easily affected by various noises such as lighting and head movement.

[0004] Early rPPG-based heart rate measurement methods mainly used color space conversion and signal decomposition methods to extract physiological signals from videos. However, these methods were limited by certain assumptions, such as specific skin reflection models and linear combinations, and could not be applied to other complex scenarios. With the rapid development of deep learning, some methods have begun to use deep learning with powerful modeling capabilities to solve the impact of various noises in face videos, but these methods mainly use traditional convolutional neural networks to process videos or manually extracted feature maps, which have many disadvantages. In particular, convolutional neural networks are limited by limited spatiotemporal receptive fields and often ignore the interaction between long-range spatiotemporal receptive fields, resulting in poor accuracy of heart rate estimation results for face videos and weak generalization, making it difficult to adapt to various complex real-world scenarios. Summary of the invention

[0005] In view of the deficiencies in the prior art, the present invention provides a face video heart rate estimation system and method based on token learning, so as to achieve accurate estimation of the face video heart rate and improve the accuracy and robustness of the face video heart rate estimation.

[0006] The present invention adopts the following method scheme to solve the technical problem:

[0007] The present invention is characterized in that a face video heart rate estimation system based on token learning comprises: a facial key point detection module, a feature extraction module, an rPPG signal prediction module and a heart rate calculation module;

[0008] The facial key point detection module uses OpenFace, a face detector based on deep learning, to detect the facial key point positions of each frame in the face video;

[0009] The feature extraction module selects a facial region of interest according to the position of the facial key points, performs color space conversion on the facial region of interest, and then uses a pixel average pooling operation to perform denoising on the converted facial region of interest, thereby generating a multi-scale spatiotemporal graph of the face video;

[0010] The rPPG signal prediction module is based on the multi-scale spatiotemporal graph of the face video, uses a deep learning method to build and train a neural network model based on token learning, and uses the trained neural network model based on token learning to transform the multi-scale spatiotemporal graph to be predicted to obtain a corresponding rPPG signal;

[0011] The heart rate calculation module performs peak point detection on the rPPG signal to obtain the heartbeat frequency, thereby outputting the average heart rate value of the face video.

[0012] The face video heart rate estimation system based on token learning of the present invention is also characterized in that the rPPG signal prediction module trains the neural network model according to the following process:

[0013] Step a: construct a neural network model based on token learning, including: a token extractor, a Transformer encoder and an rPPG signal predictor, wherein the token extractor is composed of a linear mapping layer, an additional learnable token and a position encoding embedding layer, the Transformer encoder includes an L-layer structure, each layer is composed of a first standardization layer, a multi-head attention layer, a first residual connection layer, a second standardization layer, a first multi-layer perceptron and a second residual connection layer in sequence, and the rPPG signal predictor is composed of a third standardization layer and a second multi-layer perceptron;

[0014] Step b: the multi-scale spatiotemporal graph of the face video is input into the token extractor, the multi-scale spatiotemporal graph of the face video is firstly cut into different image blocks, and then the image blocks are processed by a linear mapping layer to obtain tokens, and the tokens and additional learnable tokens are input into a position encoding embedding layer for processing, so as to obtain token features;

[0015] The token features are processed by the L-layer structure of the Transformer encoder in sequence, and the token features are output by the last layer structure, from which the feature representation of the rPPG signal is obtained;

[0016] The feature representation of the rPPG signal is sequentially normalized by the third layer of the rPPG signal predictor and processed by the second multi-layer perceptron to obtain the rPPG signal corresponding to the multi-scale spatiotemporal graph;

[0017] Step c: Use the negative Pearson correlation coefficient to calculate the error between the rPPG signal and the label PPG signal corresponding to the multi-scale spatiotemporal graph, and use it as the loss function of the neural network model based on token learning. Then use the Adam optimizer to update the parameters of the neural network model, and stop training when the loss function stops decreasing, so as to obtain a trained neural network model based on token learning.

[0018] The method for estimating heart rate from a face video based on token learning of the present invention is characterized by being performed in the following steps:

[0019] Step 1: Data preprocessing:

[0020] Step 1.1: Obtain a heart rate estimation dataset, and let any face video in the heart rate estimation dataset be V i , let the i-th face video V i The corresponding label PPG signal is S i , let the i-th face video V i The corresponding label heart rate value sequence is HR i , 1≤i≤N vid , N vid The total number of videos in the heart rate estimation dataset;

[0021] Step 1.2: Use OpenFace, a deep learning-based face detector, to detect the face video V i The face image f in the tth frame t i The facial key point positions are calibrated as follows: in, Represents the i-th face video V i The face image f in the tth frame t i The jth facial key point position coordinates, T i Represents the i-th face video V i The total number of frames of , W represents the number of facial key points recognized by the deep learning-based face detector OpenFace;

[0022] Step 1.3: Use the i-th face video V i The face image f in the tth frame t i The coordinate set of the facial key point positions Defining facial regions of interest in, Represents the i-th face video V i The face image f in the tth frame t i The nth facial region of interest, n represents the number of facial regions of interest;

[0023] Step 1.4: The facial region of interest Convert the RGB three channels into YUV three channels to get the region of interest after color space conversion

[0024] Step 1.5: Calculate the region of interest after the color space conversion All non-empty subsets of ; let (2 n -1) elements represent different combinations of regions of interest, and perform pixel average pooling on each color channel of each combination of regions of interest, thus obtaining (2 n -1)×C with a length of T i The signal sequence of the frame is stacked row by row to obtain the i-th face video V i Multi-scale spatiotemporal graph of Wherein, C=3 represents the number of color channels;

[0025] Step 1.6: Use a sliding window with a length of T frames and a step size of st frames to map the multi-scale spatiotemporal graph M i Split into a fixed-length multi-scale spatiotemporal graph collection At the same time, the label PPG signal S i Divide into PPG signal sets of the same fixed length Label the heart rate value sequence HR i Also divided into heart rate sets of the same fixed length in, Represents the i-th face video V i The generated k-th fixed-length multi-scale spatiotemporal graph, Represents the kth fixed-length multi-scale spatiotemporal graph The corresponding PPG signal, Represents the kth fixed-length multi-scale spatiotemporal graph The corresponding heart rate value sequence, Represents the i-th face video V iThe number of fixed-length multi-scale spatiotemporal graphs generated is used to preprocess all face videos and their corresponding label data in the heart rate estimation dataset and form a training dataset. Among them, I p is the p-th fixed-length multi-scale spatiotemporal graph in the training dataset, is the p-th fixed-length multi-scale spatiotemporal graph I p The corresponding label PPG signal, is the p-th fixed-length multi-scale spatiotemporal graph I p The corresponding labeled heart rate value sequence, N is the total number of fixed-size multi-scale spatiotemporal graphs in the training dataset;

[0026] Step 2: Training of the neural network model based on token learning:

[0027] Establish a neural network model F(I p ,ζ), including: a token extractor, a Transformer encoder and an rPPG signal predictor, wherein ξ is the neural network model F(I p ,ζ) parameters;

[0028] Let the current number of training times be e, and initialize e = 1, let the neural network model F(I p ,ζ) is ξ e ;

[0029] Step 2.1, Token Extractor Processing:

[0030] Step 2.1.1: The p-th fixed-length multi-scale spatiotemporal graph I p Divide by row into (2 n -1) image blocks in, is the p-th fixed-length multi-scale spatiotemporal graph I p The qth image block, P h Represents the height of the image block, P w Indicates the width of the image block;

[0031] Step 2.1.2: The token extractor uses formula (1) to extract (2 n -1) image blocks Layer 0 Token Characteristics and as the pth fixed-length multi-scale spatiotemporal graph I p Layer 0 token features:

[0032]

[0033] In formula (1), is a linear mapping layer, used to transform the (2 n-1) image blocks Mapped into the D-dimensional token vector space, are additional learnable tokens for predicting rPPG signals, is an additional learnable position embedding vector representing the token location information;

[0034] Step 2.2, Transformer encoder processing:

[0035] The Transformer encoder uses formula (2) to transform the l-1th layer token feature Z l-1 Encode and output the token features of the lth layer Thus, we get the token features of layer L

[0036]

[0037] In formula (2), MSA is the multi-head attention layer, LN is the layer normalization; MLP is the multi-layer perceptron layer, Z l ′ is the token feature of the lth layer after multi-head attention processing, and L is the number of layers of the Transformer encoder;

[0038] Step 2.3, processing of rPPG signal predictor;

[0039] The rPPG signal predictor uses formula (3) to obtain the p-th fixed-length multi-scale spatiotemporal graph I p The corresponding rPPG signal

[0040]

[0041] In formula (3), For additional learnable tokens X rPPG The token features output after the Transformer encoder; Step 2.4, using formula (4) to construct the loss function Loss(ξ e ):

[0042]

[0043] In formula (4), is the p-th fixed-length multi-scale spatiotemporal graph I in the training dataset p rPPG signal predicted by the neural network model based on token learning, is the p-th fixed-length multi-scale spatiotemporal graph I in the training dataset p The label PPG signal of , Con(·,·) represents the covariance;

[0044] Step 2.5: Determine the error Loss(ξ e ) converges, if converged, it indicates that the neural network model parameter ξ during the e-th training e is the optimal parameter, and the optimal parameter is used as the parameter of the final neural network model to obtain a trained neural network model based on token learning; otherwise, the neural network model is back-propagated to update the parameters of the neural network model, and then step 2.1 is executed;

[0045] Step 3: Calculate heart rate;

[0046] Peak point detection is used to calculate the peak point positions of the rPPG signal predicted by the trained token learning-based neural network model, and the heart rate is calculated through the peak point positions, thereby calculating the average heart rate value corresponding to the rPPG signal.

[0047] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0048] 1. The present invention utilizes advanced deep learning technology to propose a face video heart rate estimation system based on token learning. The system consists of a facial key point detection module, a feature extraction module, an rPPG signal prediction module and a heart rate calculation module. The system can be applied to estimate the heart rate value of face videos containing various light intensities and head motion noises, and improves the accuracy and robustness of face video heart rate estimation.

[0049] 2. In the feature extraction module proposed in the present invention, facial key points are used to obtain the region of interest with the richest facial physiological signals, and the video is converted into a multi-scale spatiotemporal graph through color space conversion and pixel average pooling operations, which better suppresses the noise in the background area and enhances the weak heart rate signal.

[0050] 3. In the rPPG signal prediction module proposed in the present invention, a neural network model based on token learning is used to adaptively integrate the global features of the multi-scale spatiotemporal graph, and is no longer limited by the limited spatiotemporal receptive field of the convolutional neural network, thereby reducing the error and improving the prediction accuracy.

[0051] 4. The present invention proposes a face video heart rate estimation method based on token learning. The method extracts the global temporal token features of different combinations of regions of interest, and then learns the global correlation between different token features through the Transformer encoder, so as to fully exploit the weak heart rate signals in the face video, which is conducive to further improving the robustness of the method. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1It is a structural schematic diagram of a face video heart rate estimation system based on token learning of the present invention;

[0053] Figure 2 It is a structural block diagram of a feature extraction module of a face video heart rate estimation system based on token learning of the present invention;

[0054] Figure 3 It is a structural block diagram of the rPPG signal prediction module of the face video heart rate estimation system based on token learning of the present invention. DETAILED DESCRIPTION

[0055] The specific technical solutions for implementing the present invention will be described in detail below with reference to the accompanying drawings.

[0056] In this embodiment, a face video heart rate estimation system based on token learning is provided. Figure 1 As shown, it includes: a facial key point detection module, a feature extraction module, an rPPG signal prediction module and a heart rate calculation module.

[0057] Among them, the facial key point detection module detects the position of facial key points from each frame of the face image in the input face video;

[0058] In the specific implementation, a face video is input, and the face detector OpenFace based on deep learning is used to detect the facial key point positions of each frame of the face image in the face video;

[0059] The structural diagram of the feature extraction module is as follows: Figure 2 As shown in the figure, the facial region of interest is selected by the position of facial key points, the facial region of interest is then converted into color space, and pixel average pooling operation is used for denoising, thereby generating a multi-scale spatiotemporal graph of the face video;

[0060] In the specific implementation, n = 6 facial regions of interest are selected through W = 68 facial key point positions, and then a non-empty subset of n facial regions of interest is used to obtain (2 n -1) = 63 combined regions of interest, and then (2 n -1) Combined regions of interest are converted into color space from RGB color space to YUV color space, and pixel average pooling operation is used for denoising to generate a multi-scale spatiotemporal graph of the face video. The multi-scale spatiotemporal graph is then divided into multiple fixed-length multi-scale spatiotemporal graphs using a sliding window with a length of T = 300 frames and a step size of st = 15 frames;

[0061] The structural block diagram of the rPPG signal prediction module is as follows Figure 3As shown, a deep learning method is used to build and train a neural network model based on token learning, and the trained neural network model based on token learning is used to transform the fixed-length multi-scale spatiotemporal graph to obtain the corresponding rPPG signal;

[0062] In the specific implementation, the rPPG signal prediction module trains the neural network model according to the following process:

[0063] Step a: Construct a neural network model based on token learning, including: a token extractor, a Transformer encoder and an rPPG signal predictor, wherein the token extractor consists of a linear mapping layer, an additional learnable token and a positional encoding embedding, the Transformer encoder consists of layer normalization, multi-head attention, residual connection, layer normalization, a multi-layer perceptron and a residual connection sequence, and the rPPG signal predictor consists of layer normalization and a multi-layer perceptron;

[0064] Step b: The multi-scale spatiotemporal graph of the face video is input into the token extractor, and the multi-scale spatiotemporal graph of the face video is cut into different image blocks. The image blocks are processed by the linear mapping layer to obtain tokens, and an additional learnable token is added. Then, position encoding embedding is added to all tokens to obtain token features;

[0065] The token features are processed by the Transformer encoder layer normalization, multi-head attention, residual connection, layer normalization, multi-layer perceptron and residual connection in turn to obtain updated token features. The updated token features are processed by L layers of Transformer encoders in turn, so as to obtain the feature representation of the rPPG signal from the token features of the last layer.

[0066] The feature representation of the rPPG signal is sequentially processed by layer normalization and multi-layer perceptron of the rPPG signal predictor to obtain the rPPG signal corresponding to the multi-scale spatiotemporal graph;

[0067] Step c: The error between the rPPG signal and the label PPG signal corresponding to the multi-scale spatiotemporal graph is calculated using the negative Pearson correlation coefficient, and used as the loss function of the neural network model based on token learning. The Adam optimizer is then used to update the model parameters, and the training is stopped when the loss function stops decreasing, thereby obtaining a trained neural network model based on token learning.

[0068] The heart rate calculation module uses peak point detection to calculate the peak point positions of all rPPG signals, and calculates the average heart rate through the peak point positions, thereby calculating the average heart rate value corresponding to the rPPG signal.

[0069] In this embodiment, a method for estimating heart rate of face video based on token learning is to first input a face video, detect the position of facial key points in each frame of the face video; then use the position of facial key points to obtain the facial region of interest, and perform color space conversion and pixel average pooling operations on the facial region of interest, thereby generating a multi-scale spatiotemporal graph of the face video; then, construct a neural network model based on token learning to learn the multi-scale spatiotemporal graph and predict the corresponding rPPG signal; finally, perform peak point detection on the predicted rPPG signal and calculate the corresponding average heart rate value. Specifically, the method includes the following steps:

[0070] Step 1: Get the heart rate estimation dataset and divide the videos in the dataset into two parts: training dataset and test dataset according to the participants. The divided training set accounts for 80% of the total videos, and the test dataset accounts for the remaining 20%. Each video contains RGB video, labeled PPG signal and labeled heart rate value.

[0071] Step 2: Data preprocessing:

[0072] Step 2.1: Let any face video in the heart rate estimation dataset be V i , let the i-th face video V i The corresponding label PPG signal is S i , let the i-th face video V i The corresponding label heart rate value sequence is HR i , 1≤i≤N vid , N vid The total number of videos in the heart rate estimation dataset;

[0073] Step 2.2: Use OpenFace, a deep learning-based face detector, to detect face video V i In the tth frame f t i The facial key point positions are calibrated and the coordinate set of the facial key point positions is in, Represents the i-th face video V i In the tth frame f t i The jth facial key point position coordinates, T i Represents the i-th face video V i The total number of frames, W = 68 represents the number of facial key points recognized by the deep learning-based face detector OpenFace;

[0074] Step 2.3: Use the i-th face video V i In the tth frame f t i The coordinate set of the facial key point positions Defining facial regions of interest in, Represents the i-th face video V i In the tth frame f t i The nth facial region of interest, n=6 represents the number of facial regions of interest;

[0075] Step 2.4: The facial region of interest Convert the RGB three channels into YUV three channels to get the region of interest after color space conversion

[0076] Step 2.5: Calculate the region of interest after color space conversion All non-empty subsets of ; let (2 n -1) elements represent different combinations of regions of interest, and perform pixel average pooling on each color channel of each combination of regions of interest, thus obtaining (2 n -1)×C with a length of T i The signal sequence of the frame is stacked row by row to obtain the i-th face video V i Multi-scale spatiotemporal graph of Wherein, C=3 represents the number of color channels;

[0077] Step 2.6: Use a sliding window with a length of T = 300 frames and a step size of st = 15 frames to map the multi-scale spatiotemporal graph M i Split into a fixed-length multi-scale spatiotemporal graph collection To achieve data augmentation, the label PPG signal S i Divide into PPG signal sets of the same fixed length Label the heart rate value sequence HR i Also divided into heart rate sets of the same fixed length in, represents the kth fixed-length multi-scale spatiotemporal graph generated by the i-th face video, Representing a fixed-length multi-scale spatiotemporal graph The corresponding PPG signal, Representing a fixed-length multi-scale spatiotemporal graph The corresponding heart rate value sequence, Represents the number of fixed-length multi-scale spatiotemporal graphs generated by the i-th face video, thereby preprocessing all face videos and their corresponding label data in the heart rate estimation dataset and forming a training dataset Among them, I p is the p-th fixed-length multi-scale spatiotemporal graph in the training set, For I p The corresponding label PPG signal, For Ip The corresponding labeled heart rate value sequence, N is the total number of fixed-size multi-scale spatiotemporal graphs in the training dataset;

[0078] Step 3: Neural network model training:

[0079] Establish a neural network model F(I p ,ζ), including: token extractor, Transformer encoder and rPPG signal predictor, where I p is the p-th fixed-length multi-scale spatiotemporal graph in the training set, ξ is the neural network model F(I p ,ζ) parameters;

[0080] Let the current number of training times be e, and initialize e = 1, let the neural network model F(I p ,ζ) is ξ e ;

[0081] Step 3.1. Token Extractor:

[0082] Step 3.1.1: Convert the fixed-length multi-scale spatiotemporal graph I p Divide by row into (2 n -1) image blocks in, is the qth image block of the pth fixed-length multi-scale spatiotemporal graph in the training set, P h =1 indicates the height of the image block, P w =T=300 represents the width of the image block;

[0083] Step 3.1.2: Use the token extractor shown in formula (1) to extract the 0th layer token features, thereby obtaining a fixed-length multi-scale spatiotemporal graph I p Layer 0 Token Characteristics

[0084]

[0085] in, is a linear mapping layer, (2 n -1) image blocks Mapped into the D-dimensional token vector space, are additional learnable tokens used to predict rPPG signals, is an additional learnable position embedding vector representing the token location information;

[0086] Step 3.2, Transformer encoder:

[0087] The Transformer encoder shown in formula (2) is used to encode the token features Z of each layerl-1 ,l∈1,2,...,L is encoded and the token features of the lth layer are output

[0088]

[0089] Among them, MSA is the multi-head attention layer, MLP is the multi-layer perceptron layer, and L=6 is the number of layers of the Transformer encoder; Step 3.3, rPPG signal predictor

[0090] The fixed-length multi-scale spatiotemporal graph I is obtained by using the rPPG signal predictor shown in formula (3) p The corresponding rPPG signal

[0091]

[0092] In formula (3), For additional learnable tokens X rPPG The token features output after passing through L layers of Transformer encoders, LN is layer normalization, and MLP is a multi-layer perceptron layer;

[0093] Step 3.4: Use formula (4) to construct the loss function Loss(ξ e ):

[0094]

[0095] In formula (4), is the rPPG signal of the p-th fixed-length multi-scale spatiotemporal graph in the training set after being predicted by the model, is the label PPG signal of the p-th fixed-length multi-scale spatiotemporal graph in the training set, Con(·,·) represents the covariance, and N is the total number of fixed-length multi-scale spatiotemporal graphs in the training set;

[0096] Step 3.5: Determine the error Loss(ξ e ) converges. If it converges, it means the neural network model parameter ξ at the e-th training e is the optimal parameter, and the optimal parameter is used as the parameter of the final neural network model; otherwise, the neural network model is back-propagated to update the parameters of the neural network model, and then step 2 is executed;

[0097] Step 4: Heart rate calculation

[0098] Peak point detection is used to calculate the peak point positions of the rPPG signal predicted by the optimal neural network model, and the heart rate is calculated through the peak point positions, thereby calculating the average heart rate value corresponding to the rPPG signal.

[0099] In summary, the present invention proposes a face video heart rate estimation system and method based on token learning, which solves the problem that the traditional convolutional neural network-based method is limited by the limited spatiotemporal receptive field, and uses a multi-scale spatiotemporal graph that can suppress noise and enhance the heart rate signal to represent the heart rate signal in the face video; extracts the token features of the global time of different combinations of regions of interest, and then learns the global correlation between different token features through the Transformer encoder, so as to fully mine the weak heart rate signal in the face video; the face video heart rate estimation system and method effectively improves the accuracy of face video heart rate estimation, and can overcome complex scene noise, thereby increasing the robustness of heart rate estimation.

Claims

1. A face video heart rate estimation system based on token learning, characterized in that: include: Facial key point detection module, feature extraction module, rPPG signal prediction module and heart rate calculation module; The facial key point detection module uses OpenFace, a face detector based on deep learning, to detect the facial key point positions of each frame in the face video; The feature extraction module selects a facial region of interest according to the position of the facial key points, performs color space conversion on the facial region of interest, and then uses a pixel average pooling operation to perform denoising on the converted facial region of interest, thereby generating a multi-scale spatiotemporal graph of the face video; The rPPG signal prediction module is based on the multi-scale spatiotemporal graph of the face video, uses a deep learning method to build and train a neural network model based on token learning, and uses the trained neural network model based on token learning to transform the multi-scale spatiotemporal graph to be predicted to obtain a corresponding rPPG signal; The rPPG signal prediction module trains the neural network model according to the following process: Step a: Construct a neural network model based on token learning, including: a token extractor, a Transformer encoder and an rPPG signal predictor, wherein the token extractor is composed of a linear mapping layer, an additional learnable token and a position encoding embedding layer, and the Transformer encoder contains Layer structure, each layer is composed of a first standardization layer, a multi-head attention layer, a first residual connection layer, a second standardization layer, a first multi-layer perceptron and a second residual connection layer in sequence, and the rPPG signal predictor is composed of a third standardization layer and a second multi-layer perceptron; Step b: the multi-scale spatiotemporal graph of the face video is input into the token extractor, the multi-scale spatiotemporal graph of the face video is firstly cut into different image blocks, and then the image blocks are processed by a linear mapping layer to obtain tokens, and the tokens and additional learnable tokens are input into a position encoding embedding layer for processing, so as to obtain token features; The token features are sequentially transformed through the Transformer encoder After the layer structure is processed, the token features are output by the last layer structure, and the feature representation of the rPPG signal is obtained from it; The feature representation of the rPPG signal is sequentially normalized by the third layer of the rPPG signal predictor and processed by the second multi-layer perceptron to obtain the rPPG signal corresponding to the multi-scale spatiotemporal graph; Step c: using the negative Pearson correlation coefficient to calculate the error between the rPPG signal and the label PPG signal corresponding to the multi-scale spatiotemporal graph, and using it as the loss function of the neural network model based on token learning, and then using the Adam optimizer to update the parameters of the neural network model, and stopping the training when the loss function stops decreasing, thereby obtaining a trained neural network model based on token learning; The heart rate calculation module performs peak point detection on the rPPG signal to obtain the heartbeat frequency, thereby outputting the average heart rate value of the face video.

2. A method for estimating heart rate from face videos based on token learning, characterized by Proceed as follows: Step 1: Data preprocessing: Step 1.1, obtain a heart rate estimation dataset, and let any face video in the heart rate estimation dataset be , Personal face video The corresponding label PPG signal is , let the Personal face video The corresponding label heart rate value sequence is , , The total number of videos in the heart rate estimation dataset; Step 1.2: Use OpenFace, a deep learning-based face detector, to detect the face video Middle Frame face image The facial key point positions are calibrated as follows: ,in, Indicates Personal face video Middle Frame face image No. The facial key point position coordinates, Indicates Personal face video The total number of frames, represents the number of facial key points recognized by the deep learning-based face detector OpenFace; Step 1.3: Use the Personal face video Middle Frame face image The coordinate set of the facial key point positions Define facial regions of interest ,in, Indicates the Personal face video Middle Frame face image The nth facial region of interest, Indicates the number of facial regions of interest; Step 1.4: The facial region of interest Convert the RGB three channels into YUV three channels to get the region of interest after color space conversion ; Step 1.5: Calculate the region of interest after the color space conversion All non-empty subsets of ; let any non-empty subset The elements represent different combinations of regions of interest, and pixel average pooling is performed on each color channel of each combination of regions of interest to obtain The length is The signal sequence of the frame is stacked row by row to obtain the first Personal face video Multi-scale spatiotemporal graph of ,in, Indicates the number of color channels; Step 1.6, use length Frame, step size is The sliding window of the frame transforms the multi-scale spatiotemporal graph Split into a fixed-length multi-scale spatiotemporal graph collection , , while labeling the PPG signal Divide into PPG signal sets of the same fixed length , label the heart rate value sequence Also divided into heart rate sets of the same fixed length ,in, Indicates Personal face video The generated k-th fixed-length multi-scale spatiotemporal graph, Represents the kth fixed-length multi-scale spatiotemporal graph The corresponding PPG signal, Represents the kth fixed-length multi-scale spatiotemporal graph The corresponding heart rate value sequence, Indicates Personal face video The number of fixed-length multi-scale spatiotemporal graphs generated is used to preprocess all face videos and their corresponding label data in the heart rate estimation dataset and form a training dataset. ,in, is the training data set A fixed-length multi-scale spatiotemporal graph, For the Fixed-length multi-scale spatiotemporal graph The corresponding label PPG signal, For the Fixed-length multi-scale spatiotemporal graph The corresponding label heart rate value sequence, is the total number of fixed-size multi-scale spatiotemporal graphs in the training dataset; Step 2: Training of the neural network model based on token learning: Building a Neural Network Model Based on Token Learning , including: a token extractor, a Transformer encoder and an rPPG signal predictor, where The neural network model based on token learning Parameters; Let the current number of training times be , and initialize , Neural network model at training time The parameters are ; Step 2.1, Token Extractor Processing: Step 2.1.1, the Fixed-length multi-scale spatiotemporal graph Split into rows Image blocks ,in, For the Fixed-length multi-scale spatiotemporal graph No. image blocks, Represents the height of the image block, Indicates the width of the image block; Step 2.1.2: The token extractor uses formula (1) to extract Image blocks Layer 0 Token Characteristics , and as the said Fixed-length multi-scale spatiotemporal graph Layer 0 token features: (1) In formula (1), is a linear mapping layer, used to transform the Image blocks Mapped into the D-dimensional token vector space, are additional learnable tokens for predicting rPPG signals, is an additional learnable position embedding vector representing the token location information; Step 2.2, Transformer encoder processing: The Transformer encoder uses formula (2) to transform the l-1th layer token features Encode and output the token features of the lth layer , thus obtaining the token features of the Lth layer : (2) In formula (2), MSA is the multi-head attention layer, LN is the layer normalization; MLP is the multi-layer perceptron layer, is the token feature of the lth layer after multi-head attention processing, is the number of layers of the Transformer encoder; Step 2.3, processing of rPPG signal predictor; The rPPG signal predictor uses formula (3) to obtain the Fixed-length multi-scale spatiotemporal graph The corresponding rPPG signal : (3) In formula (3), For additional learnable tokens Token features output after passing through the Transformer encoder; Step 2.4: Use formula (4) to construct The loss function of the neural network model during training : (4) In formula (4), is the training data set Fixed-length multi-scale spatiotemporal graph rPPG signal predicted by the neural network model based on token learning, The training data set Fixed-length multi-scale spatiotemporal graph The label of PPG signal, represents covariance; Step 2.5: Determine the The error during training Whether it converges, if it converges, it means that the Neural network model parameters during training is the optimal parameter, and the optimal parameter is used as the parameter of the final neural network model to obtain a trained neural network model based on token learning; otherwise, the neural network model is back-propagated to update the parameters of the neural network model, and then step 2.1 is executed; Step 3: Calculate heart rate; Peak point detection is used to calculate the peak point positions of the rPPG signal predicted by the trained token learning-based neural network model, and the heart rate is calculated through the peak point positions, thereby calculating the average heart rate value corresponding to the rPPG signal.