Electrocardiograms (ECG) are the primary basis for the diagnosis of cardiovascular diseases. However, due to the large volume of patients' ECG data, manual diagnosis is time-consuming and laborious. Therefore, intelligent automatic ECG signal classification is an important technique for overcoming the shortage of medical resources. This paper proposes a novel model for inter-patient heartbeat classification, named G2-ResNeXt, which adds a two-fold grouping convolution (G2) to the original ResNeXt structure, as to achieve better automatic feature extraction and classification of ECG signals. Experiments, conducted on the MIT-BIH arrhythmia database, confirm that the proposed model outperforms all state-of-the-art models considered (except the GRNN model for one of the heartbeat classes), by achieving overall accuracy of 96.16%, and sensitivity and precision of 97.09% and 95.90%, respectively, for the ventricular ectopic heartbeats (VEB), and of 80.59% and 82.26%, respectively, for the supraventricular ectopic heartbeats (SVEB).INDEX TERMS Cardiovascular disease (CVD), ECG signal classification, ResNeXt, convolutional block attention module (CBAM), MIT-BIH.