Accepted (implemented in Phase 2)
The original NIDS used frugally-deep for neural network inference. frugally-deep is a header-only C++ library that loads Keras models exported as JSON via a custom converter.
Problems encountered:
- Model format lock-in: Only supports Keras
.h5/.kerasmodels via a fragile JSON intermediate format. No support for PyTorch, TensorFlow SavedModel, or other frameworks. - No GPU acceleration: CPU-only inference with no path to GPU/NPU acceleration.
- Complex dependency chain: Requires FunctionalPlus + Eigen3 + frugally-deep, each
needing manual installation or
git clonein Docker builds. - Unpinned versions: Dockerfile cloned frugally-deep at HEAD, making builds non-reproducible.
- Performance: Inference throughput insufficient for real-time per-flow detection at high packet rates.
Replace frugally-deep with ONNX Runtime as the sole ML inference backend.
- ONNX Runtime is available in vcpkg (
onnxruntime) for reproducible builds. - Models are exported to
.onnxformat, which is supported by PyTorch, TensorFlow, scikit-learn, and most ML frameworks. - GPU acceleration available via CUDA, DirectML, and TensorRT execution providers.
- Dynamic input/output tensor name querying eliminates hardcoded assumptions.
- Single vcpkg dependency replaces three manual
git clonebuilds. - PyTorch models can be exported directly via
torch.onnx.export(). - Future GPU acceleration requires only changing the execution provider, no code changes.
- 5-10x inference speedup on CPU alone (optimized ONNX graph execution).
- Broader ecosystem: ONNX is the industry standard for ML model interchange.
- ONNX Runtime binary is larger than header-only frugally-deep (~50 MB shared library).
- Old Keras
.h5models need a one-time conversion viatf2onnxor retraining. - Requires C++17 or later (already our minimum).
- Added
onnxruntimetovcpkg.json, removedfrugally-deep. - Rewrote
OnnxAnalyzerto use ONNX Runtime C++ API. - Created
scripts/convert_model.pyfor legacy Keras model conversion. - Deleted
FdeepAnalyzer.h/.cpp,model.json,keras_converter.py. - Rewrote Dockerfile to use vcpkg instead of manual dependency builds.