## 3 Methodology
### Temporal Convolutional Network Model with Channel Attention
#### 3.1.1 PPG Signal Preprocessing Module  
The preprocessing module initially segments the original PPG signal data into time-series segments of 20 s intervals [28; 29], yielding the processed PPG signal data W as the input for training the network model.  
\[\text{W}=\{w_{1},w_{2},\ldots,w_{n-1},w_{n}\},n\in\{1,\text{N}\},\text{N}=\left\lfloor \frac{length(PPG)}{20}\right\rfloor \tag{1}\]  
In Equation (1), \(w_{n}\) represents the _PPG_ raw signal data segmented into 20 s segments, length(PPG) denotes the length of each _PPG_ raw signal segment, and \(n\) corresponds to the number of segments for each stimulus video of each subject. N represents the total number. \"\(\left\lfloor\right\rfloor\)\" represents a rounding down function.  
The CWT is employed to conduct time-frequency conversion on the PPG signal data, which is segmented based on the windowing method, in order to generate a spectrogram. During the wavelet transform process, the pre-segmented data W are fed into a CWT function, which processes the data across various scales. Initially, the transform begins at the smallest scale to analyze high-frequency characteristics, with smaller scales corresponding to higher frequencies. Next, as the data scale increases with a doubling exponential factor, the frequency decreases inversely. This methodology enables the analysis of half of the data's behavior at the highest frequency. As the scale continues to grow, the frequency decreases, and the analysis concludes at the maximum decomposition level. This entire wavelet transform process is carried out using the 'pywt' wavelet transform processing package in Python, with the CWT function 'CWT' being applied to the segmented data. The result is a multidimensional spectrogram X, which is obtained through the computation of the CWT. The aforementioned process can be represented by the following Equations (2)-(5).  
\[CF=\text{CentralFrequency}(\text{Wavelet}) \tag{2}\]  
\[\text{cparam}=2*CF*\text{totalscale} \tag{3}\]  
Figure 2: Network model architecture diagram of proposed PPG-based emotion recognition. Blue circles represent input information; white circles mean middle layers; yellow circles describe output information.  
\[\text{Scale}=\frac{\text{cparam}}{\text{\it{range}}(\text{\it{totalscale}},1,-1)} \tag{4}\]  
\[X=\text{CWT}(\text{\it{W}},\text{\ Scale},\text{\it{Wavelet}},\text{\it{sampling\_period}}) \tag{5}\]  
In these equations, \(\text{\it{W}}\) is the well-segmented 20 s PPG signal data, and \(\text{\it{CF}}\) is the center frequency of the wavelet in Equation (2). In Equation (3), cparam is the wavelet transform parameter with a total scale of 257. In Equation (4), the 'arange' function is a random matrix generator. Scale is the scale using wavelet transform, calculated from cparam and scale matrix. Wavelet is a wavelet object, with many wavelet objects available in the entire CWT processing package. Commonly used wavelet objects include Gaussian derivative wavelet ('gausP'), complex Gaussian derivative wavelet ('cgauP'), Monet wavelet ('morl'), and Mexican hat wavelet ('makh'). In this study, the complex Gaussian derivative wavelet ('cgau8') was selected as the wavelet and the eighth-order derivative was used for calculation. Sampling_period is the sampling period of the PPG signal, with a period of 64 Hz. The calculation of the complex Gaussian derivative wavelet is shown in Equation (6) and \(\text{\it{C}}\) is a normalization constant parameter related to the order of the data.  
\[\psi(t)=\text{Ce}^{-\text{j}t}\text{e}^{-t^{2}} \tag{6}\]