Objectives Cardiac arrhythmia is one of the most severe cardiovascular diseases that can be fatal. Therefore, its early detection is critical. However, detecting types of arrhythmia by physicians based on visual identification is time-consuming and subjective. Deep learning can develop effective approaches to classify arrhythmias accurately and quickly. This study proposed a deep learning approach developed based on a Chapman–Shaoxing electrocardiogram (ECG) dataset signal to detect seven types of arrhythmias. Method Our DNN model is a hybrid CNN-BILSTM-BiGRU algorithm assisted by a multi-head self-attention mechanism regarding the challenging problem of classifying various arrhythmias of ECG signals. Additionally, the synthetic minority oversampling technique (SMOTE)–Tomek technique was utilized to address the data imbalance problem to detect and classify cardiac arrhythmias. Result The proposed model, trained with a single lead, was tested using a dataset containing 10,466 participants. The performance of the algorithm was evaluated using a random split validation approach. The proposed algorithm achieved an accuracy of 98.57% by lead II and 98.34% by lead aVF for the classification of arrhythmias. Conclusion We conducted an analysis of single-lead ECG signals to evaluate the effectiveness of our proposed hybrid model in diagnosing and classifying different types of arrhythmias. We trained separate classification models using each individual signal lead. Additionally, we implemented the SMOTE–Tomek technique along with cross-entropy loss as a cost function to address the class imbalance problem. Furthermore, we utilized a multi-headed self-attention mechanism to adjust the network structure and classify the seven arrhythmia classes. Our model achieved high accuracy and demonstrated good generalization ability in detecting ECG arrhythmias. However, further testing of the model with diverse datasets is crucial to validate its performance.