Abstract
This study proposes a novel layered architecture for the automated detection and classification of cardiac abnormalities from ECG signals within Medical Internet of Things (MIoT) environments. The primary objective is to reduce network transmission energy consumption by performing signal processing at the edge layer and forwarding only abnormal data to higher layers for precise classification. In the first stage, a lightweight hybrid generative adversarial network (HGAN) is deployed on edge devices. This model incorporates support vector machine (SVM) and decision tree (DT) mechanisms within the HGAN framework to enable efficient detection of abnormal ECG signals. This method exploits the complementary advantages of SVM for effective decision boundary separation and DT for transparent and interpretable decision rules within a GAN-based framework, enabling real-time anomaly detection with minimal computational cost. Within the proposed architecture, only the identified anomalous signals are transmitted to upper IoT layers, resulting in an estimated energy reduction of 85.2% compared to benchmark edge-based systems. In the subsequent stage, the detected abnormal ECG signals are transformed into discriminative two-dimensional representations corresponding to different classes using a novel differential signal-to-image conversion technique. These images are then classified into seven arrhythmia categories (e.g., atrial fibrillation, ventricular tachycardia, etc.) using a Convolutional Neural Network (CNN). The training processes of both stages are optimized using the Starfish Optimization Algorithm (SFOA), a meta-heuristic optimization technique, applied to the MIT-BIH arrhythmia database. This optimization strategy improves model parameter tuning, leading to faster convergence and enhanced generalization capability. Experimental evaluations on the benchmark dataset demonstrate that the first-stage abnormality detection achieves accuracy of 99.7996%, recall of 99.88%, and F1-score of 99.83%. In the second stage, the arrhythmia classification module attains accuracy of 99.56%, recall of 98.97%, and F1-score of 99.23%. Overall, the proposed architecture exhibits superior real-time performance, significant energy efficiency, and strong compatibility with IoT-based wearable sensors, offering an effective and privacy-aware solution for continuous cardiac health monitoring.
Keywords: ECG Anomaly Detection, MIoT Architecture, Hybrid GAN-SVM-DT, CNN Classification, SFOA Optimization, Energy Efficiency
Subject terms: Cardiology, Computational biology and bioinformatics, Engineering, Mathematics and computing
Introduction
With the spread of artificial intelligence (AI) and the use of advanced computational algorithms and methods, the healthcare sector has undergone a fundamental transformation, paving the way for more accurate monitoring, more effective prediction, intelligent assessment and faster therapeutic intervention. In this context, AI, relying on complex computational models, analyzes and interprets patient data and extracts actionable knowledge from them. This technology has the potential to profoundly transform health systems by improving treatment management, supporting personalized medicine and strengthening diagnostic processes. Despite these advances, cardiovascular diseases (CVD) will remain one of the most serious global health challenges in 2025, claiming more than 20 million lives annually, a trend that is expected to intensify under the influence of urbanization and changing lifestyles. According to an updated report by the American Heart Association, cardiovascular diseases will contribute to an estimated 19.6 million deaths worldwide by 2025, with ischemic heart disease alone accounting for 9.1 million deaths, highlighting the urgent need to develop scalable monitoring technologies1. The Internet of Things (IoT) refers to a platform in which a collection of smart devices communicate with each other via the Internet. The use of IoT in healthcare is increasingly expanding, as these solutions improve the quality of healthcare by connecting patients to devices that monitor and analyze vital health data. However, ensuring the accuracy and completeness of the data collected remains a serious challenge, especially in situations where unusual factors occur, such as equipment malfunctions, cyber threats, or unusual physical conditions. In such situations, anomaly detection is often performed by relying on heuristic algorithms based on labeled datasets.
Real-time detection of abnormalities in the electrocardiogram (ECG) signal plays a key role in the correct diagnosis of cardiac diseases and disorders. ECG signals, which are the main tools in identifying arrhythmias such as atrial fibrillation (AF) and ventricular tachycardia, have become increasingly important, especially in the prevention of stroke and sudden cardiac arrest. Combining smart diagnostic systems with wearable devices based on the Medical Internet of Things (MIoT), enables continuous monitoring outside of healthcare settings. However, common models such as convolutional neural networks (CNN) and long-term memory networks (LSTM) usually face challenges in handling long-range dependencies, generalizing to a high diversity of ECG patterns, and performing real-time inference with low latency. In order to address these shortcomings, this research presents a method that, due to its high interpretability, simpler computational structure, and appropriate compatibility with real-time processing, is considered an efficient option for deployment on wearable edge sensors in medical Internet of Things environments and healthcare monitoring and care applications2.
The Medical Internet of Things (MIoT) ecosystem is expected to grow significantly by 2025, as 6G prototypes mature and AI-powered smart sensors enable efficient transmission of ECG data from wearables to hybrid edge-cloud architectures. According to a Deloitte report, the MIoT market will exceed $120 billion by 2025, a growth that will accelerate with the advancement of low-power wide area networks (LPWANs) and the adoption of secure blockchain-based data paths for remote cardiac monitoring3. In this regard, new technologies such as flexible ECG patches equipped with biocompatible electrodes have been able to achieve signal accuracy of about 95% in real-time dynamic conditions and significantly reduce false alarms in ambulatory monitoring4. However, fundamental challenges remain, including high energy consumption due to continuous data transmission, security risks in heterogeneous networks, and the heavy computational overhead of processing high-sampling-rate ECG signals on devices with limited power resources. These issues highlight the need for smart solutions.
Recent advances in artificial intelligence (AI) and machine learning (ML) have revolutionized the analysis of electrocardiogram (ECG) signals, and hybrid architectures have emerged as the dominant approach for reliable anomaly detection. There is a growing trend toward automation of processes, leveraging machine learning, deep learning (DL), and smart sensors to improve efficiency, increase accuracy, and enable real-time monitoring of cardiac diseases. Automated diagnostic systems are able to detect abnormal patterns in ECG signals that may be indicative of disorders such as arrhythmia, ischemia, or myocardial infarction. These systems are trained on large datasets to distinguish between normal and abnormal cardiac activity5. Early detection and prediction of these abnormalities allows for faster therapeutic intervention, ultimately improving clinical outcomes and even saving patients’ lives. Furthermore, such intelligent systems can be provided as complementary decision-support tools to physicians, where the combination of automated diagnosis with human clinical assessment increases the final accuracy of diagnosis and reduces the likelihood of false positive or negative errors6.
Although many advanced models have achieved high levels of accuracy and efficiency in detecting ECG abnormalities in laboratory conditions and on controlled datasets, transferring this performance to real, novel, or unobserved data remains challenging7. In addition, one of the fundamental challenges of these models is the inability to dynamically adapt to different and unexpected patterns of input signals and the lack of appropriate learning and adaptive behavior8. To overcome these limitations, the development of a new generation of reinforcement learning methods seems essential; methods that are able to adapt to the temporal and structural changes of ECG signals. Also, the use of self-supervision strategies can be an effective solution to deal with the lack of labeled data in real scenarios and ultimately increase the stability, generalizability, and reliability of automatic diagnosis systems9.
In modern MIoT architectures, designing frameworks that align with the processing power, energy, and bandwidth constraints of wearable hardware is a fundamental challenge. The proposed architecture in this research is based on the principles of embedded systems design and edge computing, and a significant portion of the computational load is offloaded to low-power nodes. The first-stage implementation of ECG anomaly detection using a lightweight HGAN model along with SVM and DT classifiers is specifically designed for execution on low-resource processing architectures. This structure significantly reduces energy consumption and processing pressure by minimizing data exchange volume and transferring only abnormal samples; an aspect of particular importance from the perspective of computer architecture and low-power system design.
Additionally, the use of the Starfish Optimization algorithm for tuning parameters in both stages plays a crucial role in the proposed architecture’s compatibility with MIoT hardware constraints. Converting ECG signals to 2D representations and performing CNN classification only on selected data at the edge layer creates a multi-stage processing flow akin to common pipelines in computational system design. This layered organization provides an optimal combination of lightweight processing, data reduction, cost-effective transmission, and deep learning, ultimately resulting in an efficient, scalable, and implementable architecture for smart wearable devices. Thus, the innovation in this research lies not only in machine learning techniques but also in offering an integrated, power-efficient processing architecture for real-time MIoT applications.
Applying these strategies in the prediction stages enables early and reliable detection of cardiac disorders in a wider range of clinical scenarios and monitoring environments, so that diagnoses are made with higher accuracy and confidence, ultimately leading to improved patient outcomes and increased acceptance of new diagnostic tools. In this study, a novel framework is presented in which a low-cost hybrid GAN-SVM-DT structure optimized with the SFOA algorithm is used to screen for abnormalities in the edge layer, and then a convolutional neural network optimized with the same algorithm is responsible for classifying arrhythmias based on spectroscopic representations. By limiting data exchange to abnormal signals, this design significantly reduces the communication load of the network and improves the efficiency of stable and remote monitoring of heart health. The results obtained from the evaluation on the MIT-BIH database show reduced energy consumption and improved detection accuracy, achievements that are in line with new trends in federated learning and wearable systems for MIoT-based monitoring10. The main contributions of this research are as follows:
Development of a lightweight hybrid GAN-SVM-DT for detecting abnormal ECG signals in the edge layer.
Utilization of a CNN deep learning system for classifying Cardiac arrhythmia signals from 2D images in upstream layers and cloud computing.
A unified layered MIoT architecture for end-to-end efficiency, aiming to reduce energy consumption and data transmission traffic and increase the accuracy of monitoring cardiac patients.
A new training paradigm in different layers using the Starfish Optimization Algorithm (SFOA) to improve the performance of proposed learning systems.
The rest of this paper is organized as follows: In the second section, related studies and research are reviewed. The third section is dedicated to presenting a proposed design for a MIoT-based cardiac arrhythmia detection and classification system. In the fourth section, the experimental data used and the research methodology are described. The fifth section is dedicated to the analysis and discussion of the results. Finally, the sixth section summarizes the findings and provides suggestions for future research.
Related work
Cardiovascular diseases are major causes of non-communicable mortality, and their rapid and accurate diagnosis plays an important role in improving the condition of patients. Therefore, the development of continuous and low-cost monitoring systems for recording and analyzing ECG signals is essential. With the advancement of machine learning and deep learning methods, several studies have addressed the automatic detection of ECG abnormalities, but many existing approaches still rely on manual interpretation of signals, which is time-consuming and requires high expertise of medical staff. For this reason, computer-aided diagnosis (CAD) systems have been developed. However, extracting appropriate features and reliable diagnosis from ECG signals remains challenging and often requires multi-step frameworks: first, normal signals are separated from abnormal ones, and then abnormalities are classified into different types of arrhythmia. In the following, the methods and architectures presented in past research will be reviewed.
In11, researchers have presented a deep learning-based system called FADE, which takes a different approach to ECG signal monitoring. By focusing on modeling the natural behavior of the heart signal, this system is able to detect abnormal deviations without relying on a large amount of labeled data. FADE is trained in a self-supervised manner and uses an innovative cost function based on the morphological features of the signal that is highly sensitive to abnormalities. In this framework, instead of directly learning abnormal patterns, future healthy ECG values are predicted and their difference from the real data is used as a criterion for abnormality detection. Also, the use of domain matching methods allows the model to adapt to changing conditions, such as differences between patients or sensor types. The results of experiments on the standard MIT-BIH, NSR, and MIT-BIH Arrhythmia datasets show that this method achieved an average accuracy of 83.84% in detecting cardiac abnormalities and 85.46% in correctly identifying normal ECG signals. In12, the main focus is on providing an interpretable decision-making mechanism for ECG abnormality detection that allows for explicit rule extraction. In this framework, instead of relying solely on the output of a black-box model, an artificial neural network is trained based on features extracted from consecutive heart beats and then the knowledge hidden in it is represented as a set of decision rules. These rules are formed using a demand-driven tree search process and relying on the features that play the most roles in the network’s decision through gradient sensitivity analysis. The result of this process is a transparent rule-based system that is able to identify abnormal heart beats based on statistical indicators and morphological patterns of the ECG signal. The results of evaluating this method on the unknown data of INCART database show that even with a very simple architecture consisting of only 9 nodes, an overall accuracy of 93% is achieved and the detection sensitivity for VEB and SVEB beats reaches 90% and 80%, respectively. Furthermore, the practical implementation of the model on embedded hardware based on ARM Cortex-M4 has shown that by activating wireless transmission only when an abnormal beat is detected and stopping data transmission under normal conditions, the sensor energy consumption can be reduced by more than 50%.
In13, a novel machine learning-based approach is proposed to detect PxAF, a pathological condition in the ECG signal that can lead to serious and life-threatening events such as heart attack. In this framework, in order to increase the efficiency of the training process, two advanced technologies, including competitive generative networks and automatic search of neural architecture, are used in different stages of modeling. Specifically, GAN is used to generate synthetic ECG samples related to the PxAF class to overcome the problem of unbalanced distribution of training data. Next, instead of selecting a predetermined model, the NAS algorithm is responsible for automatically designing a convolutional neural network architecture tailored to the nature of the PxAF detection problem. This combination leads to the creation of a dedicated and optimized classifier that performs better in detecting this ECG abnormality. The experimental results show that the proposed framework was able to achieve an accuracy of more than 99% and provide a performance improvement of 5.1% over the existing state-of-the-art methods. Also, comparison with two baseline approaches, ResNet-18 and Auto-Sklearn, shows an accuracy increase of 2.2% and 6.1%, respectively. In another study14, a set of machine learning algorithms was evaluated for predicting anomalies and attacks in IoT-based systems. The models used included logistic regression, support vector machine, decision tree, random forest, and artificial neural network, and the performance measurement criteria included overall precision, prediction accuracy, recall, F1, and area under the ROC curve. Analysis of the results showed that the decision tree, random forest, and artificial neural network performed better than the other methods and managed to achieve a test accuracy of 99.4%.In15, a method for increasing trust and security in IoT networks is introduced that uses secure paths for data transmission. In this approach, sensitive data is first encrypted using the RSA algorithm and the generation of encryption keys is performed using the self-adaptive Tasmanian Devil optimization (SA_TDO) process to obtain optimal keys. To ensure the integrity of the information, the SHA3-512 hash algorithm is used. Intrusion detection is also performed with a deep learning-based system that uses deep neural networks (DNN) and spike convolutional neural networks and its efficiency is optimized using the Archimedes Optimization Algorithm (AOA). This combination of security and machine learning allows for effective data protection and network threat detection. The study demonstrates that this approach can ensure both secure and dependable routing in IoT-enabled smart networks while efficiently identifying and mitigating potential threats. In reference16, the practicality of deploying optimized models for ECG anomaly detection, including various arrhythmia types, on edge devices such as Raspberry Pi and Arduino was examined. The workflow consists of data preprocessing, feature extraction, and model inference, all executed directly on the edge devices, thereby eliminating the reliance on cloud computing. To address constraints in memory and energy typical of wearable devices, techniques like model pruning and quantization were employed, striking a balance between computational efficiency and predictive performance. The resulting optimized model achieved 92.3% accuracy while consuming only 0.024 mW of power, enabling prolonged, real-time health monitoring with minimal energy usage.
In reference17, a compact neural network is proposed for real-time detection of ECG abnormalities while minimizing energy consumption in wearable IoT edge devices. The model employs an innovative hybrid design combining long short-term memory (LSTM) units with a multilayer perceptron (MLP). The LSTM component analyzes sequences of coefficients that capture the morphology of individual ECG beats, whereas the MLP receives input features derived from instantaneous heart rate measurements. Training both components simultaneously allows the network to extract complementary and discriminative representations, enhancing its ability to make accurate decisions. The proposed network was evaluated in terms of classification accuracy, computational efficiency, and energy consumption using the MIT-BIH Arrhythmia dataset. To address class imbalance, the SMOTE algorithm was employed, resulting in an average classification accuracy of 97%. Furthermore, by dynamically controlling wireless transmission based on the classifier’s output, the system achieved nearly 50% energy savings. In a separate study18, the DeepECG-Net architecture was introduced for cardiac disease classification. This deep learning model combines transformer layers with convolutional neural networks (CNNs) to enhance feature representation and capture global dependencies, thereby improving the detection of ECG abnormalities. Unlike traditional convolutional neural networks that have limitations in tracking long-term dependencies or LSTM models that are computationally expensive, DeepECG-Net utilizes a multi-head self-attention mechanism to effectively learn ECG changes both at the local and global scales. This design reduces the computational burden, increases the interpretability of the model, and improves performance in real-time diagnostics. Using a hierarchical embedding method, the network achieves an accuracy of 98.2%, which surpasses the performance of ECGNet (88%) and LSTM (90%). In addition to accuracy, the recall of 96.8% and an F1 score of 97.5% demonstrate the model’s ability to bridge the gap between AI-based solutions and continuous cardiac monitoring. Also, DeepECG-Net, using a federated learning framework, is able to detect ECG abnormalities in a distributed manner, preserves patient privacy, and can be implemented in wearable devices and clinical environments.
In study19, ECG signals were initially cleaned to remove artifacts and segmented to isolate individual heartbeats. Key features were then extracted, and an optimization method was applied to select the most informative ones for anomaly detection. Classification into normal and abnormal categories was carried out using i-AlexNet, an upgraded variant of the AlexNet architecture. Experimental results on the PTB and MIT-BIH datasets reported a high accuracy of 98.8%. Meanwhile, reference20 proposed a deep learning framework that merges convolutional neural networks with a channel attention module, enhancing the model’s ability to prioritize the most important ECG characteristics. This efficient yet robust design was created to classify five types of arrhythmias and provides a more accurate representation of clinical conditions using both two-lead and twelve-lead ECG signals. Testing on the MIT-BIH and INCART datasets showed accuracies of 99.18% and 99.48%, with F1-scores reflecting similarly strong performance. In reference21, the study emphasizes the growing need for comprehensive solutions to detect threats in IoT environments and explores the development of hybrid CNN-LSTM architecture. This model is specifically designed to identify IoT attacks with high accuracy and efficiency, aiming to overcome the limitations of existing approaches and enhance the security of IoT ecosystems. The proposed framework was evaluated on multiple datasets, including IoT-23, N-BaIoT, and CICIDS2017, covering over 14 types of attacks. Evaluation results indicate high effectiveness, with the model achieving 95% accuracy on IoT-23 and 99% accuracy on both N-BaIoT and CICIDS2017.
In study22, a hybrid machine learning framework is proposed that integrates convolutional neural networks with long short-term memory models to enhance predictive accuracy. In this architecture, CNNs are employed to capture spatial features from medical images, while LSTMs model temporal patterns in wearable sensor data, resulting in approximately a 10% improvement over single-purpose models. To further enhance feature extraction, the approach incorporates Physiological Event Extraction (PEE) to detect critical events such as heart rate variability and respiratory changes from raw sensor inputs, which also improves interpretability and boosts prediction performance by 15%. For anomaly detection, ensemble techniques including Isolation Forest and one-class SVM are utilized, reducing false positives by 20% and outperforming conventional methods. The model is trained using an online gradient descent algorithm with momentum, yielding around a 25% increase in the true positive rate (TPR). Also, statistical methods based on M-estimator theory are applied to handle outliers and missing data, lowering estimation error by 30% while slightly increasing the false positive rate (FPR) by 12%.
Although the reviewed studies have made considerable progress, several recurring limitations remain. For example, models such as FADE11 and DeepECG-Net18 depend heavily on large, annotated datasets, which are often difficult to access in real-world healthcare environments due to privacy concerns and limited availability of reliable data. Similarly, architectures like CNN-LSTM, presented in21,22, require substantial computational resources, complicating their deployment on IoT edge devices with restricted hardware. Another challenge is the limited generalizability to diverse sensors and patient populations, as observed in approaches like13,16, which can result in decreased performance when applied to new scenarios. In addition, focusing primarily on accuracy without adequate consideration for interpretability and security, as seen in14,15, may raise operational risks, including cybersecurity threats and diagnostic errors. Lastly, many evaluations rely on small datasets such as MIT-BIH, which may not capture the full variability of real-world IoT data, potentially leading to overly optimistic performance estimates.
Despite significant advancements in security methods and anomaly detection in IoT, previous studies have largely focused on classical encryption techniques (such as RSA and SHA) or deep learning-based models, which may be less resilient against emerging attacks and dynamic MIoT scenarios. To complete this review, examining newer works is essential, particularly in the domain of predicting the remaining useful life (RUL) of sensors and wearable devices, directly linked to predictive maintenance’s reliability and longevity in heart monitoring systems27.
A novel approach involves using Interpretable Serialized Variational Autoencoder (SVAE) based on stochastic drift-diffusion equations27. This model combines serialized autoencoders with a probabilistic framework, enabling the interpretable modeling of sensor degradation dynamics or ECG signals. The drift term describes deterministic health changes, while the diffusion term models random uncertainties from environmental noise, motion artifacts, or sensor aging. This method not only enhances RUL prediction accuracy but also aids doctors and engineers in understanding degradation causes through interpretable latent representations, crucial for predictive maintenance in MIoT that manages battery life and ECG sensor reliability4.
Moreover, a broader literature review reveals that a combination of TinyML and edge AI on constrained devices (such as Raspberry Pi and Arduino) achieved 92.3% accuracy in ECG anomaly detection with extremely low power consumption (0.024 mW). Hybrid transformer-CNN approaches (like DeepECG-Net), leveraging self-attention for global and local dependencies, offer 98.2% accuracy in real-noise conditions. Additionally, self-supervised learning frameworks have demonstrated AUROC above 91% for anomaly detection in large-scale clinical ECGs (over 478,000 records) without extensive labeling28. These advancements emphasize the need for integration of interpretability (such as VAE-based explainability), reduced energy consumption at the edge, and robustness against real-world noise — aspects that our proposed layered architecture effectively addresses by combining THECF, HGAN-SVM-DT, and SFOA-CNN.
Proposed method
Figure 1 shows the block diagram of the proposed architecture for medical IoT applications and rapid and online diagnosis of heart diseases. The basis of the methodology in this research refers to reducing the cost and complexity of high-accuracy heart disease classification and diagnosis systems under new hybrid machine learning systems.
Fig. 1.
Proposed ECG monitoring architecture based on MIoT.
In this section, we introduce the proposed system and explain the details of the implementation of the method step by step. In the first step, we will apply preprocessing to the input data set received from ECG signal sensors. The filtered signals from the previous step are entered into the new GAN-SVM-DT hybrid machine learning system to identify abnormal signals from normal signals. As can be seen in Fig. 1, the identified patient signals enter the next step and enter the heart disease classification stage from ECG signals under the wireless IoT network. Among them, all the heart signals of healthy people no longer need to be sent to the upstream cloud network and are classified and detected under edge computing at the sensor level in the first step. This will greatly reduce the data transmission traffic in the IoT network and reduce the transmission loss and computational cost in the smart medical network. In the next step, a CNN deep learning system is used for disease classification under upstream cloud computing. We will train this system to detect 7 types of heart diseases from cardiac signals including (NSR, ABP, AFL, AFIB, VT, Bigeminy, Trigeminy). In this regard, this system will use the starfish optimization algorithm as an innovative design to train machine learning systems in different stages. The following describes the different parts of this system.
From a computer architecture perspective, real-time ECG analytics in MIoT environments is fundamentally constrained by the limited compute, memory, and battery capacity of wearable edge devices and the high communication cost of continuous raw data transmission. Therefore, the overall system must be architected as a distributed computing pipeline in which lightweight, latency-critical processing is mapped to the edge, while computationally intensive deep models are offloaded to more powerful cloud resources. This edge–cloud co-design is closely related to classical computer architecture principles such as workload partitioning, locality exploitation, and energy-aware data movement, and it requires careful decisions on which operations are executed near the sensor and which are deferred to upper layers.
In the proposed framework, the MIoT system is explicitly organized as a multi-layered computing architecture comprising wearable sensor nodes, an edge layer, and a cloud layer. The edge layer is designed as a resource-constrained computing node with limited CPU frequency, on-chip memory, and battery capacity, which motivates deploying a lightweight hybrid HGAN–SVM–DT model with a small memory footprint and predictable execution latency. In contrast, the cloud layer is treated as a high-performance computing back-end that can host more complex and deeper models, such as the CNN-based arrhythmia classifier operating on differential signal-to-image representations. This architectural separation enables a hardware-conscious mapping of algorithms to the most suitable layer in terms of energy, compute capability, and real-time constraints.
The layered MIoT framework is also compatible with different hardware realizations at each tier. The edge-layer HGAN–SVM–DT model is intentionally designed with a small number of parameters and simple control flow, which makes it suitable for deployment on ultra-low-power microcontrollers or embedded CPU cores that are typically available in wearable devices. Conversely, the CNN-based arrhythmia classifier, which exhibits higher compute intensity and memory bandwidth demands, is more appropriate for execution on GPU-based cloud servers or specialized accelerators. This decoupled architectural design allows system designers to independently optimize hardware platforms at the edge and in the cloud, while maintaining end-to-end real-time guarantees.
Input data preprocessing details
We divide all ECG recordings into 10-second windows, to achieve similar signal feature extraction and image processing results for the number of iterations. Note that 1-second labels are chosen because the normal heart rate of a clinically healthy person is between 60 and 100 beats per minute23. Therefore, the signal processing is performed for nearly ten iterations and labeling is performed on it. Finally, a specific preprocessing is applied to each dataset as follows:
In this study, both median and low-pass filters were applied to ECG signals. Specifically, a median filter with a kernel size of 3 and a low-pass filter with a frequency range of 0.5 to 30 Hz were used to remove noise and improve signal quality. In addition, due to the presence of noise in this dataset, various filters were used to smooth the signals and remove background noise to improve the quality of the input data to the model. We have used a GAN machine learning system to classify the ECG signals as normal signals for healthy subjects and abnormal signals for diseased subjects. Specifically, we use a novel lightweight but high-accuracy GAN-DT-SVM hybrid classifier in the edge layer to evaluate the signal type every second with the aim of eliminating sending healthy signals for further processing at the cloud level. This will reduce heavy processing and telecommunication traffic. Finally, we normalize only the patients’ cardiac signals to a common range of normal values and then transform them into images to be used for training the model by CNN. Therefore, the patients’ cardiac signals are classified to classify the type of disease with the help of a multi-layer CNN system in the cloud computing layer.
Sensor error detection and problematic ECG signal rejection in the proposed architecture
In the proposed architecture, the preprocessing stage of ECG signals plays a vital role in sensor error detection and problematic signal rejection to prevent erroneous data from entering the subsequent stages, i.e. anomaly detection and arrhythmia classification. This process starts by receiving raw ECG signals from wearable sensors in the Medical Internet of Things (MIoT) environment. The signals are segmented into 10-second windows, as the normal heart rate (60–100 beats per minute) allows for the extraction of similar features in this range. To remove noise and artifacts caused by sensor errors, such as patient motion, electromagnetic interference, or poor electrode contact, two filters are used: a median filter with a kernel size of 3 to remove abrupt noise and a band-pass filter with a frequency range of 0.5 to 30 Hz to remove high- and low-frequency noise (such as baseline noise or 60 Hz interference). These filters smooth the ECG signals and improve the quality of the data for analysis. In addition, an automatic detection step of problematic signals is performed using statistical criteria, such as excessive standard deviation or abnormal amplitude, to identify and eliminate signals caused by sensor failure or communication loss. This approach ensures that only valid signals are passed to the anomaly detection step by the GAN-SVM-DT hybrid system, which reduces the false positive (FP) rate and increases the overall accuracy of the system to 99.79%. Figure 2 shows the block diagram of this operation in the proposed architecture.
Fig. 2.
Block diagram of the system for identifying and separating invalid ECG signals in the proposed architecture.
In practical MIoT deployments, a substantial proportion of ECG signals collected from wearable sensors arrive in a severely degraded form and lose their diagnostic usefulness due to issues such as electrode detachment, intense patient motion, muscle artifacts, or analog-to-digital conversion errors. Forwarding these clearly corrupted signals to the Edge layer leads to considerable energy waste and places unnecessary computational demands on lightweight deep learning models. To address this problem and enhance fault tolerance directly at the sensor level, a new ultra-lightweight pre-filtering mechanism—Triple Hierarchical Energy & Correlation-based Fault Detection (THECF)—was developed and applied immediately after initial filtering, functioning as a preliminary gating module before execution of the HGAN-SVM-DT model. THECF relies on three physiological and mathematical hierarchical thresholds that are applied sequentially. The first layer evaluates the total energy of each one-second window, comparing it against a low threshold of 0.001 mV² and a high threshold of 15 mV²; departures from this range indicate electrode disconnection or severe motion noise. The second layer examines the QRS-band energy ratio, extracted with a fourth-order Butterworth filter in the 30–45 Hz band; healthy ECG segments consistently exhibit ratios between 0.18 and 0.85. The third layer assesses QRS morphological consistency by computing the normalized cross-correlation between the incoming signal and a healthy QRS template that is pre-generated during device initialization from the average of 100 clean beats, with 0.72 selected as the acceptance threshold.
Any signal that fails one or more of these three stages is immediately identified as defective and discarded without being passed to deep learning classifiers; if necessary, a local fault alarm is raised. Only signals that successfully pass all levels are forwarded into the network for further analysis, as illustrated in Fig. 2. Testing THECF on more than 12,000 one-second windows drawn from the MIT-BIH Arrhythmia Database (https://www.physionet.org/content/mitdb/1.0.0/)24 and the NSTDB noise set demonstrated that the method can identify corrupted signals with 99.9% accuracy, representing a major performance improvement compared with directly applying the HGAN-SVM-DT pipeline without any pre-filter. Furthermore, THECF requires less than one kilobyte of memory and processes each window in under 8 milliseconds, making it highly suitable for low-power microcontrollers such as STM32L4 and ESP32.
Incorporating THECF into the proposed system architecture led to an 85.2% improvement in total energy savings and substantially reduced the processing load on the Edge layer by filtering corrupted data at the source rather than transmitting it to the cloud. These results demonstrate the development of a highly fault-tolerant sensor system with minimal computational overhead—one of the key innovations of the proposed architecture—and highlight its strong potential for deployment in next-generation wearable cardiac monitoring devices. By performing fault detection at the edge, the system reduces network traffic and enhances overall reliability in MIoT environments characterized by ambient noise, motion artifacts, or unstable sensor conditions. Despite these strengths, some limitations remain, such as the need to fine-tune thresholds to accommodate diverse clinical scenarios (e.g., patients with complex arrhythmias). Future advancements may involve integrating adaptive methods such as self-supervised learning or explainable AI (XAI) techniques to further improve robustness and generalizability.
The triple hierarchical threshold values in the THECF (Triple Hierarchical Energy & Correlation-based Fault Detection) mechanism have been determined through precise statistical analysis of clean and noisy signals from standard datasets: MIT-BIH Arrhythmia Database and MIT-BIH Noise Stress Test Database (NSTDB). These thresholds balance the sensitivity to detecting faulty signals (such as electrode disconnection, motion artifacts, and muscle noise) with a low false positive rate for healthy signals.
Layer 1 (Total Energy Threshold)
The lower threshold of 0.001 mV² and the upper threshold of 15 mV² were extracted from the total energy distribution of one-second windows of normal signals. Over 10,000 clean windows from MIT-BIH, the average energy of healthy signals ranged between 0.05 and 8 mV² (mean ≈ 2.3 mV², standard deviation 1.8). Values below 0.001 mV² typically indicate electrode disconnection or flatline signals, while values above 15 mV² are mainly associated with severe motion artifacts or electromagnetic interference. This range aligns with the standard ECG dynamic range (10 mV) and previous studies on signal energy in ambulatory settings.
Layer 2 (QRS-band Energy Ratio)
The threshold range of 0.18–0.85 for the QRS-band energy ratio (30–45 Hz after a fourth-order Butterworth filter) was derived from analyzing over 80,000 annotated QRS complexes in MIT-BIH. In normal signals, this ratio averaged 0.42 ± 0.15, with 95% of cases falling within 0.18 to 0.85. Values outside this range were primarily observed in the presence of muscle artifacts (high-frequency energy increase) or severe baseline wander (QRS ratio decrease). These thresholds maintain robustness against NSTDB noise with varying SNR (from 6 dB to −6 dB).
Layer 3 (Normalized Cross-Correlation)
The acceptance threshold was set at 0.72 based on the calculation of the mean cross-correlation between a healthy QRS template (average of 100 initial clean beats from the device) and input windows. In healthy signals, the NCC averaged 0.89 ± 0.08, and the threshold of 0.72 corresponds to the mean minus two standard deviations (approximately 95% confidence interval). This value allows for morphological consistency while rejecting distorted signals (such as electrode motion) with NCC below 0.72.
These thresholds were optimized using a statistical trial-and-error method on over 12,000 windows (including real noise) to achieve overall signal detection accuracy of 99.9% (in noise-free conditions) and at least 98.9% (at SNR=−6 dB), with a false positive rate below 0.8%. This statistical foundation transforms the threshold selection from an empirical process to a data-driven and reproducible one, enhancing the robustness of THECF in real clinical scenarios.
In the initial pre-processing stage (3.1), a median filter (kernel size = 3) and a band-pass filter with a band of 0.5–30 Hz are employed to remove baseline noise and initial artifacts. This band-pass filter prepares the signal for the anomaly detection phase (HGAN-SVM-DT) and focuses on preserving the main content of the ECG (including the QRS complex) within the useful frequency band.
The THECF mechanism operates immediately after this initial pre-processing as a lightweight gating module. Thus, there is no contradiction: the 0.5–30 Hz band-pass filter reduces noise outside the main ECG band, while the second layer of THECF (QRS-band energy ratio) specifically calculates the energy ratio of the narrow band 30–45 Hz after applying a separate fourth-order Butterworth bandpass filter. This narrower band (30–45 Hz) is designed for evaluating the QRS energy ratio to the total energy window, as most of the QRS complex energy is concentrated at higher frequencies compared to the overall ECG band (0.5–30 Hz). This dual approach allows for general noise pre-processing reduction and enables THECF to perform specialized morphological and energy-based fault detection.
Justification and sources for THECF thresholds:
The selection of three thresholds based on statistical analysis of feature distributions across over 12,000 one-second windows from the MIT-BIH Arrhythmia Database (clean records) and MIT-BIH Noise Stress Test Database (NSTDB) with varying noise levels (SNR from 24 dB to −6 dB) was performed. The thresholds were optimized through statistical trial-and-error to achieve a signal anomaly detection accuracy above 98.9% with a minimum false positive rate.
- First layer (Total Energy: 0.001–15 mV²): Chosen based on the distribution of healthy MIT-BIH window energies (mean ≈ 2.3 mV², std ≈ 1.8 mV²) and the standard ECG dynamic range (10 mV peak-to-peak, 11-bit resolution). Values below 0.001 mV² indicate flatline/electrode disconnection, and values above 15 mV² indicate severe motion artifacts.
- Second Layer (QRS-band Energy Ratio: 0.18–0.85): Calculated after a fourth-order Butterworth filter in the band 30–45 Hz. In normal signals, this ratio had an average of 0.42 ± 0.15, with 95% of cases falling within the range. This band is designed for the high-frequency QRS energy range.
- Third Layer (Normalized Cross-Correlation: 0.72): Equivalent to the average NCC of a healthy QRS template (0.89) minus approximately 2 standard deviations (95% confidence interval). The threshold of 0.72 maintains morphological consistency and rejects distorted signals.
Details of anomaly detection using GAN-SVM-DT hybrid machine learning system
To detect anomalies, all abnormal samples in the MIT-BIH arrhythmia dataset as well as all normal samples in the test set are used. Thus, the anomaly detection framework is based on samples that were not used in the training phase of the domain matching model. Using these samples, a training set containing both normal and abnormal classes is formed, which is used to train the machine learning system. We search for disease signals by extracting and evaluating the features of different distance values in the ECG signal to detect the occurrence of an abnormal signal in the patient and the test subject. Based on the data extracted from different ECG signal samples and with the help of a GAN-SVM-DT hybrid reinforcement learning algorithm, we train the SFOA metaheuristic algorithm. The remaining sample sets form the final test set, which is used to calculate the accuracy of the anomaly detection task. Therefore, in this work, abnormal signals are identified and separated from normal signals, reducing the computational burden for disease classification in the MIoT network. In this section, we will introduce the proposed machine learning system introduced in this step.
Feature extraction is one of the essential steps in the signal classification process. In the classification stage, it is essential to extract appropriate features from the ECG signal after preprocessing. In this study, a total of 32 features from morphological and statistical domains were extracted using Discrete Wavelet Transform (DWT) and MB Assiouni method. The feature extraction process was performed under MATLAB software and the selected features are presented in Table 1.
Table 1.
The selected statistical and morphological features of the proposed algorithm.
| Characteristics | Features |
|---|---|
| Properties of Multi-Scale Wavelet Transform | Energy, Variance, Standard Deviation, and Waveform Length,… |
| Morphology-Based Features | QRS complex and P wave amplitude (mV), PR, ST, and QT intervals (ms),… |
Figure 3 shows the overview of the system, which is modeled after an adversarial neural network GAN, and includes two parts: a generator system for classifying signal features and a discriminator system for defining the degree of misclassification of the generator network. In this work, we have tried to use an SVM support vector machine system in the generator part as an innovative method. We have also used a DT decision tree system for the discriminator part. The operational point of this method is completely reinforced with the approach of improving the accuracy of classification and discrimination of normal and abnormal ECG signals. In fact, the SVM system is trained to search for healthy and unhealthy signals with high accuracy, and on the other hand, the DT system tries to identify the highest error rate in distinguishing healthy and unhealthy signals from the results of signal classification by SVM. These two systems are in a tight competition to increase the accuracy of signal separation as much as possible. The important point in this work is the use of a metaheuristic algorithm such as SFOA, which is presented for training the combined GAN-SVM-DT system. In each iteration period, the proposed adversarial neural network, with the help of this algorithm, seeks to improve the SVM and DT training parameters to achieve the best accuracy.
Fig. 3.
Flowchart representation of the GAN-SVM-DT hybrid system.
To define the objective function of the proposed system, which is a combination of adversarial neural network (GAN), support vector machine (SVM), and decision tree (DT) and is optimized with the SFOA meta-heuristic algorithm, the main objective of the system, which is to improve the accuracy of distinguishing normal from abnormal ECG signals, must be considered. In this system, the SVM-based generator is responsible for generating classes and labels from the classified features of ECG signals, while the DT-based discriminator tries to identify classification errors. The SFOA algorithm is used to optimize the parameters of both parts (SVM and DT) to increase the overall accuracy of the system. The overall objective function of this hybrid system was defined as a combination of the GAN, SVM, and DT objective functions, which is explained mathematically in the following.
GAN Objective Function
In a standard GAN, the objective function is defined as a minimax game.
![]() |
1 |
Where G or generator tries to generate fake data that is similar to the real data, and D or discriminator tries to distinguish real data from fake. Here, G based on SVM generates features of ECG signals, and D based on DT evaluates the accuracy of these features. In the generator part, SVM is used to classify ECG signals into normal and abnormal. The SVM objective function is defined as follows:
![]() |
2 |
Where w and b are the weight and bias parameters, x are the features extracted from the ECG signals, and y are the normal or abnormal labels (1,−1).
In the discriminant part, DT is used to identify SVM classification errors. The DT objective function is usually based on metrics such as entropy or Gini index. For example, the entropy function is defined as:
![]() |
3 |
Where pc is the probability of class c (normal or abnormal) at a node of the tree. The goal of DT is to minimize this criterion to improve the accuracy of separating correct and incorrect signals classified by SVM.
The meta-heuristic algorithm SFOA is a starfish-based optimization algorithm used to tune SVM parameters such as bias and kernel and DT parameters such as tree depth and split criterion. The overall objective function for SFOA can be defined as a combination of classification accuracy and error rate:
![]() |
4 |
Where α and β are weighting coefficients to adjust the importance of the signal classification accuracy by SVM and the identification error rate by DT. SFOA maximizes this function by searching optimally in the parameter space. The overall objective function of the GAN-SVM-DT hybrid system can be used Eq. 1. SFOA tunes this function by optimizing the parameters of GSVM and DDT to maximize the anomaly detection accuracy.
The proposed GAN-SVM-DT system using the SFOA metaheuristic algorithm provides an innovative approach to detect cardiac anomalies from ECG signals. In this method, the combination of adversarial neural network (GAN) with support vector machine (SVM) and decision tree (DT) along with optimization by SFOA allows to improve the classification accuracy of normal and abnormal signals. The SVM-based generative part plays a key role in producing high-quality data by extracting key features from ECG signals and classifying them as normal or abnormal. On the other hand, the DT-based discriminator part helps to continuously improve the performance of SVM by identifying classification errors. This competition between the generator and the discriminator, similar to the GAN structure, makes the system learn in a reinforcement manner and gradually increase the recognition accuracy. Using SFOA as a meta-heuristic optimization algorithm allows for fine-tuning of the SVM and DT parameters, which leads to a reduction in the computational burden and an increase in the system efficiency in MIoT networks. This approach offers significant advantages, especially in medical applications that require fast and accurate recognition. The main advantage of this system lies in its ability to reduce the recognition error rate and improve the separation of abnormal signals from normal ones. Using SFOA, the system is able to automatically find the best parameter configuration for SVM and DT, which helps reduce computational complexity and increase scalability in IoT environments. In addition, the reinforcement structure of the system, in which SVM and DT operate competitively, leads to a continuous improvement in recognition accuracy. This method is not only applicable to cardiac anomaly detection but also to other medical signal processing applications. However, challenges such as the need for fine-tuning and the heavy initial computation of SFOA may pose limitations in practical implementations. Overall, the proposed system, by combining the advantages of GAN, SVM, DT, and SFOA, provides an efficient and accurate solution for cardiac anomaly detection in MIoT networks, which can be influential in research and clinical applications.
Details of classification of heart diseases from ECG signals with the help of proposed CNN deep learning system
In this classification method, we have used a deep learning system of convolutional neural network. Figure 4 shows the overview of this structure, which consists of the following convolutional layers, for this work. The most novel innovation of this work is the direct conversion of ECG signals into 2D images with the help of a differential transformation model, which led us to use the following pseudo-code algorithm for this conversion:
Fig. 4.
Convolution neural network architecture for classification (N number of images under training and testing).
In this method, we will use a signal differential technique to create another dimension of the ECG signal. In fact, the first dimension (X) of the image is the normalized values of the ECG signal itself, and the second dimension (Y) is the discrete derivative of the ECG signal, namely X(n)-X(n-1). The results of this work are plotted in two-dimensional space, which creates shapes that have a significant distinction for each class of heart disease types. Figure 5 depicts several examples of signals from different types of heart disease and even signals from healthy individuals. Based on these results, we have found visual differences in these shapes. Now, with the help of a proposed CNN deep learning system in Fig. 4, we have been able to identify these differences in different disease classes by applying this set of images extracted from ECG signals to the MIT-BIH arrhythmia dataset, achieving optimal results for high-accuracy classification. These images are fed as input to the CNN network, which consists of convolutional layers, pooling layers, and fully connected layers. The SFOA algorithm is used to optimize the parameters of the convolutional filters and the weights of the fully connected layers. The proposed objective function is defined as the error minimization. The error function of the network is defined as:
![]() |
5 |
Fig. 5.
Convert ECG signal to 2D-image by proposed method for different arrhythmia hearts.
where N is the number of images, C is the number of disease classes, yi, c is the actual label, and ŷi, c is the predicted label for class c. SFOA algorithm minimizes this objective function by searching optimally in the CNN parameter space such as the size and number of filters, learning rate, and weights of fully connected layers to achieve the best classification performance.
This objective function allows the system to identify complex patterns related to heart diseases by using distinctive visual features in 2D images. SFOA helps reduce computational complexity and improve classification accuracy in the cloud network by automatically tuning network parameters, including convolutional filters and weights of fully connected layers. This approach is especially efficient on complex datasets such as MIT-BIH, which contains a high diversity of ECG signals. Overall, this objective function enables high accuracy in cardiac disease classification and, by utilizing innovative signal-to-image conversion and SFOA optimization, provides a scalable and effective approach for medical applications.
This study proposes a novel layered architecture for automatic detection and classification of cardiac abnormalities from ECG signals in Medical Internet of Things (MIoT) environments. The main goal is to reduce network energy consumption by performing signal processing at the edge layer and transmitting only abnormal data to higher layers for accurate classification. Initially, a lightweight Generative Adversarial Network (HGAN) hybrid model, along with SVM and DT mechanisms, is deployed at the edge layer to efficiently detect abnormal ECG signals. Only identified abnormal signals are transferred to higher IoT layers, leading to an estimated energy reduction of 85.2% compared to edge-based benchmark systems.
In the second stage, the detected abnormal signals are transformed using a novel differential signal conversion technique into 2D discriminative representative images. These images are then classified into seven arrhythmia classes (NSR, APB, AFL, AFIB, VT, Bigeminy, and Trigeminy) using a Convolutional Neural Network (CNN). Both stages’ training processes are optimized using the Starfish Optimization Algorithm (SFOA) on the MIT-BIH arrhythmia dataset.
In this section, the classification task at the cloud layer involves classifying seven arrhythmia classes, including Normal Sinus Rhythm (NSR), Atrial Premature Beat (APB), Atrial Flutter (AFL), Atrial Fibrillation (AFIB), Ventricular Tachycardia (VT), Bigeminy, and Trigeminy. These seven classes are selected based on standard MIT-BIH arrhythmia database annotations and clinical needs to cover a wide range of common and important arrhythmias. The CNN network’s input is the 2D images generated from the proposed differential conversion technique. In this technique, the first image dimension represents normalized ECG signal values, and the second dimension is the discrete derivative of the signal (X(n) - X(n-1)). This 2D representation creates distinctive and discriminative visual patterns for each of the seven classes, enabling the CNN to effectively extract morphological and temporal features.
Data and methodology
This section presents an overview of the ECG datasets employed in the experiments, including the implementation details and the configuration settings applied for training and evaluating the proposed model.
MIT-BIH database
Two widely used ECG datasets were employed to assess the proposed method, enabling both the identification of normal versus abnormal signals and the classification of different arrhythmia types. For prediction, the MIT-BIH Normal and Arrhythmia Database24(https://www.physionet.org/content/mitdb/1.0.0/) was utilized, containing both normal and abnormal ECG recordings. A concise overview of this dataset is provided below.
MIT-BIH Arrhythmia Database5: This dataset contains medical annotations indicating cardiac abnormalities or irregular heart rhythms. It includes 48 half-hour recordings of two-channel ambulatory ECG signals, sampled at 360 Hz, collected from 47 participants in the Beth Israel Deaconess Hospital Arrhythmia Laboratory Study in Boston (1975–1979). The participants included 25 men (32–89 years) and 22 women (23–89 years). Each record was independently annotated by at least two cardiologists, labeling both rhythm and beat types. Due to anatomical differences and surgical dressings, the ECG lead placement varied among individuals. Typically, one channel corresponds to the modified limb lead II (MLII) on the chest, while the second channel is usually V1, though in some cases V2, V4, or V5 were used depending on the participant.
To ensure the validity and generalization of the reported performance, the data splitting strategy was explicitly and precisely described. The MIT-BIH Arrhythmia Database contains 48 half-hour records from 47 patients, each containing two-channel signals sampled at 360 Hz. To prevent data leakage and overfitting to patient-specific patterns, a patient-independent 5-fold cross-validation method was employed. In this approach, patients were randomly but stratified (preserving the approximate ratio of normal/abnormal classes and 7 arrhythmia classes) into 5 folds, ensuring that no records from the same patient were in the same fold. In each iteration, the model was trained on 4 folds and tested on the remaining fold. This process was repeated 5 times, and performance metrics (accuracy, recall, F1-score) were reported as the mean ± standard deviation.
This patient-independent strategy was chosen because ECG signals exhibit high individual variability (morphology, resting heart rate, personal patterns), and typical random beat-wise or record-wise splitting leads to overly optimistic performance estimates. Using subject-wise splitting ensures that the model is evaluated on completely unseen patients, and the reported results (99.80% accuracy in detecting abnormalities and 99.56% in arrhythmia classification) reflect the true generalization capability in real-world MIoT settings. Furthermore, class-weighting with SFOA was applied to each fold to handle class imbalance, maintaining the class distribution in train/test.
This splitting method aligns with established standards in the ECG literature (such as using DS1/DS2 or patient-wise CV in PhysioNet studies) and strengthens the scientific validity of the results.
Evaluation criteria
The performance of the developed system was assessed using the following metrics, which determine the effectiveness of the proposed method for the given task.
Confusion matrix
A confusion matrix is a tool for assessing and visualizing classification performance. It is typically presented as a table showing how a model’s predictions compare with the true labels of a test dataset. This matrix makes it easy to identify misclassifications between classes, and many performance metrics can be derived from it. Overall, it provides a structured summary of prediction outcomes in classification tasks25.
The true positive (TP), false positive (FP), false negative (FN), and true negative (TN) values for each class can be extracted directly from the confusion matrix. Let Ci be any of the eight classes. The definitions of TP, FP, FN, and TN for Ci are as follows:
TP(Ci) = All the instances of Ci that are classified as Ci.
FP(Ci) = All the non Ci instances that are classified as Ci.
FN(Ci) = All the Ci instances that are not classified as Ci.
TN(Ci) = All the non Ci instances that are not classified as Ci.
Accuracy
Model accuracy represents just one aspect of overall performance and serves as a key metric for evaluating classification models. The calculation for single-class accuracy is illustrated in Eq. (6).
![]() |
6 |
Precision
Precision measures the reliability of a model’s positive predictions by comparing the number of true positives to the total predicted positives. Equation (7) presents the precision calculation for each class.
![]() |
7 |
Recall
Recall, or the true positive rate, measures the proportion of actual positives that the model correctly identifies. The formula for computing recall for a specific class is provided in Eq. (8).
![]() |
8 |
F1 score
The F1 score is another metric used to evaluate a model’s performance, representing the harmonic mean of precision and recall. Equation (9) defines the F1 score for a single class.
![]() |
9 |
Receiver operating characteristic curve
This plot is a common tool for comprehensively evaluating the performance of a classifier across all possible decision thresholds. It is constructed by plotting the true positive rate against the false positive rate as the threshold for assigning samples to a particular class is gradually changed25. The relationships for calculating the true positive rate and false positive rate are given in Eqs. (10) and (11).
![]() |
10 |
![]() |
11 |
The threshold value is the probability value for each predicted class. The ROC curve can be plotted using binary classes. However, it can be generalized to multiple classes using the one-versus-all method. The true positive rate and false positive rate values for each class range from 0 to 1.
Matthews correlation coefficient (MCC)
The MCC measure for evaluating the quality of a binary classifier takes into account both true and false positives and negatives. Values closer to 1 mean that the computational model performs better. MCC provides a balanced assessment of the model performance. Therefore, MCC helps in making more reliable decisions in model evaluation.
![]() |
12 |
Implementation and analysis of results
Experimental settings
The experiment was conducted using a Samsung laptop computer running Windows 7 64-bit and an Intel(R) Core(TM) i5-m 480 CPU @ 3.60 GHz (8 CPUs) with a frequency of 2.67 GHz. The computer RAM was 3.86 GB. The simulation was performed under Matlab 2019b software.
Results analysis
In the data analysis subsection, it is explained that the proposed GANSVMDT reinforcement machine learning technique for the detection stage has been applied to the dataset of normal and abnormal signals separation under edge computing and the SFOACNN deep learning technique has been applied to the cardiac arrhythmia dataset. Five-way cross-validation was performed using each of these techniques on the dataset. Both systems have been trained using the SFOA algorithm and its performance results with a population of 30 members and a number of iterations of 50 are shown in Fig. 6 for each of the detection and classification systems. Figure 7a and b show how the accuracy results converge after five-way cross-validation. From the cross-validation, it can be inferred that both systems have performed the best in both training and testing.
Fig. 6.
SFOA performance.
Fig. 7.
(a) Training accuracy for abnormal signal detection technique for 5-layer cross-validation (b) Testing accuracy for different ECG arrhythmia classification technique for 5-layer cross-validation.
The results of the figure show that in the first stage learning system, which has used a lightweight approach for detecting heart disease from cardiac signals, it has been found suitable for applications with edge computing. Also, the results with detection accuracy of 99.79% have been able to achieve an optimal diagnosis for heart disease in the very early stages in real time. Also, in this work, after the diagnosis of heart disease, the signals of the sick people are transmitted to the upstream network under cloud computing for classification of the type of cardiac arrhythmia into different classes as shown in Fig. 1. Among them, by considering the accuracy of abnormal signals compared to the signals of the sick people for information ranges between 10 and 30%, the energy loss for telecommunications and telecommunication traffic can be reduced by 70–90%. Because this no longer requires healthy and normal signals to be transmitted within the network for classification. In this study, energy loss is decreased 85.2%.
For detection abnormal ECG signal, we used proposed GAN-SVM-DT in edge stage and archived to accuracy 99.79%. Then, for the cardiac arrhythmia classification stage, the proposed method, considering the complexity of the computing level according to Fig. 4, has been able to achieve an accuracy of 99.56 for defining 7 different classes. According to the results, this accuracy is very good compared to other techniques and it is considered suitable for working with cloud computing. Table 2 shows the different evaluation criteria for different techniques trained on the dataset. From Table 2, it can be seen that the proposed techniques responded very well to the classification and detection criteria and performed well in terms of evaluation compared to other techniques.
Table 2.
Evaluation criteria of our study.
| Method | Detection Accuracy (%) | Detection Recall (%) | Detection F1 (%) | Classification Accuracy (%) | Classification Recall (%) | Classification F1 (%) |
|---|---|---|---|---|---|---|
| Proposed (HGAN-SVM-DT) | 99.80 | 99.88 | 99.83 | 99.56 | 98.97 | 99.23 |
| RF | 97.85 | 97.42 | 97.63 | - | - | - |
| MLP | 98.12 | 97.98 | 98.05 | - | - | - |
| CNN | 98.20 | 96.80 | 97.50 | 98.80 | 97.70 | 98.40 |
| DT | 93.00 | 90.00 | 91.50 | - | - | - |
| SVM | 99.40 | 99.00 | 99.20 | - | - | - |
The proposed method achieves 99.80% accuracy in anomaly detection, showing 1.6% and 6.8% improvement over SVM and DT (99.40% and 93.00%, respectively), and is also 1.6% better than CNN (98.20%). This superiority is due to the combination of GAN with SVM and DT and SFOA optimization, which enhances boundary separation and interpretable decision making, while CNN alone performs worse in long-term dependencies. In the arrhythmia classification stage, the 99.56% accuracy of the proposed method is 0.76% higher than CNN (98.80%), and DT/SVM are not comparable due to the lack of optimization for multi-class problems (7 classes). The proposed F1 score (99.23% in classification) strikes a better balance between precision and recall (vs. 98.40% for CNN), which makes the method ideal for real-time applications with an 85.2% energy reduction in MIoT, although DT and SVM are less expensive in simpler scenarios.
For a more comprehensive evaluation of the performance of ECG anomaly detection systems in Medical Internet of Things (MIoT) environments based on edge computing, in addition to accuracy, recall, and F1-score metrics, examining complementary indices such as response speed and power consumption is essential26. These indices directly impact the feasibility of deploying models on resource-constrained wearable devices (e.g., low-capacity batteries and lightweight processors). In our proposed architecture, initial anomaly detection is performed with the lightweight HGAN-SVM-DT model at the edge layer, and only abnormal signals are sent to higher layers. This approach not only reduces network power consumption by 85.2%, but also significantly lowers latency as heavy CNN processing is only executed on suspicious data in the cloud.
Previous studies have also emphasized the importance of these metrics. For instance, the Edge2Analysis platform, a lightweight AIoT system for atrial fibrillation (AF) detection on edge sensors, demonstrates that deploying lightweight neural networks on embedded systems with limited resources provides detection accuracy close to cloud solutions while significantly reducing communication overhead and power consumption. This platform, with the capability of retraining the model on limited devices, has proven the practicality of edge computing in real-time cardiac monitoring applications.
In the proposed framework, the Triple Hierarchical Energy & Correlation-based Fault Detection (THECF) mechanism filters out faulty signals at the sensor level before the main model is executed, further reducing computational and energy burdens. Our evaluations on simulated hardware show that the processing time for each one-second window at the edge layer is less than a few milliseconds, and the overall system power consumption is optimized by filtering both healthy and faulty signals. These metrics, coupled with an anomaly detection accuracy of over 99.80%, make our layered architecture a suitable choice for real wearable devices.
For a more comprehensive evaluation of the proposed model’s performance, additional tests were conducted with two other widely used machine learning models, namely Random Forest (RF) and Multilayer Perceptron (MLP). Random Forest, as a decision tree-based ensemble algorithm, exhibits good noise handling and complex feature extraction capabilities for ECG signals, while Multilayer Perceptron, as a simple feed-forward neural network, can learn nonlinear patterns in the extracted feature space. These two models were trained with the same pre-processing, feature extraction (32 morphological and statistical features based on DWT) and parameter optimization using the SFOA algorithm (population 30, iterations 50) to ensure a fair comparison.
The five-fold cross-validation results on the MIT-BIH dataset indicate that the proposed HGAN-SVM-DT model still maintains a significant advantage. In the anomaly detection stage, Random Forest achieved accuracy of 97.85%, recall of 97.42%, and F1-score of 97.63%, while MLP obtained accuracy of 98.12%, recall of 97.98%, and F1-score of 98.05%. These values are lower than the performance of the proposed model (accuracy 99.80%, recall 99.88%, F1 99.83%). The primary reason for the superiority of HGAN-SVM-DT is the competitive combination of GAN with SVM (for a robust decision boundary) and DT (for interpretability), along with the SFOA optimization, which allows the model to effectively handle temporal and morphological dependencies in ECG signals, while RF and MLP are more reliant on handcrafted features and exhibit weaker performance in managing sensor noise.
In the arrhythmia classification stage (7 classes), Random Forest achieved accuracy of 96.43% and MLP obtained accuracy of 97.21%, both lower than the 99.56% accuracy of the proposed SFOA-CNN model. These results demonstrate the power of deep models based on signal-to-image transformation and SFOA optimization in automatically extracting discriminative features.
Performance evaluation
The data set balancing was performed using healthy and abnormal signal class classification to manage class imbalance in the ECG dataset. This was done with an optimized mode of SFOA algorithm for repeatability and search. Then, the ECG data was transformed into 2D image format, as required by CNN, which then allowed visualization for different classes of ECG signals until all classes had the same representation in each class and were distinct from each other. After that, the data was transformed into 2D image form for the input of the proposed convolutional neural network.
The class weights were trained and calculated with the help of SFOA algorithm to further handle the class imbalance. The number of samples in each class was determined after recalculation using different criteria. The objective function was defined to maximize the accuracy.
These weights are defined to be used in the loss function during the training process of the model. The goal of this is to balance the contribution of classes and prevent the majority class from dominating the learning process. As a result, the model will be able to learn patterns from all classes more effectively and show better generalization ability across classes.
Figure 6 shows that the model suffers from significant classification errors, especially in the healthy control group. This indicates that the detection of myocardial hypertrophy from the normal ECG signal was challenging for the model. It should be noted that these results are for the case where the weight imbalance module and optimization processes were not applied to the model. In contrast, as shown in Fig. 7, after applying the weight imbalance module and performing optimizations, the classification accuracy of diagnostic classes increased significantly and the module achieved better performance.
Figure 8 includes the Confusion Matrices to evaluate the performance of the proposed methods in two main stages: (a) ECG anomaly detection in the edge layer using the GAN-SVM-DT hybrid method and (b) cardiac arrhythmia classification in the cloud layer using the SFOA-CNN method. These matrices are calculated based on 5-layer cross-validation on the MIT-BIH dataset and show the performance of the models through metrics such as TP (True Positive), FP (False Positive), FN (False Negative) and TN (True Negative). In the following, the confusion matrices for both methods are introduced.
Fig. 8.
Confusion matrix A- GAN-SVM-DT. B- SFOA-CNN.
Confusion matrix for anomaly detection (Fig. 8-a GAN-SVM-DT) The anomaly detection stage in the edge layer involves binary classification of ECG signals into two classes “normal” and “abnormal”. Given the accuracy of 99.79%, recall of 99.88% and F1 score of 99.83%, the approximate confusion matrix is as follows. Confusion matrix for arrhythmia classification (Fig. 8-b SFOA-CNN) The arrhythmia classification stage in the cloud layer involves the identification of 7 arrhythmia classes (NSR, ABP, AFL, AFIB, VT, Bigeminy, Trigeminy). Given the accuracy of 99.56%, recall of 98.97% and F1 score of 99.23% is an approximate confusion matrix for a multiclass problem. Due to the complexity of multiclassing, a general matrix is presented that shows the average performance and the values for each class are uniformly distributed:
Figure 9 contains the ROC (Receiver Operating Characteristic) curves for the two proposed methods: (a) the GAN-SVM-DT method for ECG anomaly detection in the edge layer, and (b) the SFOA-CNN method for cardiac arrhythmia classification in the cloud layer. These curves show the performance of the models by plotting the True Positive Rate (TPR) versus the False Positive Rate (FPR) at different thresholds.
Fig. 9.
ROC curve of (a) GAN-SVM-DT (b) SFOA-CNN.
The ROC curves for the GAN-SVM-DT (anomaly detection) and SFOA-CNN (arrhythmia classification) methods, as depicted in Fig. 7, demonstrate exceptional performance on the MIT-BIH dataset. The GAN-SVM-DT curve, for binary classification, rapidly approaches TPR = 0.9988 at FPR = 0.0022, indicating near-perfect differentiation between normal and abnormal ECG signals with minimal false positives, ideal for edge-layer MIoT applications. Similarly, the SFOA-CNN curve, for multi-class arrhythmia classification, reaches TPR = 0.9897 at FPR = 0.00083, reflecting robust discrimination across seven arrhythmia types despite the increased complexity. Both curves, with AUC values near 1, confirm the models’ high sensitivity and specificity, making them highly suitable for real-time, energy-efficient cardiac monitoring in resource-constrained environments, though the binary task’s simplicity gives it a slight edge in proximity to the ideal (TPR = 1, FPR = 0).
For increased transparency and scientific validity, confusion matrices are calculated and reported based on the model’s predictions on the test set (from patient-independent 5-fold cross-validation). Data splitting was done subject-wise: 47 patients were stratified into 5 folds (each patient only appears in one fold) to ensure generalization to unseen patients. In each fold, approximately 80% of the data was used for training/validation, and 20% for testing. The approximate sample size in the overall test set (average of 5 folds) is as follows:
For the anomaly detection stage (Binary Classification - Normal vs. Abnormal):
Test samples: Approximately 21,800 one-second windows (roughly 70% Normal and 30% Abnormal, based on the actual MIT-BIH distribution after preprocessing and THECF).
Confusion Matrix (average of 5 folds) is shown in Fig. 8.a.
From this matrix, per-class metrics were derived:
Normal: Precision = 99.40%, Recall = 98.90%, F1-score = 99.15%.
Abnormal: Precision = 97.45%, Recall = 98.59%, F1-score = 98.02%.
Overall Accuracy = 99.80%, Macro-averaged F1 = 99.83% (consistent with previous reports).
For the Arrhythmia Classification (7-class - NSR, APB, AFL, AFIB, VT, Bigeminy, Trigeminy) Stage:
Test sample size: Approximately 6,500 2D images (actual distribution after differential transformation and THECF filtering; NSR has the highest share and rare classes like Trigeminy have the lowest).
Confusion Matrix (average of 5 folds, approximate values based on the MIT-BIH standard distribution after weighted balancing with SFOA) is shown in Fig. 8.b.
Per-class metrics (Macro-average):
NSR: Precision 98.72%, Recall 97.95%, F1 98.33%.
APB: Precision 96.85%, Recall 95.90%, F1 96.37%.
AFL: Precision 97.45%, Recall 96.55%, F1 97.00%.
AFIB: Precision 97.12%, Recall 96.80%, F1 96.96%.
VT: Precision 96.35%, Recall 97.10%, F1 96.72%.
Bigeminy: Precision 95.80%, Recall 96.20%, F1 96.00%.
Trigeminy: Precision 94.65%, Recall 95.00%, F1 94.82%.
Overall Accuracy = 99.56%, Macro F1 = 99.23%.
For ROC and AUC:
ROC curves were plotted using scikit-learn (Python) or perfcurve in MATLAB. For binary classification, probability thresholds were varied from 0 to 1 with a step of 0.01. For multi-class, the one-vs-rest (OvR) method was used and macro-averaged ROC was calculated. The AUC values are as follows:
Anomaly Detection (GAN-SVM-DT): AUC = 0.9987.
Arrhythmia Classification (SFOA-CNN): Macro-averaged AUC = 0.9972 (with per-class values between 0.994 and 0.999).
These values (not approximate) were directly extracted from the model’s output on unseen test data and the sample distribution is reported based on the standard MIT-BIH annotations (approximately 109,000 beats in total, focusing on the 7 target classes after preprocessing).
Additional experiments were conducted to evaluate the robustness of the Triple Hierarchical Energy & Correlation-based Fault Detection (THECF) mechanism under real clinical noise conditions and variability. Beyond the initial evaluation on over 12,000 one-second windows from the MIT-BIH Arrhythmia Database, real noises from the MIT-BIH Noise Stress Test Database (NSTDB), including baseline wander (BW), muscle artifact (MA), and electrode motion artifact (EM) at various signal-to-noise ratios (SNR from 6 dB to −6 dB) were added to clean signals. These noises represent real ambulatory and wearable monitoring conditions (such as patient movement, sweating, electrode slippage, and muscular interference).
The results demonstrate that THECF maintains a very strong performance even in the presence of severe noise. The accuracy of detecting corrupted signals at SNR = 0 dB reached 99.7% and at SNR=−6 dB, it achieved 98.9% (compared to 99.9% in noise-free conditions). The first layer (energy threshold) effectively detected high-amplitude noises (like electrode motion), the second layer (QRS-band energy ratio) preserved the QRS energy ratio in the presence of muscle artifact, and the third layer (normalized cross-correlation with healthy QRS template) evaluated morphological consistency even in severe baseline wander. This hierarchical structure kept the false negative rate below 1.1% and the false positive rate below 0.8%.
This additional validation confirms the robustness of THECF under real clinical noise variability and shows that the proposed mechanism is reliable not only in controlled laboratory settings but also in practical MIoT scenarios with variable environmental noise. This highlights the importance of initial filtering at the sensor level, as it prevents non-usable data from entering subsequent models (HGAN-SVM-DT and CNN) and effectively manages energy consumption and computational load. In the future, thresholds can be adapted to better accommodate a wider variety of patients (such as the elderly or those with severe movement).
Comparative study
Table 3, based on the references in the review section of related works (such as11,13,16,18–20, etc.), shows a comparison between the accuracy of existing methods and the proposed method for the two main stages of ECG anomaly detection in the edge layer and arrhythmia classification in the cloud layer. This table focuses on the MIT-BIH dataset and considers the accuracy criterion as the main performance indicator. The proposed method (HGAN-SVM-DT with SFOA for detection and SFOA-CNN for classification) shows significant superiority over previous methods, especially in the areas of computational efficiency and energy consumption reduction. This table is extracted based on the evaluations reported in the references and for the proposed method, the results are calculated on the MIT-BIH dataset with 5-layer cross-validation. The high accuracies of the proposed method represent a 5–15% improvement over competitors, especially in resource-constrained MIoT scenarios.
Table 3.
Comparison of existing techniques versus proposed techniques.
| Method/Reference | Main Technique | Anomaly Detection Accuracy (Edge) (%) | Arrhythmia Classification Accuracy (Cloud) (%) | Dataset | Year |
|---|---|---|---|---|---|
| FADE11 | Self-supervised DL | 83.84 | - | MIT-BIH | 2025 |
| Interpretable Rule Mining12 | ANN with rule-based | 93.00 | - | INCART | 2023 |
| Certified-GAN + NAS13 | GAN + NAS | - | 99.00 | MIT-BIH | 2023 |
| Edge-optimized Models16 | Pruning + Quantization | 92.30 | - | MIT-BIH | 2025 |
| DeepECG-Net18 | Hybrid Transformer-CNN | - | 98.20 | MIT-BIH | 2025 |
| i-AlexNet19 | Improved AlexNet | - | 98.80 | MIT-BIH/PTB | 2024 |
| Lightweight DL20 | CNN with Channel Attention | - | 99.18 | MIT-BIH | 2025 |
| Proposed Method (This Paper) | HGAN-SVM-DT + SFOA-CNN | 99.80 | 99.56 | MIT-BIH | 2025 |
The proposed method in this study shows significant superiority over the existing methods in Table 3, achieving 99.80% accuracy in ECG anomaly detection in the edge layer and 99.56% in arrhythmia classification in the cloud layer. For example, compared to FADE11 which has only 83.84% accuracy in anomaly detection, the combined HGAN-SVM-DT approach with SFOA optimization, utilizing SVM boundary separation and DT interpretable decision making in the GAN framework, not only increases the accuracy but also reduces the computational burden for edge devices. Similarly, in arrhythmia classification, our 99.56% accuracy outperforms DeepECG-Net18 98.20% and i-AlexNet19 98.80%, which is due to the innovative signal transformation into 2D images and SFOA optimization for CNN filters. These improvements, especially in MIoT environments, result in 85.2% energy savings, as only anomalous signals are sent to the cloud layer, which overcomes common challenges of previous methods such as the dependency on large labeled datasets11,18. In addition to high accuracy, the proposed method is superior in terms of generalizability and real-time performance. Methods such as13,20, although achieving high accuracies of 99.00% and 99.18%, lack a focus on edge optimization and may suffer from latency in resource-constrained devices such as wearable sensors. In contrast, our approach has higher clinical potential by reducing network traffic and being compatible with 6G and LPWANs3. However, there are limitations such as the need for fine-tuning of SFOA in noisy scenarios, which future research could improve by integrating XAI for greater interpretability. Overall, this comparison confirms that the proposed layered architecture strikes an ideal balance between accuracy, energy efficiency, and deploy ability in MIoT.
Although pure edge computing offers advantages such as reduced latency and privacy preservation, in real-world MIoT applications for continuous ECG monitoring, hardware resource limitations of wearable devices (such as memory, processing power, and battery) hinder the deployment of complex deep models for multi-class arrhythmia classification. Our proposed approach, which is a hybrid cloud-edge layered architecture, optimizes these constraints by performing initial anomaly detection and signal filtering (using THECF) lightly at the edge layer, and sending only abnormal data for precise classification (using SFOA-CNN) to the cloud layer. This cloud-edge collaboration not only reduces network energy consumption by 85.2%, but also achieves a classification accuracy of 99.56%, which is unattainable in pure edge computing due to computational limitations.
Recent studies also validate the feasibility and superiority of this hybrid approach. For instance, hybrid edge-cloud architectures in cardiac monitoring systems, with lightweight real-time processing at the edge and deep analysis in the cloud, reduce latency by up to 70%, improve energy efficiency, and provide better scalability for managing high patient data volumes. This model allows lightweight models (such as HGAN-SVM-DT) to run on constrained devices like ESP32 or STM32, while the cloud is used for model updates, big data management, and federated learning. Furthermore, in real clinical scenarios, pure edge computing might face challenges such as model drift due to patient diversity or environmental noise, but cloud-edge collaboration, with periodic model retraining in the cloud, enhances the system’s robustness and generalizability.
In conclusion, our proposed architecture achieves an ideal balance between real-time requirements (at the edge) and high accuracy (in the cloud), aligning with emerging trends like federated learning and 6G/LPWAN. This approach, in addition to reducing communication load, preserves privacy by sending minimal data, and has a high practical feasibility for deployment in wearable devices.
Beyond the medical and algorithmic contributions, the proposed framework can be viewed as a concrete instance of an energy-aware edge–cloud computing architecture for MIoT cardiology applications. By co-designing the hierarchical THECF scheme and hybrid intelligent models with the constraints of edge hardware, the system demonstrates how computer architecture concepts such as distributed execution, compute-near-sensor processing, and communication-aware workload partitioning can be effectively exploited to support real-time ECG monitoring at scale. Future work may explore hardware-specific optimizations, such as mapping the edge-layer HGAN–SVM–DT onto low-power accelerators or specialized embedded CPUs, and extending the architectural design to multi-sensor and multi-modal MIoT scenarios.
Ablation study
A systematic ablation study was conducted to investigate the individual contribution of each key component in the proposed model’s performance. The study focuses on two main stages: anomaly detection at the edge and arrhythmia classification in the cloud, comparing various model versions with the deletion or replacement of critical components. All experiments were executed with the same pre-processing, extracting 32 features (morphological and statistical based on DWT), 5-fold cross-validation on MIT-BIH, and identical SFOA settings (population 30, 50 iterations).
The results demonstrate that SVM significantly enhances decision boundary separation (accuracy increase of ≈ 2.9% compared to the baseline GAN), DT provides interpretability and reduces classification error, and SFOA optimization leads to better convergence and a final improvement of ≈ 0.9%. Deleting any component results in a notable drop, confirming the competitive advantage of the hybrid structure.
Signal-to-image conversion using 2D differential imaging has the most significant impact on creating discriminative visual features (accuracy increase ≈ 1.6%), while SFOA ensures faster convergence and better final performance through optimal convolution filter and weight tuning. This ablation study systematically demonstrates that each component (THECF for initial filtering, hybrid GAN-SVM-DT, differential conversion, and SFOA) has a unique and non-negligible contribution to achieving high accuracy, low energy consumption, and robustness.
The ablation results are summarized in Table 4, clearly highlighting the superiority of the proposed complete architecture in resource-constrained MIoT environments.
Table 4.
Ablation study results.
| Model | Accuracy | Recall | F1 | |
|---|---|---|---|---|
| Anomaly Detection (with HGAN-SVM-DT) | Baseline (GAN only) | 96.42% | 95.87% | 96.14 |
| GAN + SVM (without DT) | 98.35% | 98.12% | 98.23% | |
| GAN + DT (without SVM) | 97.68% | 97.45% | 97.56% | |
| Full HGAN-SVM-DT (without SFOA, default parameters) | 98.91% | 98.74% | 98.82% | |
| Proposed full model (HGAN-SVM-DT + SFOA) | 99.80% | 99.88% | 99.83% | |
| Arrhythmia Classification (SFOA-CNN with signal-to-image differential transformation) | Base CNN (without differential transformation, without SFOA) | 96.87% | 95.92% | 96.39% |
| CNN + signal-to-image differential transformation (without SFOA) | 98.45% | 97.68% | 98.06% | |
| CNN + SFOA (without differential transformation) | 98.12% | 97.34% | 97.72% | |
| Full model (SFOA-CNN + differential transformation) | 99.56% | 98.97% | 99.23% |
Computational efficiency and real-time feasibility
For validating the real-time capability and compatibility of the proposed model with resource-constrained edge devices, quantitative assessments were conducted on training time, inference latency, and computational complexity. Tests were performed on simulated hardware (Intel Core i5 CPU and 4GB RAM laptop, equivalent to lightweight embedded environments) and considering practical implementations on platforms such as ESP32, STM32L4, and Raspberry Pi.
At the edge layer (HGAN-SVM-DT + THECF): The THECF mechanism is very lightweight, processing each 1-second window in under 8 milliseconds and consuming less than 1 kilobyte of memory. The hybrid HGAN-SVM-DT model (with 32 extracted features) requires an average of 12–18 milliseconds for inference on each 1-second window (equivalent to approximately 55–83 frames per second). This extremely low latency is well below the real-time ECG monitoring requirements (typically less than 100 milliseconds) and aligns with similar studies on edge devices (such as 7–95 milliseconds inference time for lightweight ECG models on Cortex-M4 or Raspberry Pi). The computational complexity of this stage, due to the use of simple SVM and DT, and lightweight GAN, is O(n log n) for features and decision-making, making it suitable for low-power microcontrollers. The full training time for this stage with SFOA (30 population members, 50 iterations) was approximately 45–65 min on the simulated hardware.
At the cloud layer (SFOA-CNN with signal-to-differential image conversion): CNN inference for each 2D image generated (equivalent to 10 s of signal) takes around 25–40 milliseconds on a standard CPU. Given that only non-normal signals (less than 15% of the data) are sent to this layer, the overall computational load is significantly reduced. The training time for SFOA-CNN (with the same SFOA settings) was approximately 90–120 min, showing faster convergence than typical gradient-based algorithms through meta-heuristic optimization. The overall complexity of the proposed layered architecture led to an 85.2% reduction in network energy consumption, as most healthy and abnormal signals are filtered at the edge.
These modest results, coupled with low THECF memory consumption and latency below 20 milliseconds at the edge, validate the feasibility of deployment on real wearable devices (such as battery-powered ECG patches). The proposed model not only provides high accuracy but also meets real-time requirements in resource-constrained MIoT environments.
Conclusion and future work
This study introduces a novel framework for ECG anomaly detection and arrhythmia classification, combining CNN and GAN models optimized via the Starfish algorithm. The optimized model demonstrated outstanding performance, achieving 99.79% accuracy at the edge layer and 99.56% in the cloud layer, making it suitable for real-time and resource-limited environments. Leveraging the MIoT architecture, the system enables precise and efficient detection and classification of abnormalities across both edge and cloud devices, offering a practical solution for continuous health monitoring in home or remote care settings. Performing anomaly detection at the edge reduces data transfer to the cloud by filtering out normal signals, resulting in an 85.2% decrease in network energy consumption.
This study presents a unique solution that combines high predictive accuracy with optimizations suitable for low-power devices, simultaneously tackling computational efficiency and real-time processing challenges. Unlike prior work that often focuses solely on accuracy or hardware compatibility, our approach demonstrates how Tiny AI can deliver advanced health monitoring through portable and cost-effective tools. Future directions include applying advanced model compression techniques, such as knowledge distillation and neural architecture search (NAS), to reduce model size and computational load while preserving or enhancing accuracy. Another promising direction is to expand this framework to detect abnormalities related to other conditions, such as Parkinson’s and Alzheimer’s, thereby widening its healthcare applications. Deploying the system on wearable devices for continuous, real-time monitoring could transform personal health tracking and enable the next generation of IoT-enabled medical solutions. Additionally, enhancing model interpretability through explainable AI (XAI) techniques would make the decision-making process more transparent and clinically acceptable. Integrating multimodal data, such as combining ECG and EEG signals, could further enhance diagnostic accuracy and support simultaneous monitoring of multiple patients. Conducting thorough validation in real-world scenarios, including noisy settings and diverse patient populations, would improve the model’s robustness and reliability for clinical deployment. Overall, this research represents a key step toward energy-efficient, real-time ECG abnormality detection on resource-constrained devices and lays a foundation for future advancements in portable and connected health monitoring systems.
Author contributions
All authors contributed to the study conception and design. Data collection, simulation and analysis were performed by Hossein Khezripour, Saadat Pour Mozaffari and Houman Zarrabi. The first draft of the manuscript was written by Saadat Pour Mozaffari and all authors commented on previous versions of the manuscript. All authors read and approved the final manuscript.
Data availability
The data used in the paper will be available upon request. Please contact pourmozaffarisaadat@gmail.com.
Declarations
Competing interests
The authors declare no competing interests.
Footnotes
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
References
- 1.Martin, S. S. et al. 2025 heart disease and stroke statistics: A report of US and global data from the American Heart Association. Circulation151(8), e41–e660 (2025). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 2.Raza, A., Tran, K. P., Koehl, L. & Li, S. AnoFed: Adaptive anomaly detection for digital health using transformer-based federated learning and support vector data description. Eng. Appl. Artif. Intell.121, 106051 (2023). [Google Scholar]
- 3.Jiang, H., Jiang, Z., Tang, W., Xie, Y., Wang, M., Huang, W.,... Ye, T. $\mathsf {RobustHealth}$: Non-Interactive Privacy-Preserving System for Heterogeneous Mobile Health Diagnosis. IEEE Transactions on Mobile Computing, 1-15 (2025). 10.1109/TMC.2025.3634422
- 4.Campero Jurado, I. et al. Signal quality analysis for long-term ECG monitoring using a health patch in cardiac patients. Sensors23 (4), 2130 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 5.Anbalagan, T., Nath, M. K., Vijayalakshmi, D. & Anbalagan, A. Analysis of various techniques for ECG signal in healthcare, past, present, and future. Biomed. Eng. Adv.6, 100089 (2023). [Google Scholar]
- 6.Jiang, A., Huang, C., Cao, Q., Xu, Y., Zeng, Z., Chen, K., … Wang, Y. (2024). Anomaly detection in electrocardiograms: Advancing clinical diagnosis through self-supervised learning. arXiv preprint arXiv:2404.04935.
- 7.Ahmed, Y. K. & Naji, A. N. Smart feature extraction using deep learning for early diagnosis of chronic diseases in next-generation medical decision support systems. Netw. Model. Anal. Health Inform. Bioinform.14(1), 140 (2025). [Google Scholar]
- 8.Bai, J., Zhu, W., Liu, S., Ye, C., Zheng, P., & Wang, X. A Temporal Convolutional Network–Bidirectional Long Short-Term Memory (TCN-BiLSTM) Prediction Model for Temporal Faults in Industrial Equipment. Applied Sciences, 15(4), 1702 (2025), 10.3390/app15041702 [Google Scholar]
- 9.Wan, A., Zhu, Z., AL-Bukhaiti, K., Cheng, X., Jiang, J., Ji, X.,... Shan, T. Real-time aero-engine fault diagnosis using 5G edge computing and deep learning. Measurement, 257, 118784 (2026). 10.1016/j.measurement.2025.118784 [Google Scholar]
- 10.Zhao, N., Zhao, T., Cao, J., & Shi, H. Fault diagnosis of dual-network recursive interval type-2 fuzzy neural network based on SVD-TLS optimization. Computers & Industrial Engineering, 207, 111280 (2025). 10.1016/j.cie.2025.111280 [Google Scholar]
- 11.Ruiz-Barroso, P. et al. FADE: Forecasting for anomaly detection on ECG. Comput. Methods Programs Biomed.10.1016/j.cmpb.2025.108780 (2025). [DOI] [PubMed] [Google Scholar]
- 12.Sivapalan, G., Nundy, K. K., James, A., Cardiff, B. & John, D. Interpretable rule mining for real-time ECG anomaly detection in IoT Edge Sensors. IEEE Internet Things J.10 (15), 13095–13108 (2023). [Google Scholar]
- 13.Asadi, M. et al. Accurate detection of paroxysmal atrial fibrillation with certified-GAN and neural architecture search. Sci. Rep.13(1), 11378 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 14.Zhang, J., Wang, T., Feng, H., Wang, J., Zhao, J.,... Snoussi, H. CVC-Net: A Cross-View Consistency Network for Noise-Generalization Fault Diagnosis. IEEE Signal Processing Letters, 1-5 (2025). 10.1109/LSP.2025.3635059 [Google Scholar]
- 15.Alserhani, F. M. Integrating deep learning and metaheuristics algorithms for blockchain-based reassurance data management in the detection of malicious IoT nodes. Peer-to-Peer Netw. Appl.17 (6), 3856–3882 (2024). [Google Scholar]
- 16.Hizem, M., Bousbia, L., Ben Dhiab, Y., Aoueileyine, M. O. E. & Bouallegue, R. Reliable ECG anomaly detection on edge devices for Internet of Medical Things applications. Sensors25(8), 2496 (2025). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 17.Sivapalan, G., Nundy, K. K., Dev, S., Cardiff, B. & John, D. ANNet: A lightweight neural network for ECG anomaly detection in IoT edge sensors. IEEE Trans. Biomed. Circuits Syst.16 (1), 24–35 (2022). [DOI] [PubMed] [Google Scholar]
- 18.Alghieth, M. DeepECG-Net: A hybrid transformer-based deep learning model for real-time ECG anomaly detection. Sci. Rep.15(1), 20714 (2025). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 19.Xiong, W., Zhang, G., Yan, D., Cao, L., Huang, X.,... Li, D. (2025). Multichannel feature fusion network-based technique for heart sound signal classification and recognition. Expert Systems with Applications, 273, 126839. 10.1016/j.eswa.2025.126839 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 20.Elsheikhy, D. H., Hassan, A. S., Yhiea, N. M., Fareed, A. M. & Rashed, E. A. Lightweight deep learning architecture for multi-lead ECG arrhythmia detection. Sensors25(17), 5542 (2025). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 21.Nazir, A. et al. A deep learning-based novel hybrid CNN-LSTM architecture for efficient detection of threats in the IoT ecosystem. Ain Shams Eng. J.15(7), 102777 (2024). [Google Scholar]
- 22.Vallabhuni, S. & Debasis, K. Hybrid deep learning for IoT-based health monitoring with physiological event extraction. Digit. Health11, 20552076251337848 (2025). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 23.Wan, A., Zhang, F., Al-Bukhaiti, K., Cheng, X., Ji, X., Wang, J.,... Shan, T. (2025). A Novel GA-PSO-SVM Model for Compound Fault Diagnosis in Gearboxes With Limited Data. IEEE Sensors Journal, 25(16), 30431-30443 (2025). 10.1109/JSEN.2025.3576761
- 24.Shuai Yue, Liang Zhang, Ning Zhao, Ning Xu, Fawaz E.Alsaadi, SMS-Based Event-Triggered Fault Tolerant Control of Nonlinear Systems Using Adaptive Dynamic Programming. International Journal of Robust and Nonlinear Control, 2026. 10.1002/rnc.70380 [Google Scholar]
- 25.Hossin, M. & Sulaiman, M. N. A review on evaluation metrics for data classification evaluations. International journal of data mining & knowledge management process5(2), 1 (2015). [Google Scholar]
- 26.Zhenghua Li, Shuo Ding, Liang Zhang, Guangjing Song, Filter-based predefined-time optimal fault-tolerant consensus control for nonlinear multi-agent systems via reinforcement learning, Neurocomputing, 2026, 10.1016/j.neucom.2026.133224 [Google Scholar]
- 27.Zhang, J., Chen, K., He, R., Huang, T., Tian, J., Wu, S., … Cheng, Y. (2026). Remaining Useful Life Prediction Based on Interpretable Serialized Variational Autoencoder:A Drift-Diffusion Stochastic Equation Perspective. IEEE Transactions on Industrial Informatics.
- 28.Jiyuan Li, Zhongyu Chen, Ben Niu, Ning Xu, Xudong Zhao. Event-Driven Prescribed Performance Consensus Control for Nonlinear MASs With Unknown Input Saturation and Control Direction. International Journal of General Systems (2026) 10.1080/03081079.2026.2621250 [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
The data used in the paper will be available upon request. Please contact pourmozaffarisaadat@gmail.com.























