# Edge AI for Real-Time Anomaly Detection in Smart Homes
## 5 Results and Discussion
### Computational Efficiency  
The computational efficiency of the proposed Edge AI framework was evaluated by comparing the inference time, memory footprint, and energy consumption of the Isolation Forest and LSTM Autoencoder models on edge devices. Inference time on the Raspberry Pi 4 was reduced from 150 ms (non-optimized) to 35 ms (quantized LSTM model), improving real-time execution by 76% while reducing power consumption by 35% compared to continuous cloud inference. The Isolation Forest model exhibited a significantly lower computational footprint, requiring 5 MB of memory, while the LSTM Autoencoder model, despite being more accurate in detecting sequential anomalies, required 50 MB due to its deep learning architecture. The quantized LSTM Autoencoder achieved an inference time of 35 ms, whereas the Isolation Forest model required only 22 ms, further reinforcing the latter's suitability for  
Figure 3: Time-series visualization of anomalies detected in IoT sensor data using the LSTM Autoencoder model. The red ‘X’ markers indicate anomalies identified by the Isolation Forest model across temperature, motion, and energy usage readings. \begin{table}
\begin{tabular}{l l l l l} \hline
**Temperature** (\({}^{\circ}\)**C**) & **Motion (0/1)** & **Energy Usage (W)** & **Anomaly Score (LSTM)** & **Anomaly (LSTM)** \\ \hline
22.99 & 0 & 484.54 & 0.04372 & 0 \\
21.72 & 0 & 462.39 & 0.03132 & 0 \\
23.29 & 0 & 515.96 & 0.05711 & 0 \\
25.04 & 0 & 567.02 & 0.11847 & 0 \\
21.53 & 0 & 406.24 & 0.05983 & 0 \\ \hline \end{tabular}
\end{table} 
Table 9: Sample of the LSTM Autoencoder anomaly detection results. The table presents temperature, motion, energy usage readings, corresponding anomaly scores, and binary anomaly labels (1 for anomalies, 0 for normal values). real-time applications with strict latency constraints. Isolation Forest's faster inference time (22 ms vs. 35 ms for LSTM-AE) is due to its simpler decision tree-based structure, which requires fewer computational operations compared to the sequential nature of LSTM-AE. The hybrid approach, where the Isolation Forest serves as a preliminary anomaly detector, and the LSTM Autoencoder refines the classification, achieved a 30% reduction in false positives compared to IF alone while maintaining real-time detection capability. This suggests that a two-step anomaly detection mechanism can enhance speed and accuracy, where IF quickly flags suspicious readings, and LSTM-AE provides further validation. Table 10 presents a confusion matrix comparison for the hybrid model versus standalone models, highlighting the improvements in precision and recall. Compared to LSTM-AE alone, the hybrid model reduced false negatives from three to two, while false positives dropped from three to two, reinforcing its effectiveness in maintaining detection accuracy with reduced alert noise. Energy consumption analysis revealed that the event-triggered execution of anomaly detection models led to substantial power savings. The LSTM Autoencoder's power draw was 4.2 W during inference, compared to 2.8 W for Isolation Forest, reinforcing the trade-off between energy efficiency and detection precision. To evaluate the computational efficiency of the proposed Edge AI framework, we compared the inference time, memory footprint, and power consumption of the Isolation Forest and LSTM Autoencoder models. Table 11 summarizes these key performance metrics, highlighting the trade-offs between computational efficiency and anomaly detection accuracy. While quantization significantly improved the LSTM Autoencoder's inference speed, its memory footprint remained substantially larger than Isolation Forest's. To optimize real-time performance in smart home environments, a balance must be achieved between computational efficiency and detection accuracy. Figure 4 illustrates the inference time and power consumption of the Isolation Forest and LSTM Autoencoder models to provide a clearer comparison of computational efficiency.