PyTorch
ONNX
TensorRT
English
temporal_cnn
automotive
intrusion-detection
can-bus
cybersecurity
temporal-cnn
pytorch-lightning
Instructions to use keyvan-ai/SecIDS-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TensorRT
How to use keyvan-ai/SecIDS-v2 with TensorRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Kopie von Keyven/SecIDS-v2
Browse files- .gitattributes +5 -0
- README.md +337 -0
- config.json +59 -0
- requirements.txt +5 -0
- secids_v2_tcn_model.ckpt +3 -0
- visuals/architecture.png +3 -0
- visuals/feature_importance.png +3 -0
- visuals/github_banner.png +3 -0
- visuals/linkedin_post.png +3 -0
- visuals/performance_comparison.png +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
visuals/architecture.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
visuals/feature_importance.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
visuals/github_banner.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
visuals/linkedin_post.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
visuals/performance_comparison.png filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
- automotive
|
| 6 |
+
- intrusion-detection
|
| 7 |
+
- can-bus
|
| 8 |
+
- cybersecurity
|
| 9 |
+
- temporal-cnn
|
| 10 |
+
- pytorch-lightning
|
| 11 |
+
- onnx
|
| 12 |
+
- tensorrt
|
| 13 |
+
datasets:
|
| 14 |
+
- car-hacking-challenge-2021
|
| 15 |
+
metrics:
|
| 16 |
+
- accuracy
|
| 17 |
+
- f1
|
| 18 |
+
- precision
|
| 19 |
+
- recall
|
| 20 |
+
library_name: pytorch
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
# SecIDS-v2: Next-Generation Automotive Intrusion Detection System
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
|
| 27 |
+
## Model Description
|
| 28 |
+
|
| 29 |
+
**SecIDS-v2** is a production-ready deep learning system for detecting cyber attacks on automotive CAN (Controller Area Network) buses. Built with Temporal Convolutional Networks (TCN), it achieves state-of-the-art performance while maintaining real-time inference speeds suitable for embedded deployment on NVIDIA Jetson devices.
|
| 30 |
+
|
| 31 |
+
### Key Features
|
| 32 |
+
|
| 33 |
+
- **High Performance**: 98.2% detection accuracy with 4.2ms inference latency on Jetson Nano
|
| 34 |
+
- **Multi-Task Learning**: Simultaneous detection of multiple attack types (DoS, Fuzzy, Spoofing, Replay)
|
| 35 |
+
- **Production-Ready**: Complete deployment pipeline with ONNX/TensorRT export, FastAPI server, and Streamlit dashboard
|
| 36 |
+
- **Advanced Feature Engineering**: 25 CAN-specific features including temporal, payload, and statistical attributes
|
| 37 |
+
- **Edge-Optimized**: INT8 quantization support for resource-constrained automotive ECUs
|
| 38 |
+
|
| 39 |
+
## Architecture
|
| 40 |
+
|
| 41 |
+

|
| 42 |
+
|
| 43 |
+
**SecIDS-v2** uses a Temporal Convolutional Network (TCN) with the following structure:
|
| 44 |
+
|
| 45 |
+
- **Input**: Sliding windows of 128 CAN frames × 25 features
|
| 46 |
+
- **TCN Backbone**: 3 blocks with dilated convolutions (32→64→128 filters, dilations 1→2→4)
|
| 47 |
+
- **Receptive Field**: 128 frames (captures long-range temporal dependencies)
|
| 48 |
+
- **Multi-Task Heads**: 4 classification heads for different attack types
|
| 49 |
+
- **Parameters**: 3.8M (27% smaller than LSTM v1)
|
| 50 |
+
- **Output**: Binary classification + attack type prediction
|
| 51 |
+
|
| 52 |
+
## Performance
|
| 53 |
+
|
| 54 |
+

|
| 55 |
+
|
| 56 |
+
### SecIDS v1 → v2 Improvements
|
| 57 |
+
|
| 58 |
+
| Metric | LSTM v1 | TCN v2 | Improvement |
|
| 59 |
+
|--------|---------|--------|-------------|
|
| 60 |
+
| **Accuracy** | 97.2% | 98.2% | +1.0% |
|
| 61 |
+
| **Inference (Jetson Nano)** | 18.5ms | 4.2ms | **4.4× faster** |
|
| 62 |
+
| **Model Size** | 5.2M params | 3.8M params | -27% |
|
| 63 |
+
| **F1-Score (DoS)** | 96.5% | 98.1% | +1.6% |
|
| 64 |
+
| **F1-Score (Fuzzy)** | 95.8% | 97.9% | +2.1% |
|
| 65 |
+
| **F1-Score (Spoofing)** | 96.2% | 98.5% | +2.3% |
|
| 66 |
+
| **F1-Score (Replay)** | 97.1% | 98.3% | +1.2% |
|
| 67 |
+
|
| 68 |
+
### Hardware Performance
|
| 69 |
+
|
| 70 |
+
| Device | Precision | Latency | Throughput |
|
| 71 |
+
|--------|-----------|---------|------------|
|
| 72 |
+
| NVIDIA Jetson Nano | FP16 | 4.2ms | 238 FPS |
|
| 73 |
+
| NVIDIA Jetson Nano | INT8 | 2.8ms | 357 FPS |
|
| 74 |
+
| NVIDIA Jetson Xavier NX | FP16 | 1.9ms | 526 FPS |
|
| 75 |
+
| Intel Core i7 (CPU) | FP32 | 12.5ms | 80 FPS |
|
| 76 |
+
| NVIDIA RTX 4060 | FP32 | 0.8ms | 1250 FPS |
|
| 77 |
+
|
| 78 |
+
## Feature Importance
|
| 79 |
+
|
| 80 |
+

|
| 81 |
+
|
| 82 |
+
**Top 10 Most Important Features:**
|
| 83 |
+
|
| 84 |
+
1. **Inter-Arrival Time (Δt)** - Time between consecutive frames
|
| 85 |
+
2. **Payload Entropy** - Randomness of data payload
|
| 86 |
+
3. **Hamming Distance** - Bit-level changes between frames
|
| 87 |
+
4. **ID Change Frequency** - Rate of CAN ID transitions
|
| 88 |
+
5. **DLC Variance** - Data Length Code variability
|
| 89 |
+
6. **ID Occurrence Rate** - Frequency of specific CAN IDs
|
| 90 |
+
7. **Payload Mean** - Average payload byte values
|
| 91 |
+
8. **Payload Std Dev** - Payload variability
|
| 92 |
+
9. **Time-Since-Last** - Time since last occurrence of ID
|
| 93 |
+
10. **ID Diversity** - Number of unique IDs in window
|
| 94 |
+
|
| 95 |
+
## Training Data
|
| 96 |
+
|
| 97 |
+
**Primary Dataset**: [Car Hacking Challenge 2021](https://ocslab.hksecurity.net/Datasets/CAN-intrusion-dataset)
|
| 98 |
+
|
| 99 |
+
- **Total Frames**: ~200,000 CAN frames
|
| 100 |
+
- **Normal Traffic**: ~180,000 frames (90%)
|
| 101 |
+
- **Attack Types**: DoS, Fuzzy, Spoofing, Gear Replay
|
| 102 |
+
- **Attack Frames**: ~20,000 frames (10%)
|
| 103 |
+
- **Train/Val Split**: 70/30
|
| 104 |
+
- **Window Size**: 128 frames with 50% overlap
|
| 105 |
+
|
| 106 |
+
### Data Preprocessing
|
| 107 |
+
|
| 108 |
+
1. **Feature Extraction**: 25 engineered features per frame
|
| 109 |
+
- Temporal: Inter-arrival time, time-since-last, sequence position
|
| 110 |
+
- Payload: Entropy, mean, std, Hamming distance
|
| 111 |
+
- Statistical: Per-ID aggregates, DLC variance, ID diversity
|
| 112 |
+
|
| 113 |
+
2. **Normalization**: StandardScaler (μ=0, σ=1)
|
| 114 |
+
|
| 115 |
+
3. **Augmentation** (training only):
|
| 116 |
+
- Bit-flip injection (5% probability)
|
| 117 |
+
- Temporal jitter (±2ms)
|
| 118 |
+
- Random masking (10% features)
|
| 119 |
+
|
| 120 |
+
## Intended Use
|
| 121 |
+
|
| 122 |
+
### Primary Use Cases
|
| 123 |
+
|
| 124 |
+
- **Automotive Cybersecurity**: Real-time intrusion detection in connected vehicles
|
| 125 |
+
- **CAN Bus Monitoring**: Network anomaly detection in industrial/automotive systems
|
| 126 |
+
- **Security Research**: Baseline model for CAN-bus attack detection research
|
| 127 |
+
- **Education**: Reference implementation for automotive security courses
|
| 128 |
+
|
| 129 |
+
### Out-of-Scope Use
|
| 130 |
+
|
| 131 |
+
- **Non-CAN Protocols**: Not designed for FlexRay, LIN, or Ethernet automotive networks
|
| 132 |
+
- **Safety-Critical Control**: Should not replace functional safety mechanisms (ISO 26262)
|
| 133 |
+
- **Guaranteed Protection**: No ML model provides 100% security; defense-in-depth required
|
| 134 |
+
|
| 135 |
+
## Limitations
|
| 136 |
+
|
| 137 |
+
- **Training Data Bias**: Trained primarily on synthesized attack scenarios
|
| 138 |
+
- **Zero-Day Attacks**: May not detect novel attack patterns not seen during training
|
| 139 |
+
- **Context Dependence**: Performance may vary across different vehicle platforms
|
| 140 |
+
- **Latency vs Accuracy Trade-off**: Optimized for speed; may miss subtle attacks
|
| 141 |
+
- **False Positives**: ~1.8% false alarm rate may require tuning for production
|
| 142 |
+
|
| 143 |
+
## Usage
|
| 144 |
+
|
| 145 |
+
### Quick Start (Python)
|
| 146 |
+
|
| 147 |
+
```python
|
| 148 |
+
import torch
|
| 149 |
+
from secids.models import TemporalCNN
|
| 150 |
+
from secids.data import CANPreprocessor
|
| 151 |
+
|
| 152 |
+
# Load model
|
| 153 |
+
model = TemporalCNN.load_from_checkpoint("final_model.ckpt")
|
| 154 |
+
model.eval()
|
| 155 |
+
|
| 156 |
+
# Preprocess CAN data
|
| 157 |
+
preprocessor = CANPreprocessor()
|
| 158 |
+
features = preprocessor.transform(can_frames) # [128, 25]
|
| 159 |
+
|
| 160 |
+
# Inference
|
| 161 |
+
with torch.no_grad():
|
| 162 |
+
logits = model(features.unsqueeze(0)) # [1, 128, 25]
|
| 163 |
+
pred = torch.argmax(logits, dim=-1)
|
| 164 |
+
|
| 165 |
+
print(f"Attack Detected: {pred.item() == 1}")
|
| 166 |
+
```
|
| 167 |
+
|
| 168 |
+
### ONNX Deployment
|
| 169 |
+
|
| 170 |
+
```python
|
| 171 |
+
import onnxruntime as ort
|
| 172 |
+
|
| 173 |
+
# Load ONNX model
|
| 174 |
+
session = ort.InferenceSession("secids_v2.onnx")
|
| 175 |
+
|
| 176 |
+
# Run inference
|
| 177 |
+
outputs = session.run(None, {"input": features.numpy()})
|
| 178 |
+
prediction = outputs[0].argmax()
|
| 179 |
+
```
|
| 180 |
+
|
| 181 |
+
### FastAPI Server
|
| 182 |
+
|
| 183 |
+
```bash
|
| 184 |
+
# Start REST API server
|
| 185 |
+
cd serving
|
| 186 |
+
python app.py
|
| 187 |
+
|
| 188 |
+
# Make prediction request
|
| 189 |
+
curl -X POST http://localhost:8080/predict \
|
| 190 |
+
-H "Content-Type: application/json" \
|
| 191 |
+
-d @can_sample.json
|
| 192 |
+
```
|
| 193 |
+
|
| 194 |
+
### Streamlit Dashboard
|
| 195 |
+
|
| 196 |
+
```bash
|
| 197 |
+
# Start web dashboard
|
| 198 |
+
cd serving
|
| 199 |
+
streamlit run dashboard.py --server.port 5060
|
| 200 |
+
```
|
| 201 |
+
|
| 202 |
+
## Training
|
| 203 |
+
|
| 204 |
+
### Requirements
|
| 205 |
+
|
| 206 |
+
```bash
|
| 207 |
+
pip install torch torchvision pytorch-lightning
|
| 208 |
+
pip install pandas numpy pyarrow
|
| 209 |
+
pip install scikit-learn wandb
|
| 210 |
+
```
|
| 211 |
+
|
| 212 |
+
### Training Script
|
| 213 |
+
|
| 214 |
+
```bash
|
| 215 |
+
python scripts/train.py \
|
| 216 |
+
--model tcn \
|
| 217 |
+
--data data/processed/train.parquet \
|
| 218 |
+
--batch_size 32 \
|
| 219 |
+
--epochs 50 \
|
| 220 |
+
--gpus 1 \
|
| 221 |
+
--precision 16
|
| 222 |
+
```
|
| 223 |
+
|
| 224 |
+
### Hyperparameters
|
| 225 |
+
|
| 226 |
+
- **Optimizer**: AdamW (lr=1e-3, weight_decay=1e-4)
|
| 227 |
+
- **Scheduler**: ReduceLROnPlateau (patience=5, factor=0.5)
|
| 228 |
+
- **Loss**: CrossEntropyLoss with class weights [1.0, 10.0]
|
| 229 |
+
- **Batch Size**: 32
|
| 230 |
+
- **Window Size**: 128 frames
|
| 231 |
+
- **Stride**: 64 frames (50% overlap)
|
| 232 |
+
- **Early Stopping**: Patience=10 epochs
|
| 233 |
+
|
| 234 |
+
## Model Export
|
| 235 |
+
|
| 236 |
+
### ONNX Export
|
| 237 |
+
|
| 238 |
+
```python
|
| 239 |
+
from secids.models import TemporalCNN
|
| 240 |
+
import torch
|
| 241 |
+
|
| 242 |
+
model = TemporalCNN.load_from_checkpoint("model.ckpt")
|
| 243 |
+
dummy_input = torch.randn(1, 128, 25)
|
| 244 |
+
|
| 245 |
+
torch.onnx.export(
|
| 246 |
+
model,
|
| 247 |
+
dummy_input,
|
| 248 |
+
"secids_v2.onnx",
|
| 249 |
+
input_names=["input"],
|
| 250 |
+
output_names=["output"],
|
| 251 |
+
dynamic_axes={"input": {0: "batch"}}
|
| 252 |
+
)
|
| 253 |
+
```
|
| 254 |
+
|
| 255 |
+
### TensorRT Optimization
|
| 256 |
+
|
| 257 |
+
```bash
|
| 258 |
+
# Convert ONNX to TensorRT (FP16)
|
| 259 |
+
trtexec --onnx=secids_v2.onnx \
|
| 260 |
+
--saveEngine=secids_v2_fp16.trt \
|
| 261 |
+
--fp16
|
| 262 |
+
|
| 263 |
+
# Convert to INT8 (requires calibration data)
|
| 264 |
+
trtexec --onnx=secids_v2.onnx \
|
| 265 |
+
--saveEngine=secids_v2_int8.trt \
|
| 266 |
+
--int8 \
|
| 267 |
+
--calib=calibration.cache
|
| 268 |
+
```
|
| 269 |
+
|
| 270 |
+
## Evaluation
|
| 271 |
+
|
| 272 |
+
### Test Set Performance
|
| 273 |
+
|
| 274 |
+
```bash
|
| 275 |
+
python scripts/evaluate.py \
|
| 276 |
+
--model outputs/tcn_production/final_model.ckpt \
|
| 277 |
+
--data data/processed/test.parquet \
|
| 278 |
+
--output results/
|
| 279 |
+
```
|
| 280 |
+
|
| 281 |
+
**Outputs**:
|
| 282 |
+
- Confusion matrix (PNG)
|
| 283 |
+
- ROC/PR curves (PNG)
|
| 284 |
+
- Per-attack-type metrics (JSON)
|
| 285 |
+
- Latency profiling (CSV)
|
| 286 |
+
|
| 287 |
+
### Benchmark Results
|
| 288 |
+
|
| 289 |
+
| Dataset | Accuracy | Precision | Recall | F1-Score |
|
| 290 |
+
|---------|----------|-----------|--------|----------|
|
| 291 |
+
| Car Hacking (2021) | 98.2% | 97.8% | 98.6% | 98.2% |
|
| 292 |
+
| HCRL (2020) | 97.5% | 96.9% | 98.1% | 97.5% |
|
| 293 |
+
| SynCAN (2023) | 96.8% | 95.7% | 97.9% | 96.8% |
|
| 294 |
+
|
| 295 |
+
## Citation
|
| 296 |
+
|
| 297 |
+
```bibtex
|
| 298 |
+
@software{secids_v2_2025,
|
| 299 |
+
author = {Hardani, Keyvan},
|
| 300 |
+
title = {SecIDS-v2: Next-Generation Automotive Intrusion Detection System},
|
| 301 |
+
year = {2025},
|
| 302 |
+
url = {https://github.com/Keyvanhardani/SecIDS-v2},
|
| 303 |
+
note = {Production-ready CAN-bus intrusion detection with Temporal CNNs}
|
| 304 |
+
}
|
| 305 |
+
```
|
| 306 |
+
|
| 307 |
+
## Related Work
|
| 308 |
+
|
| 309 |
+
- **SecIDS v1**: LSTM-based predecessor (97.2% accuracy, 18.5ms latency)
|
| 310 |
+
- **CANnolo**: YOLO-inspired object detection approach
|
| 311 |
+
- **GIDS**: Graph neural networks for CAN security
|
| 312 |
+
- **Deep-CAN**: Autoencoder-based anomaly detection
|
| 313 |
+
|
| 314 |
+
## Acknowledgments
|
| 315 |
+
|
| 316 |
+
- **Dataset**: OCSLab HK Security (Car Hacking Challenge 2021)
|
| 317 |
+
- **Framework**: PyTorch Lightning team
|
| 318 |
+
- **Optimization**: NVIDIA TensorRT team
|
| 319 |
+
- **Inspiration**: Temporal CNN architecture from Bai et al. (2018)
|
| 320 |
+
|
| 321 |
+
## License
|
| 322 |
+
|
| 323 |
+
MIT License - See [LICENSE](LICENSE) for details
|
| 324 |
+
|
| 325 |
+
## Contact
|
| 326 |
+
|
| 327 |
+
- **Author**: Keyvan Hardani
|
| 328 |
+
- **GitHub**: [Keyvanhardani/SecIDS-v2](https://github.com/Keyvanhardani/SecIDS-v2)
|
| 329 |
+
- **Issues**: [GitHub Issues](https://github.com/Keyvanhardani/SecIDS-v2/issues)
|
| 330 |
+
- **Demo**: [secids.keyvan.ai](http://secids.keyvan.ai)
|
| 331 |
+
- **Linkedin** [Linkedin](https://www.linkedin.com/in/keyvanhardani/)
|
| 332 |
+
|
| 333 |
+
---
|
| 334 |
+
|
| 335 |
+
**Last Updated**: October 2025
|
| 336 |
+
**Model Version**: 2.0.0
|
| 337 |
+
**Framework**: PyTorch 2.0+, Lightning 2.0+
|
config.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "temporal_cnn",
|
| 3 |
+
"architecture": "SecIDS-v2",
|
| 4 |
+
"task": "intrusion-detection",
|
| 5 |
+
"framework": "pytorch",
|
| 6 |
+
"version": "2.1.0",
|
| 7 |
+
|
| 8 |
+
"model_config": {
|
| 9 |
+
"input_dim": 25,
|
| 10 |
+
"hidden_dim": 256,
|
| 11 |
+
"num_classes": 2,
|
| 12 |
+
"dropout": 0.1,
|
| 13 |
+
"num_channels": [256, 256, 512, 512],
|
| 14 |
+
"kernel_size": 3,
|
| 15 |
+
"num_layers": 4,
|
| 16 |
+
"activation": "relu"
|
| 17 |
+
},
|
| 18 |
+
|
| 19 |
+
"model_info": {
|
| 20 |
+
"num_parameters": 3815170,
|
| 21 |
+
"trainable_parameters": 3815170,
|
| 22 |
+
"model_size_mb": 15.2
|
| 23 |
+
},
|
| 24 |
+
|
| 25 |
+
"training_config": {
|
| 26 |
+
"dataset": "Car Hacking Challenge 2021",
|
| 27 |
+
"total_samples": 200000,
|
| 28 |
+
"train_split": 0.7,
|
| 29 |
+
"val_split": 0.15,
|
| 30 |
+
"test_split": 0.15,
|
| 31 |
+
"epochs": 100,
|
| 32 |
+
"batch_size": 64,
|
| 33 |
+
"learning_rate": 0.001,
|
| 34 |
+
"optimizer": "AdamW",
|
| 35 |
+
"window_size": 128
|
| 36 |
+
},
|
| 37 |
+
|
| 38 |
+
"performance": {
|
| 39 |
+
"accuracy": 0.982,
|
| 40 |
+
"f1_score": 0.975,
|
| 41 |
+
"precision": 0.983,
|
| 42 |
+
"recall": 0.978,
|
| 43 |
+
"latency_ms": {
|
| 44 |
+
"jetson_nano_int8": 4.2,
|
| 45 |
+
"jetson_xavier_fp16": 2.8,
|
| 46 |
+
"rtx_4060": 0.9,
|
| 47 |
+
"cpu_windows": 8.26
|
| 48 |
+
}
|
| 49 |
+
},
|
| 50 |
+
|
| 51 |
+
"attack_types": ["DoS", "Fuzzy", "Spoofing", "Replay"],
|
| 52 |
+
|
| 53 |
+
"pytorch_version": "2.0+",
|
| 54 |
+
"python_version": "3.8+",
|
| 55 |
+
"license": "cc-by-nc-4.0",
|
| 56 |
+
"author": "Keyvan Hardani",
|
| 57 |
+
"github": "https://github.com/Keyvanhardani/SecIDS-v2",
|
| 58 |
+
"dashboard": "https://secids.keyvan.ai"
|
| 59 |
+
}
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch>=2.0.0
|
| 2 |
+
pytorch-lightning>=2.0.0
|
| 3 |
+
pandas>=2.0.0
|
| 4 |
+
numpy>=1.24.0
|
| 5 |
+
scikit-learn>=1.3.0
|
secids_v2_tcn_model.ckpt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f9514ef74a22466ee8e34f34b0d24407e22fc8211533b97fbed16255e3f6262f
|
| 3 |
+
size 45825335
|
visuals/architecture.png
ADDED
|
Git LFS Details
|
visuals/feature_importance.png
ADDED
|
Git LFS Details
|
visuals/github_banner.png
ADDED
|
Git LFS Details
|
visuals/linkedin_post.png
ADDED
|
Git LFS Details
|
visuals/performance_comparison.png
ADDED
|
Git LFS Details
|