ECG is the most commonly used diagnostic tool for identifying cardiovascular disease. However, manual interpretation of ECG is inefficient and requires medical practitioners with a lot of training. In this work we proposed a novel deep learning model to classify ECG automatically. The customized model has a residual neural network architecture which consists of 28 convolutional layers. The convolutional features of ECG are compressed by using a global average pooling layer and a global max pooling layer simultaneously. The output layer is activated by a sigmoid function to get classification results. The training data were preprocessed to eliminate abrupt noises with their voltage more than 20 mV. To improve our algorithm's performance on ECG with abnormal rhythm, we manually located all the premature beats in each ECG recording and selected 5 s segments which contained at least one premature beat as training samples. Recordings without premature beats were randomly split into 5 s segments. The model was then trained on these ECG segments for 60 epochs with an optimizer of Adam. After training, the model performance was evaluated on the hidden test set maintained by the challenge organizers. Each test recording had a prediction made by inference from all of its split segments. Our model’s F2 Score, G2 Score and Geometric Mean reached 0.786, 0.584 and 0.678, respectively. The results show promising application prospects of our model in automatically classifying 12-lead ECG..