Psychological anxiety prediction method and system based on face video analysis
Through facial video analysis technology, heart rate-related features are extracted and an adaptive improvement algorithm model is constructed, which solves the efficiency problem of offline assessment in traditional psychological anxiety diagnosis and achieves timely identification and assessment of remote psychological anxiety diseases.
Patent Information
- Application Number
- CN202410715514.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-10-01
AI Technical Summary
Traditional diagnosis and assessment of psychological anxiety-related diseases require offline psychological clinics, making it difficult for patients to obtain timely diagnosis and treatment, and to identify and contain mental illnesses in a timely manner.
A method based on facial video analysis is used to collect facial video data, extract rPPG signals, perform noise reduction processing and extract heart rate-related features, and combine it with psychological anxiety assessment tools to build an adaptive improvement algorithm model to achieve prediction of psychological anxiety.
It realizes remote psychological anxiety data collection and prediction, improves the efficiency of timely identification and assessment of psychological anxiety diseases, and provides a faster diagnosis method.
Smart Images

Figure CN118717119A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of mental illness detection, and more specifically, to a method and system for predicting mental anxiety based on facial video analysis. Background Art
[0002] Traditionally, the diagnosis and assessment of psychological anxiety-related diseases are usually conducted by psychologists in offline psychological clinics. For more and more patients, this method usually requires them to queue up to get treatment from psychologists, which leads to the problem that psychological anxiety-related diseases cannot be diagnosed in a timely manner. Therefore, in mental health management and psychological anxiety intervention, products that can easily and accurately identify the psychological anxiety of the subjects and give assessment results can detect and curb mental illness earlier. Summary of the invention
[0003] The main purpose of this application is to provide a method and system for predicting psychological anxiety based on facial video analysis, so as to realize the recognition and prediction of psychological anxiety of subjects.
[0004] In order to achieve the above object, the present application provides: a method for predicting psychological anxiety based on facial video analysis, the method comprising:
[0005] Collect facial video data;
[0006] Extract rPPG signals from facial video data;
[0007] De-noise the rPPG signal and extract multiple features to describe heart rate related indicators;
[0008] The subjects were assessed for anxiety symptom levels using a psychological anxiety assessment tool and the anxiety categories were marked;
[0009] Constructing an anxiety prediction model based on the plurality of characteristics, anxiety symptom levels and anxiety categories, wherein the anxiety prediction model uses an adaptive boosting algorithm model;
[0010] Deploy and maintain the anxiety prediction model into the application system.
[0011] Further, the method for extracting rPPG signals from facial video data specifically includes:
[0012] Detecting each video frame of the facial video to obtain a facial rectangle and segment a facial region of interest;
[0013] Identify color variations in the skin in each facial region of interest;
[0014] The color model is applied to calculate the color channels of the varying skin color pixels, and the rPPG signal is constructed by the average value of the color channels.
[0015] Furthermore, the method of performing noise reduction processing on the rPPG signal and extracting multiple features for describing heart rate related indicators specifically includes:
[0016] Applying a baseline elimination algorithm eliminates or suppresses the sharp drop or rise trend of the original rPPG signal pulse;
[0017] Apply the spike smoothing algorithm to eliminate the sharp drop spike noise;
[0018] A five-point cubic smoothing algorithm was applied to remove high-frequency random noise and obtain the denoised rPPG signal;
[0019] Extracting at least time domain features, frequency domain features and time-frequency domain features from the denoised rPPG signal;
[0020] A plurality of parameters related to heart rate variability are extracted from the time domain features, the frequency domain features and the time-frequency domain features as the plurality of the features.
[0021] Furthermore, the method of using the psychological anxiety assessment tool to assess the anxiety symptom level of the subject and label the anxiety category specifically includes:
[0022] The psychological anxiety level data of the subjects were collected through the psychological anxiety assessment tool;
[0023] Processing missing values and outliers on the anxiety level data;
[0024] According to the content design of the psychological anxiety assessment tool and routine practice combined with the processed anxiety level data, the subjects' anxiety symptom levels and anxiety categories were divided.
[0025] Furthermore, the anxiety prediction model is constructed based on the plurality of the features, anxiety symptom levels and anxiety categories, and the anxiety prediction model uses an adaptive boosting algorithm model, specifically including:
[0026] Dividing the plurality of characteristics, anxiety symptom levels and anxiety category data into a training set and a test set;
[0027] Adaptive boosting algorithm is used to train the training set data and output the anxiety prediction model;
[0028] Using the test set data to perform performance evaluation and parameter tuning on the anxiety prediction model;
[0029] Output the tuned anxiety prediction model.
[0030] Furthermore, the method of selecting an adaptive boosting algorithm to train the training set data and output an anxiety prediction model specifically includes:
[0031] Given a training sample set D = {(x1, y1), (x2, y2) ... (xn, yn), y∈{0,1}, where the y label value corresponds to two categories of positive samples ("0") and other samples ("1") of emotional state;
[0032] Given each training sample set D, initialize the weights
[0033] Calculate the training bias of the base classifier
[0034] The loop iterates T times and updates the weight of each training sample:
[0035]
[0036] Among them, Z t is the standardization factor, h t is the basic classifier;
[0037] The strong classifier H is represented by multiple basic classifiers with weights and trained, where H is
[0038] Furthermore, the method for deploying and maintaining the anxiety prediction model in the application system specifically includes:
[0039] Create an API service to load the model and receive requests and return model recognition results;
[0040] Deploy API services into application systems;
[0041] Monitor the running status of the API service and update the model regularly.
[0042] This embodiment further discloses a psychological anxiety prediction system based on facial video analysis, including:
[0043] A data acquisition module, used for collecting facial video data;
[0044] An rPPG signal extraction module, used to extract rPPG signals from facial video data;
[0045] A feature extraction module is used to perform noise reduction on the rPPG signal and extract multiple features for describing heart rate related indicators;
[0046] A data annotation module is used to evaluate the anxiety symptom level of the subjects using a psychological anxiety assessment tool and annotate the anxiety category;
[0047] A model training and evaluation module, for constructing an anxiety prediction model based on a plurality of the features, anxiety symptom levels and anxiety categories, wherein the anxiety prediction model uses an adaptive boosting algorithm model;
[0048] The model deployment module is used to deploy and maintain the anxiety prediction model into the application system.
[0049] This embodiment further discloses a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program implements the above method when executed by a processor.
[0050] This embodiment further discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-described method when executing the program.
[0051] Compared with the prior art, the method and system for predicting psychological anxiety based on facial video analysis provided by the present invention have the following beneficial effects: using facial video data as basic data for predicting psychological anxiety can meet the needs of remote basic data collection, and data collection is more convenient and quick. At the same time, by adaptively improving the algorithm model training based on the psychological anxiety levels of multiple respondents and the corresponding multiple features collected, after the anxiety prediction model is remotely deployed, it is possible to accurately identify psychological anxiety-related diseases of the subjects through the facial video signals collected remotely. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The drawings constituting a part of this application are used to provide a further understanding of this application, so that other features, purposes and advantages of this application become more obvious. The schematic embodiment drawings and their descriptions of this application are used to explain this application and do not constitute an improper limitation on this application. In the drawings:
[0053] Figure 1 Schematic diagram of the process of the psychological anxiety prediction method based on facial video analysis in this embodiment;
[0054] Figure 2 Schematic diagram of the system structure of psychological anxiety prediction based on facial video analysis in this embodiment;
[0055] Figure 3 Schematic diagram of the test results of the anxiety prediction model for each anxiety level in this embodiment;
[0056] Figure 4 Schematic diagram of working characteristics of subjects in multiple different models in this embodiment. DETAILED DESCRIPTION
[0057] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0058] It should be noted that the terms "first", "second", etc. in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0059] In the present application, the terms "upper", "lower", "left", "right", "front", "back", "top", "bottom", "inner", "outer", "middle", "vertical", "horizontal", "lateral", "longitudinal" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the drawings. These terms are mainly used to better describe the present application and its embodiments, and are not used to limit the indicated devices, elements or components to have a specific orientation, or to be constructed and operated in a specific orientation.
[0060] In addition, some of the above terms may be used to express other meanings in addition to indicating orientation or positional relationship. For example, the term "on" may also be used to express a certain dependency or connection relationship in some cases. For those of ordinary skill in the art, the specific meanings of these terms in this application can be understood according to specific circumstances.
[0061] In addition, the term "plurality" shall mean two or more.
[0062] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0063] As the proportion of contemporary people suffering from psychological anxiety-related diseases is increasing, timely identification and response to psychological anxiety is the key to protecting individual mental health. How to identify and accurately quantify and predict the level of psychological anxiety as early as possible has become an important prerequisite for effectively solving the above problems. In recent years, the research on heart rate variability analysis methods in the field of diagnosis of psychological anxiety-related diseases has developed rapidly. When in a state of psychological anxiety, the autonomic nervous system is different from that of ordinary people. More and more studies have shown that heart rate variability analysis can help determine the probability of an anxious state. Therefore, based on the characteristic data of heart rate variability, a psychological anxiety prediction method and system based on facial video analysis is proposed.
[0064] Specifically, this method uses video analysis, signal extraction and other technologies, combined with the subject's own psychological anxiety category information and heart rate variability characteristic data, to build a machine learning prediction model, train and evaluate it, and deploy it to the terminal device or cloud platform.
[0065] refer to Figure 1 This embodiment discloses a method for predicting psychological anxiety based on facial video analysis, the method comprising:
[0066] S100: Collect facial video data.
[0067] The facial video data is the facial video of the subjects who have the basic knowledge of color recognition. The facial video is collected by camera, specifically RGB facial video. To ensure the availability of the video, when shooting the facial video, the light in the collection environment must be uniform and bright enough to ensure the good quality of light reflected from the skin surface. At the same time, the pixel resolution of the camera must be as high as possible to ensure that a clear facial image is obtained. The collection position and angle of the camera must be at an appropriate distance from the subject's face and kept perpendicular to the face. The subject must maintain a relatively static posture to improve the stability of video collection. In addition, the length of the collected video should preferably be more than 15 seconds to obtain sufficient data for subsequent signal processing and analysis.
[0068] S200: extracting rPPG signals from facial video data.
[0069] The rPPG signal refers to remote photoelectric pulse wave recording, which reflects the changes in blood volume in tiny blood vessels on the surface of the skin during the heartbeat. It is extracted by analyzing facial video data and obtaining color changes of the facial skin.
[0070] For the extraction of rPPG signals, face detection and tracking in facial video data are crucial, while head motion and background noise can significantly affect the performance of rPPG signal pulse waves. Therefore, a face detector is used to assist in extraction.
[0071] Specific:
[0072] S210: Detect the video frame of each facial video to obtain a facial rectangle and segment the facial interest region;
[0073] S220: Identify skin color changes in each facial region of interest.
[0074] In this embodiment, the OpenCV Viola-Jones face detector is used to detect the face rectangle of each video frame and segment the facial interest region. Exemplarily, the interest region may be the forehead region, the nose region, the cheek region, etc., and then the skin color change of each interest region is identified.
[0075] S230: Apply the color model to calculate the color channels of the changed skin color pixels, and construct the rPPG signal through the average value of the color channels.
[0076] After obtaining the skin color change, the extraction of the rPPG signal pulse wave is mainly achieved by applying the color model. Commonly used color models include RGB, HSI, YCbCr, etc. For the HSI model, only the H channel can be used for signal pulse extraction, and the YCbCr model consists of brightness (Y) and two chrominance components (Cb, Cr). YCbCr produces better results in detecting heart rate than the motion-restricted HSI, and the color channel of the RGB color model can give the strongest signal-to-noise ratio SNR. Therefore, the RGB color model is selected in this embodiment, and the rPPG signal is constructed by calculating the average value of the color channel of the pixels in the detected facial interest area rectangle.
[0077] S300: performing noise reduction processing on the rPPG signal, and extracting a plurality of features for describing heart rate related indicators therefrom.
[0078] When constructing rPPG signals, even if the facial area is accurately tracked, the average intensity in the facial area may suddenly drop or rise due to subtle changes in facial expressions or movements of the subject during the acquisition process, resulting in more noise in the RPPG signal pulse wave. Therefore, the baseline elimination algorithm, spike smoothing algorithm and five-point cubic smoothing algorithm are used to optimize and adjust the original RPPG signal. Specifically:
[0079] S310: Applying a baseline elimination algorithm to eliminate or suppress the sharp drop or rise trend of the original rPPG signal pulse.
[0080] First, the original rPPG signal pulse is cut into multiple M-point non-overlapping segments and the average value of each segment is calculated. Then, the average value of each segment is set equal to the average value of the entire original pulse to eliminate the trend of the signal, and the signal sampling rate is used as the value of the segment length M.
[0081] S320: Apply a peak smoothing algorithm to eliminate the sharp drop peak noise.
[0082] The signal after baseline elimination is close to the ideal pulse signal, but the above-mentioned spike noise will exist. The processing process of the spike smoothing algorithm is to first cut the original rPPG signal pulse into multiple M-point non-overlapping segments and calculate the standard deviation of each segment. If the standard deviation of a segment exceeds twice the overall standard deviation, the corresponding segment is considered to be a high-noise segment and a compression method is used to smooth the segment. The algorithm formula is as follows:
[0083] where CR is the compression ratio for smoothing the noise segment, sd i is the standard deviation of the noise segment, and sd is the overall standard deviation of the pulse signal. Obviously, the calculated CR increases with sd i All pulse wave values in the noise segment are multiplied by (1-CR) to achieve spike smoothing.
[0084] S330: Apply a five-point cubic smoothing algorithm to remove high-frequency random noise and obtain a noise-reduced rPPG signal.
[0085] In order to keep the curve characteristics of the original rPPG signal pulse unchanged, a cubic polynomial is used to fit the experimental data through a five-point cubic smoothing algorithm:
[0086] Y(t)=a0+a1t+a2t 2 +a3t 3 (2)
[0087] Then calculate the unknown coefficients in the equation. By defining the least squares formula:
[0088]
[0089] Make φ(a0,a1,a2,a3) minimum and calculate a k Taking the partial derivative of (a0,a1,a2,a3) and setting it equal to zero, we get the equation
[0090]
[0091] Undetermined coefficient a k (a0, a1, a2, a3) is calculated by formula (4), and a k Substituting (a0, a1, a2, a3) into formula (2) yields the five-point cubic smoothing formula:
[0092]
[0093] S340: extracting at least time domain features, frequency domain features, and time-frequency domain features from the denoised rPPG signal.
[0094] Among them, time domain features are features extracted directly from the time series of the signal, which can describe the basic statistical characteristics and morphological characteristics of the signal, including the mean, variance, standard deviation, kurtosis, skewness, etc. of the signal. Frequency domain features are features obtained by performing spectrum analysis methods such as Fourier transform or wavelet transform on the signal, which can describe the frequency components and spectrum distribution characteristics of the signal, including the spectrum energy, spectrum mean, spectrum peak, etc. of the signal. Time-frequency domain features are features obtained by comprehensively considering the time domain and frequency domain information of the signal. For example, methods such as short-time Fourier transform (STFT) and wavelet transform can obtain time-frequency domain features, including time-spectrum spectrum, instantaneous frequency, etc.
[0095] S350: Extracting a plurality of parameters related to heart rate variability from the time domain features, the frequency domain features, and the time-frequency domain features as the plurality of features.
[0096] In this embodiment, 25 parameter features related to heart rate variability are finally extracted.
[0097] Specific:
[0098] SDNN: standard deviation of RR interval, standard deviation of heartbeat interval;
[0099] RMSSD: the root mean square of the sum of squares of the differences between adjacent normal heart beat intervals;
[0100] LF: The amplitude of the normal heartbeat interval in the low frequency range (0.04-0.15hz);
[0101] HF: The amplitude of normal heartbeat intervals in the high frequency range (0.15-40 Hz);
[0102] LF / HF: low-high frequency power ratio; sdsd: standard deviation of adjacent RR differences;
[0103] hf_nu: normalized high frequency power; lf_nu: normalized low frequency power;
[0104] nn: normal heartbeat interval, RR interval;
[0105] cvnni: coefficient of variation, standard deviation of the series data of heart beat-to-beat variability;
[0106] nn20: the number of adjacent RR interval differences > 20 ms;
[0107] nn50: the number of adjacent RR interval differences > 50 ms;
[0108] pnn20: the percentage of NN20 in the total heart rate;
[0109] pnn50: the percentage of NN50 in the total heart rate;
[0110] cvcd: coefficient of variation of consecutive differences;
[0111] sd1: standard deviation of the projection of the Poincare map onto the line perpendicular to the line of the equation;
[0112] sd2: standard deviation of the Poincare projection;
[0113] SDNNindex: the average of the standard deviations of all RR intervals;
[0114] Hrvindex: the total number of RR intervals divided by the height of the RR interval;
[0115] Max_min: the difference between the maximum and minimum values of all RR intervals;
[0116] MEAN: mean value of RR interval;
[0117] totalpower: total power spectral density;
[0118] VLF: Very low frequency power, range 0.04~0.15Hz;
[0119] HFn: normalization of high frequency capability;
[0120] LFn: The proportion of low-frequency power in the total power spectrum.
[0121] S400: Use the psychological anxiety assessment tool to assess the anxiety symptom level of the subjects and label the anxiety category.
[0122] Specific:
[0123] S410: Collect the psychological anxiety level data of the subjects through the psychological anxiety assessment tool.
[0124] Exemplarily, using a standard psychological anxiety assessment tool, the Hamilton Anxiety Rating Scale, the Beck Anxiety Self-Rating Scale, the Social Anxiety Disorder Scale, etc. can be selected to assess the subject's psychological anxiety level and mark the anxiety category. The Anxiety Symptom Self-Rating Scale is a commonly used psychological assessment tool used to assess whether an individual has anxiety symptoms and the severity of the symptoms. Data annotation is the process of marking the subject's self-rating scale score as the corresponding anxiety symptom level. First, collect the anxiety symptom self-rating scale data filled in by the subject. It usually includes the subject's personal information (such as age, gender, place of residence, occupation, income level, etc.) and the score of each question.
[0125] S420: Process the anxiety level data for missing values and outliers.
[0126] In the process of anxiety status labeling, missing values, outliers, etc. can be handled by filling missing values, removing outliers, etc. to ensure the quality of the data.
[0127] S430: Based on the content design of the psychological anxiety assessment tool and routine practice combined with the processed anxiety level data, the subjects' anxiety symptom levels and anxiety categories are divided.
[0128] After obtaining the data from the symptom self-assessment scale, the scores were divided into different anxiety symptom levels according to the design of the self-assessment scale and routine practice. For example, subjects with a total score of 0-4 points were divided into no anxiety, mild anxiety, moderate anxiety, and severe anxiety levels. Finally, the data from the self-assessment scale were annotated. Finally, the scores of each subject were marked as the corresponding anxiety symptom level, no anxiety (0 points), mild anxiety (5-9 points), moderate anxiety (10-14 points), and severe anxiety (15 points and above).
[0129] S500: constructing an anxiety prediction model according to the plurality of features, anxiety symptom levels and anxiety categories, wherein the anxiety prediction model uses an adaptive boosting algorithm (AdaBoost algorithm) model.
[0130] The adaptive boosting algorithm model combines multiple weak classifiers to form a strong classifier, thereby improving the robustness of the model. At the same time, it can adaptively adjust the sample weights so that more attention is paid to misclassified samples during training, thereby improving the performance of the model on these samples.
[0131] refer to Figure 3 , specifically:
[0132] S510: Divide the plurality of features, anxiety symptom levels, and anxiety category data into a training set and a test set.
[0133] The training set and test set data include the multiple rPPG features extracted in step S350, the anxiety symptom level and anxiety category in step S430, and the sklearn algorithm package train_test_split method is used to divide the above data into training set and test set, and the test_size value is 0.2.
[0134] S520: Select an adaptive boosting algorithm to train the training set data and output an anxiety prediction model;
[0135] S530: Using the test set data to perform performance evaluation and parameter tuning on the anxiety prediction model;
[0136] S540: Output the optimized anxiety prediction model.
[0137] In this embodiment, the adaptive boosting algorithm is used to train the training set data samples and output the anxiety prediction model. The adaptive boosting algorithm training process is as follows:
[0138] Given a training sample set D = {(x1, y1), (x2, y2) ... (xn, yn), y∈{0,1}, where the y label value corresponds to two categories of positive samples ("0") and other samples ("1") of emotional state, the weight corresponding to each data sample is equal at the beginning, that is, And train according to the given randomly divided data samples (the training set and the test set account for 80% and 20% of the total samples respectively), and train a weak classifier h1. For the samples that are misclassified by h1, the weight is appropriately increased, and the weight of the samples that are not misclassified is appropriately reduced, so as to update the distribution of the training set samples. Under the new sample distribution, the basic learning classifier is trained again to obtain h2. Repeat it T times to obtain T weak classifiers. The final integrated classifier is the weighted vote of each basic classifier. For this embodiment, SVM is selected as the basic classifier. Specifically:
[0139] Given each training sample set D, initialize the weights
[0140] Calculate the training bias of the base classifier
[0141] The loop iterates T times and updates the weight of each training sample:
[0142]
[0143] Among them, Z t is the standardization factor, h t is the basic classifier;
[0144] The strong classifier H is represented by multiple basic classifiers with weights and trained, where H is
[0145] refer to Figure 3For the evaluation of the anxiety prediction model, the confusion matrix is used to display the prediction effect of the model for different categories. Furthermore, 200 test set data samples are randomly selected, and the confusion matrix result diagram of the predicted category and the actual category is generated using the sklearn.metrics module. The prediction level status (no anxiety "0", mild anxiety "1", moderate anxiety "2", severe anxiety "3") corresponds to the confusion matrix. The confusion matrix can clearly show the prediction effect of the model for different categories, which helps to better understand the weaknesses and strengths of the model. The row represents the actual test data volume of the label of this category, and the corresponding value of each column of the row is the test data volume predicted to the label class of this column. It can be seen that the prediction accuracy of no anxiety, mild anxiety, moderate anxiety, and severe anxiety categories is 0.946 (53 / 56), 0.916 (44 / 48), 0.913 (42 / 46), and 0.96 (48 / 50), respectively, and the overall prediction accuracy of the model is 0.935 (187 / 200).
[0146] Through statistical analysis and correlation measurement of the above test data, it was found that when anxiety occurs, the heart rate variability index is reflected in the decrease of SDNN and RMSSD as anxiety increases, reflecting the decrease of short-term changes in heart rate variability. LF increases when anxiety occurs, HF decreases, and the LF / HF ratio increases, reflecting the decrease of parasympathetic nerve activity. HF_nu decreases, while LF_nu, SDSD, NN, CVNNi, NN20, and NN50 increase. SDNNindex and HRVindex decrease, reflecting the overall decrease of heart rate variability.
[0147] refer to Figure 4 , is a schematic diagram of the working characteristics of the subjects when multiple different models are used in this embodiment. To further illustrate the rationality of model selection, AdaBoost, Gaussian Process, Naive Bayes, NearestNeighbors models are selected for experiments. For multi-category classification problems, a one-vs-rest strategy is used to calculate the multi-category AUC (Area Under the Curve), and the value range is [0,1]. The closer the value is to 1, the better the model's ability to distinguish different categories is. The closer the value is to 0.5, the closer the model's classification performance is to random. The closer the value is to 0, the poorer the model's classification performance is. The details of the initial setting of the model parameters are as follows:
[0148] AdaBoost(n_estimators=50, learning_rate=1.0, algorithm='SAMME.R');
[0149] Gaussian Process(optimizer='fmin_l_bfgs_b',n_restarts_optimizer=1,
[0150] max_iter_predict=90, warm_start=False, copy_X_train=True, n_jobs=None);
[0151] Naive Bayes(priors=None,var_smoothing=1e-09);
[0152] Nearest Neighbors(n_neighbors=5,weights='uniform',algorithm='brute',
[0153] leaf_size=30, p=2, metric='minkowski').
[0154] Figure 4 In the figure, the true positive rate (TPR) is shown on the Y axis and the false positive rate (FPR) is shown on the X axis. Therefore, the larger the area under the curve (AUC), the better. Maximizing TPR while minimizing FPR is the ideal state. It can be seen that the adaptive boosting algorithm model selected in this embodiment has better performance.
[0155] S600: Deploy the anxiety prediction model to the application system and maintain it.
[0156] Model deployment refers to embedding the trained model into an actual application system, such as a smartphone application or an online platform, for real-time monitoring and identification of the user's psychological anxiety level, and persistently storing the anxiety prediction model in step S500 to a disk. For example, the model file is anxiety_model.pkl. In addition, data security and privacy protection are considered during the deployment process to ensure that sensitive information is not leaked. Specifically:
[0157] S610: Create an API service for loading a model, receiving requests, and returning model recognition results.
[0158] For example, taking the online access platform scenario as an example, use a web framework such as Flask or FastAPI to create an API service to receive requests and return model prediction results. The following is a simple example using Flask (Python code):
[0159] from flask import Flask,request,jsonify
[0160] import joblib
[0161] app = Flask(__name__)
[0162] # Load the model
[0163] model=joblib.load('anxiety_model.pkl')
[0164] @app.route(' / predict',methods=['POST'])
[0165] def predict():
[0166] data=request.json
[0167] prediction=model.predict([data['features']])
[0168] return jsonify({'prediction':prediction.tolist()})
[0169] if __name__ == '__main__':
[0170] app.run(debug=True).
[0171] S620: Deploy the API service to the application system.
[0172] To deploy API services to a production environment, you can use a cloud platform (such as Baidu Cloud, Tencent Cloud, Alibaba Cloud, and other cloud services) or build your own server.
[0173] S630: Monitor the running status of the API service and update the model regularly.
[0174] In addition, during the deployment of the anxiety prediction model, encryption and decryption processing is also required to ensure the security and privacy of patient data.
[0175] The specific manner of executing the operation of each unit in the above embodiment has been described in detail in the embodiment of the method, and will not be elaborated here.
[0176] refer to Figure 2 This embodiment further discloses a method and system for predicting psychological anxiety based on facial video analysis, which specifically includes:
[0177] A data acquisition module 21, used for acquiring facial video data;
[0178] The rPPG signal extraction module 22 is used to extract the rPPG signal from the facial video data; and is also used to:
[0179] Detecting each video frame of the facial video to obtain a facial rectangle and segment a facial region of interest;
[0180] Identify color variations in the skin in each facial region of interest;
[0181] The color model is applied to calculate the color channels of the varying skin color pixels, and the rPPG signal is constructed by the average value of the color channels.
[0182] The feature extraction module 23 is used to perform noise reduction processing on the rPPG signal and extract multiple features for describing heart rate related indicators; and is also used to:
[0183] Applying a baseline elimination algorithm eliminates or suppresses the sharp drop or rise trend of the original rPPG signal pulse;
[0184] Apply the spike smoothing algorithm to eliminate the sharp drop spike noise;
[0185] A five-point cubic smoothing algorithm was applied to remove high-frequency random noise and obtain the denoised rPPG signal;
[0186] Extracting at least time domain features, frequency domain features and time-frequency domain features from the denoised rPPG signal;
[0187] A plurality of parameters related to heart rate variability are extracted from the time domain features, the frequency domain features and the time-frequency domain features as the plurality of the features.
[0188] The data annotation module 24 is used to evaluate the anxiety symptom level of the subject using the psychological anxiety assessment tool and to annotate the anxiety category; and is also used to:
[0189] The psychological anxiety level data of the subjects were collected through the psychological anxiety assessment tool;
[0190] Processing missing values and outliers on the anxiety level data;
[0191] According to the content design of the psychological anxiety assessment tool and routine practice combined with the processed anxiety level data, the subjects' anxiety symptom levels and anxiety categories were divided.
[0192] The model training and evaluation module 25 is used to construct an anxiety prediction model based on the plurality of features, anxiety symptom levels and anxiety categories, wherein the anxiety prediction model uses an adaptive boosting algorithm model; and is also used to:
[0193] Dividing the plurality of characteristics, anxiety symptom levels and anxiety category data into a training set and a test set;
[0194] Adaptive boosting algorithm is used to train the training set data and output the anxiety prediction model;
[0195] Using the test set data to perform performance evaluation and parameter tuning on the anxiety prediction model;
[0196] Output the tuned anxiety prediction model.
[0197] Among them, the method of using the adaptive boosting algorithm to train the training set data and output the anxiety prediction model specifically includes:
[0198] Given a training sample set D = {(x1, y1), (x2, y2) ... (xn, yn), y∈{0,1}, where the y label value corresponds to two categories of positive samples ("0") and other samples ("1") of emotional state;
[0199] Given each training sample set D, initialize the weights
[0200] Calculate the training bias of the base classifier
[0201] The loop iterates T times and updates the weight of each training sample:
[0202]
[0203] Among them, Z t is the standardization factor, h t is the basic classifier;
[0204] The strong classifier H is represented by multiple basic classifiers with weights and trained, where H is
[0205] The model deployment module 26 is used to deploy the anxiety prediction model to the application system and maintain it; it is also used to,
[0206] Create an API service to load the model and receive requests and return model recognition results;
[0207] Deploy API services into application systems;
[0208] Monitor the running status of the API service and update the model regularly.
[0209] This embodiment further provides an electronic device, the electronic device comprising: a processor, a memory, and a bus;
[0210] The processor and the memory communicate with each other via a bus; the processor is used to call program instructions in the memory to execute the methods provided by the above-mentioned method embodiments.
[0211] This embodiment provides a non-transitory computer-readable storage medium, which stores computer instructions. The computer instructions enable a computer to execute the methods provided by the above method embodiments.
[0212] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk, etc., various storage media that can store program codes.
[0213] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0214] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.
[0215] The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for predicting psychological anxiety based on facial video analysis, characterized in that: The method comprises: Collect facial video data; Extract rPPG signals from facial video data; De-noise the rPPG signal and extract multiple features to describe heart rate related indicators; The subjects were assessed for anxiety symptom levels using a psychological anxiety assessment tool and the anxiety categories were marked; Constructing an anxiety prediction model based on the plurality of characteristics, anxiety symptom levels and anxiety categories, wherein the anxiety prediction model uses an adaptive boosting algorithm model; Deploy and maintain the anxiety prediction model into the application system.
2. The method for predicting psychological anxiety based on facial video analysis according to claim 1, characterized in that: The method for extracting rPPG signals from facial video data specifically includes: Detecting each video frame of the facial video to obtain a facial rectangle and segment a facial region of interest; Identify color variations in the skin in each facial region of interest; The color model is applied to calculate the color channels of the varying skin color pixels, and the rPPG signal is constructed by the average value of the color channels.
3. The method for predicting psychological anxiety based on facial video analysis according to claim 2, characterized in that: The method of performing noise reduction processing on the rPPG signal and extracting multiple features for describing heart rate related indicators specifically includes: Applying a baseline elimination algorithm eliminates or suppresses the sharp drop or rise trend of the original rPPG signal pulse; Apply the spike smoothing algorithm to eliminate the sharp drop spike noise; A five-point cubic smoothing algorithm was applied to remove high-frequency random noise and obtain the denoised rPPG signal; Extracting at least time domain features, frequency domain features and time-frequency domain features from the denoised rPPG signal; A plurality of parameters related to heart rate variability are extracted from the time domain features, the frequency domain features and the time-frequency domain features as the plurality of the features.
4. The method for predicting psychological anxiety based on facial video analysis according to claim 1, characterized in that: The method of using the psychological anxiety assessment tool to assess the anxiety symptom level of the subjects and mark the anxiety category specifically includes: The psychological anxiety level data of the subjects were collected through the psychological anxiety assessment tool; Processing missing values and outliers on the anxiety level data; According to the content design of the psychological anxiety assessment tool and routine practice combined with the processed anxiety level data, the subjects' anxiety symptom levels and anxiety categories were divided.
5. The method for predicting psychological anxiety based on facial video analysis according to claim 1, characterized in that: The anxiety prediction model is constructed based on the plurality of characteristics, anxiety symptom levels and anxiety categories, and the anxiety prediction model uses an adaptive boosting algorithm model, specifically including: Dividing the plurality of characteristics, anxiety symptom levels and anxiety category data into a training set and a test set; Adaptive boosting algorithm is used to train the training set data and output the anxiety prediction model; Using the test set data to perform performance evaluation and parameter tuning on the anxiety prediction model; Output the tuned anxiety prediction model.
6. The method for predicting psychological anxiety based on facial video analysis according to claim 5, characterized in that: The method of selecting an adaptive boosting algorithm to train the training set data and output an anxiety prediction model specifically includes: Given a training sample set D = {(x1,y1), (x2,y2) ... (xn,yn), y∈{0,1}, where the y label value corresponds to two categories of positive samples ("0") and other samples ("1") of emotional state; Given each training sample set D, initialize the weights Calculate the training bias of the base classifier The loop iterates T times and updates the weight of each training sample: Among them, Z t is the standardization factor, h t is the basic classifier; The strong classifier H is represented by multiple basic classifiers with weights and trained, where H is 7. The method for predicting psychological anxiety based on facial video analysis according to claim 1, characterized in that: The method for deploying and maintaining the anxiety prediction model in the application system specifically includes: Create an API service to load the model and receive requests and return model recognition results; Deploy API services to application systems; Monitor the running status of the API service and update the model regularly.
8. A psychological anxiety prediction system based on facial video analysis, characterized in that: include: A data acquisition module, used for collecting facial video data; An rPPG signal extraction module, used to extract rPPG signals from facial video data; A feature extraction module is used to perform noise reduction on the rPPG signal and extract multiple features for describing heart rate related indicators; A data annotation module is used to evaluate the anxiety symptom level of the subjects using a psychological anxiety assessment tool and annotate the anxiety category; A model training and evaluation module, for constructing an anxiety prediction model based on a plurality of the features, anxiety symptom levels and anxiety categories, wherein the anxiety prediction model uses an adaptive boosting algorithm model; The model deployment module is used to deploy and maintain the anxiety prediction model into the application system.
9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Security activity scheme generation method and system based on machine learning
CN121189805A
