Keras
English
intrusion-detection
network-security
iot-security
cnn
bilstm
time-series
cybersecurity
Instructions to use Codelord01/binary_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use Codelord01/binary_model with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://Codelord01/binary_model") - Notebooks
- Google Colab
- Kaggle
| license: apache-2.0 | |
| language: en | |
| library_name: keras | |
| tags: | |
| - intrusion-detection | |
| - network-security | |
| - iot-security | |
| - cnn | |
| - bilstm | |
| - time-series | |
| - cybersecurity | |
| datasets: | |
| - CICIoT2023 | |
| # Binary Network-Layer Cyber-Physical IDS | |
| A hybrid **CNN-BiLSTM** model for real-time binary network intrusion detection in IoT environments. | |
| This model acts as the first line of defense by quickly distinguishing between malicious and legitimate traffic. | |
| ## Model Description | |
| - **Architecture:** `Conv1D -> ... -> Bidirectional LSTM -> Dense -> Dense (Sigmoid)` | |
| - **Dataset:** Balanced subset of CICIoT2023 | |
| - **Performance:** 99.9997% accuracy | |
| - **Limitations:** Validated only on CICIoT2023-like network traffic; may not detect novel attack types. Input must be normalized. | |
| - **Training Information:** | |
| - Optimizer: Adam | |
| - Loss: Binary Cross-Entropy | |
| - Balanced dataset: 2 million samples (1M benign, 1M attack) | |
| ## Intended Use | |
| - **Primary Use:** Real-time network intrusion detection | |
| - **Input:** `(batch_size, 10, 46)` — 46 network flow features, normalized | |
| - **Output:** Float between 0.0 (Benign) and 1.0 (Attack), threshold 0.5 | |
| ## How to Use | |
| ```python | |
| import tensorflow as tf | |
| import numpy as np | |
| from huggingface_hub import hf_hub_download | |
| # Download the model from Hugging Face | |
| MODEL_PATH = hf_hub_download("Codelord01/binary_model", "binary_model.keras") | |
| model = tf.keras.models.load_model(MODEL_PATH) | |
| model.summary() | |
| # Prepare a sample input: 1 sample, 10 timesteps, 46 features | |
| sample_data = np.random.rand(1, 10, 46).astype(np.float32) | |
| # Make a prediction | |
| prediction_prob = model.predict(sample_data) | |
| predicted_class = 1 if prediction_prob > 0.5 else 0 | |
| print(f"Prediction Probability: {prediction_prob:.4f}") | |
| print("Malicious Traffic Detected" if predicted_class == 1 else "Benign Traffic") | |
| @mastersthesis{ababio2025multilayered, | |
| title={A Multi-Layered Hybrid Deep Learning Framework for Cyber-Physical Intrusion Detection in Climate-Monitoring IoT Systems}, | |
| author={Awuni David Ababio}, | |
| year={2025}, | |
| school={Kwame Nkrumah University of Science and Technology} | |
| } | |