{"id":19839831,"url":"https://github.com/qdata/featuresqueezing","last_synced_at":"2025-05-01T19:30:25.613Z","repository":{"id":83652158,"uuid":"88904019","full_name":"QData/FeatureSqueezing","owner":"QData","description":"NDSS18: Detecting Adversarial Examples in Deep Neural Networks","archived":false,"fork":false,"pushed_at":"2017-04-20T19:42:19.000Z","size":15,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-06T17:05:56.952Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://evademl.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QData.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-20T19:41:07.000Z","updated_at":"2025-03-21T17:14:12.000Z","dependencies_parsed_at":"2023-03-12T18:59:26.688Z","dependency_job_id":null,"html_url":"https://github.com/QData/FeatureSqueezing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FFeatureSqueezing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FFeatureSqueezing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FFeatureSqueezing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FFeatureSqueezing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QData","download_url":"https://codeload.github.com/QData/FeatureSqueezing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251932522,"owners_count":21667158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T12:24:31.802Z","updated_at":"2025-05-01T19:30:25.607Z","avatar_url":"https://github.com/QData.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Feature Squeezing\n*Detecting Adversarial Examples in Deep Neural Networks*  \n  \n\u003cimg src=\"http://evademl.org/images/squeezing.png\" height=\"150\" width=\"360\" alt=\"idea_figure\" \u003e  \n\n## Run the code\n\n### 1. Install dependencies.\n\n```bash\npip install tensorflow==0.12.1 keras==1.2.0 pillow scikit-learn\n```\n\nIf you are going to run experiment on GPU, you should install `tensorflow-gpu` instead of `tensorflow`.\n\nCleverhans v1.0.0 will be automatically fetched and located when executing `from utils import load_externals` in Python. You don't need to do anything on it.\n\n### 2. Run the experiments on MNIST.\n\n(Optional) Train a classification model on MNIST, then use adversarial training to get a second model.\n```bash\npython train_mnist_model.py\n```\n\nIf you don't train your own models, the program `python mnist_experiment.py` will automatically download the pre-trained ones from our website.\n\nFirst, let's test the color bit depth reduction with FGSM.\n```bash\npython mnist_experiment.py --task FGSM --visualize\n```\nThe program will generate adversarial examples with FGSM, output a figure with image examples, and evaluate the model accuracy with and without the binary filter. In order to save time, the program only generates adversarial examples in the first run, and the later runs will reuse the adversarial examples.\n\nSecond, we will test adversarial training with and without the binary filter, so as to compare adversarial training with feature squeezing.\n```bash\npython mnist_experiment.py --task FGSM-adv-train\n```\n\nNext, we will test the median smoothing with JSMA.\n```bash\npython mnist_experiment.py --task JSMA --visualize\n```\nThe program will generate adversarial examples with JSMA, output a figure with image examples, and evaluate the model accuracy with and without median smoothing.\n\nFinally, we will conduct three detection experiments. The program will report the detection performance as well as the selected thresholds.\n\n\n\u003cimg src=\"http://evademl.org/images/squeezingframework.png\" height=\"120\" width=\"360\" alt=\"idea_figure\" \u003e  \n\n```bash\npython mnist_experiment.py --task FGSM-detection\npython mnist_experiment.py --task JSMA-detection\npython mnist_experiment.py --task joint-detection\n```\n\n### 3. Review the results.\n\nThe experimental results are stored in `./results/mnist/`, including tables, figures, and pickled files.\n\nYou can also download the results we generated before using one GeForce GTX 1080.\n\n```bash\nmkdir results \u0026\u0026 cd results\nwget http://www.cs.virginia.edu/~wx4ed/downloads/squeezing/results_mnist.tar.gz\ntar xfz results_mnist.tar.gz\nrm results_mnist.tar.gz\ncd ..\npython mnist_experiment.py --task joint-detection\n```\n\n## Cite this work\n\nYou are encouraged to cite the following paper if you use `Feature Squeezing` for academic research.\n\n```\n@article{xu2017feature,\n  title={Feature Squeezing: Detecting Adversarial Examples in Deep Neural Networks},\n  author={Xu, Weilin and Evans, David and Qi, Yanjun},\n  journal={arXiv preprint arXiv:1704.01155},\n  year={2017}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqdata%2Ffeaturesqueezing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqdata%2Ffeaturesqueezing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqdata%2Ffeaturesqueezing/lists"}