A hybrid transformer model with supervised contrastive loss for automatic music classification

Read full text
Authors: Tingting Zhuang, Dongyun Chang, Xiaohua Wang
Cited by: 1
References: 17

Abstract

With the rapid expansion of the digital music industry, streaming platforms are required to efficiently and accurately classify massive music collections to support personalized recommendation, content organization, and copyright management. However, music genre classification remains challenging due to class imbalance, limited samples in minority genres, and the inherent limitations of single-model architectures in capturing complex temporal and structural patterns. These issues restrict the robustness and discriminative capability of existing supervised deep learning approaches. To address these challenges, we propose a Hybrid Transformer with Supervised Contrastive Learning (HT-SCL) framework for automatic music classification. The proposed model integrates Transformer, Long Short-Term Memory (LSTM), and Convolutional Neural Network (CNN) branches in a parallel architecture, enabling simultaneous modeling of global dependencies, temporal dynamics, and local spectral features. In addition, a joint optimization strategy combining supervised contrastive loss and cross-entropy loss is introduced to enhance intra-class compactness and inter-class separability, thereby mitigating class imbalance and improving feature discriminability. Extensive experiments under multiple data split strategies demonstrate that HT-SCL consistently outperforms conventional machine learning models and single-branch deep architectures across evaluation metrics, showing stable performance even under reduced training data conditions. The results confirm the effectiveness and robustness of the proposed hybrid design and representation learning strategy. Overall, this work provides a reliable and scalable solution for music genre classification and offers practical value for real-world music streaming systems.

Fields of Study & Subjects

Music and Audio Processing Speech Recognition and Synthesis Blind Source Separation Techniques

Publication details

Journal / source
Alexandria Engineering Journal
Publisher
Elsevier BV
Volume
143
Pages
160–169
Publication date
16 April 2026
Language
EN