Cabin comfort recognition system and method based on non-contact measurement of facial video
Through facial video non-contact measurement, combined with rPPG signal and facial feature extraction, it solves the problems of high time consumption and large error of traditional evaluation methods, achieves more efficient and accurate cabin comfort evaluation, and provides new solutions for the aviation industry. means of assessment.
Patent Information
- Application Number
- CN202410711915.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-06-04
AI Technical Summary
Traditional cabin comfort assessment methods rely on subjective surveys and objective measurements, which are time-consuming, costly and subject to measurement errors. It is also difficult to effectively assess the correlation between passengers' physiological responses and ride comfort.
Using a non-contact measurement method based on facial videos, the facial frame sequence is extracted through a lightweight face detection network, combined with modular technology and spatiotemporal attention mechanism network, to extract rPPG signals and facial features, perform feature fusion and dimension adjustment, and use Neural network for comfort recognition.
It achieves a more direct and efficient comfort assessment, improves the accuracy of comfort identification, reduces measurement time and cost, and provides a new assessment method for the aviation industry.
Smart Images

Figure CN118279964B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning technology, and in particular to a cabin comfort recognition system and method based on non-contact measurement of facial videos. Background Art
[0002] With the continuous increase in flight mileage and the number of passengers, passengers' demand for a comfortable experience during flight is increasing. Improving passenger comfort and the quality of travel experience has become an important part of the development of the aviation industry. Traditional cabin comfort is evaluated by combining subjective surveys and objective measurements. Subjective surveys rely on passenger feedback and are easily affected by subjective factors. They are time-consuming, costly, and have measurement errors, making it difficult to effectively evaluate passengers' physiological states. Objective measurements use sensors to collect data, such as seat pressure, posture activity, environmental parameters, VR simulation, etc., but environmental parameters are often based on established standards, and VR simulation cannot effectively reflect the state of the aircraft cabin. There is a relative lack of research on the correlation between passengers' physiological responses and ride comfort.
[0003] In contrast, physiological signals can provide more direct information about the comfort state of the human body, but conventional contact measurements may cause discomfort and interference. Remote photoplethysmography (rPPG) is a method of non-contact monitoring by measuring pulse wave signals in the area of interest, which can bring better detection experience and higher efficiency, and make up for the shortcomings of contact detection methods in certain occasions. The present invention uses modular technology and spatiotemporal attention mechanism networks to extract feature vectors of two modalities, rPPG signals and faces, from the video data source, respectively, and uses a fully connected layer to adjust the dimension, and fuses them through serial splicing to obtain a fused feature vector. This can capture complementary information of different modalities, significantly improve the accuracy of comfort recognition, and open up a new way for the aviation industry to improve the passenger travel experience. Summary of the invention
[0004] The object of the present invention is to provide a cabin comfort recognition system and method based on non-contact measurement of facial video to solve the problems raised in the above background technology.
[0005] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0006] The cabin comfort recognition method based on non-contact measurement of facial video includes the following steps:
[0007] S100, extracting a facial frame sequence, inputting a collected facial video, and obtaining a facial frame sequence through a lightweight face detection network, wherein the lightweight face detection network is constructed by using a MobileNet and an SSD network;
[0008] S200, extracting rPPG signal features, extracting the acquired facial frame sequence into rPPG signals through modular technology, wherein the content extracted through modular technology includes normalized segmentation, dynamic ROI selection and RGB mapping, and then performing time series analysis and frequency conversion calculation to obtain a number of rPPG signal features;
[0009] S300, extract facial features, select them by frame difference method, input the extracted facial key frame sequence into the spatiotemporal attention mechanism network, enhance facial feature extraction by capturing global and local spatiotemporal information, and extract several facial features;
[0010] S400, performing feature fusion, adjusting the dimensions of the extracted physiological features and facial features through a fully connected layer, and then concatenating them to obtain a feature vector;
[0011] S500, comfort level identification is performed using a neural network classifier including a linear layer.
[0012] According to step S100, the collected facial video is processed, and the frame images obtained after frame conversion are input into the lightweight face detection network one by one; the lightweight face detection network adopts MobileNet and SSD network to jointly construct the network architecture, and the detection process is as follows:
[0013] S101, extracting multi-scale feature maps, resizing the RGB frame image, normalizing it, inputting the normalized image into MobileNet, extracting multi-scale feature maps through the Conv1 to Conv13 depth-separable convolutional layers, capturing image features at different levels from fine to coarse, and used to locate and detect faces of different sizes;
[0014] S102, define anchor boxes. The extracted feature maps are passed through the Conv11 and Conv13 layers in MobileNet to generate anchor boxes of different sizes. The scale of the anchor box increases linearly with the scale of the feature map. The calculation formula is as follows:
[0015] ;
[0016] Among them, m is the number of feature maps, is the ratio of the size of the anchor box on the kth feature map to the image, is the maximum value of the ratio, is the minimum value of the ratio;
[0017] Set the aspect ratio of the anchor box to , the size of the anchor box on each layer of feature map is calculated by the following formula:
[0018] ;
[0019] in, is the width of the anchor box, is the height of the anchor box;
[0020] The Conv11 and Conv13 layers generate anchor boxes at each feature map location, each with a different aspect ratio to accommodate different shapes and sizes of faces;
[0021] S103, perform bounding box positioning and category prediction, and the generated anchor box is passed to two key layers of the SSD network, which include the Box loc layer and the Box conf layer; the Box loc layer will output four position offsets, including: the lateral offset of the predicted box relative to the center of the anchor box , the longitudinal offset of the prediction box relative to the center of the anchor box , the width of the prediction box relative to the scale of the anchor box and the height of the predicted box relative to the scale of the anchor box , the predicted box is the box predicted by the model based on the anchor box and the learned position offset; the position offset is calculated by the following formula:
[0022] ;
[0023] ;
[0024] Among them, x is the horizontal coordinate of the prediction box, y is the vertical coordinate of the prediction box, w is the width of the prediction box, and h is the height of the prediction box. is the horizontal coordinate of the anchor box, is the vertical coordinate of the anchor box, is the width of the anchor box, is the height of the anchor box;
[0025] S104. After prediction by the Box loc and Box conf layers, the model will use the intersection over union (IoU) to calculate the NMS, select the best prediction box based on the confidence score IoU, calculate the IoU between the remaining prediction boxes and the selected prediction box, and remove the prediction boxes that exceed a specific threshold. If the IoU is greater than the threshold, it is a positive class, indicating that it contains a face; if the IoU is less than the threshold, it is a negative class, indicating that it contains a background, ensuring that each detected face has a most accurate bounding box. The formula is as follows:
[0026] ;
[0027] S105, each detected face is marked with a bounding box, the position and size of the bounding box are predicted and adjusted by the network to accurately match the actual position and size of the face, and then the detected bounding box is used to crop the face area from the original image;
[0028] S106, for each video frame, repeat S101-S105, and save the face image detected in each frame, and the face detected in each frame will constitute the final output of the frame, until all frames of the video are processed; finally, each video clip obtains a continuous image, and the facial frame sequence is a four-dimensional tensor;
[0029] The initial feature points of the acquired facial frame are calculated using the Python dlib library, and the facial frame image and the corresponding initial feature points are passed as input to the deep alignment network. The positions of the feature points are updated at each stage of the network. After several iterations, the deep alignment network generates the final, precisely aligned facial feature points, which mark the key areas of the face.
[0030] According to step S103, the anchor box is passed to the Box conf layer, and Box conf uses a 3×3 convolution kernel to predict a confidence score for each anchor box;
[0031] The confidence score is calculated by the Softmax function, which indicates the confidence of the model that the predicted box contains the target. Once the position and size of the anchor box are adjusted by the position offset, the adjusted box becomes the predicted box. The output of the Boxconf layer is based on the anchor box, but the confidence score will be used to evaluate the confidence of the predicted box containing the target. If there are c categories, each predicted box will have c confidence scores, and each score corresponds to the confidence of a category. The confidence score calculation formula is as follows:
[0032] ;
[0033] in, is the raw score of the predicted box containing category c, c is the total number of categories, i is used to traverse from 1 to c, is the raw score of the predicted box containing category i; the calculated confidence scores are between 0 and 1. If the value of is close to 1, it means that the model is confident that the predicted box contains a face; otherwise, If the value of is close to 0, it means that the model believes that there is almost no possibility that the predicted box contains a face.
[0034] According to step S200, a facial frame sequence containing facial feature points is processed using modular technology to obtain an rPPG signal, and rPPG modular extraction includes normalized segmentation, dynamic ROI selection and RGB mapping;
[0035] The normalized segmentation expands the landmark point set by interpolation, creates a fixed face mesh composed of a plurality of triangles, and fixes the coordinates of the fixed face mesh to a typical front face; maps each triangle in the detected face to a corresponding triangle in the standardized shape, normalizes the face on each frame, and generates a normalized face spatiotemporal matrix;
[0036] The dynamic ROI selection divides the normalized face into a matrix consisting of several rectangles, where the matrix is the ROI region, contains the spatiotemporal representation of the face, and each region represents a signal in the frame sequence; then, the statistical parameters of each local and global region are calculated, and through parameter calculation and analysis, the region that does not contain valuable information is eliminated, and the effective ROI region is dynamically selected;
[0037] The RGB mapping obtains several valid ROI areas through the dynamic ROI selection, calculates the pixel mean value of the ROI area to obtain the RGB signal, and adds the RGB signal of each selected area in the time domain to obtain the final RGB signal; constructs an orthogonal matrix using QR decomposition, the orthogonal matrix contains linearly unrelated components to restore the rPPG physiological signal, and finally obtains the rPPG signal with a high signal-to-noise ratio through filtering;
[0038] The obtained high signal-to-noise ratio rPPG signal is calculated, and ten features including MeanNN, RR, HRG, Skewness, ApEn, DFA, Sample, VLF, Total_Power, and main_freq_component are extracted in the time domain and frequency domain.
[0039] The specific steps of dynamic ROI selection are as follows:
[0040] S201-1, preliminarily pruning the ROI region to remove regions that do not contain any valuable information; by checking the variance change of each candidate region along time t, removing regions with zero variance, wherein the regions with zero variance are represented as black rectangular regions;
[0041] S201-2. Threshold value based on Katz fractal dimension KFD For further screening, the threshold Able to describe the complexity of the signal, The calculation method is as follows:
[0042] ;
[0043] Where L is the total length of the time series, avg is the average Euclidean distance between consecutive points in the sample, d is the Euclidean distance from the first point in the sequence to the farthest point, and n is the ratio of L to avg. After calculation, each relative Areas where the value is lower than the user-set value;
[0044] S201-3, perform detrended fluctuation analysis (DFA) to determine the RGB signal area with expected correlation with the whole face signal and identify the area that may be disturbed by excessive noise or external trends; DFA calculates the Hurst index Quantify the whole face signal correlation, The value of is determined by the slope of the linear fit; if = , then the time series are uncorrelated; if < < , then there is a positive correlation in the time series; if < , then the time series is negatively correlated, and those irrelevant and negatively correlated regions are finally discarded;
[0045] S201-4. Perform a final screening on the remaining regions according to energy, set a fixed number G, and select G ROI regions with the highest energy. The energy refers to the power spectrum density. Regions with high power spectrum density will provide spectrum responses with less noise. The calculation formula is as follows:
[0046] ;
[0047] Where PSD(f) is the power spectral density at frequency f, X(f) is the frequency domain signal after FFT, and N is the number of FFT points; It is the square of the amplitude of the frequency domain signal and represents the power at that frequency.
[0048] According to the rPPG signal, time domain features are extracted: MeanNN is the arithmetic mean of all NN interval lengths, reflecting the average level of heart rate during the measurement period. The formula is as follows:
[0049] ;
[0050] Where Q represents the total number of heartbeat intervals recorded during the measurement period, express The length of the heartbeat interval;
[0051] RR represents the respiratory rate. When the respiratory rate is higher than a certain threshold, the patient will be in an uncomfortable state. The respiratory rate is estimated by calculating in the time domain, setting the resting respiratory rate range, filtering the signal with a low-pass filter, and then using the peak detection algorithm to detect the number of peaks NOP in the respiratory signal in the entire video. The respiratory rate value is estimated according to the RR calculation formula, where TNFF represents the total number of frames of the captured video, and fs represents the frame rate of the captured video:
[0052] ;
[0053] HRG is the increment of heart rate, which can reflect the degree of change of heart rate when the human body is unwell. The HRG corresponding to the u-th peak point is defined as:
[0054] ;
[0055] in, The calculation formula is as follows:
[0056] ;
[0057] in, and are the signal indexes corresponding to the i-th and i+1-th peak points respectively;
[0058] Skewness is called the skewness coefficient, which is a measure of the asymmetry of the statistical data distribution, reflecting the skewness direction and degree of the data distribution. In HRV analysis, the skewness coefficient can reflect the shape and distribution characteristics of the heartbeat signal. The scipy.stats.skew function in Python is used to calculate the skewness feature. The calculation formula is as follows:
[0059] ;
[0060] Among them, R is the number of data, It is data one by one. is the data mean, is the standard deviation;
[0061] ApEn is the approximate entropy, which is used to quantify the regularity and unpredictability of fluctuations in time series data. It uses a non-negative number to represent the complexity of a time series, reflecting the possibility of new information in the time series. The more complex the time series, the greater the corresponding approximate entropy.
[0062] Suppose a time series of length N ,in It is a time series At the continuous time points in , the approximate entropy is calculated as follows:
[0063] Set m to represent the length of the window and generate a set of vectors with dimension m, namely:
[0064] ;
[0065] Define the distance d[X(i),X(j)] between X(i) and X(j), where i is not equal to j, and d[X(i),X(j)] is the one with the largest difference between the corresponding elements of the two, where, :
[0066] ;
[0067] Given a threshold r, for each value i, count the number of distances d less than r and the ratio of this number to the total number of distances Nm, recorded as ,Right now:
[0068] ;
[0069] Will Take the logarithm and then find its average for all i:
[0070] ;
[0071] Add 1 to the dimension, changing it to m+1, and repeat the above steps to get , and then calculate the approximate entropy:
[0072] ;
[0073] DFA is used to measure the long-range correlation of time series and can quantitatively analyze the correlation properties of signal sequences. DFA calculates the correlation index Quantifying the long-range correlation, The value of is determined by the slope of the linear fit; if = , the time series is similar to white noise and has no long-range correlation; if < < , the time series shows a positive long-range correlation, indicating that the trend is persistent; if < , the time series shows a negative long-range correlation, indicating a reversal of trend;
[0074] Sample is the sample entropy, which measures the complexity of the time series by measuring the probability of generating new patterns in the signal. The greater the probability of generating new patterns, the greater the complexity of the sequence. Suppose a time series of length N , the sample entropy is calculated as follows:
[0075] The time series X is constructed into an m-dimensional vector, that is:
[0076] ;
[0077] Where m is the embedding dimension, i.e., the window length, .
[0078] Define the distance between X(i) and X(j) as d[X(i), X(j)], where i is not equal to j, and d[X(i), X(j)] is the largest one among the differences of their corresponding elements:
[0079] ;
[0080] Given a threshold r, r > 0, count the number of < r and its ratio to the total number of vectors N - m , and then average all the results to obtain , that is:
[0081] ;
[0082] Increment the dimension m by 1 and repeat the above steps to obtain , and the calculation of sample entropy is:
[0083] ;
[0084] Extract frequency domain features based on the rPPG signal:
[0085] Very low frequency power VLF is the component of the heart rate power spectrum in the HRV analysis within the very low frequency range, and its calculation formula is as follows:
[0086] ;
[0087] Total_Power is the total power density spectrum, which represents the sum of the power spectral densities PSD of all frequency components within a certain frequency range and can reflect the total amplitude of all periodic fluctuations during the heartbeat; where is the lowest frequency limit, is the highest frequency limit, and its calculation formula is as follows:
[0088] ;
[0089] main_freq_component is the largest frequency point in the power spectral density curve, which can understand the frequency range of the dominant heart rate variability and reflect the main regulatory mechanism of cardiac activity.
[0090] According to step S300, key frames are selected from the facial image sequence by the frame difference method, and the steps are as follows:
[0091] S301-1. Grayscale a series of facial image frames, select the first frame in the sequence as the initial reference frame, calculate the pixel difference between the current frame and the previous frame by directly subtracting the pixel values;
[0092] S301-2, calculating the difference sum of the difference images to evaluate the degree of change between the two frames, setting a threshold, and confirming the frame as a key frame when the difference between the frames exceeds the threshold;
[0093] S301-3. Sort all selected key frames according to the degree of difference, and select the key frames with the largest difference. The frame is the final saved frame, and the saved key frame is the original color frame. A sequence of video key frames;
[0094] The extracted key frame sequence is input into the spatiotemporal attention mechanism network to enhance facial feature extraction by capturing global and local spatiotemporal information; the spatiotemporal attention mechanism network includes the STA mechanism, which can extract attention vectors with global and local spatiotemporal information, and adds an attention vector fusion strategy to the STA mechanism to combine the spatial and temporal attention vectors to generate a new vector; finally, 1024 facial feature vectors are extracted by stacking ResNet-style STA modules; the steps of changing the output feature map of each layer of the spatiotemporal attention mechanism network for the image sequence are as follows:
[0095] S302-1, adjust the size of each key frame image in the sequence, normalize it and pass it into two convolutional layers, each convolutional layer will obtain the corresponding feature map output; the first convolutional layer integrates the channel dimension features of the input image frame sequence, and performs preliminary feature extraction in a cross-channel manner; the second convolutional layer further extracts the spatial and temporal features of the input sequence and increases the depth of the features;
[0096] S302-2, Bottleneck module contains three convolutional layers and one residual connection. The third convolutional layer is used to reduce the dimension and reduce the amount of calculation. The fourth convolutional layer extracts spatial and temporal features while maintaining the time and space dimensions. The fifth convolutional layer expands the dimension and learns deeper features. The residual connection can alleviate the gradient vanishing problem in deep networks and improve the efficiency of network training.
[0097] S302-3, the STA module processes the obtained feature map through a convolution layer, a batch normalization layer and a maximum pooling layer, and then inputs it into the STA module to extract high-dimensional features. The STA module contains four residual blocks, namely, SpatialBlock, TemporalBlock, SpatiotemporalBlock and AttentionSpatiotemporalBlock. Among them, SpatialBlock focuses on extracting features in the spatial dimension, TemporalBlock focuses on extracting features in the temporal dimension, SpatiotemporalBlock is used to fuse features in the temporal and spatial dimensions, and AttentionSpatiotemporalBlock adds an attention mechanism to enable the network to focus on important features.
[0098] The facial feature vector is extracted through the AttentionSpatiotemporalBlock layer.
[0099] According to step S400, the extracted physiological features and facial features are dimensionally adjusted through a fully connected layer, and then concatenated to obtain a feature vector; wherein the steps of dimension adjustment are as follows:
[0100] S401-1. Use random initialization to initialize the weights of the fully connected layer;
[0101] S401-2, obtaining the user's facial feature information, the facial feature information including facial expression, expression change speed, facial structure, skin color, captureable facial area, facial occlusion information, and specified facial features; wherein, through facial expression and expression change speed, users with rich expressions are identified; through facial structure and skin color, users of different races are distinguished; through captureable facial area and facial occlusion information, users with serious facial occlusion are analyzed, the facial occlusion information includes the type of occluding object and the occlusion position; through the specified facial features, users with specified facial features are identified, the specified facial features include wrinkles, spots and scars;
[0102] S401-3. Design a linear function to describe the relationship between the severity of facial occlusion and the dimension of facial features. The captureable facial area is expressed as a percentage ranging from 0 to 100. The type of occluding object is represented by a binary variable, where 1 represents a fixed occluding object and 0 represents the user's own specified facial features. The facial feature dimension V is represented as the captureable facial area. and occluding object type The linear combination of is as follows:
[0103] ;
[0104] in, Indicates the degree of influence of the occlusion area on the facial feature dimension, It indicates the influence of the type of occluded object on the facial feature dimension, and b is the bias term;
[0105] S401-4, collecting a facial occlusion dataset including facial images and corresponding facial occlusion information, wherein the facial occlusion dataset includes a plurality of samples and annotation information of an occlusion area and an occlusion object type of each sample;
[0106] S401-5, preprocessing the facial occlusion data set, the preprocessing including image normalization and encoding of occlusion information to ensure uniformity of data format and correctness of labels;
[0107] S401-6, using a convolutional neural network to extract features from the facial image of each sample to obtain facial feature representation;
[0108] S401-7. Use a convolutional neural network for training, take facial feature representation as input features, occlusion area and occlusion object type as target labels, and use an existing data set to train the convolutional neural network; the input layer of the convolutional neural network is used to receive facial features; the convolutional layer of the convolutional neural network performs a convolution operation on the input facial features to extract features; the activation function layer of the convolutional neural network applies a nonlinear activation function ReLU to increase the nonlinear fitting ability of the network; the pooling layer of the convolutional neural network performs a pooling operation on the feature map to reduce the dimension of the feature map; the fully connected layer of the convolutional neural network maps the features output by the pooling layer to the target label space;
[0109] Define the loss function to measure the difference between the model prediction result and the true label. Choose the mean square error as the loss function. Its expression is as follows:
[0110] ;
[0111] in, is the number of samples of the convolutional neural network, It is The true labels of samples are used to reflect the true occlusion area and the type of occluded objects. It is The predicted labels of samples;
[0112] Use the gradient descent optimization algorithm to update the parameters in the convolutional neural network by minimizing the loss function; use the back propagation algorithm to calculate the gradient of the loss function for each parameter, and use the gradient to update the parameters; finally, after several rounds of training, a trained convolutional neural network model is obtained, including the weight parameters. , and bias term b;
[0113] S401-8. Using another test data set to evaluate the trained linear combination, and evaluating the performance of the linear combination in predicting facial feature dimensions;
[0114] S401-9. According to the evaluation results, the linear combination is tuned, and the trained linear combination is used in practical applications to infer the relationship between the severity of facial occlusion and the dimension of facial features;
[0115] S401-10, establishing the influence between the severity of facial occlusion, the richness of expression and information of different races and the facial feature dimension; the higher the severity of facial occlusion, the lower the facial feature dimension; the higher the richness of expression, the lower the facial feature dimension; further adjusting the facial feature dimension according to the expression habits of different races; obtaining the facial feature dimension;
[0116] S401-11, according to the facial feature dimension, adjusting the physiological feature dimension to a dimension matching the facial feature vector;
[0117] The dimensionally adjusted physiological feature vector and facial feature vector are concatenated using torch.cat to obtain the final feature vector.
[0118] According to step S500, the output classifier uses a fully connected layer to construct a forward structure, which includes two linear layers and a ReLU activation function; the input dimension of the first linear layer is A, and the output dimension is B; the input dimension of the second linear layer is B, and the output dimension is C. The sigmoid activation function is used to map the output Output to the range of (0, 1), and the calculation is as follows:
[0119] ;
[0120] Among them, CP is the comfort probability predicted by the model, and the threshold is set to CP'. When CP > CP', it is judged as comfortable; otherwise, it is judged as uncomfortable.
[0121] The cabin comfort recognition system based on non-contact measurement of facial video includes:
[0122] Facial frame sequence extraction module: extracts facial frame sequences, inputs the collected facial video, and obtains facial frame sequences through a lightweight face detection network. The lightweight face detection network uses MobileNet and SSD networks to jointly construct a network architecture.
[0123] rPPG signal feature extraction module: extract rPPG signal features, extract the acquired facial frame sequence into rPPG signal through modular technology, and then perform time series analysis and frequency conversion calculation to obtain several rPPG signal features;
[0124] Facial feature extraction module: extracts facial features, inputs the extracted facial key frame sequence into the spatiotemporal attention mechanism network, and extracts several facial features;
[0125] Feature fusion module: performs feature fusion, adjusts the dimensions of the extracted physiological features and facial features through the fully connected layer, and then concatenates them to obtain the feature vector;
[0126] Comfort level recognition module: Comfort level recognition is performed through a neural network classifier containing a linear layer.
[0127] Compared with the prior art, the beneficial effects achieved by the present invention are:
[0128] The present invention utilizes remote photoplethysmography, combined with facial feature extraction and modularization technology, to achieve non-contact comfort assessment, providing a new and more direct means of assessment for the aviation industry.
[0129] By fusing rPPG signals and facial features and using a fully connected layer for dimensionality adjustment and splicing, the present invention can more comprehensively capture the comfort state of passengers, thereby improving the accuracy of comfort recognition.
[0130] Compared with traditional subjective survey and objective measurement methods, the technology proposed in the present invention is more efficient and can be evaluated through video data sources, which reduces the time and cost of measurement and improves the efficiency of evaluation. BRIEF DESCRIPTION OF THE DRAWINGS
[0131] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0132] Figure 1 It is a schematic diagram of the steps of the cabin comfort recognition method based on non-contact measurement of facial video of the present invention;
[0133] Figure 2 It is a diagram of the rPPG signal extraction process of the cabin comfort recognition method based on non-contact measurement of facial video of the present invention;
[0134] Figure 3 It is a schematic diagram of the STA module layer of the spatiotemporal attention network of the cabin comfort recognition method based on non-contact measurement of facial video in the present invention. DETAILED DESCRIPTION
[0135] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0136] See also Figure 1-Figure 3 , the present invention provides a technical solution:
[0137] According to one embodiment of the present invention, Figure 1 As shown in the schematic diagram of the steps of the cabin comfort recognition method based on non-contact measurement of facial video of the present invention, the cabin comfort recognition method based on non-contact measurement of facial video comprises the following steps:
[0138] S100, extracting a facial frame sequence, inputting a collected facial video, and obtaining a facial frame sequence through a lightweight face detection network, wherein the lightweight face detection network is constructed by using a MobileNet and an SSD network;
[0139] S200, extracting rPPG signal features, extracting the acquired facial frame sequence into rPPG signals through modular technology, wherein the content extracted through modular technology includes normalized segmentation, dynamic ROI selection and RGB mapping, and then performing time series analysis and frequency conversion calculation to obtain a number of rPPG signal features;
[0140] S300, extract facial features, select them by frame difference method, input the extracted facial key frame sequence into the spatiotemporal attention mechanism network, enhance facial feature extraction by capturing global and local spatiotemporal information, and extract several facial features;
[0141] S400, performing feature fusion, adjusting the dimensions of the extracted physiological features and facial features through a fully connected layer, and then concatenating them to obtain a feature vector;
[0142] S500, comfort level identification is performed using a neural network classifier including a linear layer.
[0143] According to step S100, the collected facial video is processed, the video collection time is 1 minute, and the frame rate is 30 frames per second. The frame images obtained after frame conversion are input one by one into the lightweight face detection network; the lightweight face detection network uses MobileNet and SSD networks to jointly construct the network architecture, and the detection process is as follows:
[0144] S101, extract multi-scale feature maps, resize the RGB frame image to 300×300, perform normalization, input the normalized image into MobileNet, extract multi-scale feature maps through Conv1 to Conv13 deep separable convolutional layers, capture different levels of image features from fine to coarse, and use them to locate and detect faces of different sizes;
[0145] S102, define anchor boxes. The extracted feature maps are passed through the Conv11 and Conv13 layers in MobileNet to generate anchor boxes of different sizes. The scale of the anchor box increases linearly with the scale of the feature map. The calculation formula is as follows:
[0146] ;
[0147] Among them, m is the number of feature maps, is the ratio of the size of the anchor box on the kth feature map to the image, is the maximum value of the ratio, is the minimum value of the ratio;
[0148] Set the aspect ratio of the anchor box to , the size of the anchor box on each layer of feature map is calculated by the following formula:
[0149] ;
[0150] in, is the width of the anchor box, is the height of the anchor box;
[0151] The Conv11 layer generates 4 anchor boxes at each feature map location, and the Conv13 layer generates 6 anchor boxes at each feature map location, each with a different aspect ratio to accommodate different shapes and sizes of faces.
[0152] S103, perform bounding box positioning and category prediction, and the generated anchor box is passed to two key layers of the SSD network, which include the Box loc layer and the Box conf layer; the Box loc layer will output four position offsets, including: the lateral offset of the predicted box relative to the center of the anchor box , the longitudinal offset of the prediction box relative to the center of the anchor box , the width of the prediction box relative to the scale of the anchor box and the height of the predicted box relative to the scale of the anchor box , the predicted box is the box predicted by the model based on the anchor box and the learned position offset; the position offset is calculated by the following formula:
[0153] ;
[0154] ;
[0155] Among them, x is the horizontal coordinate of the prediction box, y is the vertical coordinate of the prediction box, w is the width of the prediction box, and h is the height of the prediction box. is the horizontal coordinate of the anchor box, is the vertical coordinate of the anchor box, is the width of the anchor box, is the height of the anchor box;
[0156] S104. After prediction by the Box loc and Box conf layers, the model will use the intersection over union (IoU) to calculate the NMS, select the best prediction box based on the confidence score IoU, calculate the IoU between the remaining prediction boxes and the selected prediction box, and remove the prediction boxes that exceed a specific threshold. If the IoU is greater than the threshold, it is a positive class, indicating that it contains a face; if the IoU is less than the threshold, it is a negative class, indicating that it contains a background, ensuring that each detected face has a most accurate bounding box.
[0157] S105, each detected face is marked with a bounding box, the position and size of the bounding box are predicted and adjusted by the network to accurately match the actual position and size of the face, and then the detected bounding box is used to crop the face area from the original image;
[0158] S106. For each video frame, S101-S105 are repeatedly executed, and the face image detected in each frame is saved. The face detected in each frame will constitute the final output of the frame until all frames of the video are processed. Finally, each 1-minute video clip obtains 1800 consecutive frames of images with an image size of 300×300×3. The facial frame sequence is a four-dimensional tensor with a shape of (1800, 300, 300, 3).
[0159] The acquired facial frame is used to calculate the initial feature points through the Python dlib library, and the facial frame image and the corresponding initial feature points are passed as input to the deep alignment network. At each stage of the network, the position of the feature points is updated to make it closer to the real facial structure. This is achieved by comparing the difference between the predicted position of the feature points and the actual image. After multiple iterations, the deep alignment network produces the final, precisely aligned 68 facial feature points, which accurately mark the key areas of the face, such as the eyes, nose, mouth, etc.
[0160] According to step S103, the anchor box is passed to the Box conf layer, and Box conf uses a 3×3 convolution kernel to predict a confidence score for each anchor box;
[0161] The confidence score is calculated by the Softmax function, which indicates the confidence of the model that the predicted box contains the target. Once the position and size of the anchor box are adjusted by the position offset, the adjusted box becomes the predicted box. The output of the Boxconf layer is based on the anchor box, but the confidence score will be used to evaluate the confidence of the predicted box containing the target. If there are c categories, each predicted box will have c confidence scores, and each score corresponds to the confidence of a category. The confidence score calculation formula is as follows:
[0162] ;
[0163] in, is the raw score of the predicted box containing category c, c is the total number of categories, i is used to traverse from 1 to c, is the raw score of the predicted box containing category i; the calculated confidence scores are between 0 and 1. If the value of is close to 1, it means that the model is confident that the predicted box contains a face; otherwise, If the value of is close to 0, it means that the model believes that there is almost no possibility that the predicted box contains a face.
[0164] According to step S300, key frames are selected from the facial image sequence by using the frame difference method, and the steps are as follows:
[0165] S301-1, selecting key frames for a facial image sequence of 1800 frames by using a frame difference method, graying a series of facial image frames, selecting the first frame in the sequence as an initial reference frame, calculating the pixel difference between the current frame and the previous frame, and directly subtracting the pixel values;
[0166] S301-2, calculating the difference sum of the difference images to evaluate the degree of change between the two frames, setting a threshold value to 15, and confirming the key frame when the difference between the frames exceeds the threshold value;
[0167] S301-3. Sort all selected key frames according to the degree of difference, and select the key frames with the largest difference. The frame is taken as the final saved frame, and the saved key frame is the original color frame. Finally, 16 video key frame sequences are obtained, and their shape is (16, 300, 300, 3);
[0168] The extracted key frame sequence is input into the spatiotemporal attention mechanism network to enhance facial feature extraction by capturing global and local spatiotemporal information; the spatiotemporal attention mechanism network includes the STA mechanism, which can extract attention vectors with global and local spatiotemporal information, and adds an attention vector fusion strategy to the STA mechanism to combine the spatial and temporal attention vectors to generate a new vector; finally, 1024 facial feature vectors are extracted by stacking ResNet-style STA modules; the steps of changing the output feature map of each layer of the spatiotemporal attention mechanism network for the image sequence are as follows:
[0169] S302-1, resize each key frame image in the sequence to 128×128, normalize it and pass it into two convolutional layers, each convolutional layer will get the corresponding feature map output; input sequence: 16×3×16×128×128 (batch, number of channels, sequence, image width, image height); the first convolutional layer integrates the channel dimension features of the input image frame sequence, performs preliminary feature extraction in a cross-channel manner, and the output dimension is 16×64×16×128×128; the second convolutional layer further extracts the spatial and temporal features of the input sequence and increases the depth of the features, and the output dimension is 16×128×16×128×128;
[0170] S302-2, the Bottleneck module contains three convolutional layers and one residual connection. The third convolutional layer is used to reduce the dimension and reduce the amount of calculation; the fourth convolutional layer extracts spatial and temporal features while maintaining the time and space dimensions; the fifth convolutional layer expands the dimension and learns deeper features; the residual connection can alleviate the gradient vanishing problem in deep networks and improve the efficiency of network training; the feature dimension output after passing through the Bottleneck module is 16×256×16×128×128.
[0171] S302-3, according to Figure 3As shown in the schematic diagram of the STA module layer of the spatiotemporal attention network of the cabin comfort recognition method based on non-contact measurement of facial video of the present invention, the STA module processes the obtained feature map through a convolution layer, a batch normalization layer and a maximum pooling layer, and the output feature dimension is 16×64×16×32×32, which is then input into the STA module to extract high-dimensional features. The STA module contains four residual blocks, namely SpatialBlock, TemporalBlock, SpatiotemporalBlock and AttentionSpatiotemporalBlock; SpatialBlock focuses on extracting features in the spatial dimension, and the output dimension is 16×128×16×32×32; TemporalBlock focuses on extracting features in the temporal dimension, and the output dimension is 16×256×8×16×16; SpatiotemporalBlock is used to fuse features in the temporal and spatial dimensions, and the output dimension is 16×512×4×8×8; AttentionSpatiotemporalBlock adds an attention mechanism to enable the network to focus on important features, and the output dimension is 16×1024×2×4×4.
[0172] The facial feature vector is extracted through the AttentionSpatiotemporalBlock layer, and the size of the facial feature vector is 1024×1.
[0173] According to step S400, the extracted physiological features and facial features are dimensionally adjusted through a fully connected layer, and then concatenated to obtain a 512×1 feature vector; wherein the steps of dimension adjustment are as follows:
[0174] S401-1. Use random initialization to initialize the weights of the fully connected layer;
[0175] S401-2, obtaining the user's facial feature information, the facial feature information including facial expression, expression change speed, facial structure, skin color, captureable facial area, facial occlusion information, and specified facial features; wherein, through facial expression and expression change speed, users with rich expressions are identified; through facial structure and skin color, users of different races are distinguished; through captureable facial area and facial occlusion information, users with serious facial occlusion are analyzed, the facial occlusion information includes the type of occluding object and the occlusion position; through the specified facial features, users with specified facial features are identified, the specified facial features include wrinkles, spots and scars;
[0176] S401-3. Design a linear function to describe the relationship between the severity of facial occlusion and the dimension of facial features. The captureable facial area is expressed as a percentage ranging from 0 to 100. The type of occluding object is represented by a binary variable, where 1 represents a fixed occluding object and 0 represents the user's own specified facial features. The facial feature dimension V is represented as the captureable facial area. and occluding object type The linear combination of is as follows:
[0177] ;
[0178] in, Indicates the degree of influence of the occlusion area on the facial feature dimension, It indicates the influence of the type of occluded object on the facial feature dimension, and b is the bias term;
[0179] S401-4, collecting a facial occlusion dataset including facial images and corresponding facial occlusion information, wherein the facial occlusion dataset includes a plurality of samples and annotation information of an occlusion area and an occlusion object type of each sample;
[0180] S401-5, preprocessing the facial occlusion data set, the preprocessing including image normalization and encoding of occlusion information to ensure uniformity of data format and correctness of labels;
[0181] S401-6, using a convolutional neural network to extract features from the facial image of each sample to obtain facial feature representation;
[0182] S401-7. Use a convolutional neural network for training, take facial feature representation as input features, occlusion area and occlusion object type as target labels, and use an existing data set to train the convolutional neural network; the input layer of the convolutional neural network is used to receive facial features; the convolutional layer of the convolutional neural network performs a convolution operation on the input facial features to extract features; the activation function layer of the convolutional neural network applies a nonlinear activation function ReLU to increase the nonlinear fitting ability of the network; the pooling layer of the convolutional neural network performs a pooling operation on the feature map to reduce the dimension of the feature map; the fully connected layer of the convolutional neural network maps the features output by the pooling layer to the target label space;
[0183] Define the loss function to measure the difference between the model prediction result and the true label. Choose the mean square error as the loss function. Its expression is as follows:
[0184] ;
[0185] in, is the number of samples of the convolutional neural network, It is The true labels of samples are used to reflect the true occlusion area and the type of occluded objects. It is The predicted labels of samples;
[0186] Use the gradient descent optimization algorithm to update the parameters in the convolutional neural network by minimizing the loss function; use the back propagation algorithm to calculate the gradient of the loss function for each parameter, and use the gradient to update the parameters; finally, after several rounds of training, a trained convolutional neural network model is obtained, including the weight parameters. , and bias term b;
[0187] S401-8. Using another test data set to evaluate the trained linear combination, and evaluating the performance of the linear combination in predicting facial feature dimensions;
[0188] S401-9. According to the evaluation results, the linear combination is tuned, and the trained linear combination is used in practical applications to infer the relationship between the severity of facial occlusion and the dimension of facial features;
[0189] S401-10, establishing the influence between the severity of facial occlusion, the richness of expression and information of different races and the facial feature dimension; the higher the severity of facial occlusion, the lower the facial feature dimension; the higher the richness of expression, the lower the facial feature dimension; further adjusting the facial feature dimension according to the expression habits of different races; obtaining the facial feature dimension;
[0190] S401-11, according to the facial feature dimension, adjusting the physiological feature dimension to a dimension matching the facial feature vector;
[0191] The dimensionally adjusted physiological feature vector and facial feature vector are concatenated using torch.cat to obtain a feature vector with a final size of 512×1.
[0192] According to step S500, the output classifier uses a fully connected layer to construct a forward structure, which includes two linear layers and a ReLU activation function; the input dimension of the first linear layer is 512, and the output dimension is 256; the input dimension of the second linear layer is 256, and the output dimension is 1. The sigmoid activation function is used to map the output Output to the range of (0, 1), and the calculation is as follows:
[0193] ;
[0194] Among them, CP is the comfort probability predicted by the model, and the threshold is set to 0.5. When CP > 0.5, it is judged as comfortable; otherwise, it is judged as uncomfortable.
[0195] According to another embodiment of the present invention, Figure 2 As shown in the figure, the rPPG signal feature extraction process of the cabin comfort recognition method based on non-contact measurement of facial video of the present invention, according to step S200, a facial frame sequence containing 68 facial feature points is processed by modular technology to obtain an rPPG signal, and the rPPG modular extraction includes normalized segmentation, dynamic ROI selection and RGB mapping;
[0196] The normalized segmentation expands the landmark point set from 68 to 85 landmark points by interpolation, creates a fixed face mesh consisting of 131 triangles, and fixes the coordinates of the fixed face mesh to a typical front face; maps each triangle in the detected face to a corresponding triangle in the standardized shape, normalizes the face on each frame, and generates a normalized face spatiotemporal matrix;
[0197] The dynamic ROI selection divides the normalized face into a matrix of 81 rectangles, where the matrix is the ROI region, contains the spatiotemporal representation of the face, and each region represents a signal in the frame sequence; then, 9 statistical parameters of each local and global region are calculated, and through parameter calculation and analysis, regions that do not contain valuable information are eliminated, and effective ROI regions are dynamically selected;
[0198] The RGB mapping obtains several valid ROI areas through the dynamic ROI selection, calculates the pixel mean value of the ROI area to obtain the RGB signal, and adds the RGB signal of each selected area in the time domain to obtain the final RGB signal; constructs an orthogonal matrix using QR decomposition, the orthogonal matrix contains linearly unrelated components to restore the rPPG physiological signal, and finally obtains the rPPG signal with a high signal-to-noise ratio through filtering;
[0199] The obtained high signal-to-noise ratio rPPG signal is calculated to extract features in the time domain and frequency domain.
[0200] The specific steps of dynamic ROI selection are as follows:
[0201] S201-1, preliminarily pruning the 81 ROI regions to remove regions that do not contain any valuable information; by checking the variance change of each candidate region along time t, removing the region with zero variance, wherein the region with zero variance is represented as a black rectangular region;
[0202] S201-2. Threshold value based on Katz fractal dimension KFD For further screening, the threshold Able to describe the complexity of the signal, The calculation method is as follows:
[0203] ;
[0204] Where L is the total length of the time series, avg is the average Euclidean distance between consecutive points in the sample, d is the Euclidean distance from the first point in the sequence to the farthest point, and n is the ratio of L to avg. After calculation, each relative Areas with values below 0.85;
[0205] S201-3, perform detrended fluctuation analysis (DFA) to determine the RGB signal area with expected correlation with the whole face signal and identify the area that may be disturbed by excessive noise or external trends; DFA calculates the Hurst index Quantify the whole face signal correlation, The value of is determined by the slope of the linear fit; if = , then the time series are uncorrelated; if < < , then there is a positive correlation in the time series; if < , then the time series is negatively correlated, and those irrelevant and negatively correlated regions are finally discarded;
[0206] S201-4. Perform a final screening on the remaining regions according to energy, set a fixed number of 18, and select the 18 ROI regions with the highest energy. The energy refers to the power spectrum density. Regions with high power spectrum density will provide a spectrum response with less noise. The calculation formula is as follows:
[0207] ;
[0208] Where PSD(f) is the power spectral density at frequency f, X(f) is the frequency domain signal after FFT, and N is the number of FFT points; It is the square of the amplitude of the frequency domain signal and represents the power at that frequency.
[0209] According to the rPPG signal, extract the time domain features:
[0210] MeanNN is the arithmetic mean of all NN interval lengths, reflecting the average level of heart rate during the measurement period. The formula is as follows:
[0211] ;
[0212] Where Q represents the total number of heartbeat intervals recorded during the measurement period, express The length of the heartbeat interval;
[0213] RR represents the respiratory rate. When the respiratory rate is higher than a certain threshold, the patient will be in an uncomfortable state. The respiratory rate is estimated by calculating in the time domain. The resting respiratory rate range is set to 12brpm~25brpm. The signal is filtered using a low-pass filter with a cutoff frequency of 0.42Hz. The peak detection algorithm is then used to detect the number of peaks NOP in the respiratory signal in the entire video. The respiratory rate value is estimated according to the RR calculation formula, where TNFF represents the total number of frames of the captured video, and fs represents the frame rate of the captured video:
[0214] ;
[0215] HRG is the increment of heart rate, which can reflect the degree of change of heart rate when the human body is unwell. The HRG corresponding to the u-th peak point is defined as:
[0216] ;
[0217] in, The calculation formula is as follows:
[0218] ;
[0219] in, and are the signal indexes corresponding to the i-th and i+1-th peak points respectively;
[0220] The Skewness coefficient is a measure of the asymmetry of statistical data distribution, reflecting the skewness direction and degree of data distribution. In HRV analysis, the Skewness coefficient can reflect the shape and distribution characteristics of the heartbeat signal. The scipy.stats.skew function in Python is used to calculate the Skewness feature. The calculation formula is as follows:
[0221] ;
[0222] Among them, R is the number of data, It is data one by one. is the data mean, is the standard deviation;
[0223] ApEn is the approximate entropy, which is used to quantify the regularity and unpredictability of fluctuations in time series data. It uses a non-negative number to represent the complexity of a time series, reflecting the possibility of new information in the time series. The more complex the time series, the greater the corresponding approximate entropy.
[0224] Suppose a time series of length N ,in It is a time series At the continuous time points in , the approximate entropy is calculated as follows:
[0225] Set m to represent the length of the window and generate a set of vectors with dimension m, namely:
[0226] ;
[0227] Define the distance d[X(i),X(j)] between X(i) and X(j), where i is not equal to j, and d[X(i),X(j)] is the one with the largest difference between the corresponding elements of the two, where, :
[0228] ;
[0229] Given a threshold r, for each value i, count the number of distances d less than r and the ratio of this number to the total number of distances Nm, recorded as ,Right now:
[0230] ;
[0231] Will Take the logarithm and then find its average for all i:
[0232] ;
[0233] Add 1 to the dimension, changing it to m+1, and repeat the above steps to get , and then calculate the approximate entropy:
[0234] ;
[0235] DFA is used to measure the long-range correlation of time series and can quantitatively analyze the correlation properties of signal sequences. DFA calculates the correlation index Quantifying the long-range correlation, The value of is determined by the slope of the linear fit; if = , the time series is similar to white noise and has no long-range correlation; if < < , the time series shows a positive long-range correlation, indicating that the trend is persistent; if < , the time series shows a negative long-range correlation, indicating a reversal of trend;
[0236] Sample is the sample entropy, which measures the complexity of the time series by measuring the probability of generating new patterns in the signal. The greater the probability of generating new patterns, the greater the complexity of the sequence. Suppose a time series of length N , the sample entropy is calculated as follows:
[0237] Construct the time series X into an m-dimensional vector, i.e.:
[0238] ;
[0239] where m is the embedding dimension, i.e., the window length, 。
[0240] Define the distance between X(i) and X(j) as d[X(i), X(j)], where i is not equal to j, and d[X(i), X(j)] is the largest of the differences between the corresponding elements of the two:
[0241] ;
[0242] Given a threshold r, r > 0, count the number of < r and the ratio to the total number of vectors N - m , and then average all the results to obtain , i.e.:
[0243] ;
[0244] Increment the dimension m by 1 and repeat the above steps to obtain , and the calculation of sample entropy is:
[0245] ;
[0246] Extract frequency domain features from the rPPG signal:
[0247] The very low frequency power VLF is the component of the heart rate power spectrum in the HRV analysis within the very low frequency range, and the calculation formula is as follows:
[0248] ;
[0249] Total_Power is the total power density spectrum, representing the sum of the power spectral densities PSD of all frequency components within a certain frequency range, and can reflect the total amplitude of all periodic fluctuations during the heartbeat; where is the lowest frequency limit, is the highest frequency limit, and the calculation formula is as follows:
[0250] ;
[0251] main_freq_component is the largest frequency point in the power spectral density curve, which can understand the frequency range of the dominant heart rate variability and reflect the main regulatory mechanism of cardiac activity.
[0252] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0253] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A cabin comfort recognition method based on non-contact measurement of facial video, characterized by: The steps include: S100, extracting a facial frame sequence, inputting a collected facial video, and obtaining a facial frame sequence through a lightweight face detection network, wherein the lightweight face detection network is constructed by using a MobileNet and an SSD network; S200, extracting rPPG signal features, extracting the acquired facial frame sequence into rPPG signals through modular technology, wherein the content extracted through modular technology includes normalized segmentation, dynamic ROI selection and RGB mapping, and then performing time series analysis and frequency conversion calculation to obtain a number of rPPG signal features; S300, extract facial features, select them by frame difference method, input the extracted facial key frame sequence into the spatiotemporal attention mechanism network, enhance facial feature extraction by capturing global and local spatiotemporal information, and extract several facial features; S400, performing feature fusion, adjusting the dimensions of the extracted physiological features and facial features through a fully connected layer, and then concatenating them to obtain a feature vector; S500, comfort level identification through a neural network classifier including a linear layer; According to step S200, a facial frame sequence containing facial feature points is processed using modular technology to obtain an rPPG signal, and rPPG modular extraction includes normalized segmentation, dynamic ROI selection and RGB mapping; The normalized segmentation expands the landmark point set by interpolation, creates a fixed face mesh composed of a plurality of triangles, and fixes the coordinates of the fixed face mesh to a typical front face; maps each triangle in the detected face to a corresponding triangle in the standardized shape, normalizes the face on each frame, and generates a normalized face spatiotemporal matrix; The dynamic ROI selection divides the normalized face into a matrix consisting of several rectangular areas, where the rectangular area is the ROI area, which contains the spatiotemporal representation of the face, and each area represents a signal in the frame sequence; then the statistical parameters of each local and global area are calculated, and through parameter calculation and analysis, the area that does not contain valuable information is eliminated, and the effective ROI area is dynamically selected; The RGB mapping obtains a plurality of effective ROI regions through the dynamic ROI selection, calculates the pixel average value of the ROI region to obtain an RGB signal, and adds the RGB signal of each selected region in the time domain to obtain a final RGB signal; An orthogonal matrix is constructed by using QR decomposition, wherein the orthogonal matrix contains linearly uncorrelated components to restore the rPPG physiological signal, and finally an rPPG signal with a high signal-to-noise ratio is obtained by filtering; The obtained high signal-to-noise ratio rPPG signal is calculated, and ten features including MeanNN, RR, HRG, Skewness, ApEn, DFA, Sample, VLF, Total_Power, and main_freq_component are extracted in the time domain and frequency domain; Among them, MeanNN is the arithmetic mean of all NN interval lengths, RR represents the respiratory rate, HRG is the degree of heart rate increment, Skewness is the skewness coefficient, a measure of the asymmetry of the statistical data distribution, ApEn is the approximate entropy, which is used to quantify the regularity and unpredictability of time series data fluctuations, DFA is used to measure the long-range correlation of time series, Sample is the sample entropy, VLF is the component of the heart rate power spectrum in the very low frequency range in HRV analysis, Total_Power is the total power density spectrum, and main_freq_component is the maximum frequency point in the power spectrum density curve.
2. The method for cabin comfort recognition based on non-contact measurement of facial video according to claim 1, characterized in that: According to step S100, the collected facial video is processed, and the frame images obtained after frame conversion are input into the lightweight face detection network one by one; the lightweight face detection network adopts MobileNet and SSD network to jointly construct the network architecture, and the detection process is as follows: S101, extracting multi-scale feature maps, resizing the RGB frame image, normalizing it, inputting the normalized image into MobileNet, extracting multi-scale feature maps through the Conv1 to Conv13 depth-separable convolutional layers, capturing image features at different levels from fine to coarse, and used to locate and detect faces of different sizes; S102, define anchor boxes. The extracted feature maps are passed through the Conv11 and Conv13 layers in MobileNet to generate anchor boxes of different sizes. The scale of the anchor box increases linearly with the scale of the feature map. The calculation formula is as follows: ; Among them, m is the number of feature maps, is the ratio of the size of the anchor box on the kth feature map to the image, is the maximum value of the ratio, is the minimum value of the ratio; Set the aspect ratio of the anchor box to , the size of the anchor box on each layer of feature map is calculated by the following formula: ; in, is the width of the anchor box, is the height of the anchor box; The Conv11 and Conv13 layers generate anchor boxes at each feature map location, each with a different aspect ratio to accommodate different shapes and sizes of faces; S103, perform bounding box positioning and category prediction, and the generated anchor box is passed to two key layers of the SSD network, which include the Box loc layer and the Box conf layer; the Box loc layer will output four position offsets, including: the lateral offset of the predicted box relative to the center of the anchor box , the longitudinal offset of the prediction box relative to the center of the anchor box , the width of the prediction box relative to the scale of the anchor box and the height of the predicted box relative to the scale of the anchor box , the predicted box is the box predicted by the model based on the anchor box and the learned position offset; the position offset is calculated by the following formula: ; ; Among them, x is the horizontal coordinate of the prediction box, y is the vertical coordinate of the prediction box, w is the width of the prediction box, and h is the height of the prediction box. is the horizontal coordinate of the anchor box, is the vertical coordinate of the anchor box, is the width of the anchor box, is the height of the anchor box; S104. After prediction by the Box loc and Box conf layers, the model will use the intersection over union (IoU) to calculate the NMS, select the best prediction box based on the confidence score IoU, calculate the IoU between the remaining prediction boxes and the selected prediction box, and remove the prediction boxes that exceed a specific threshold. If the IoU is greater than the threshold, it is a positive class, indicating that it contains a face; if the IoU is less than the threshold, it is a negative class, indicating that it contains a background, ensuring that each detected face has a most accurate bounding box. S105, each detected face is marked with a bounding box, the position and size of the bounding box are predicted and adjusted by the network to accurately match the actual position and size of the face, and then the detected bounding box is used to crop the face area from the original image; S106, for each video frame, repeat S101-S105, and save the face image detected in each frame, and the face detected in each frame will constitute the final output of the frame, until all frames of the video are processed; finally, each video clip obtains a continuous image, and the facial frame sequence is a four-dimensional tensor; The initial feature points of the acquired facial frame are calculated using the Python dlib library, and the facial frame image and the corresponding initial feature points are passed as input to the deep alignment network. The positions of the feature points are updated at each stage of the network. After several iterations, the deep alignment network generates the final, precisely aligned facial feature points, which mark the key areas of the face.
3. The cabin comfort recognition method based on non-contact measurement of facial video according to claim 2 is characterized in that: According to step S103, the anchor box is passed to the Box conf layer, and Box conf uses a 3×3 convolution kernel to predict a confidence score for each anchor box; The confidence score is calculated by the Softmax function, which indicates the confidence of the model that the predicted box contains the target. Once the position and size of the anchor box are adjusted by the position offset, the adjusted box becomes the predicted box. The output of the Box conf layer is based on the anchor box, but the confidence score will be used to evaluate the confidence of the predicted box containing the target. If there are c categories, each predicted box will have c confidence scores, and each score corresponds to the confidence of a category. The confidence score is calculated as follows: ; in, is the raw score of the predicted box containing category c, c is the total number of categories, i is used to traverse from 1 to c, is the raw score of the predicted box containing category i; the calculated confidence scores are between 0 and 1. If the value of is close to 1, it means that the model is confident that the predicted box contains a face; otherwise, If the value of is close to 0, it means that the model believes that there is almost no possibility that the predicted box contains a face.
4. The method for cabin comfort recognition based on non-contact measurement of facial video according to claim 1, characterized in that: The specific steps of dynamic ROI selection are as follows: S201-1, preliminarily pruning the ROI region to remove regions that do not contain any valuable information; by checking the variance change of each candidate region along time t, removing regions with zero variance, wherein the regions with zero variance are represented as black rectangular regions; S201-2. Threshold value based on Katz fractal dimension KFD For further screening, the threshold Able to describe the complexity of the signal, The calculation method is as follows: ; Where L is the total length of the time series, avg is the average Euclidean distance between consecutive points in the sample, d is the Euclidean distance from the first point in the sequence to the farthest point, and n is the ratio of L to avg. After calculation, each relative Areas where the value is lower than the user-set value; S201-3, perform detrended fluctuation analysis (DFA) to determine the RGB signal area with expected correlation with the whole face signal and identify the area that may be disturbed by excessive noise or external trends; DFA calculates the Hurst index Quantify the whole face signal correlation, The value of is determined by the slope of the linear fit; if = , then the time series are uncorrelated; if < < , then there is a positive correlation in the time series; if < , then the time series is negatively correlated, and those irrelevant and negatively correlated regions are finally discarded; S201-4. Perform a final screening on the remaining regions according to energy, set a fixed number G, and select G ROI regions with the highest energy. The energy refers to the power spectrum density. Regions with high power spectrum density will provide spectrum responses with less noise. The calculation formula is as follows: ; Where PSD(f) is the power spectral density at frequency f, X(f) is the frequency domain signal after FFT, and N is the number of FFT points; It is the square of the amplitude of the frequency domain signal and represents the power at that frequency.
5. The cabin comfort recognition method based on non-contact measurement of facial video according to claim 1 is characterized in that: According to the rPPG signal, extract the time domain features: MeanNN is the arithmetic mean of all NN interval lengths, reflecting the average level of heart rate during the measurement period. The formula is as follows: ; Where Q represents the total number of heartbeat intervals recorded during the measurement period, express The length of the heartbeat interval; RR represents the respiratory rate. When the respiratory rate is higher than a certain threshold, the patient will be in an uncomfortable state. The respiratory rate is estimated by calculating in the time domain, setting the resting respiratory rate range, filtering the signal with a low-pass filter, and then using the peak detection algorithm to detect the number of peaks NOP in the respiratory signal in the entire video. The respiratory rate value is estimated according to the RR calculation formula, where TNFF represents the total number of frames of the captured video, and fs represents the frame rate of the captured video: ; HRG is the increment of heart rate, which can reflect the degree of change of heart rate when the human body is unwell. The HRG corresponding to the u-th peak point is defined as: ; in, The calculation formula is as follows: ; in, and are the signal indexes corresponding to the i-th and i+1-th peak points respectively; The Skewness coefficient is a measure of the asymmetry of statistical data distribution, reflecting the skewness direction and degree of data distribution. In HRV analysis, the Skewness coefficient can reflect the shape and distribution characteristics of the heartbeat signal. The scipy.stats.skew function in Python is used to calculate the Skewness feature. The calculation formula is as follows: ; Among them, R is the number of data, It is data one by one. is the data mean, is the standard deviation; ApEn is the approximate entropy, which is used to quantify the regularity and unpredictability of fluctuations in time series data. It uses a non-negative number to represent the complexity of a time series, reflecting the possibility of new information in the time series. The more complex the time series, the greater the corresponding approximate entropy. DFA is used to measure the long-range correlation of time series and can quantitatively analyze the correlation properties of signal sequences. DFA calculates the correlation index quantify the long-range correlation; if = , the time series is similar to white noise and has no long-range correlation; if < < , the time series shows a positive long-range correlation, indicating that the trend is persistent; if < , the time series shows a negative long-range correlation, indicating a reversal of trend; Sample is sample entropy, which measures the complexity of the time series by measuring the probability of generating new patterns in the signal. The greater the probability of generating new patterns, the greater the complexity of the sequence; According to the rPPG signal, frequency domain features are extracted: Very low frequency power VLF is the component of the heart rate power spectrum in the extremely low frequency range in HRV analysis. The calculation formula is as follows: ; Total_Power is the total power density spectrum, which means the sum of the power spectrum density PSD of all frequency components within a certain frequency range, and can reflect the total amplitude of all periodic fluctuations during the heartbeat; is the minimum frequency limit, is the maximum frequency limit, calculated as follows: ; main_freq_component is the largest frequency point in the power spectrum density curve, which can understand the frequency range of the dominant heart rate variability and reflect the main regulatory mechanism of cardiac activity.
6. The cabin comfort recognition method based on non-contact measurement of facial video according to claim 1 is characterized in that: According to step S300, key frames are selected from the facial image sequence by using the frame difference method, and the steps are as follows: S301-1, grayscale a series of facial image frames, select the first frame in the sequence as the initial reference frame, calculate the pixel difference between the current frame and the previous frame, and directly subtract the pixel values; S301-2, calculating the difference sum of the difference images to evaluate the degree of change between the two frames, setting a threshold, and confirming the frame as a key frame when the difference between the frames exceeds the threshold; S301-3. Sort all selected key frames according to the degree of difference, and select the key frames with the largest difference. The frame is the final saved frame, and the saved key frame is the original color frame. A sequence of video key frames; The extracted key frame sequence is input into the spatiotemporal attention mechanism network to enhance facial feature extraction by capturing global and local spatiotemporal information; the spatiotemporal attention mechanism network includes the STA mechanism, which can extract attention vectors with global and local spatiotemporal information, and adds an attention vector fusion strategy to the STA mechanism to combine the spatial and temporal attention vectors to generate a new vector; finally, 1024 facial feature vectors are extracted by stacking ResNet-style STA modules; the steps of changing the output feature map of each layer of the spatiotemporal attention mechanism network for the image sequence are as follows: S302-1, adjust the size of each key frame image in the sequence, normalize it and pass it into two convolutional layers, each convolutional layer will obtain the corresponding feature map output; the first convolutional layer integrates the channel dimension features of the input image frame sequence, and performs preliminary feature extraction in a cross-channel manner; the second convolutional layer further extracts the spatial and temporal features of the input sequence and increases the depth of the features; S302-2, Bottleneck module contains three convolutional layers and a residual connection. The third convolutional layer is used to reduce the dimension and reduce the amount of calculation. The fourth convolutional layer extracts spatial and temporal features while maintaining the time and space dimensions. The fifth convolutional layer expands the dimension and learns deeper features; the residual connection can alleviate the gradient vanishing problem in deep networks and improve the efficiency of network training; S302-3, the STA module processes the obtained feature map through a convolution layer, a batch normalization layer and a maximum pooling layer, and then inputs it into the STA module to extract high-dimensional features. The STA module contains four residual blocks, namely, SpatialBlock, TemporalBlock, SpatiotemporalBlock and AttentionSpatiotemporalBlock. Among them, SpatialBlock focuses on extracting features in the spatial dimension, TemporalBlock focuses on extracting features in the temporal dimension, SpatiotemporalBlock is used to fuse features in the temporal and spatial dimensions, and AttentionSpatiotemporalBlock adds an attention mechanism to enable the network to focus on important features. The facial feature vector is extracted through the AttentionSpatiotemporalBlock layer.
7. The method for cabin comfort recognition based on non-contact measurement of facial video according to claim 1, characterized in that: According to step S400, the extracted physiological features and facial features are dimensionally adjusted through a fully connected layer, and then concatenated to obtain a feature vector; wherein the steps of dimension adjustment are as follows: S401-1. Use random initialization to initialize the weights of the fully connected layer; S401-2, obtaining the user's facial feature information, the facial feature information including facial expression, expression change speed, facial structure, skin color, captureable facial area, facial occlusion information, and specified facial features; wherein, through facial expression and expression change speed, users with rich expressions are identified; through facial structure and skin color, users of different races are distinguished; through captureable facial area and facial occlusion information, users with serious facial occlusion are analyzed, the facial occlusion information includes the type of occluding object and the occlusion position; through the specified facial features, users with specified facial features are identified, the specified facial features include wrinkles, spots and scars; S401-3. Design a linear function to describe the relationship between the severity of facial occlusion and the dimension of facial features. The captureable facial area is expressed as a percentage ranging from 0 to 100. The type of occluding object is represented by a binary variable, where 1 represents a fixed occluding object and 0 represents the user's own specified facial features. The facial feature dimension V is represented as the captureable facial area. and occluding object type The linear combination of is as follows: ; in, Indicates the degree of influence of the occlusion area on the facial feature dimension, It indicates the influence of the type of occluded object on the facial feature dimension, and b is the bias term; S401-4, collecting a facial occlusion dataset including facial images and corresponding facial occlusion information, wherein the facial occlusion dataset includes a plurality of samples and annotation information of an occlusion area and an occlusion object type of each sample; S401-5, preprocessing the facial occlusion data set, the preprocessing including image normalization and encoding of occlusion information to ensure uniformity of data format and correctness of labels; S401-6, using a convolutional neural network to extract features from the facial image of each sample to obtain facial feature representation; S401-7. Use a convolutional neural network for training, take facial feature representation as input features, occlusion area and occlusion object type as target labels, and use an existing data set to train the convolutional neural network; the input layer of the convolutional neural network is used to receive facial features; the convolutional layer of the convolutional neural network performs a convolution operation on the input facial features to extract features; the activation function layer of the convolutional neural network applies a nonlinear activation function ReLU to increase the nonlinear fitting ability of the network; the pooling layer of the convolutional neural network performs a pooling operation on the feature map to reduce the dimension of the feature map; the fully connected layer of the convolutional neural network maps the features output by the pooling layer to the target label space; Define the loss function to measure the difference between the model prediction result and the true label. Choose the mean square error as the loss function. Its expression is as follows: ; in, is the number of samples of the convolutional neural network, It is The true labels of samples are used to reflect the true occlusion area and the type of occluded objects. It is The predicted labels of samples; Use the gradient descent optimization algorithm to update the parameters in the convolutional neural network by minimizing the loss function; use the back propagation algorithm to calculate the gradient of the loss function for each parameter, and use the gradient to update the parameters; finally, after several rounds of training, a trained convolutional neural network model is obtained, including the weight parameters. , and bias term b; S401-8. Using another test data set to evaluate the trained linear combination, and evaluating the performance of the linear combination in predicting facial feature dimensions; S401-9. According to the evaluation results, the linear combination is tuned, and the trained linear combination is used in practical applications to infer the relationship between the severity of facial occlusion and the dimension of facial features; S401-10, establishing the influence between the severity of facial occlusion, the richness of expression and information of different races and the facial feature dimension; the higher the severity of facial occlusion, the lower the facial feature dimension; the higher the richness of expression, the lower the facial feature dimension; further adjusting the facial feature dimension according to the expression habits of different races; obtaining the facial feature dimension; S401-11, according to the facial feature dimension, adjusting the physiological feature dimension to a dimension matching the facial feature vector; The dimensionally adjusted physiological feature vector and facial feature vector are concatenated using torch.cat to obtain the final feature vector.
8. The method for cabin comfort recognition based on non-contact measurement of facial video according to claim 1, characterized in that: According to step S500, the output classifier uses a fully connected layer to construct a forward structure, which includes two linear layers and a ReLU activation function; the input dimension of the first linear layer is A, and the output dimension is B; the input dimension of the second linear layer is B, and the output dimension is C. The sigmoid activation function is used to map the output Output to the range of (0, 1), and the calculation is as follows: ; Among them, CP is the comfort probability predicted by the model, and the threshold is set to CP'. When CP > CP', it is judged as comfortable; otherwise, it is judged as uncomfortable.
9. A cabin comfort recognition system based on non-contact measurement of facial video, using the cabin comfort recognition method based on non-contact measurement of facial video according to any one of claims 1 to 8, characterized in that: include: Facial frame sequence extraction module: extracts facial frame sequences, inputs the collected facial video, and obtains facial frame sequences through a lightweight face detection network. The lightweight face detection network uses MobileNet and SSD networks to jointly construct a network architecture. rPPG signal feature extraction module: extract rPPG signal features, extract the acquired facial frame sequence into rPPG signal through modular technology, and then perform time series analysis and frequency conversion calculation to obtain several rPPG signal features; The facial frame sequence containing facial feature points is processed by modular technology to obtain rPPG signals. The rPPG modular extraction includes normalized segmentation, dynamic ROI selection and RGB mapping. The normalized segmentation expands the landmark point set by interpolation, creates a fixed face mesh composed of a plurality of triangles, and fixes the coordinates of the fixed face mesh to a typical front face; maps each triangle in the detected face to a corresponding triangle in the standardized shape, normalizes the face on each frame, and generates a normalized face spatiotemporal matrix; The dynamic ROI selection divides the normalized face into a matrix consisting of several rectangular areas, where the rectangular area is the ROI area, which contains the spatiotemporal representation of the face, and each area represents a signal in the frame sequence; then the statistical parameters of each local and global area are calculated, and through parameter calculation and analysis, the area that does not contain valuable information is eliminated, and the effective ROI area is dynamically selected; The RGB mapping obtains a plurality of effective ROI regions through the dynamic ROI selection, calculates the pixel average value of the ROI region to obtain an RGB signal, and adds the RGB signal of each selected region in the time domain to obtain a final RGB signal; An orthogonal matrix is constructed by using QR decomposition, wherein the orthogonal matrix contains linearly uncorrelated components to restore the rPPG physiological signal, and finally an rPPG signal with a high signal-to-noise ratio is obtained by filtering; The obtained high signal-to-noise ratio rPPG signal is calculated, and ten features including MeanNN, RR, HRG, Skewness, ApEn, DFA, Sample, VLF, Total_Power, and main_freq_component are extracted in the time domain and frequency domain; Among them, MeanNN is the arithmetic mean of all NN interval lengths, RR represents the respiratory rate, HRG is the increment degree of heart rate, Skewness is the skewness coefficient, a measure of the asymmetry of the statistical data distribution, ApEn is the approximate entropy, which is used to quantify the regularity and unpredictability of the fluctuations of time series data, DFA is used to measure the long-range correlation of time series, Sample is the sample entropy, VLF is the component of the heart rate power spectrum in the very low frequency range in HRV analysis, Total_Power is the total power density spectrum, and main_freq_component is the maximum frequency point in the power spectrum density curve; Facial feature extraction module: extracts facial features, inputs the extracted facial key frame sequence into the spatiotemporal attention mechanism network, and extracts several facial features; Feature fusion module: performs feature fusion, adjusts the dimensions of the extracted physiological features and facial features through the fully connected layer, and then concatenates them to obtain the feature vector; Comfort level recognition module: Comfort level recognition is performed through a neural network classifier containing a linear layer.
