How shahriar0651/canshield works
Project Type and Purpose
• CANShield is a research-oriented deep learning system designed for intrusion detection on the CAN bus. It processes high-dimensional CAN signals and applies multiple deep autoencoders to extract temporal features from different scales before combining results through an ensemble detection mechanism.
• The README explicitly mentions the three stages: (a) data preprocessing, (b) deep autoencoder analysis (training), and (c) attack detection (ensemble decision-making). Supplementary components include evaluation and visualization of results.
Main Components
a. Environment & Configuration:
• Dependency management and configuration aspect. This includes:
• “dependency” folder containing environment YAML files (environment_v1.yaml, environment_v2.yaml).
• “config” folder with different configuration files (road.yaml, syncan.yaml).
• As a “Configuration/Environment” block that feeds into the rest of the system.
b. Data Acquisition and Preprocessing:
c. Model Training (Autoencoder Training):
• A “Training Module” that includes:
• The training scripts (train_autoencoder.py) and helper functions (get_autoencoder.py).
• A clear linkage to the preprocessed data and the configuration (modules under src/training).
• How this module trains different autoencoders over various temporal granularities.
d. Model Evaluation:
• An “Evaluation Module” represented by run_evaluation_canshield.py and the testing utilities found in src/testing (e.g., load_predictions.py, load_thresholds.py). This module takes the trained model and evaluates its performance on test datasets (both continuous and partial).
• Feedback loop to compare predicted intrusion scores against ground truth.
e. Visualization:
Relationships and Interactions
• From the “Data Acquisition” to “Preprocessing” module.
• From “Preprocessing” to “Training.”
• From “Training” to “Evaluation” and then onward to “Visualization.”
• The “Configuration/Environment” component should have connections pointing to every module that depends on these settings (training, evaluation, etc.).
• The “Dependency” and “Config” components should also be highlighted as integral to ensuring consistency across different computation setups (as noted in the README).
Architectural Patterns and Design Principles
• The system is modular: separating concerns into clearly defined blocks (data processing, training, evaluation, and visualization).
• It leverages a pipeline-like flow: raw data is cleaned and processed, then used to train multiple specialized models, subsequently evaluated, and finally visualized.
• Use of external tools (shell scripting for dataset download, configuration via YAML files, and Jupyter Notebook for model preprocessing) that all need to be reflected in the architecture.