Emotion recognition system based on pulse signals and random forest algorithm
By designing an emotion recognition system based on pulse signals and improving random forest algorithms, the problems of expensive equipment and inconvenient operation in the prior art are solved, and a high-precision and portable emotion recognition effect is achieved.
Patent Information
- Application Number
- CN202510142590.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-10
- Publication Date
- 2025-03-11
AI Technical Summary
In the existing emotion recognition technology, the equipment is expensive and inconvenient, and the collection of a variety of physiological signals leads to inconvenient operation, which limits the application of the technology in daily life.
A emotion recognition system based on pulse signal and improved random forest algorithm is designed. Through the pulse signal acquisition node, control unit and PC terminal host computer, pulse signals are collected and denoised through discrete wavelet transformation and wavelet threshold function, feature data is extracted and emotion classification model is trained.
It realizes emotional recognition with high portability and easy operation, significantly improving the accuracy and reliability of recognition, allowing ordinary users to easily experience emotional recognition technology.
Smart Images

Figure CN119598270A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of emotion analysis, and in particular relates to an emotion recognition system based on pulse signals and a random forest algorithm. Background Art
[0002] Emotions are psychological and physiological states that accompany human consciousness and cognitive processes. They are important representations of physical and mental health. Therefore, accurately and objectively understanding, identifying and evaluating emotional changes is crucial to assessing individual physical and mental health. The key issue in the emotion recognition process is how to quickly and easily collect high-quality emotional data signals, ensure the miniaturization and portability of the collection equipment, and efficiently and accurately identify emotions after the collection is completed. Although there are currently a variety of emotional data signal collection schemes, most of the emotion recognition methods based on physiological signals require the collection of multiple physiological signals, such as electrocardiogram, skin electricity, respiration and body temperature. These methods are not only costly and bulky, but also difficult to popularize to ordinary users due to inconvenient operation, which limits the practical application of these technologies in daily life.
[0003] In the field of emotion recognition, there are self-report method, behavioral observation method and physiological measurement method. The self-report method requires the subject to describe his or her emotional state, but it is easily affected by subjective factors, and the emotional recollection of a past time segment is inaccurate. Instant reports may also interfere with the emotion itself, reducing its reliability. The behavioral observation method requires the subject to distinguish different emotional states under professional equipment and professionals, which requires a lot of energy and time, and is difficult for ordinary individuals to achieve. The physiological measurement method infers the emotional state by monitoring the physiological response of the subject. With the high integration of semiconductor technology and wearable devices, this method has gradually been widely adopted. However, in existing research work, researchers often use sensor devices to collect physiological data in emotion induction experiments, and then transfer the data to a computer or to a server via a wireless network for processing. However, wearing too many devices may interfere with the emotional state of the subject, and the stability differences between devices may cause the problem of missing data modality. For this reason, an emotion recognition system based on pulse signals and random forest algorithm is proposed. Summary of the invention
[0004] The purpose of the present invention is to provide an emotion recognition system based on pulse signals and random forest algorithm, aiming to solve the problems raised in the above background technology.
[0005] To achieve the above object, the present invention provides the following technical solutions: An emotion recognition system based on pulse signal and random forest algorithm, including a pulse signal acquisition node, a control unit and a PC host computer; The pulse signal acquisition node includes a pulse sensor and an ADC module. The pulse sensor is used to measure the pulse signal by detecting the change of microvascular blood volume in the tissue, converting the collected signal into pulse data in digital form through the ADC module, and transmitting it to the control unit; The control unit is used to receive the original pulse data from the pulse signal acquisition node, and after preliminary judgment and processing, send the data to the PC host computer through the serial port; The PC-side host computer is used to receive the pulse data from the control unit and use Processing software to display the pulse heart rate in real time. The PC-side host computer further processes the pulse data, including using discrete wavelet transform and denoising the pulse data through a wavelet threshold function, extracting features from the denoised pulse data, training an emotion classification model through an improved random forest algorithm, and analyzing and classifying the extracted feature data to complete the recognition of emotions.
[0006] Furthermore, the steps of using discrete wavelet transform and performing denoising on the pulse data through a wavelet threshold function are specifically as follows: Step 1, wavelet decomposition: select a wavelet with N levels to decompose the pulse data and obtain the wavelet coefficients of each layer; Step 2, threshold processing: threshold processing is performed on the decomposed coefficients, and the coefficients of each layer are quantized using the threshold function; the wavelet coefficients smaller than the threshold are regarded as noise and set to zero, and the wavelet coefficients larger than the threshold are regarded as signal parts and retained; Step 3: Wavelet reconstruction: Reconstruct the pulse signal using the processed wavelet coefficients.
[0007] Furthermore, the step of extracting features from the denoised pulse data is specifically as follows: Step 1: Peak and trough detection: Set up a data point window, where fs is the sampling frequency of the PPG signal, which is 20 Hz. The length of a pulse cycle is 0.75 s. Several of the data points constitute a length of L The sequence of time domain ; set up S L / 2 As the starting point, set the initial window at the starting point, and gradually move the window to the end of the signal. After each move, use the binary search method to search for the maximum value in the window. For each peak point found, verify whether it meets the conditions of formulas 1 to 3. If it does, use formula 4 to update the window position and search process. Formula 1: ; Formula 2: ; Formula 3: ; Formula 4: ; in, H is the threshold with an initial value of 0.9; is a point in the range of (0.1,0.2), which is a peak of S; is the amplitude of the peak point in the current window, ; If the conditions of equations 1 to 3 are not met, the window is continuously moved to the right to form a new window with the first point as the interval. ,by As a new starting point, the search process is repeated until all peaks of the entire PPG signal are found; After finding the peak point, search for the trough point, which is the first minimum point on the left side of the peak point; Step 2: Pulse feature extraction: Assume that the PP interval sequence of a band is , is the number of elements in the sequence, For the time series i elements; let the peak voltage value sequence of this band be , N is the number of elements in the sequence, For the sequence i The voltage value of each peak; extract the following ten PPG signal time domain features: MEAN , SDNN , RMSSD , H_R , SDSD , V_Mean , V_Max , V_Min , V_Middle and V_ SDNN , respectively represent the mean value of PP interval, the standard deviation of PP interval, the root mean square of adjacent PP intervals, the average heart rate of the band, the standard deviation of the difference between adjacent PP intervals, the mean value of the voltage sequence, the maximum value of the voltage sequence, the minimum value of the voltage sequence, the median value of the voltage sequence and the standard deviation of the voltage sequence; the calculation method of the time domain features of each PPG signal is as follows: ; ; ; ; ; ; ; ; ; ; in, For the i The difference between the PP intervals, It is the average value of the difference between PP intervals.
[0008] Furthermore, the steps of training the emotion classification model by improving the random forest algorithm are as follows: Step 1: Prepare data: organize the extracted pulse feature data and save it as a csv file; Step 2, load data: use software to load pulse characteristic data in csv file; Step 3: Divide the data set into training set and test set. Step 4: Train the random forest model: extract different subsample sets from the training set with replacement multiple times, build a decision tree for each subsample set, and recursively select the optimal partitioning attribute to divide the feature space during the construction of each decision tree until the stopping condition is met; integrate the prediction results of multiple decision trees to obtain the final prediction result of the random forest; Step 5: Evaluate the random forest model: Use the test set to evaluate the quality of the random forest model. Step 6: Build a gradient boosting decision tree model: Use the features selected by the random forest algorithm as input and the classification results of the random forest algorithm as output to build a gradient boosting decision tree model; Step 7: Evaluate the gradient boosted decision tree model: Use the test set to evaluate the quality of the gradient boosted decision tree model.
[0009] Furthermore, the step of selecting the optimal partition attribute is as follows: Suppose the current sample set D i The proportion of samples in the class is , the information entropy of D is defined as shown in Formula 5: Formula 5: ; Assuming discrete attributes x There are M different possible values , using the attribute Divide the sample set , generating M branch nodes, among which the first The branch nodes contain sample sets All properties in The upper value is The sample is denoted as ; When using information gain as a reference, use the attribute x The information gain calculation obtained by dividing the sample set is shown in Formula 6: Formula 6: ; in, express Information entropy; select the attribute with the largest information gain as the optimal partitioning attribute; When the Gini index is used as a reference, the attribute The calculation of the Gini index is shown in formula 7: Formula 7: ; in for The Gini value of is calculated as shown in formula 8: Formula 8: ; The attribute with the smallest Gini index is selected as the optimal partitioning attribute.
[0010] Compared with the prior art, the present invention has the following beneficial effects: The present invention proposes an emotion recognition system based on pulse signals and random forest algorithms. The system uses its portability to collect pulse signals under various emotional states in the early stage, and then analyzes and processes the pulse data through an improved random forest algorithm to train an efficient emotion classification model. The trained model can be used for high-precision emotion recognition. The present invention overcomes the shortcomings of previous emotion recognition equipment, which are expensive and non-portable, and the measurement process is convenient. The emotion recognition algorithm of the present invention has significant improvements in accuracy and reliability, allowing ordinary users to easily experience emotion recognition technology, and has broad promotion potential. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 The framework diagram of the system.
[0012] Figure 2 Flow chart of denoising pulse data.
[0013] Figure 3 It is the pulse wave feature point.
[0014] Figure 4 Flowchart for building a random forest.
[0015] Figure 5 The out-of-bag error rate of the random forest model changes with the increase in the number of decision trees; (a) is the change in the out-of-bag error rate when the calm-angry emotion classification increases with the increase in the number of decision trees, (b) is the change in the out-of-bag error rate when the calm-sad emotion classification increases with the increase in the number of decision trees, (c) is the change in the out-of-bag error rate when the calm-happy emotion classification increases with the increase in the number of decision trees, and (d) is the change in the out-of-bag error rate when the angry-happy emotion classification increases with the increase in the number of decision trees.
[0016] Figure 6Flowchart for the gradient boosted decision tree model for identifying sentiment. DETAILED DESCRIPTION
[0017] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0018] The specific implementation of the present invention is described in detail below in conjunction with specific embodiments.
[0019] like Figure 1 As shown, an emotion recognition system based on pulse signal and random forest algorithm is provided in one embodiment of the present invention, including a pulse signal acquisition node, a control unit and a PC host computer; The pulse signal acquisition node includes a Pulse Sensor and an ADC module. The Pulse Sensor performs detection based on photoplethysmography (PPG) to detect changes in microvascular blood volume in tissues and obtain PPG signals. Due to its low power consumption characteristics, the sensor is particularly suitable for wearable devices. The PulseSensor converts the collected signal into digital pulse data through the ADC module and transmits it to the control unit.
[0020] The control unit is used to receive the original pulse data from the pulse signal acquisition node, preliminarily determine whether it is a valid PPG signal in the control unit (for example, if it is found that there is no signal or only a noise signal, no data will be returned, only a control field such as "invalid data" will be returned), and after eliminating abnormal signals (such as an over-limit signal) in the control unit, the data will be sent to the PC host computer through the serial port; during the whole process, the control unit works as an intermediary for data transmission.
[0021] The PC-side host computer is the center of data reception, processing and analysis of the entire system. In terms of data reception, the PC-side host computer receives data sent by the control unit through the serial port, and uses Processing software to display the pulse heart rate in real time, which is more intuitive and effective. In terms of data processing, after the pulse data collection is completed, the PC-side host computer uses discrete wavelet transform and wavelet threshold function to denoise the pulse data, and extracts features from the denoised pulse data. In terms of data analysis, the PC-side host computer trains an emotion classification model by improving the random forest algorithm and analyzes and classifies the extracted feature data to complete the recognition of emotions.
[0022] As a preferred embodiment of the present invention, a large amount of noise is encountered in the process of obtaining the PPG signal, including baseline interference, power frequency interference, electromyographic interference, etc. Therefore, discrete wavelet transform is used and the pulse data is denoised through the wavelet threshold function. After wavelet decomposition, the wavelet coefficient of the useful signal is usually larger, while the wavelet coefficient of the noise is smaller, and the wavelet coefficient of the noise is generally smaller than the wavelet coefficient of the signal. By setting an appropriate threshold, the wavelet coefficients greater than the threshold can be regarded as the useful signal part and retained, while those less than the threshold are regarded as the noise part and set to zero to achieve the purpose of denoising. This is essentially to enhance the useful part by suppressing the useless part of the signal. Figure 2 As shown, the specific steps are as follows: Step 1, wavelet decomposition: select a wavelet with N levels to decompose the pulse data and obtain the wavelet coefficients of each layer; Step 2, threshold processing: threshold processing is performed on the decomposed coefficients, and the coefficients of each layer are quantized using the threshold function; the wavelet coefficients smaller than the threshold are regarded as noise and set to zero, and the wavelet coefficients larger than the threshold are regarded as signal parts and retained; Step 3: Wavelet reconstruction: Reconstruct the pulse signal using the processed wavelet coefficients.
[0023] As a preferred embodiment of the present invention, the step of extracting features from the denoised pulse data is specifically as follows: Step 1: Peak and trough detection: Although the PPG signal has been denoised, the changes on both sides of the peak are still very rapid and dramatic, with the left signal increasing rapidly and the right signal decreasing rapidly. The present invention combines the threshold method and the moving window method to quickly extract the extreme points of the signal. The sampling frequency of the PPG signal is fs= At 20Hz, the length of a pulse cycle is about 0.75s.
[0024] First set up a data points, which form a window of length L The sequence of time domain ; In a complete pulse cycle, S L / 2 Taking the starting point as an example, the initial window is set at the starting point, and the window is gradually moved to the end of the signal. After each movement, the maximum value is searched in the window using the binary search method. For each peak point found, verify whether it meets the conditions of formulas 1 to 3. If it does, use the adaptive method (formula 4) to update the window position and search process. Formula 1: ; Formula 2: ; Formula 3: ; Formula 4: ; in, H is the threshold with an initial value of 0.9; is a point in the range of (0.1,0.2), which is a peak of S; is the amplitude of the peak point in the current window, ; If the conditions of equations 1 to 3 are not met, the window is continuously moved to the right to form a new window with the first point as the interval. ,by As a new starting point, the search process is repeated until all peaks of the entire PPG signal are found; After finding the peak point, search for the trough point. According to the characteristics of the pulse waveform, the first minimum point on the left side of the peak value is the trough point. The time interval between the trough and the peak is about 1 / 10 of the entire pulse cycle. Similarly, the trough point can be found using a similar method.
[0025] Step 2: Pulse feature extraction: A typical pressure pulse wave contains four main feature points, such as Figure 3 As shown, point A corresponds to the beginning of the pulse, marking the beginning of ventricular ejection, point B represents the systolic half-rise, point C is the systolic peak, indicating that the intra-arterial pressure reaches the maximum value, point D is the dicrotic notch, indicating that the ventricle begins to relax, point E indicates the end of the pulse, and point F represents the systolic peak of the next pulse. The AC segment represents the stage of rapid ventricular ejection, and the CE segment represents the process from the end of ventricular ejection to the beginning of the next ejection. The time domain characteristics of the human pulse signal will change significantly when the emotions change. Existing studies have also shown that emotion analysis based on these time domain features can achieve good results. Therefore, the following ten PPG signal time domain features are selected for extraction, as shown in Table 1. Table 1 Feature list
[0026] Suppose the PP interval sequence of a band is , is the number of elements in the sequence, For the time series i elements; let the peak voltage value sequence of this band be , N is the number of elements in the sequence, For the sequence i The voltage value of the peak; extract the ten PPG signal time domain features shown in Table 1, where For the i The difference between the PP intervals, is the average value of the difference between the PP intervals.
[0027] As a preferred embodiment of the present invention, in the step of training the emotion classification model by improving the random forest algorithm: 1. Overview of Random Forest Algorithm: Random Forest Algorithm is a homogeneous ensemble learning method, commonly used for classification and regression tasks. It constructs multiple independent decision trees by extracting multiple samples with replacement from the original sample set. Each decision tree models the sample it extracts, and finally combines the results of all decision trees to obtain the final prediction. The Random Forest Algorithm has a simple structure, is easy to implement, and has a high prediction accuracy.
[0028] 2. Construction of decision trees and random forests; 1) Basic structure of decision tree: A decision tree consists of a root node, multiple internal nodes and leaf nodes. The root node contains the entire sample set, and the leaf nodes correspond to the classification results. Each internal node represents an attribute test. The process of building a decision tree is to divide the feature space and form a tree structure by summarizing a set of conditional rules for the training set of given features.
[0029] 2) Construction of random forest: Figure 4 As shown in the figure, when constructing a decision tree, firstly, some samples are randomly selected with replacement, which is to construct a subset of the training set. Each subset will be used to train a tree. Then, some feature values are extracted from the subset as candidate features, and then the optimal attribute is selected from the candidate features. After selecting the optimal attribute, a node is generated, and then it is determined whether this node can become a leaf node. If not, branching is performed and then returning to the step of randomly extracting some feature values, and repeating. If it can, it is determined whether the current tree reaches the stopping condition. If not, branching is performed and then returning to the step of randomly extracting some feature values, and repeating. If the stopping condition is reached, the decision tree can stop growing and the decision tree is stored. For each subset, we repeat the construction until the number of decision trees reaches the expected value and then generate a random forest. In order to overcome the problems of single classification rules of decision trees, easy to fall into local optimal solutions and overfitting, the ensemble learning method is adopted, that is, combining multiple decision trees with high classification accuracy, and making decisions by voting to form a random forest, thereby greatly improving its generalization ability. Random forests have been improved when selecting the optimal attribute for node splitting. When splitting a node, the traditional decision tree selects the best split attribute from the current attribute set, while the random forest randomly selects a subset of n attributes from the attribute set of the node, and then selects the best attribute from this subset for splitting. This method reduces the correlation between decision trees in the random forest, reduces overfitting, and improves the overall prediction accuracy.
[0030] 3. Combination of random forest and gradient boosted decision tree: Usually, when the sample data set is small, the interpretation and prediction ability of statistical mathematics is not much different from that of machine learning. When the sample data set is large, we pay more attention to the prediction ability, but the random forest algorithm is not sensitive to outliers, so we combine the gradient boosted decision tree to optimize and improve the random forest algorithm. The gradient boosted decision tree is a regression tree model, which belongs to the series combination form of decision trees. The output of each level of tree is used as the input of the next level of tree, and the information transmission process strictly follows the time sequence. In the random forest algorithm, each decision tree is independent and parallel, and the final result is determined by the votes of multiple trees. In order to further improve the prediction ability of the model, a method of combining the random forest algorithm and the gradient boosted decision tree is proposed. The random forest algorithm is used to select features from the data set, and the random forest model is trained for classification. Then, the features selected by the random forest algorithm are used as input, and the classification results of the random forest algorithm are used as output to construct a gradient boosted decision tree model.
[0031] The flowchart of the gradient boosting decision tree model for emotion recognition is as follows Figure 6 The specific steps are as follows: Step 1: Prepare data: organize the extracted pulse feature data and save it as a csv file; Step 2, load data: use software to load pulse characteristic data in csv file; Step 3: Divide the data set into training set and test set. Step 4: Train the random forest model: extract different subsample sets from the training set with replacement multiple times, and build a decision tree for each subsample set. During the construction process, each decision tree divides the feature space by recursively selecting the optimal partitioning attribute, and repeat until the preset tree depth or other stopping conditions are reached, such as the number of node samples is less than the set threshold; integrate the prediction results of multiple decision trees to obtain the final prediction result of the random forest; Step 5: Evaluate the random forest model: Use the test set to evaluate the quality of the random forest model. Step 6: Build a gradient boosting decision tree model: Use the features selected by the random forest algorithm as input and the classification results of the random forest algorithm as output to build and train the gradient boosting decision tree model; Step 7: Evaluate the gradient boosting decision tree model: Use the test set to evaluate the quality of the gradient boosting decision tree model. Step 8: Finally output the recognition result.
[0032] Through the above steps, an emotion classification model with high classification accuracy can be trained to achieve accurate recognition of different emotions.
[0033] In an embodiment of the present invention, for the application of random forest in emotion classification: the present invention designs and trains a binary classification random forest model to distinguish four emotions: calm, angry, sad, and happy, wherein the number of decision trees is 10, 50, 100, 200, 500, and 1000 respectively, and plots the out-of-bag error rate (OOB error rate) as a function of the number of decision trees, so as to find the optimal number of decision trees and classification accuracy. Figure 5 The variation of the out-of-bag error rate of the random forest model with the increase of the number of decision trees is shown. From this, we can get the influence of the number of decision trees on the classification effect under different classification conditions, as shown in Table 2. For the same type of model, the same number of decision trees is selected and trained multiple times, the error rate of each time is recorded, and finally the average out-of-bag accuracy is calculated.
[0034] Table 2 Model average out-of-bag accuracy Model Number of decision trees Average out-of-bag accuracy Calm - Angry 200 83.56% Calm - Sad 500 71.85% Calm - Happy 100 85.17% Angry - Happy 100 93.42% Four categories (calm, angry, sad, happy) 500 67.88% It can be seen that the model trained based on pulse signals can complete basic emotion recognition with excellent performance. In addition, the number of decision trees will affect the accuracy of prediction.
[0035] As a preferred embodiment of the present invention, the ultimate goal of decision tree construction is to generate a tree with strong generalization ability, which can effectively handle unseen examples. In the construction process, the most critical step is to select the optimal partitioning attribute, because this directly affects the generalization performance of the final decision tree. As the construction proceeds, we expect the branch nodes to contain as few sample categories as possible, which can be achieved by using "information entropy" to measure the degree of mixing of sample categories in the node. The steps of selecting the optimal partitioning attribute are as follows: Suppose the current sample set D i The proportion of samples in the class is , the information entropy of D is defined as shown in Formula 5: Formula 5: ; The smaller the value of , the fewer categories are included in the sample set D, that is, the higher the purity of D.
[0036] Assuming discrete attributes x There are M different possible values , using the attribute Divide the sample set , generating M branch nodes, among which the first The branch nodes contain sample sets All properties in The upper value is The sample is denoted as ; When using information gain as a reference, use the attributex The information gain calculation obtained by dividing the sample set is shown in Formula 6: Formula 6: ; in, express Information entropy; generally, the attribute with the largest information gain is selected as the optimal partitioning attribute; When the Gini index is used as a reference, the attribute The calculation of the Gini index is shown in formula 7: Formula 7: ; in for The Gini value of is calculated as shown in formula 8: Formula 8: ; The attribute with the smallest Gini index is selected as the optimal partitioning attribute.
[0037] The above are only preferred embodiments of the present invention. It should be pointed out that, for those skilled in the art, several modifications and improvements can be made without departing from the concept of the present invention. These should also be regarded as the protection scope of the present invention. These will not affect the effect of the implementation of the present invention and the practicality of the patent.
Claims
1. An emotion recognition system based on pulse signal and random forest algorithm, characterized in that: It includes pulse signal acquisition node, control unit and PC host computer; The pulse signal acquisition node includes a pulse sensor and an ADC module. The pulse sensor is used to measure the pulse signal by detecting the change of microvascular blood volume in the tissue, converting the collected signal into pulse data in digital form through the ADC module, and transmitting it to the control unit; The control unit is used to receive the original pulse data from the pulse signal acquisition node, and after preliminary judgment and processing, send the data to the PC host computer through the serial port; The PC-side host computer is used to receive the pulse data from the control unit and use Processing software to display the pulse heart rate in real time. The PC-side host computer further processes the pulse data, including using discrete wavelet transform and denoising the pulse data through a wavelet threshold function, extracting features from the denoised pulse data, training an emotion classification model through an improved random forest algorithm, and analyzing and classifying the extracted feature data to complete the recognition of emotions.
2. The emotion recognition system based on pulse signal and random forest algorithm according to claim 1, characterized in that: The steps of using discrete wavelet transform and wavelet threshold function to denoise the pulse data are as follows: Step 1, wavelet decomposition: select a wavelet with N levels to decompose the pulse data and obtain the wavelet coefficients of each layer; Step 2, threshold processing: threshold processing is performed on the decomposed coefficients, and the coefficients of each layer are quantized using the threshold function; The wavelet coefficients smaller than the threshold are regarded as noise and set to zero, and the wavelet coefficients larger than the threshold are regarded as signal parts and retained; Step 3: Wavelet reconstruction: Reconstruct the pulse signal using the processed wavelet coefficients.
3. The emotion recognition system based on pulse signal and random forest algorithm according to claim 1, characterized in that: The steps of extracting features from the denoised pulse data are as follows: Step 1: Peak and trough detection: Set up a data point window, where fs is the sampling frequency of the PPG signal, which is 20 Hz. The length of a pulse cycle is 0.75 s. Several of the data points constitute a length of L The sequence of time domain ; set up S L / 2 As the starting point, set the initial window at the starting point, and gradually move the window to the end of the signal. After each move, use the binary search method to search for the maximum value in the window. For each peak point found, verify whether it meets the conditions of formulas 1 to 3. If it does, use formula 4 to update the window position and search process. Formula 1: ; Formula 2: ; Formula 3: ; Formula 4: ; in, H is the threshold with an initial value of 0.9; is a point in the range of (0.1,0.2), which is a peak of S; is the amplitude of the peak point in the current window, ; If the conditions of equations 1 to 3 are not met, the window is continuously moved to the right to form a new window with the first point as the interval. ,by As a new starting point, the search process is repeated until all peaks of the entire PPG signal are found; After finding the peak point, search for the trough point, which is the first minimum point on the left side of the peak point; Step 2: Pulse feature extraction: Assume that the PP interval sequence of a band is , is the number of elements in the sequence, For the time series i elements; let the peak voltage value sequence of this band be , N is the number of elements in the sequence, For the sequence i The voltage value of each peak; extract the following ten PPG signal time domain features: MEAN , SDNN , RMSSD , H_R , SDSD , V_Mean , V_Max , V_Min , V_Middle and V_SDNN , respectively represent the mean value of PP interval, the standard deviation of PP interval, the root mean square of adjacent PP intervals, the average heart rate of the band, the standard deviation of the difference between adjacent PP intervals, the mean value of the voltage sequence, the maximum value of the voltage sequence, the minimum value of the voltage sequence, the median value of the voltage sequence and the standard deviation of the voltage sequence; the calculation method of the time domain features of each PPG signal is as follows: ; ; ; ; ; ; ; ; ; ; in, For the i The difference between the PP intervals, It is the average value of the difference between PP intervals.
4. The emotion recognition system based on pulse signal and random forest algorithm according to claim 1, characterized in that: The steps of training the emotion classification model by improving the random forest algorithm are as follows: Step 1: Prepare data: organize the extracted pulse feature data and save it as a csv file; Step 2, load data: use software to load pulse characteristic data in csv file; Step 3: Divide the data set into training set and test set. Step 4: Train the random forest model: extract different subsample sets from the training set with replacement multiple times, build a decision tree for each subsample set, and recursively select the optimal partitioning attribute to divide the feature space during the construction of each decision tree until the stopping condition is met; integrate the prediction results of multiple decision trees to obtain the final prediction result of the random forest; Step 5: Evaluate the random forest model: Use the test set to evaluate the quality of the random forest model. Step 6: Build a gradient boosting decision tree model: Use the features selected by the random forest algorithm as input and the classification results of the random forest algorithm as output to build a gradient boosting decision tree model; Step 7: Evaluate the gradient boosted decision tree model: Use the test set to evaluate the quality of the gradient boosted decision tree model.
5. The emotion recognition system based on pulse signal and random forest algorithm according to claim 1, characterized in that: The steps of selecting the optimal partition attribute are as follows: Suppose the current sample set D i The proportion of samples in the class is , the information entropy of D is defined as shown in Formula 5: Formula 5: ; Assuming discrete attributes x There are M different possible values , using the attribute Divide the sample set , generating M branch nodes, among which the first The branch nodes contain sample sets All properties in The upper value is The sample is denoted as ; When using information gain as a reference, use the attribute x The information gain calculation obtained by dividing the sample set is shown in Formula 6: Formula 6: ; in, express Information entropy; select the attribute with the largest information gain as the optimal partitioning attribute; When the Gini index is used as a reference, the attribute The calculation of the Gini index is shown in formula 7: Formula 7: ; in for The Gini value of is calculated as shown in formula 8: Formula 8: ; The attribute with the smallest Gini index is selected as the optimal partitioning attribute.
Citation Information
Patent Citations
Emotion recognition system and method based on breathing components in pulse signals
CN112043252A
Breast cancer diagnosis and prediction method based on voting mechanism
CN116936073A
AI-based depression clinical decision-making method and system
CN117747064A
Cited By
Random forest model-based power distribution network traveling wave adaptive filtering method and device
CN121327673A