Automatic Detection of Arrhythmias Using a YOLO-Based Network with Long-Duration ECG Signals

: Early detection of arrhythmias is very important. Recently, wearable devices are being used to monitor the patient’s heartbeat to detect an arrhythmia. However, there are not satisfactory algorithms for real-time monitoring of arrhythmias in a wearable device. In this work, a novel fast and simple arrhythmia detection algorithm based on YOLO is proposed. The algorithm can detect each heartbeat on long-duration electrocardiogram (ECG) signals without R-peak detection and can classify an arrhythmia simultaneously. The model replaces the 2D Convolutional Neural networks (CNN) with a 1D CNN and the bounding box with a bounding window to utilize raw ECG signals. Results demonstrate that the proposed algorithm has high performance in speed and mean average precisionin detecting an arrhythmia. Furthermore, the bounding window can predict different window lengths on different types of arrhythmia. Therefore, the model can choose an optimal heartbeat window length for arrhythmia classification. Since the proposed model is a compact 1D CNN model based on YOLO, it can be used in a wearable device and embedded system


Introduction
Arrhythmia refers to a group of conditions that cause the heart to beat rapid or irregular.They are detected by an electrocardiogram, which measures the state of the heart's electrical activity.In general, the process of arrhythmia detection is performed in three steps: beat segmentation, feature extraction and classification.Conventional heartbeat segmentation is the process of R-peak detection in long-duration ECG signals.Differentiation [1] and a digital filter [2] are used in R-peak detection.The R-peak detection algorithm is especially emphasized in bio-signal wearable devices for its computational cost [3].
Feature extraction is the following step in beat segmentation.In machine learning, wavelet transform (WT) [4] and independent component analysis (ICA) [5] are used.Feature extraction reduces the dimensions of beat feature and can greatly improve classification performance.Classification is the process of classifying a beat to each class based on its feature.However, most algorithms are handcrafted features, and such a pipeline processing method involves the problem of loading data into memory in each step and the problem of real-time execution due to operation processing.
A deep learning-based method overcame this problem by end-to-end learning which features extraction and classification fused into one model.Jun [6] used a 2D convolutional neural network (CNN) model which uses ECG images as input.Ji [7] also proposed the Faster R-CNN which converts the ECG signal into an ECG image.They had a 99.21% average accuracy.Kiranyaz [8] used a 1D CNN for classification of five types of arrhythmia.They made a real-time classification model using three consecutive 1D CNN layers.However, deep learning-based methods for classifying arrhythmias still need a beat segmentation process.
In this paper, we proposed a 1D YOLO model which can detect arrhythmia without an R peak in long ECG sequences.The model can detect more than one type of arrhythmia in a long sequence.We modified the YOLO model into a 1D YOLO model and the bounding box was replaced with a bounding window.As a result, the model predicts only one coordinate for the bounding window.

YOLO (You Only Look Once)
YOLO is an effective real-time object detection deep learning model [10].The model applies a single neural network to the input image and divides the image into an S × S grid cell.The grid cell approach is faster than using selective search and edge boxes in a region proposal.The Fast R-CNN use selective search and the Faster R-CNN adapts edge boxes for region proposal, but these kinds of region proposal are not good enough to use in real-time systems.Therefore, YOLO is widely used in real-time object detection.

MIT-BIH Database
In this study, the MIT-BIH arrhythmia database [9] is used for training and testing.The heartbeats are classified into 5 types: normal, right bundle branch block (RBBB), left bundle branch block (LBBB), ventricular ectopic beat (VEB), and supraventricular ectopic beat (SVEB).Since this is imbalanced, we down-sampled the normal type to match the overall number of other types of arrhythmia.
The MIT-BIH arrhythmia database contains 48 recordings and each recording is about 30 min long.We split 30-min ECG data into 10-s ECG segments.We did not use segments which have only normal-type heartbeats.Therefore, each segment has more than one type of arrhythmia.

Proposed 1D YOLO Model
An overview of the proposed 1D YOLO model is shown in Figure 1.We divided 36 grids into ECG segments and each grid predicts 2 bounding windows.Therefore, 72 bounding windows were predicted in each 10-s ECG segment, with a confidence score and position.Most of the bounding windows had a low confidence score, which means that the bounding window was detected as a background.We wanted to focus on the bounding windows which have ECG beats.To remove bounding windows which had low scores, the bounding windows were sorted according to their confidence scores-from high to low.We set a threshold, and windows with a confidence score under this threshold were deleted.
Post-processing was needed to remove several detections of the same heartbeat.Non-maximum suppression was used to remove multiple bounding windows showing the same heartbeat, and the bounding windows which had a high confidence score were left.The results are shown in Figure 2.

Result and Discussion
The proposed YOLO model was examined using the MIT-BIH database.We determined five types of arrhythmia and the number of beat in each types of arrhythmia is in Table 1.The precision and recall of each type of arrhythmia is shown in Table 2. Table 3 shows that the proposed model was able to correctly detect the five types of arrhythmia at an average precision of 0.97, an average recall of 0.95 and a 0.96 F1 score.However, SVEB has a low recall value.This may be due to the smaller dataset of SVEB compared to other types of arrhythmia.In addition, SVEB is characterized not only by morphological features but also a beat-to-beat feature.This made the model struggle to detect SVEB.The entire detection time of the proposed 1D YOLO model on 10-s ECG segments is 0.03 s.This makes its real-time application realizable.

Conclusions
In this study, we proposed a YOLO-based arrhythmia classification model that can detect each heartbeat and classify it as an arrhythmia in 10-s ECG segments without a beat extraction step.By processing the beat extraction step, feature extraction, and classification step into a single model, the complexity of computation was reduced and presented as a model usable for embedded application.We only classified five types of arrhythmia but the model can be used to detect various types of arrhythmia in the future.

Table 1 .
Number of beats in each arrhythmia type.

Table 2 .
Precision and recall of each arrhythmia type.

Table 3 .
Overall performance of proposed model.