This is the TensorFlow implementation of the adversarial detection methods, migrated from the PyTorch version.
pip install -r requirements.txtTo train a CNN model for a specific dataset:
python train_model.py -d mnist -e 50 -b 128
python train_model.py -d cifar -e 100 -b 512
python train_model.py -d svhn -e 100 -b 256To generate adversarial examples:
python generate_adv.py -d mnist
python generate_adv.py -d cifar
python generate_adv.py -d svhnDetection methods are being migrated. Currently implemented:
- KDE (Kernel Density Estimation) - utility functions
- LID (Local Intrinsic Dimensionality) - utility functions
- ✅ Basic directory structure
- ✅ Common utilities
- ✅ CNN models for MNIST, CIFAR-10
- ✅ Training script
- ✅ Adversarial generation script
- ✅ KDE utility functions
- ✅ LID utility functions
- 🔄 Detection scripts (detect_kde.py, detect_lid.py, etc.)
- 🔄 MagNet detection method
- 🔄 Other detection methods (FS, NSS, NIC, multiLID)
- ❌ SVHN CNN model (requires ResNet18 implementation)
- ❌ ImageNet support
- ❌ Complete detector implementations
- ❌ Testing and validation
- Models are saved in HDF5 format (.h5) instead of PyTorch format (.pt)
- TensorFlow uses NHWC format by default (no need to transpose for CNNs)
- Some advanced attacks may require additional implementation