Table 1
GTZAN dataset statistics.
| Segment Duration | Segments per 30‑s Track | Total Segments | Training (80%) | Testing (20%) |
|---|---|---|---|---|
| 30 s | 1 | 1000 | 800 | 200 |
| 15 s | 2 | 2000 | 1600 | 400 |
| 10 s | 3 | 3000 | 2400 | 600 |
| 6 s | 5 | 5000 | 4000 | 1000 |
| 3 s | 10 | 10000 | 8000 | 2000 |
Table 2
IMG‑Amrita dataset statistics.
| Segment Duration | Segments per 30‑s Track | Total Segments | Training (80%) | Testing (20%) |
|---|---|---|---|---|
| 30 s | 1 | 1800 | 1440 | 360 |
| 15 s | 2 | 3600 | 2880 | 720 |
| 10 s | 3 | 5400 | 4320 | 1080 |
| 6 s | 5 | 9000 | 7200 | 1800 |
| 3 s | 10 | 18000 | 14400 | 3600 |

Figure 1
Mel‑spectrogram of a 15‑s music signal.

Figure 2
Architecture of the convolutional neural network.

Figure 3
Convolutional neural network—long‑term short memory network architecture.

Figure 4
The architecture and training steps of the proposed model.

Figure 5
Feature‑extractor network.
Algorithm 1:
Proposed AECNN Framework
Require: Audio dataset , segment duration , sampling frequency
Ensure: Trained classifier
1: Initialize training set
2: for each audio recording do
3: Segment into fixed‑duration clips
4: Apply data augmentation:
Time stretching
Pitch shifting
Noise addition
Dynamic range compression
5: for each augmented segment do
6: Compute STFT
7: Generate log‑mel spectrogram
8: Resize to input dimension
9:
10: end for
11: end for
12: Split into training set and testing set
13: Initialize model parameters
14: while stopping criterion not satisfied do
15: Sample mini‑batch
16: for each spectrogram do
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29: end for
30: Compute categorical cross‑entropy loss
31: Update parameters () using AdamW optimizer
32: end while
33: Evaluate classifier using:
Classification accuracy
Top‑five accuracy
Confusion matrix
Area under the receiver operating characteristic curve
34: return trained model
Table 3
Statistical comparison of CNN and CNN‑LSTM on the GTZAN dataset (mean ± SD, 95% CI, paired t test).
| Duration | CNN (Mean Acc. ± SD) | 95% CI | CNN‑LSTM (Mean Acc. ± SD) | 95% CI | p‑value |
|---|---|---|---|---|---|
| 30 s | 83.05 ± 0.45 | [82.49, 83.61] | 84.55 ± 0.48 | [83.96, 85.14] | 0.004 |
| 15 s | 83.92 ± 0.44 | [83.38, 84.46] | 85.22 ± 0.47 | [84.64, 85.80] | 0.006 |
| 10 s | 85.25 ± 0.42 | [84.73, 85.77] | 87.32 ± 0.50 | [86.69, 87.95] | <0.001 |
| 6 s | 86.13 ± 0.41 | [85.62, 86.64] | 88.45 ± 0.52 | [87.80, 89.10] | <0.001 |
| 3 s | 87.05 ± 0.40 | [86.56, 87.54] | 89.63 ± 0.55 | [88.94, 90.32] | <0.001 |
Table 4
Statistical comparison of CNN and CNN‑LSTM on the IMG‑Amrita dataset (mean ± SD, 95% CI, paired t test).
| Duration | CNN (Mean Acc. ± SD) | 95% CI | CNN‑LSTM (Mean Acc. ± SD) | 95% CI | p‑value |
|---|---|---|---|---|---|
| 30 s | 90.80 ± 0.43 | [90.27, 91.33] | 91.52 ± 0.46 | [90.95, 92.09] | 0.041 |
| 15 s | 91.45 ± 0.41 | [90.94, 91.96] | 91.89 ± 0.44 | [91.35, 92.43] | 0.083 |
| 10 s | 92.05 ± 0.39 | [91.56, 92.54] | 93.11 ± 0.47 | [92.53, 93.69] | 0.009 |
| 6 s | 93.23 ± 0.38 | [92.76, 93.70] | 95.05 ± 0.49 | [94.44, 95.66] | <0.001 |
| 3 s | 95.55 ± 0.36 | [95.10, 96.00] | 96.67 ± 0.42 | [96.15, 97.19] | 0.003 |
Table 5
Training hyperparameters of the CNN and CNN‑LSTM models.
| Hyperparameter | Value |
|---|---|
| Optimizer | Adam |
| Learning rate | 0.001 |
| Loss function | Categorical cross‑entropy |
| Batch size | 128 |
| Number of epochs | 100 |
| Early stopping patience | 10 |
| Learning rate reduction patience | 5 |
| Learning rate reduction factor | 0.5 |
| Minimum learning rate | 1e‑5 |
Table 6
Statistical erformance valuation of the AECNN‑based MGC system (GTZAN) (mean ± SD, 95% CI, paired t test).
| Duration | AECNN (Mean Acc. SD) | 95% CI | p‑value vs. CNN | p‑value vs. CNN‑LSTM |
|---|---|---|---|---|
| 30 s | 90.68 ± 0.43 | [90.14, 91.22] | 0.002 | 0.006 |
| 15 s | 91.12 ± 0.45 | [90.56, 91.68] | 0.001 | 0.004 |
| 10 s | 92.05 ± 0.46 | [91.48, 92.62] | <0.001 | 0.002 |
| 6 s | 93.82 ± 0.48 | [93.22, 94.42] | <0.001 | <0.001 |
| 3 s | 96.02 ± 0.51 | [95.39, 96.65] | <0.001 | <0.001 |
Table 7
Statistical performance evaluation of the AECNN‑based MGC system (IMG‑Amrita) (mean ± SD, 95% CI, paired t test).
| Duration | AECNN (Mean Acc. SD) | 95% CI | p‑value vs. CNN | p‑value vs. CNN‑LSTM |
|---|---|---|---|---|
| 30 s | 93.62 ± 0.40 | [93.12, 94.12] | 0.003 | 0.021 |
| 15 s | 94.68 ± 0.42 | [94.15, 95.21] | 0.002 | 0.014 |
| 10 s | 95.94 ± 0.44 | [95.39, 96.49] | 0.001 | 0.006 |
| 6 s | 98.21 ± 0.47 | [97.62, 98.80] | <0.001 | 0.002 |
| 3 s | 98.94 ± 0.46 | [98.36, 99.52] | <0.001 | <0.001 |

Figure 6
Confusion matrix of the attention‑enhanced convolutional neural network–based music genre classification system (3 s) (Western genre).

Figure 7
Area under the receiver operating characteristic curve analysis of the attention‑enhanced convolutional neural network–based music genre classification system (3 s) (Western genre).

Figure 8
Confusion matrix of the attention‑enhanced convolutional neural network–based music genre classification system (3 s) (Indian genre).

Figure 9
Area under the receiver operating characteristic curve analysis of the attention‑enhanced convolutional neural network–based music genre classification system (3 s) (Indian genre).
Table 8
Performance comparison of the CNN and CNN‑LSTM with the proposed method.
| Genre | Method | Accuracy (%) | Precision (%) | Recall (%) | F1‑Score (%) |
|---|---|---|---|---|---|
| Western | CNN | 87.05 | 87.65 | 87.20 | 86.40 |
| CNN‑LSTM | 89.63 | 90.03 | 89.55 | 88.74 | |
| Proposed method | 96.02 | 96.48 | 95.63 | 96.05 | |
| Indian | CNN | 95.55 | 95.90 | 94.87 | 94.34 |
| CNN‑LSTM | 96.67 | 97.12 | 96.05 | 95.40 | |
| Proposed method | 98.94 | 99.12 | 98.63 | 98.87 |
Table 9
Training hyperparameters of the proposed AECNN model.
| Hyperparameter | Value |
|---|---|
| Optimizer | AdamW |
| Learning rate | |
| Weight decay | |
| Batch size | 128 |
| Number of epochs | 100 |
| Loss function | Categorical cross‑entropy |
| Label smoothing | 0.1 |
| Dropout rate | 0.1 |
| Stochastic depth rate | 0.01 |
Table 10
Results of the ablation study (Western genre).
| Configuration | Description | Accuracy (%) Mean ± SD [95% CI] | Precision (%) Mean ± SD [95% CI] | Recall (%) Mean ± SD [95% CI] | F1 Score Mean ± SD [95% CI] |
|---|---|---|---|---|---|
| Without batch normalization | Removed batch normalization from convolutional layers | 93.53 ± 0.38 [93.20, 93.86] | 94.08 ± 0.35 [93.77, 94.39] | 92.87 ± 0.41 [92.51, 93.23] | 93.47 ± 0.37 [93.15, 93.79] |
| Reduced CNN depth | Reduced the depth of the CNN backbone (from 3 to 2) | 92.79 ± 0.42 [92.42, 93.16] | 93.41 ± 0.39 [93.07, 93.75] | 92.06 ± 0.44 [91.67, 92.45] | 92.73 ± 0.40 [92.38, 93.08] |
| Reduced attention heads | Reduced the number of attention heads (from 2 to 1) | 92.03 ± 0.46 [91.63, 92.43] | 92.68 ± 0.43 [92.30, 93.06] | 91.42 ± 0.48 [91.00, 91.84] | 92.04 ± 0.45 [91.65, 92.43] |
| Increased attention heads | Increased the number of attention heads (from 2 to 3) | 94.98 ± 0.34 [94.68, 95.28] | 95.37 ± 0.31 [95.10, 95.64] | 94.52 ± 0.36 [94.20, 94.84] | 94.94 ± 0.33 [94.65, 95.23] |
| Without attention module | Removed the attention module; only CNN remains | 89.11 ± 0.51 [88.66, 89.56] | 90.02 ± 0.48 [89.60, 90.44] | 88.27 ± 0.55 [87.79, 88.75] | 89.13 ± 0.50 [88.69, 89.57] |
| Proposed AECNN | Complete architecture (CNN + dual attention modules) | 96.02 ± 0.29 [95.76, 96.28] | 96.48 ± 0.27 [96.24, 96.72] | 95.63 ± 0.31 [95.36, 95.90] | 96.05 ± 0.28 [95.80, 96.30] |
Table 11
Results of the ablation study (Indian genre).
| Configuration | Description | Accuracy (%) Mean ± SD [95% CI] | Precision (%) Mean ± SD [95% CI] | Recall (%) Mean ± SD [95% CI] | F1 Score Mean ± SD [95% CI] |
|---|---|---|---|---|---|
| Without batch normalization | Removed batch normalization from convolutional layers | 97.53 ± 0.27 [97.29, 97.77] | 97.88 ± 0.25 [97.66, 98.10] | 97.21 ± 0.30 [96.95, 97.47] | 97.54 ± 0.28 [97.29, 97.79] |
| Reduced CNN depth | Reduced the depth of the CNN backbone (from 3 to 2) | 97.01 ± 0.31 [96.74, 97.28] | 97.36 ± 0.29 [97.11, 97.61] | 96.68 ± 0.33 [96.39, 96.97] | 97.02 ± 0.30 [96.76, 97.28] |
| Reduced attention heads | Reduced the number of attention heads (from 2 to 1) | 96.28 ± 0.36 [95.96, 96.60] | 96.71 ± 0.34 [96.41, 97.01] | 95.83 ± 0.39 [95.49, 96.17] | 96.27 ± 0.35 [95.96, 96.58] |
| Increased attention heads | Increased the number of attention heads (from 2 to 3) | 97.88 ± 0.24 [97.67, 98.09] | 98.21 ± 0.22 [98.02, 98.40] | 97.46 ± 0.27 [97.22, 97.70] | 97.83 ± 0.25 [97.61, 98.05] |
| Without attention module | Removed the attention module; only CNN remains | 96.00 ± 0.40 [95.65, 96.35] | 96.38 ± 0.37 [96.06, 96.70] | 95.62 ± 0.42 [95.25, 95.99] | 95.99 ± 0.39 [95.65, 96.33] |
| Proposed AECNN | Complete architecture (CNN + dual attention modules) | 98.94 ± 0.18 [98.78, 99.10] | 99.12 ± 0.16 [98.98, 99.26] | 98.63 ± 0.21 [98.45, 98.81] | 98.87 ± 0.19 [98.70, 99.04] |
Table 12
Comparison of the Proposed AECNN Model with the State‑of‑the‑Art Models for the GTZAN Dataset.
| Approach | Accuracy (%) | Precision (%) | Recall (%) | F1‑Score (%) |
|---|---|---|---|---|
| Hybrid CNN‑RNN (Ashraf et al., 2023) | 89.30 | 85.00 | 91.00 | 88.00 |
| CNN–transformer encoder (Chen et al., 2024) | 87.41 | 87.93 | 87.58 | 87.28 |
| Compact convolutional transformer (Pourmoazemi and Maleki, 2024) | 94.00 | 92.00 | 93.00 | 92.00 |
| Proposed work (AECNN) | 96.02 | 96.48 | 95.63 | 96.05 |

Figure 10
Radar chart comparison of the proposed attention‑enhanced convolutional neural network model with the state‑of‑the‑art models for GTZAN dataset.
