- Main concepts
The main challenge in atrial fibrillation (AFIB) diagnosis is need in long-term monitoring due to its often-fleeting nature. Holter monitoring (HM) with 3 or 12 leads during 1 to 7 days is now the most available and cheapest test for AFIB patients. In this research the authors have focused on the development of machine learning-based AFIB-detection algorithm for HM ECG analysis software. Universality and robustness that the under-development algorithm should possess will also allow to use it in personal healthcare devices, such as smart watches.
The idea of using the machine learning-based approach for AFIB-detection comes from its specific pattern (Figure 1). AFIB is indicated by the absence of consistent P-waves, due to the chaotic atrial depolarization. Ventricular contractions are also irregular and RR intervals vary from beat to beat. Moreover, there are low-amplitude waves on the baseline between QRS-complexes (“f” waves) which replace P-waves.
Figure 1. AFIB pattern: ECG with normal sinus rhythm – on the top, ECG with atrial fibrillation (AFIB) – on the bottom.
The research is aimed to define, implement, and evaluate algorithms that provide time-efficient and precise detection of atrial fibrillation in ECG records. To achieve this goal the following tasks are accomplished (shown in Figure 2).
Figure 2. Tasks solved in the research
In the beginning, review of state-of-the-art approaches for arrhythmia classification is carried out. The recommendations on development are analysed and the best practices are considered for further algorithm implementation. After that, the authors collect and preprocess dataset for solving the problem. Once the data is aggregated, feature engineering and exploratory data analysis are conducted. The selected dataset is used for research and development of several machine learning algorithms. To define the best model, the authors evaluate the performance of the developed algorithms. Finally, strategies for deployment of the most appropriate algorithm into Holter monitoring software are proposed.
- Research outcomes
Trained and selected ML and DL models are evaluated in terms of accuracy and time-efficiency. To assess these characteristics, validation set is used. It contains 12,983 segments with normal sinus rhythm and 8841 segments with atrial fibrillation, which in total is 24 hours of ECG record. The authors use Google Colaboratory platform to unify the evaluation environment. All the validation procedures are carried out on Intel Xeon CPU 2.20GHz. The results of performance evaluation are represented in Table 1.
Table 1. Performance evaluation of selected models.
Random forest and feature-based FCN models are the most time-efficient: they process 24 hours of record less than in two seconds. Moreover, random forest provides significant accuracy (which is comparable with combined FCN): only CNN models exceed that value. The CNN-based models have the highest accuracy characteristics: more than 95%. Considering the evaluation results along with accuracy and performance requirements, the signal-based and combined CNNs with global average pooling are chosen as the most appropriate models for further deployment in Holter monitor analysis software. Their confusion matrices are represented in Table 2 and 3, respectively.
Table 2. Confusion matrix for signal-based CNN with GAP
Table 3. Confusion matrix for combined CNN with GAP
The developed model needs to be deployed in the Holter monitor analysis software. To accomplish this task, the authors have developed atrial fibrillation pipeline shown in Figure 3. At first, signal is split into 1000-sample segments. Then the segments form batch. If needed, the time-domain feature extraction is performed, and the resulting batch is given to the CNN classifier. The model produces a batch of annotations in accordance with input segments batch. Finally, the annotation is converted back to the sequence and pathological segments are located.
Figure 3. Atrial fibrillation detection pipeline
Previously developed conversion approach is suitable for CNN architectures. It is based on the idea of automatic selection of the fastest parallel processing extension supported by the specific CPU, including floating point unit (FPU), streaming SIMD extension (SSE), and advanced vector extensions (AVX).
It has been shown that the most time efficient extension, AVX, can give 9 times inference gain. Thus, expected processing time will be less than 1 second. Moreover, using only FPU extension will make it possible to prevent exceeding the upper limit (10 seconds).
The main focus of the research is dedicated to the experiments with several machine learning and deep learning models for atrial fibrillation detection: 5-fold cross-validation and grid search are applied to find out the optimal algorithm among k-nearest neighbours, support vector machines, random forest, fully-connected networks, and convolutional neural networks. Conducted performance evaluation has shown that both signal-based and combined feature-and-signal CNN models with global average pooling are the most appropriate in terms of accuracy (more than 96% for binary classification problem) and time-efficiency (less than 7 seconds for processing of 24-hour record in Python environment). These performance characteristics are sufficient for real-world applications; thus, the future plans of deployment are considered. The approach proposed by the authors, which consists in using both the signal itself and its features, made it possible to achieve higher accuracy in atrial fibrillation detecting than in other approaches found in the literature. The obtained models are expected to be deployed into the atrial fibrillation pipeline and converted into C++ for compatibility with previously implemented HM software.