Wireless sensor networks (WSNs) are integral components of smart environments. These allow monitoring and communication to take place autonomously across distributed sensor nodes. Nevertheless, they suffer from constrained resources that make them susceptible to routine-layer attacks. These specifically involve blackhole, flooding, selective forwarding attack traffic and normal traffic. The conventional machine learning and deep learning methods employed are effective in catering to these attacks, yet they have generalization issues when the network conditions are dynamic. The models are generally trained on the local features that make them more dependable and less interpretable. To overcome these issues, this paper proposes an attention-driven transformer encoder for tabular WSN traffic, designed for robust and interpretable intrusion detection in WSNs. The model represents the WSN features as sequential tokens and employs multi-head self-attention to capture global and local dependencies among sensor attributes and employs a multi-head self-attention for capturing the local and global dependencies among the sensor attributes. The framework integrated several components, including normalization, chi-square-based feature selection, and positional embedding. These are followed by multi-layer transformer encoding blocks for the feature fusion and subsequent classification. The framework has been evaluated on the publicly available WSN dataset. Results have been shown to attain an accuracy of 99.37%, which makes it outperform the traditional deep learning baseline models. The comparative analysis has shown the model to be superior in terms of generalization and reduced convergence time. It further offers enhanced interpretability that makes it a good fit to be deployed in real-world scenarios where resources can be constrained.
Baniata et al. (Fri,) studied this question.