Research Article

A Novel Hybrid Deep Learning Model for Attack Detection in IoT Environment: Convolutional Neural Network with Transformer Approach

DOI:

10.3791/68750

November 18th, 2025

In This Article

Summary

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

The study presents a hybrid deep learning model combining Convolutional Neural Networks (CNN) and Transformers for detecting attacks in IoT environments. Utilizing the CIC-IoT-2023 dataset, the model achieved high performance metrics: 99.97% accuracy and a loss of 0.0123, demonstrating its effectiveness in real-time attack detection.

Abstract

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

The rapid development of Internet of Things (IoT) devices has enhanced connectivity and accessibility. Nevertheless, the increasing interconnectivity of these environments presents new threat levels, requiring robust anomaly detection. In this study, a new security method that is based on deep learning is presented to mitigate the particular threats that are associated with Internet of Things networks. The proposed approach employs deep neural networks to efficiently monitor network activity patterns and detect potential vulnerabilities in real-time communication. A hybrid CNN-Transformer model for attack detection and classification in IoT networks is proposed in this study. To create and test this approach, we analyzed the CIC-IoT-2023 dataset, which includes 33 distinct IoT threat types distributed over 7 distinct categories. The experimental findings demonstrate that the proposed model works excellently, with a precision of 99.96%, a recall of 99.96%, an F1 score of 99.96%, and an accuracy of 99.97% with a loss of 0.0123. Moreover, the proposed model is analysed based on computational time and resource consumption, demonstrating its efficacy in detecting and classifying attacks, with minimised computational complexity while maintaining high accuracy.

Introduction

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

The Internet of Things technology has advanced significantly in recent years, and we have entered a highly interconnected digital world. Many different industries are currently using Internet of Things (IoT) devices, including health care, agricultural activity, transportation, aerospace, and production1. Renowned experts project that the Internet of Things (IoT) and related applications will significantly affect the world economy by 2025, with annual effects ranging from $3.9 trillion to $11.1 trillion2. On the other hand, new security-related difficulties arise due to this flawless connection. As IoT devices have evolv....

Access restricted. Please log in or start a trial to view this content.

Protocol

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

This section discusses attack detection system-related research materials and methods in the IoT environment. In order to replicate the experiments on the CIC-IoT-2023 dataset, this protocol outlines specific procedures. The subsequent Table of Materials contains a list of all the hardware and software used. Python (pandas, scikit-learn, and TensorFlow Keras) is used to implement the pipeline, which is run on Google Colab with PySpark available for large-file preprocessing. A detailed description of the data preprocessing procedures has been provided.

Dataset
The CIC-IoT-2023 dataset, which was released....

Access restricted. Please log in or start a trial to view this content.

Results

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

This section presents the evaluation parameters along with the test results.

Performance evaluation metrics
The effectiveness of the models may be evaluated using several defined criteria for evaluation. Accuracy, recall, precision, F1 score, ROC, confusion matrix, and other statistical metrics are shown in Table 4. Insights into the models' overall performance are provided by the metrics.

Table 4: Performance evaluation.......

Access restricted. Please log in or start a trial to view this content.

Discussion

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

The CNN-Transformer model was tested on the CICIoT2023 datasets, with 80% reserved for training and 20% for testing. The model achieved an accuracy of 99.97%, F1 score of 99.96%, recall of 99.97%, precision of 99.96% and a loss of 0.0123, confirming its effectiveness for IoT intrusion detection. CNN-based approaches, similar to the findings13, are proficient in detecting small spatial patterns within network traffic characteristics; however, they often exhibit constraints in modeling long-range de.......

Access restricted. Please log in or start a trial to view this content.

Disclosures

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

The authors have no conflicts of interest to declare.

Acknowledgements

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

I want to express my special gratitude and thanks to my guide, Dr. Sima, for imparting her knowledge and expertise in this study.

....

Access restricted. Please log in or start a trial to view this content.

Materials

List of materials used in this article
NameCompanyCatalog NumberComments
Apple M2 (8-core CPU)AppleN/A(OS) provides the environment in which deep learning frameworks and tools operate.
CICIoT2023 DatasetUNBhttps://www.unb.ca/cic/datasets/iot2023.htmlPublically available daset of IoT
Keras 2.6.0Kerashttps://keras.io/An API running on top of TensorFlow, providing a user-friendly interface.
Matplotlib 3.4.3Matplotlib https://matplotlib.org/Visualization library for Python.
NumPy 1.21.4Numpyhttps://numpy.org/Fundamental package for scientific computing with Python
NVIDIA Tesla P100 GPU (16 GB VRAM)Google Colab ProN/ATraining hardware
Pandas 1.3.4Pandashttps://pandas.pydata.org/Data analysis and manipulation tool.
Python 3.8.10Python Software Foundationhttps://www.python.org/downloads/release/python-3810/The most popular language for deep learning due to its extensive libraries and community support.
scikit-learn 1.0.2Scikit Learnhttps://scikit-learn.org/Machine learning library for Python.
Seaborn 0.11.2Seabornhttps://seaborn.pydata.org/Statistical data visualization library.
System RAMN/AN/A32 GB RAM
TensorFlow 2.6.0Googlehttps://www.tensorflow.org/Widely used for its comprehensive tools and libraries.

References

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,
  1. Abbas, S., et al. A novel federated edge learning approach for detecting cyberattacks in IoT infrastructures. IEEE Access. 11, 112189-112198 (2023).
  2. Asharf, J., et al. A....

Access restricted. Please log in or start a trial to view this content.

Reprints and Permissions

Request permission to reuse the text or figures of this JoVE article

Request Permission

Tags

IoT SecurityHybrid ModelTransformer ModelNetwork Anomaly DetectionIoT Threat ClassificationReal Time MonitoringCIC IoT 2023 Dataset

Related Articles