###### Abstract  
Early detection and effective treatment of myocardial infarction can prevent the deterioration of ischemic heart disease and greatly reduce the possibility of sudden death. On the basis of standard 12-lead electrocardiogram (ECG) records, this paper proposes a bidirectional, long short-term memory (Bi-LSTM) network with a heartbeat-attention mechanism to effectively and automatically detect myocardial infarction (MI). First, we divide the standard 12-lead ECG records into sliding windows with the same number of heartbeats. Subsequently, we do not use any labels of heartbeats to train the Bi-LSTM network and the heartbeat-attention mechanism is applied to automatically weight the difference between unlabeled heartbeats. Finally, our method is validated by patients' complete ECG records and real labels in the Physikalisch-Technische Bundesanstalt (PTB) diagnostic ECG database. When compared with the same network without the heartbeat-attention mechanism or other existing methods, our method achieves comparable or better performance. The accuracy, sensitivity, and specificity reach 94.77%, 95.58%, and 90.48%, respectively. myocardial infarction; heartbeat-attention mechanism; 12-lead ECG records +
Footnote †: journal:  
ST segment and abnormal Q wave, as shown in Figure 1; abnormal serum enzyme content; and chest pain symptoms [2]. As long as two of the criteria are met, the patient can be diagnosed with myocardial infarction. The location of infarction depends on the coronary artery that has been occluded. This evidence can appear in different ECG leads, which requires simultaneous investigation of all the 12 ECG leads [3]. With the advancement of electronic technology and big data cloud platforms, portable medical wearable devices have also undergone significant development, making real-time ECG monitoring and automatic detection of myocardial infarction possible. On the basis of the standard 12-lead ECG signals collected by portable medical wearable devices, after amplification and filtering, the automatic detection algorithm gives the diagnosis result of myocardial infarction. If an abnormality occurs, the devices will alert the patient or directly notify the hospital to take appropriate action. In our work, we are committed to developing a practical, medical-grade detection algorithm of myocardial infarction. With the increasing popularity of machine learning, many researchers [3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15] have applied machine learning techniques to the detection of myocardial infarction and achieved promising results. [PERSON] et al. [4] extracted 15-dimensional morphology feature vector from QRS measurement and introduced neural networks into the classification of myocardial infarction, achieving 79% accuracy. [PERSON] et al. [5] converted ECG signals into a density model and extracted the feature vector using hidden Markov models (HMMs). The myocardial infarction was classified by Gaussian mixture models (GMMs) and their accuracy, sensitivity and specificity achieved 82.50%, 85.71%, and 79.82%, respectively. [PERSON] et al. [6] used two new features, T-wave integral and total integral, in the detection of myocardial infarction; accuracy on the test set reached 94.74%. In a study by [PERSON] Net al. [3], a novel feature extraction method, based on multi-scale wavelet energy and multi-scale covariance matrix, was proposed. Their accuracy, sensitivity, and specificity were 96%, 93%, and 99%, respectively. [PERSON] et al. [7] synthesized the standard 12-lead ECG records and performed a morphological examination including the P-wave duration, the ST-T interval, and the peak of the QRS complex. The principal component analysis (PCA) was used to reduce the dimension of feature vectors. Their sensitivity, specificity, and accuracy were all 96.66% in 60 samples. All of the above studies used traditional classifiers, such as a support vector machine (SVM), k-Nearest Neighbor (KNN), and neural networks (NN).