Skip to main content
Have a personal or library account? Click to login
Attention‑Enhanced Convolutional Neural Network for Music Genre Classification Cover

Attention‑Enhanced Convolutional Neural Network for Music Genre Classification

Open Access
|Aug 2026

Figures & Tables

Table 1

GTZAN dataset statistics.

Segment DurationSegments per 30‑s TrackTotal SegmentsTraining (80%)Testing (20%)
30 s11000800200
15 s220001600400
10 s330002400600
6 s5500040001000
3 s101000080002000
Table 2

IMG‑Amrita dataset statistics.

Segment DurationSegments per 30‑s TrackTotal SegmentsTraining (80%)Testing (20%)
30 s118001440360
15 s236002880720
10 s3540043201080
6 s5900072001800
3 s1018000144003600
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 D=(Ai,yi)i=1N, segment duration Ts, sampling frequency Fs

Ensure: Trained classifier M

1: Initialize training set T

2: for each audio recording AiD do

3:  Segment Ai into fixed‑duration clips

4:  Apply data augmentation:

  Time stretching

  Pitch shifting

  Noise addition

  Dynamic range compression

5:  for each augmented segment aij do

6:    Compute STFT(aij)

7:    Generate log‑mel spectrogram Sij

8:    Resize Sij to input dimension H×W×C

9:    TT{(Sij,yi)}

10:  end for

11: end for

12: Split T into training set Ttrain and testing set Ttest

13: Initialize model parameters θ

14: while stopping criterion not satisfied do

15:  Sample mini‑batch BTtrain

16:  for each spectrogram SkB do

17:   F1CNNLayer1(Sk)

18:   F2CNNLayer2(F1)

19:   PPatchEmbedding(F2)

20:   EP+PositionalEncoding(P)

21:   H1AttentionHead1(E)

22:   H2AttentionHead2(E)

23:   HConcatenate(H1,H2)

24:   HLayerNormalization(H)

25:   HFeedForwardNetwork(H)

26:   HResidualConnection(H)

27:   zFullyConnected(H)

28:   pSoftmax(z)

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 M

Table 3

Statistical comparison of CNN and CNN‑LSTM on the GTZAN dataset (mean ± SD, 95% CI, paired t test).

DurationCNN (Mean Acc. ± SD)95% CICNN‑LSTM (Mean Acc. ± SD)95% CIp‑value
30 s83.05 ± 0.45[82.49, 83.61]84.55 ± 0.48[83.96, 85.14]0.004
15 s83.92 ± 0.44[83.38, 84.46]85.22 ± 0.47[84.64, 85.80]0.006
10 s85.25 ± 0.42[84.73, 85.77]87.32 ± 0.50[86.69, 87.95]<0.001
6 s86.13 ± 0.41[85.62, 86.64]88.45 ± 0.52[87.80, 89.10]<0.001
3 s87.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).

DurationCNN (Mean Acc. ± SD)95% CICNN‑LSTM (Mean Acc. ± SD)95% CIp‑value
30 s90.80 ± 0.43[90.27, 91.33]91.52 ± 0.46[90.95, 92.09]0.041
15 s91.45 ± 0.41[90.94, 91.96]91.89 ± 0.44[91.35, 92.43]0.083
10 s92.05 ± 0.39[91.56, 92.54]93.11 ± 0.47[92.53, 93.69]0.009
6 s93.23 ± 0.38[92.76, 93.70]95.05 ± 0.49[94.44, 95.66]<0.001
3 s95.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.

HyperparameterValue
OptimizerAdam
Learning rate0.001
Loss functionCategorical cross‑entropy
Batch size128
Number of epochs100
Early stopping patience10
Learning rate reduction patience5
Learning rate reduction factor0.5
Minimum learning rate1e‑5
Table 6

Statistical erformance valuation of the AECNN‑based MGC system (GTZAN) (mean ± SD, 95% CI, paired t test).

DurationAECNN (Mean Acc. SD)95% CIp‑value vs. CNNp‑value vs. CNN‑LSTM
30 s90.68 ± 0.43[90.14, 91.22]0.0020.006
15 s91.12 ± 0.45[90.56, 91.68]0.0010.004
10 s92.05 ± 0.46[91.48, 92.62]<0.0010.002
6 s93.82 ± 0.48[93.22, 94.42]<0.001<0.001
3 s96.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).

DurationAECNN (Mean Acc. SD)95% CIp‑value vs. CNNp‑value vs. CNN‑LSTM
30 s93.62 ± 0.40[93.12, 94.12]0.0030.021
15 s94.68 ± 0.42[94.15, 95.21]0.0020.014
10 s95.94 ± 0.44[95.39, 96.49]0.0010.006
6 s98.21 ± 0.47[97.62, 98.80]<0.0010.002
3 s98.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.

GenreMethodAccuracy (%)Precision (%)Recall (%)F1‑Score (%)
WesternCNN87.0587.6587.2086.40
CNN‑LSTM89.6390.0389.5588.74
Proposed method96.0296.4895.6396.05
IndianCNN95.5595.9094.8794.34
CNN‑LSTM96.6797.1296.0595.40
Proposed method98.9499.1298.6398.87
Table 9

Training hyperparameters of the proposed AECNN model.

HyperparameterValue
OptimizerAdamW
Learning rate1×103
Weight decay1×104
Batch size128
Number of epochs100
Loss functionCategorical cross‑entropy
Label smoothing0.1
Dropout rate0.1
Stochastic depth rate0.01
Table 10

Results of the ablation study (Western genre).

ConfigurationDescriptionAccuracy (%) Mean ± SD [95% CI]Precision (%) Mean ± SD [95% CI]Recall (%) Mean ± SD [95% CI]F1 Score Mean ± SD [95% CI]
Without batch normalizationRemoved batch normalization from convolutional layers93.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 depthReduced 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 headsReduced 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 headsIncreased 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 moduleRemoved the attention module; only CNN remains89.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 AECNNComplete 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).

ConfigurationDescriptionAccuracy (%) Mean ± SD [95% CI]Precision (%) Mean ± SD [95% CI]Recall (%) Mean ± SD [95% CI]F1 Score Mean ± SD [95% CI]
Without batch normalizationRemoved batch normalization from convolutional layers97.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 depthReduced 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 headsReduced 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 headsIncreased 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 moduleRemoved the attention module; only CNN remains96.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 AECNNComplete 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.

ApproachAccuracy (%)Precision (%)Recall (%)F1‑Score (%)
Hybrid CNN‑RNN (Ashraf et al., 2023)89.3085.0091.0088.00
CNN–transformer encoder (Chen et al., 2024)87.4187.9387.5887.28
Compact convolutional transformer (Pourmoazemi and Maleki, 2024)94.0092.0093.0092.00
Proposed work (AECNN)96.0296.4895.6396.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.

DOI: https://doi.org/10.5334/tismir.268 | Journal eISSN: 2514-3298
Language: English
Page range: 423 - 439
Submitted on: Apr 10, 2025
Accepted on: Jun 18, 2026
Published on: Aug 4, 2026
Published by: Ubiquity Press
In partnership with: Paradigm Publishing Services

© 2026 M Pushparajan, KT Sreekumar, KI Ramachandran, C Santhosh Kumar, published by Ubiquity Press
This work is licensed under the Creative Commons Attribution 4.0 License.