# Speech Emotion Recognition: Comparative Analysis of CNN-LSTM and Attention-Enhanced CNN-LSTM Models
## 3 Methodology
### Models Description
#### 3.3.1 Time Distributed 2D CNN-LSTM Model  
The following steps represent the structure of the first model. Stack time refers to the sequential processing of time-distributed data, such as Mel spectrogram chunks, to capture temporal dependencies [13].  
We designed the model as shown in Figure 3. This model starts with six time-distributed 2D CNN blocks that process segmented Mel spectrogram chunks, which are the spectra of the speech audio files obtained after pre-processing. The first two convolutional blocks apply a \(5\times 5\) kernel with a stride of 1 and padding of 2, while the remaining four use a \(3\times 3\) kernel with padding of 1. This configuration ensures that spatial dimensions are preserved throughout most convolutional operations. The initial convolution layers in each block extract local features from the input spectrograms. Batch normalization follows each convolution to stabilize and accelerate training, as described in Equation (4).  
The activation function used throughout the model is ELU (Exponential Linear Unit), applied after normalization to introduce non-linearity and improve the learning of complex patterns (using Equation (5)). After each activation, max pooling is applied. The first three convolutional blocks use a 2 \(\times\) 2 kernel with stride 2, while the latter three use a 4 \(\times\) 4 kernel with stride 4 (Equation (6)). Dropout is applied after every pooling layer with a probability of 0.2 (Equation (7)) to prevent overfitting.  
The convolutional blocks progressively increase the number of filters in the following sequence: 8, 16, 32, 64, 128, and 256. This enables the model to learn increasingly complex and abstract features from the Mel spectrograms, capturing variations relevant to different emotional expressions in speech.  
After the convolutional layers, the output is flattened and passed to a fully connected dense layer. This dense layer acts as a dimensionality reducer and feature combiner before the features are forwarded to a final softmax classifier. The output layer uses a linear transformation (Equation (8)) followed by a softmax activation function (Equation (9)) to produce probabilities for each emotion class.  
For example, consider a scenario in which there is an audio clip of someone speaking happily. This audio is first converted into a Mel spectrogram, highlighting the unique frequency and time characteristics of the speech. The time-distributed CNN layers analyze this spectrogram, extracting important features like intensity and pitch variations that signify happiness. These processed features are then passed through the dense layers to accurately classify the emotion as happy.  
Figure 3: Model 1: Proposed system schema showing 2D CNN-LSTM architecture.  
\[\hat{X}=\frac{X-\mu}{\sigma} \tag{4}\]  
where \(\mu\) and \(\sigma\) are the mean and standard deviation of the batch.  
\[f(x)=\begin{cases}x&\text{if }x>0\\ \alpha(e^{x}-1)&\text{if }x\leq 0\end{cases} \tag{5}\]  
where \(\alpha\) is a small positive constant (typically 1.0).  
\[Y_{i,j}=\max_{m,n}X_{i+m,j+n} \tag{6}\]  
\[y=x\cdot\text{Bernoulli}(p) \tag{7}\]  
where \(p\) is the dropout probability (0.2).  
\[y=W\cdot x+b \tag{8}\]  
\[\text{softmax}(x_{i})=\frac{e^{x_{i}}}{\sum_{j}e^{x_{j}}} \tag{9}\]