How trevillie/magnet works
Project type and purpose
• This is a research/demo machine-learning project (“MagNet”) that implements and validates a two-pronged defense against adversarial examples on image data (MNIST).
• The README makes clear it’s a pipeline for training autoencoder-based defenses, then testing them against precomputed adversarial examples, and plotting results.
File structure
• Top-level Python scripts define each pipeline stage:
• setup_mnist.py – download/prepare MNIST data
• train_models.py – (likely) trains baseline classifiers
• train_defense.py – trains the defense autoencoders/filters
• test_defense.py – runs defense on adversarial examples and reports metrics
• defensive_models.py – definitions/architectures of autoencoders and detectors
• worker.py – utility for batch processing, maybe parallel defense runs
• utils.py – shared helper functions (data loaders, metrics, plotting helpers)
• No web UI or frontend; it’s purely a computation pipeline.
• There’s an expectation of external “support data” (attacks + classifier) dropped into the MagNet/ folder.
• Output: a PDF graph under graph/defense_performance.pdf (implied).
Key architectural insights from README
• Dependency on Keras/TensorFlow for model definition and training
• train_defense.py → builds autoencoders from defensive_models.py
• test_defense.py → uses trained models + adversarial examples → defense results + plots
• No attack code is implemented here – attacks are precomputed and loaded.
Final remarks
• Be detailed: show each script, model definition, data artifact, and how they connect.
• Both the logical flow (pipeline stages) and the physical components (Python files, data files, libraries).