A Particle Swarm Algorithm-Guided Psychological Stress Analysis to ECG Signal Collecting

In recent years, effective recognition and accurate assessment of psychological stress have been the focus of research. Because of the objectivity and authenticity of physiological signals, psychological stress recognition from physiological signals has become an important research content in the field of psychological stress recognition. As an important physiological signal, electrocar-diogram has been proved to contain reliable physiological response to psychological stress. This paper designs a psychological stress analysis algorithm based on particle swarm optimization (PSO). The wavelet transform algorithm was used to filter and detect the ECG signal. RR interval was calculated from the detected R wave to obtain the ECG signal. An improved particle swarm optimization (PSO) algorithm was proposed, which introduced a particle swarm optimization model with contraction factor to eliminate the speed limit and realize the detection of psychological stress. Experimental results show that the recognition rate of the improved particle swarm optimization algorithm is significantly higher than that of the traditional method, which shows the effectiveness of the algorithm. On the one hand, the research of this paper has optimized the algorithm, which has theoretical significance; on the other hand, it can provide reference for the real psychological stress test, which has practical significance.


Introduction
With the increasingly close integration of the Internet and people's production and life, people's demand for virtual scenes is increasing, and chronic psychological stress poses a threat to the human health [1]. Because the external factors we accept are too complex, the degree of psychological pressure will be di erent for each person. When we are working or studying, a certain degree of psychological pressure can improve the e ciency of our work and study, but if the psychological pressure is too high and if it is too large or for too long, then this stress state will a ect the health of the human body and lead to some kind of psychological or physiological disease. Modern medicine has proved that psychological stress can weaken the body's immune system, leading to external factors causing diseases in the body [2]. When people are under pressure, they will have a series of physical and mental reactions. If the pressure exceeds the range that people can bear, it will break the physiological balance of the human body and cause the nervous system of the human body to be in a disordered state, showing a series of symptoms, such as: insomnia, depression, endocrine disorders, cardiovascular disease [3].
Establishing an e ective psychological stress assessment system can help identify the psychological stress states and then implement appropriate interventions. ere are many ways to assess psychological stress. Currently, a questionnaire method is commonly used to assess psychological stress, but the assessment of this method is only a general assessment and the results of the assessment are not accurate enough. Nowadays, with the widespread popularity of a series of wearable devices such as smart watches and smart bracelets, it is more convenient to use physiological parameters to identify psychological pressure in daily life, and it is helpful to reasonably adjust people's psychological pressure, which can make people's life easier. e quality, work efficiency, and learning efficiency are improved, and at the same time, it can effectively mediate people's mood, and avoid various diseases caused by psychological pressure.
Due to the objectivity and authenticity of physiological signals, psychological stress recognition from physiological signals has become an important research content in the field of psychological stress recognition and in physiological signal psychological stress identification research, mainly through the analysis of the collected psychological stress physiological signals, extracting the characteristics that can represent specific psychological stress, and establishing a psychological stress identification model for psychological stress identification. As an important physiological signal, ECG signal has been proved to contain reliable physiological response to psychological stress. At the same time, ECG signal is an important research object in medicine, and its signal processing technology has been relatively mature.
Based on this background, this paper proposes a psychological stress analysis algorithm under the particle swarm algorithm based on ECG signal acquisition. e wavelet transform algorithm is used to realize the filtering and detection of ECG signals, so as to calculate the RR interval through the detected R wave. In order to obtain the ECG signal and extract the ECG characteristic parameters that can characterize the degree of stress, an improved particle swarm optimization algorithm is proposed. e full text is divided into 5 chapters. Chapter 1 introduces the research background, research necessity, and chapter arrangement of the thesis; Chapter 2 mainly introduces some main research work on psychological stress detection at present, and introduces the research methods of this paper; Chapter 3 mainly introduces the collection and identification of ECG signals, and uses particle swarm algorithm to detect psychological stress; Chapter 4 mainly uses the designed detection algorithm to evaluate human psychological stress and examine the effect of evaluation. Chapter 5 mainly summarizes the work of the full text and proposes an imagination for the next step. e purpose of this paper is to use the improved particle swarm optimization algorithm to detect psychological stress. On the one hand, the research of this paper has optimized the algorithm, which has theoretical significance; on the other hand, it can provide reference for the real psychological stress test, which has practical significance.

State of the Art
e increasing pressure of human life has gradually attracted people's attention to the research on the identification algorithm of psychological stress. Since the beginning of the 21st century, the use of physiological parameters to identify psychological stress has become the focus of domestic and foreign researchers. At present, there are many methods and means for the identification and assessment of psychological stress at home and abroad.
Professors Healey and Picard from MIT effectively assessed the driver's psychological state by collecting the driver's ECG signal, EMG psychological stress signal and breathing signal, mainly recording the psychological stress of drivers driving on a fixed road in downtown Boston and physiological signals, and proved the feasibility of using physiological signals to identify stress [4]. Setz et al. identified the characteristics of galvanic skin response through psychological stress LDA and SVM algorithms, and the recognition rate of LDA algorithm reached more than 80%. Students at the University of Augsburg use games to induce the psychological pressure of the human body. At the same time, the collected EMG signals and breathing signals under two different states of low pressure and high pressure are the research objects, and finally judged by LDA and Fisher. According to the analysis results, the average recognition rate of psychological stress is over 85% [5]. Minh et al. of Cameron University established a psychological stress model with support vector machine as a classifier, and proved through experiments that the support vector machine algorithm model is stable in identifying stress and has a higher recognition rate [6]. Javier Hemandez et al. first collected the physiological signals of call center employees, and collected two kinds of physiological signals, stressful and non-stressed, and then corrected the loss function of the support vector machine to identify the difference between stress and non-stress. Finally, different people are trained and tested by this method to obtain higher classification accuracy [7]. Hoover et al. used computer game characters to induce the psychological stress of the testers, collected the psychological stress under two different states of low work stress and high work stress, and then detected the human heart rate variability signal by using the sub-Gaussian fitting. Compared with the method of psychological stress and analysis, the experimental results show that the sub-Gaussian fitting method has higher recognition accuracy than the classical cumulative sum method [8]. Subahni AR employs a racing game to induce stress, collects ECG signals from six subjects, and extracts features of HRV in the time and frequency domains for analysis. It has been verified that HRV can predict psychological stress by detecting changes in the autonomic nervous system [9]. Singh et al. quantitatively analyzed the stress of the human body in the state of fatigue, proposed a method for inducing stress based on neural network, and performed statistical and time-frequency domain analysis on it, taking the characteristics of galvanic skin response as the research object. Finally, the psychological stress is identified through the recurrent neural network, and the average identification rate is 89.2% [10]. Mohammadi et al. used discrete wavelet transform to decompose the ECG signal into different frequency bands, and then extracted the corresponding features for classification using KNN and SVM classifiers, achieving an accuracy of 86.75%.
Professor Hu Bin of Lanzhou University used EEG signals to identify human stress, and chose K-nearest neighbor classifier as the classification algorithm in the system, and developed an online stress monitoring system based on EEG signals [11]. Yuan Tian developed a CNN model to detect the psychological pressure of college students, and the model detection accuracy reached 98% [12].
Zhao Wen from Lanzhou University studied the psychological stress of specific groups of EEG signals, taking the mothers of seven mentally retarded children and the mothers of four normal children of the same age as the research objects, and using their EEG data as the data source [13]. Among them, the EEG data of mothers of mentally handicapped children was taken as stress data, and the EEG data of mothers of normal children was taken as stress-free data. First, the linear and nonlinear features extracted from EEG signals were compared, and then, combined with the evaluation scale PSQI and LZC complexity, alpha relative power and other features, finally, the psychological stress state was more effectively evaluated [14]. Professor Li Ting from Yanshan University led her team to first collect 36 sets of ECG signals, 18 sets of surface EMG signals, and 18 sets of finger pulse wave signals from nine test subjects, and used these signals as the raw data for identifying psychological stress. en, the DS evidence theory and the SVM algorithm are combined to build a stress recognition model, and finally, the recognition of psychological stress is realized, which proves the validity of the model in evaluating the psychological stress state [15]. Professor Li Ting led her team to improve and study the algorithm for identifying individual differences in psychological stress, using EMG signal as the sample parameter for the study, and proposed an improved support vector machine (SVM) for psychological stress identification algorithm. In order to reduce the training error, the loss function of the support vector machine is improved by the method of clustering the samples, and the clustered information is assigned to the loss function to realize the recognition of psychological stress. It is shown that the algorithm can effectively resolve the individual differences in assessing the psychological stress [16].
To sum up, it can be seen from the domestic and foreign research results that it is feasible to extract HRV features to identify psychological stress. At present, most studies at home and abroad identify psychological stress through a variety of physiological signals, which can be applied in practice to a certain extent, but the accuracy still needs to be further improved, and there are relatively few studies on stress model construction based on HRV. is paper proposes a psychological stress detection method based on PARTICLE swarm optimization (PSO) for ECG signal acquisition, and its basic framework is shown in Figure 1. ECG signal is filtered by wavelet transform. At the same time, the algorithm was used to detect the filtered ECG signal, locate the R wave, calculate the RR interval, and get the HRV signal. en, the improved particle swarm optimization algorithm is used to identify psychological pressure, which can make up for the shortcomings of previous literature research.

ECG Signal.
e internal cardiac structure of the human body includes four chambers: the left atrium, the right atrium, the left ventricle, and the right ventricle, and the power source is the heart. e heart is dominated by cardiomyocytes. Cardiomyocytes include special cardiomyocytes and ordinary cardiomyocytes. e function of special cardiomyocytes can produce excitatory effects. e composition of ordinary cardiomyocytes is the ventricular wall and the atrial wall. Its function is that it can act on the contraction of the cardiac chambers. If a person is subjected to some external stimuli, the human body will produce a state of psychological tension or nerve excitation, and at this time, it will be transmitted to the cardiomyocytes through the nerves, and the cardiomyocytes will dominate the heart, so that the diastolic and systolic functions of the heart will be accelerated., the heartbeat speed will be accelerated, therefore, it can be seen that psychological stress is closely related to ECG signal, and shows the regularity and stability of ECG signal waveform [17]. e waveform of the ECG signal is Unsampling Figure 1: Psychological stress detection method under the particle swarm algorithm based on ECG signal acquisition.
Mobile Information Systems mainly composed of five waveforms: Q, R, S, P, and T, and its characteristic intervals are: RR interval, PR interphase, QRS segment, ST segment, and QT interval. In the ECG waveform, if the lead mode is different, the ECG waveform will also be different, and the most obvious feature is the QRS complex. erefore, doctors usually diagnose the patient's condition by the morphological characteristics of the ECG signal. A typical ECG waveform is shown in Figure 2. P wave: under normal circumstances, caused by the right atrium and left atrium continuously, also known as myocardial depolarization wave. e highest amplitude of P wave generally does not exceed 0.25 mV, and the duration generally does not exceed 0.12s.
QRS complex: represents the excitation state of the left and right ventricles. e QRS complex is the most characteristic because the ventricular muscle is more developed than the atrial muscle, and its duration represents the time required for the ventricular muscle activation process. Under normal conditions, it does not exceed 0.1S, and the R wave amplitude ranges from 0.5 to 2 mV.
T wave: the potential change generated when the ventricular muscle is activated and recovered is the T wave, and its amplitude range is 0.1-0.5 mV, and its amplitude should be 1/10 lower than that of the R wave.
RR interval: refers to the time between the R waves of two QRS complexes. A cardiac cycle in the ECG is usually represented by the RR interval, and the time of the RR interval can also be used to calculate the size of the heart rate.
PR interval: refers to the part from the beginning of the P wave to the beginning of the QRS complex. e meaning of this part is the time between atrial depolarization and ventricular depolarization. e time range is 0.12-0.20s.
ST segment: refers to the part from the end of the QRS complex to the beginning of the T wave. e meaning of this part is the resting stage from ventricular depolarization to ventricular repolarization. It shows a smooth straight line on the waveform.
At present, the typical biomedical signal is the ECG signal, which is mainly analyzed from four aspects: the frequency spectrum of the signal, the amplitude of the signal, the impedance of the human body, and the noise of the ECG signal.
(1) e frequency range of ECG signal is 0.05-100 Hz, which is a low-frequency signal, and its spectral energy is mainly concentrated in 0.5-35 Hz. (2) e amplitude of the signal is very weak, it is a weak signal, its amplitude range is between 0.01 and 5 mV, and the typical value is usually 2 mV. (3) e ECG signal has high impedance. Since the human body is the source of the ECG signal, and the impedance of the human body is related to the wetness and cleanliness of the skin on the body surface, the impedance characteristics are relatively complex. e impedance value of the human body is generally in the range of several thousand ohms to tens of thousands between ohms. (4) e interference noise is strong. e noise of the ECG signal mainly includes: power frequency interference, baseline drift, and EMG interference. Among them, the power frequency interference in my country is 50 Hz, and these interferences will affect the extracted HRV. It affects the recognition rate of psychological stress, so it is also very important to remove the interference noise in the ECG signal. e human nervous system mainly includes the central nervous system (CNS) and the peripheral nervous system. e central nervous system not only affects most organs of the human body, but its physiological process also affects the psychological stress state of the human body. e CNS mainly regulates the psychological and physiological stimulation of the human body. When it receives some external stimulation, first, the hypothalamus is stimulated, and then the pituitary gland is stimulated. en, the autonomic nervous system will perceive the stimulation, so that the body's limbs will be stimulated producing a corresponding reaction. e physical and psychological stress response model is shown in Figure 3.
When the human body is stimulated by the outside world, the body's receptors will perceive the stimulation, and then judge whether it feels pressure through the cerebral cortex. Response; if the cerebral cortex does not perceive pressure, then the human body will not have a stress response [18]. HRV can be used not only to measure the human heart activity, but also to detect autonomic nervous system activity, cardiovascular disease, etc. erefore, by measuring HRV, the stability and activity of the autonomic nervous system can be assessed, as well as the psychological stress state of the human body.

ECG Signal Feature Extraction.
e ECG signal is a biological signal. According to the response characteristics of ECG signal, the RR interval of ECG signal is generally calculated after R wave is detected and HRV is obtained. e HRV is analyzed and characteristic parameters are extracted. e characteristic parameters were extracted by linear analysis (time domain analysis and frequency domain analysis) and nonlinear analysis.

Time-Domain Analysis.
e time domain features of HRV are extracted according to statistical methods. e formula for calculating the mean value of the RR interval is where N represents the number of RR intervals, and RRi is the ith RR interval. SDNN represents the overall standard deviation, which acts on the autonomic nervous system of Mobile Information Systems the human body and is used to reflect the psychological stress of the human body. e calculation formula is RMSSD represents the root mean square difference of the RR intervals, is related to the vagus nerve, and measures the magnitude of the heart rate to reflect stressful states. e calculation formula is SDSD represents the standard deviation of all adjacent RR interval differences, calculated as: Among them, ΔRRi represents the difference between adjacent RR intervals; ΔRR is the average value of the difference between N consecutive two RR intervals.

Frequency-Domain Analysis.
Since the autoregressive (AR) model can not only overcome the shortcomings of nonparametric estimation but also can well reflect the smooth spectral curve of the peaks. erefore, the frequency domain analysis adopts the AR model analysis method. e model can be expressed as rough the z-transformation, the transfer function of the system can be obtained as.
e power spectrum of the output sequence is

Nonlinear Analysis.
According to the nonlinear analysis methods for HRV researched in most literature, it can be seen that there are few studies on human psychological stress recognition, and basically use nonlinear analysis methods to study pathology. Nonlinear feature extraction of HRV is done using Poincare scatterplot method to identify stress states. Using the scatterplot method analysis, two main parameters, SD1 and SD2, can be obtained, where SD1 reflects changes in HRV medium and very low-frequency components, which are related to sympathetic nerve changes; SD2 is a rapid change in HRV, which is related to vagal nerve activity.

Elementary Particle Swarm Optimization.
Particle swarm optimization (PSO) is a behavioral research method which evolved from bird foraging behavior and is mainly used to solve optimization problems. Its basic principle is that in each problem to be optimized, one of its solutions is a particle in the search space, and each particle corresponds to a fitness value. e fitness function model is an optimization function model. In addition, the speed at which a particle searches can determine its direction and distance. When the direction and distance are determined, the direction and distance of the particle can be searched continuously until the optimal value is found [19]. It is found that particle swarm optimization algorithm can deal with some problems that traditional methods cannot deal with. Examples include nondifferentiable node transfer functions or no gradient information. e basic algorithm flow is shown in Figure 4: Assuming that the number of input features is D, and there are m individuals in the population, the velocity of the ith particle is V, and the position is expressed as Xi. At this point, the position value of the particle is a solution to the problem we need to solve. At the same time, first, the fitness function model is established, then, the fitness value is calculated, and finally, an optimal solution is obtained by comparing the fitness value of each particle. Among them, we call the best position experienced by the current ith particle as Pbest, and by comparing all particles, the best position Gbest of the entire population is obtained. When the optimal solution of Pbest and Gbest is found, the next generation of particles is obtained by calculating the following two formulas, and the calculation is repeated repeatedly until an optimal solution is obtained.
where: c 1 and c 2 are learning factors; rand 1 ( ) and rand 2 ( ) are random vectors between 0 and 1; V is the velocity of the ith particle to the nth particle; X is the ith particle e position of the particle to the nth particle.

Improved Particle Swarm Algorithm.
In order to avoid the elementary particle swarm optimization algorithm easy to fall into local optimal, there will be premature convergence in the optimization process, resulting in a large error. erefore, the fundamental particle swarm optimization algorithm will be improved. Among them, the empirical information contained in the remaining particles and the empirical information algorithm. C1 of the particles themselves are represented by learning factors C1 and C2 in the particle swarm optimization and C2 are particle trajectories that show mutual information in the particle swarm and the exchange. erefore, once the value of learning factor C1 is set at a higher level, the particles will remain in a limited range and continue searching will be more difficult converging to a local minimum. To solve this problem, a particle swarm optimization model with shrinkage factor is introduced. Under the action of contraction factor, not only the velocity boundary limit will disappear, but also appropriate parameters can be selected to ensure the bounded convergence of PSO. erefore, in order to improve the accuracy of analysis, this paper adopts the improved particle swarm optimization algorithm for analysis. e velocity formula and contraction coefficient formula are as follows:

Stress-Induced Experimental Protocol Design.
According to the ECG acquisition circuit and the designed program, the original ECG signal is obtained. On this basis, the HRV signal is calculated. en, in order to carry out the follow-up research on psychological stress recognition algorithm, an effective psychological stress induction scheme must be designed. Firstly, stress-induced ECG signals were collected by stress induction experiment, and then the characteristic parameters of HRV signals were extracted. Finally, the characteristic parameters are used to study the mental stress recognition algorithm.
In the process of stress induction, one is to collect the psychological stress signals generated in our actual life or work. Another approach is to use experimental materials and equipment to induce pressure and then collect a signal. e former is closer to reality and more effective in analyzing psychological stress. At present, there are many researchers in the world to collect pressure signals in actual work and life, but this method requires greater labor intensity, material and financial resources, and requires experimental equipment [20]. In contrast, the latter is more convenient and uses laboratory equipment and materials to achieve psychological stress induction, which not only has reliable data, but also has less interference in the collection process, providing help for the identification and research of psychological stress [21]. In order to make the data collected more effective and reliable, the selection of stress induction program is also more important.
In this design, emergency induction is accomplished by mental arithmetic task. Mental arithmetic tasks were used as a laboratory method to induce stress in subjects. e mental arithmetic task significantly increased the subjects' cortisol production (effectively triggering stress). In order to evaluate the high pressure and low pressure states more effectively, in the emergency induction experiment, the calm state of the subjects was regarded as the low state, and the part of the mental arithmetic task was regarded as the high state. e specific implementation process is shown in Figure 5.
First, let the tester be in a calm state for 120s, and then start to induce stress by using a mental arithmetic task. e task is to allow the tester to correctly mentally calculate the subtraction of twenty-four-digit problems randomly appearing on the computer within 10s, and repeat the mental arithmetic 10 times. Finally, after the mental arithmetic task is completed, the tester rests and returns to a calm state. e experimental scheme of mental arithmetic task is shown in Table 1.  In order to ensure the objectivity and scientific nature of the experiment, the subjects of this experiment were undergraduate and graduate students (19-26 years old), who did not have any mental or physical diseases and had clear cognitive ability and mental arithmetic ability. ECG signals of 30 graduate and undergraduate students were collected, a total of 200 groups of ECG data were collected, and unstable signals were removed. A total of 150 groups of effective data were collected, including 80 groups of high pressure data and 70 groups of low pressure data. 3 000 sample points during the calm phase were used as low pressure and 3 000 sample points during pressure induction were used as high pressure data. e waveforms of ECG signals under low pressure and high pressure are shown below.
From Figure 6 that the collected ECG signals in lowvoltage and high-voltage states contain interference, namely, power frequency interference, baseline drift, and EMG interference. In order to more clearly compare the RR intervals under the two stress states from the waveform diagram, ECG signal processing will be performed, the RR interval will be calculated from the processed waveform diagram, the HRV signal will be obtained, and the stress-related signals will be extracted from the HRV characteristics. erefore, the collected pressure-containing ECG signal is filtered through wavelet transform. Select the Symlets wavelet to decompose the ECG signal with 8 layers of wavelet, and use the Wden function and the Zeros function for filtering. e electrical signal is decomposed, and the number of decomposed layers is 4 layers. e waveforms of the filtered signal and the R-wave detection signal are shown in Figure 7.

ECG Signal Feature Extraction and Analysis.
According to the feature extraction method in Section 3, the obtained ECG signal is feature extracted, and some stressrelated feature data extracted by time domain, frequency domain, and nonlinear analysis methods are shown in Table 2.
Since the extracted HRV features are related to the autonomic nerve activity of the human body and reflect the degree of psychological stress, the significance of the stressrelated feature parameters is calculated and compared and analyzed. After analysis, it is found that among the extracted features, SDNN and HF show the most obvious difference under different pressure levels. e variation trend of SDNN and HF with pressure is shown in Figure 8.
Studies have shown that SDNN, PNN50, and NN50 are related to sympathetic nerve tone, and HF is related to cardiac vagal nerve activity [22]. erefore, the comparison of features extracted from HRV can reflect the influence of human body on autonomic nervous activity under stress. SDNN and HF feature parameters appear obviously with the increase of the stress level. e significant changes showed that the activity of the heart's sympathetic and vagus nerves also changed significantly. It can be seen that when pressure increases, the function of the sympathetic nerve is inhibited, and the function of the vagus nerve is reversed. erefore, the eigenvalue can effectively detect the pressure, and can be better used in the pressure recognition algorithm. is is because the optimized algorithm is more sensitive to the change of parameters and can reflect the change of nerves.

Analysis of Psychological Stress Recognition Results.
In the simulation experiment, 120 samples were selected as the training set and 30 samples as the test set, that is, the training set and test set are about 4 : 1. Low pressure sample category label set to 1, high pressure sample category label set to 2. According to the above, BP neural network and PSO-BP neural network algorithm can make more accurate analysis according to the characteristics of ECG signal. erefore, this paper selects these two algorithms for comparison. In the simulation experiment, the BP neural network algorithm and the improved PSO-BP neural network algorithm achieve the accuracy of psychological stress recognition, as shown in the Figure 9.
From Figure 9, the accuracy of the improved PSO-BP neural network test set is 93.33%, and the accuracy of the BP neural network test set is 86.67%, and the accuracy of the BP   network model optimized by the improved PSO model is increased by 6.66%. Figure 10 shows the average recognition rate of psychological stress by the BP neural network tested 20 times and the improved PSO-BP neural network. e recognition rate of HRV sample signals by the optimized neural network is relatively high and stable, and the recognition rate of psychological stress by the improved particle swarm optimization BP neural network (PSO-BP) algorithm is over 90%. As can be seen from the figure, the average recognition rate of BP neural network to psychological stress is 90.17%; the average recognition rate of improved PSO-BP neural network to stress is 94.83%; the average recognition rate of improved PSO-BP neural network is improved up 4.66%.
e experimental results show that the improved PSO-BP algorithm can effectively improve the recognition rate of psychological stress, and the recognition rate is 94.83%, and the recognition rate of BP neural network is increased by 4.66% on average. e algorithm can effectively identify the psychological stress state, and provide a means for the intervention of psychological stress state and mental health.

Conclusion
At present, the assessment of psychological stress is mainly carried out in two ways: questionnaires and physiological parameters. e method of questionnaire survey must allow the testers to actively cooperate and have subjective awareness, and the statistical data is often not reliable; and it is more accurate to evaluate psychological stress through the physiological parameter HRV. is method uses the human body's stress response to evaluate stress. When the human body is stimulated, the physiological balance of the body will be broken, and the physiological parameters of the human body will change at this time.
e method is intelligent, accurate, and reliable. In order to improve the recognition rate of psychological stress, an improved stress recognition algorithm based on particle swarm optimization BP neural network is proposed in this paper. On the basis of the basic particle swarm (PSO) model, the algorithm introduces a shrinkage factor. Under the action of the shrinkage factor, the boundary limit of the velocity disappears. Appropriate parameters are selected to ensure the bounded and convergent characteristics of the PSO algorithm. ere is optimization of BP Neural Networks. Use mental arithmetic tasks to induce stress, collect ECG signals under high and low pressure states, extract the characteristic values of heart rate variability related to psychological stress, and compare and analyze the characteristic data; establish a classification model of psychological stress degree, through the improved PSO model optimizes BP neural network to identify psychological stress. e results show that compared with the BP neural network, the improved particle swarm optimization BP neural network algorithm has fast convergence speed, small error, and high recognition rate. e recognition rate of this algorithm for psychological stress can reach 94.83%, and the recognition effect is better than the unoptimized BP neural network algorithm.

Data Availability
e labeled dataset used to support the findings of this study is available from the corresponding author upon request.

Conflicts of Interest
e authors declare that there are no conflicts of interest.