Background and objectivesArrhythmia classification based on electrocardiograms (ECG) can enhance clinical diagnostic efficiency. However, due to the significant differences in the number of different categories of heartbeats, the performance of classes with fewer samples in arrhythmia classification have not met expectations under the inter-patient paradigm. This paper aims to mitigate the adverse effects of category imbalance and improve arrhythmia classification performance. MethodsWe constructed a novel dual attention hybrid network (DA-Net) for arrhythmia classification under sample imbalance, based on modified convolutional networks with channel attention (MCC-Net) and sequence-to-sequence network with global attention (Seq2Seq). The refined local features of the input heartbeat are first extracted by MCC-Net and then sent to Seq2Seq for further feature fusion. By applying local and global attention in the feature extraction and fusion parts, respectively, the method fully fuses low-level feature details and high-level context information and enhances the ability to extract discriminative features. ResultsBased on the MIT-BIH arrhythmia database, under the inter-patient paradigm without any data augmentation methods, the proposed method achieved 99.98% accuracy (ACC) for five categories. The various performance indicators are as follows: Class N: sensitivity (SEN) = 99.96%, specificity (SPEC) = 99.93%, positive predictive value (PPV) = 99.99%; Class S: SEN = 99.67%, SPEC = 99.98%, PPV = 99.56%; Class V: SEN = 100%, SPEC = 99.99%, PPV = 99.91%; Class F: SEN = 100%, PPV = 99.98%, SPEC = 97.17%. In further experiments simulating extreme cases, the model still achieved ACC of 99.54% and 98.91% in the three-category and five-category categories when the training sample size was much smaller than the test sample. ConclusionsWithout any data augmentation methods, the proposed model not only alleviates the negative impact of class imbalance and achieves excellent performance in all categories but also provides a new approach for dealing with class imbalance in arrhythmia classification. Additionally, our method demonstrates potential in conditions with fewer samples.