{"id":15659703,"url":"https://github.com/angusg/cleverhans-attacking-bnns","last_synced_at":"2025-09-17T11:17:04.676Z","repository":{"id":87480019,"uuid":"113999538","full_name":"AngusG/cleverhans-attacking-bnns","owner":"AngusG","description":"Source for paper \"Attacking Binarized Neural Networks\"","archived":false,"fork":false,"pushed_at":"2018-03-23T14:02:39.000Z","size":327,"stargazers_count":23,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-05T19:52:40.836Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/AngusG.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.rst","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-12-12T14:22:26.000Z","updated_at":"2024-06-16T09:47:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"aa4655d7-3779-42df-bf31-9dfabf94dc49","html_url":"https://github.com/AngusG/cleverhans-attacking-bnns","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AngusG/cleverhans-attacking-bnns","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngusG%2Fcleverhans-attacking-bnns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngusG%2Fcleverhans-attacking-bnns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngusG%2Fcleverhans-attacking-bnns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngusG%2Fcleverhans-attacking-bnns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AngusG","download_url":"https://codeload.github.com/AngusG/cleverhans-attacking-bnns/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AngusG%2Fcleverhans-attacking-bnns/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275583821,"owners_count":25490764,"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","status":"online","status_checked_at":"2025-09-17T02:00:09.119Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-03T13:18:18.199Z","updated_at":"2025-09-17T11:17:04.643Z","avatar_url":"https://github.com/AngusG.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CleverHans (latest release: v2.0.0) for Attacking Binarized Neural Networks\n\n\u003cimg src=\"https://github.com/tensorflow/cleverhans/blob/master/assets/logo.png?raw=true\" alt=\"cleverhans logo\"\u003e\n\n[![Build Status](https://travis-ci.org/tensorflow/cleverhans.svg?branch=master)](https://travis-ci.org/tensorflow/cleverhans)\n\nThis repository contains the source code for CleverHans, a Python library to\nbenchmark machine learning systems' vulnerability to\n[adversarial examples](http://karpathy.github.io/2015/03/30/breaking-convnets/).\nYou can learn more about such vulnerabilities on the accompanying [blog](http://cleverhans.io).\n\nThe CleverHans library is under continual development, always welcoming\n[contributions](https://github.com/tensorflow/cleverhans#contributing)\nof the latest attacks and defenses.\nIn particular, we always welcome help towards resolving the [issues](https://github.com/tensorflow/cleverhans/issues)\ncurrently open.\n\n## Attacking Binarized Neural Networks\n+ `cleverhans_tutorials/mnist_attack.py` - white-box MNIST attacks\n+ `cleverhans_tutorials/mnist_blackbox.py` - black-box MNIST attack\n+ `examples/cifar10_attack` - white-box CIFAR-10 attacks\n+ `examples/cifar10_blackbox` - black-box CIFAR-10 attack\n\n## Setting up CleverHans\n\n### Dependencies\n\nThis library uses [TensorFlow](https://www.tensorflow.org/) to accelerate graph\ncomputations performed by many machine learning models.\nInstalling TensorFlow is therefore a pre-requisite.\n\nYou can find instructions\n[here](https://www.tensorflow.org/install/).\nFor better performance, it is also recommended to install TensorFlow\nwith GPU support (detailed instructions on how to do this are available\nin the TensorFlow installation documentation).\n\nInstalling TensorFlow will\ntake care of all other dependencies like `numpy` and `scipy`.\n\n### Installation\n\nOnce dependencies have been taken care of, you can install CleverHans using\n`pip` or by cloning this Github repository.\n\n#### `pip` installation\n\nIf you are installing CleverHans using `pip`, run the following command:\n\n```\npip install -e git+http://github.com/tensorflow/cleverhans.git#egg=cleverhans\n```\n\n#### Manual installation\n\nIf you are installing CleverHans manually, you need to install TensorFlow\nfirst. Then, run the following command to clone the CleverHans repository\ninto a folder of your choice:\n\n```\ngit clone https://github.com/tensorflow/cleverhans\n```\n\nOn UNIX machines, it is recommended to add your clone of this repository to the\n`PYTHONPATH` variable so as to be able to import `cleverhans` from any folder.\n\n```\nexport PYTHONPATH=\"/path/to/cleverhans\":$PYTHONPATH\n```\n\nYou may want to make that change permanent through your shell's profile.\n\n### Currently supported setups\n\nAlthough CleverHans is likely to work on many other machine configurations, we\ncurrently [test it](https://travis-ci.org/tensorflow/cleverhans) with Python\n{2.7, 3.5} and TensorFlow {1.0, 1.1} on Ubuntu 14.04.5 LTS (Trusty Tahr).\n\n## Tutorials\n\nTo help you get started with the functionalities provided by this library, the\n`cleverhans_tutorials/' folder comes with the following tutorials:\n* **MNIST with FGSM** ([code](cleverhans_tutorials/mnist_tutorial_tf.py)): this\ntutorial covers how to train a MNIST model using TensorFlow,\ncraft adversarial examples using the [fast gradient sign method](https://arxiv.org/abs/1412.6572),\nand make the model more robust to adversarial examples using adversarial training.\n* **MNIST with FGSM using Keras** ([code](cleverhans_tutorials/mnist_tutorial_keras_tf.py)): this\ntutorial covers how to define a MNIST model with Keras and train it using TensorFlow,\ncraft adversarial examples using the [fast gradient sign method](https://arxiv.org/abs/1412.6572),\nand make the model more robust to adversarial\nexamples using adversarial training.\n* **MNIST with JSMA** ([code](cleverhans_tutorials/mnist_tutorial_jsma.py)): this second\ntutorial covers how to define a MNIST model with Keras and train it using TensorFlow and\ncraft adversarial examples using the [Jacobian-based saliency map approach](https://arxiv.org/abs/1511.07528).\n* **MNIST using a black-box attack** ([code](cleverhans_tutorials/mnist_blackbox.py)):\nthis tutorial implements the black-box\nattack described in this [paper](https://arxiv.org/abs/1602.02697).\nThe adversary train a substitute model: a copy that imitates the black-box\nmodel by observing the labels that the black-box model assigns to inputs chosen\ncarefully by the adversary. The adversary then uses the substitute\nmodel’s gradients to find adversarial examples that are misclassified by the\nblack-box model as well.\n\nSome models used in the tutorials are defined using [Keras](https://keras.io),\nwhich should be installed before running these tutorials.\nInstallation instructions for Keras can be found\n[here](https://keras.io/#installation).\nNote that you should configure Keras to use the TensorFlow backend. You\ncan find instructions for\nsetting the Keras backend [on this page](https://keras.io/backend/).\n\n## Examples\n\nThe `examples/` folder contains additional scripts to showcase different uses\nof the CleverHans library or get you started competing in different adversarial\nexample contests.\n\n## Reporting benchmarks\n\nWhen reporting benchmarks, please:\n* Use a versioned release of CleverHans. You can find a list of released versions [here](https://github.com/tensorflow/cleverhans/releases).\n* Either use the latest version, or, if comparing to an earlier publication, use the same version as the earlier publication.\n* Report which attack method was used.\n* Report any configuration variables used to determine the behavior of the attack.\n\nFor example, you might report \"We benchmarked the robustness of our method to\nadversarial attack using v2.0.0 of CleverHans. On a test set modified by the\n`FastGradientMethod` with a max-norm `eps` of 0.3, we obtained a test set accuracy of 71.3%.\"\n\n## Contributing\n\nContributions are welcomed! To speed the code review process, we ask that:\n* New efforts and features be coordinated\non the mailing list for CleverHans development: [cleverhans-dev@googlegroups.com](https://groups.google.com/forum/#!forum/cleverhans-dev).\n* When making code contributions to CleverHans, you follow the\n`PEP8` coding style in your pull requests.\n* When making your first pull request, you [sign the Google CLA](https://cla.developers.google.com/clas)\n\nBug fixes can be initiated through Github pull requests.\n\n## Citing this work\n\nIf you use CleverHans for academic research, you are highly encouraged\n(though not required) to cite the following [paper](https://arxiv.org/abs/1610.00768):\n\n```\n@article{papernot2016cleverhans,\n  title={cleverhans v1.0.0: an adversarial machine learning library},\n  author={Papernot, Nicolas and Goodfellow, Ian and Sheatsley, Ryan and Feinman, Reuben and McDaniel, Patrick},\n  journal={arXiv preprint arXiv:1610.00768},\n  year={2016}\n}\n```\nThere is not yet an ArXiv tech report for v2.0.0 but one will be prepared soon.\n\n## About the name\n\nThe name CleverHans is a reference to a presentation by Bob Sturm titled\n“Clever Hans, Clever Algorithms: Are Your Machine Learnings Learning What You\nThink?\" and the corresponding publication, [\"A Simple Method to Determine if a\nMusic Information Retrieval System is a\n'Horse'.\"](http://ieeexplore.ieee.org/document/6847693/) Clever Hans was a\nhorse that appeared to have learned to answer arithmetic questions, but had in\nfact only learned to read social cues that enabled him to give the correct\nanswer. In controlled settings where he could not see people's faces or receive\nother feedback, he was unable to answer the same questions. The story of Clever\nHans is a metaphor for machine learning systems that may achieve very high\naccuracy on a test set drawn from the same distribution as the training data,\nbut that do not actually understand the underlying task and perform poorly on\nother inputs.\n\n## Authors\n\nThis library is managed and maintained by Ian Goodfellow (Google Brain),\nNicolas Papernot (Pennsylvania State University), and\nRyan Sheatsley (Pennsylvania State University).\n\nThe following authors contributed 100 lines or more (ordered according to the GitHub contributors page):\n* Nicolas Papernot (Pennsylvania State University, Google Brain intern)\n* Nicholas Carlini (UC Berkeley)\n* Ian Goodfellow (Google Brain)\n* Reuben Feinman (Symantec)\n* Fartash Faghri (University of Toronto, Google Brain intern)\n* Alexander Matyasko (Nanyang Technological University)\n* Karen Hambardzumyan (YerevaNN)\n* Yi-Lin Juang (NTUEE)\n* Alexey Kurakin (Google Brain)\n* Ryan Sheatsley (Pennsylvania State University)\n* Abhibhav Garg (IIT Delhi)\n* Yen-Chen Lin (National Tsing Hua University)\n* Paul Hendricks\n\n## Copyright\n\nCopyright 2017 - Google Inc., OpenAI and Pennsylvania State University.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangusg%2Fcleverhans-attacking-bnns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangusg%2Fcleverhans-attacking-bnns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangusg%2Fcleverhans-attacking-bnns/lists"}