Skip to content
MagNet: a Two-Pronged Defense against Adversarial Examples
Branch: master
Clone or download
Latest commit b115cf8 Sep 7, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE MagNet demo Sep 7, 2017


Demo code for "MagNet: a Two-Pronged Defense against Adversarial Examples", by Dongyu Meng and Hao Chen, at CCS 2017.

The code demos black-box defense against Carlini's L2 attack of various confidences. Other techniques proposed in the paper are also included in and, but are not shown in the demo defense. Attack implementations are not provided in this repository.

Run the demo code:

  1. Make sure you have Keras, Tensorflow, numpy, scipy, and matplotlib installed.
  2. Clone the repository.
  3. We provide demo attack data and classifier on Dropbox and 百度网盘 (密码: yzt4). Please download and put the unzipped files in MagNet/. You may also use your own data for test.
  4. Train autoencoders with python3
  5. Test the defense with python3 .
  6. Defense performance is plotted in graph/defense_performance.pdf.
You can’t perform that action at this time.