{"id":41439067,"url":"https://github.com/nesl/adversarial_genattack","last_synced_at":"2026-01-23T14:53:10.195Z","repository":{"id":37067904,"uuid":"135111471","full_name":"nesl/adversarial_genattack","owner":"nesl","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-24T22:00:50.000Z","size":986,"stargazers_count":51,"open_issues_count":4,"forks_count":14,"subscribers_count":19,"default_branch":"master","last_synced_at":"2023-10-20T22:01:19.508Z","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/nesl.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}},"created_at":"2018-05-28T05:02:18.000Z","updated_at":"2023-10-21T12:27:28.642Z","dependencies_parsed_at":"2022-06-24T21:38:37.877Z","dependency_job_id":"87a188e8-fc7d-4ad3-b9ee-030dfa390d47","html_url":"https://github.com/nesl/adversarial_genattack","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/nesl/adversarial_genattack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nesl%2Fadversarial_genattack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nesl%2Fadversarial_genattack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nesl%2Fadversarial_genattack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nesl%2Fadversarial_genattack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nesl","download_url":"https://codeload.github.com/nesl/adversarial_genattack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nesl%2Fadversarial_genattack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28694457,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T14:15:13.573Z","status":"ssl_error","status_checked_at":"2026-01-23T14:09:05.534Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-01-23T14:53:09.363Z","updated_at":"2026-01-23T14:53:10.186Z","avatar_url":"https://github.com/nesl.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GenAttack: Practical Black-box Attacks with Gradient-Free Optimization.\n\nThis repo has an implemntation for our paper [GenAttack: Practical Black-box Attacks with Gradient-Free Optimization](https://arxiv.org/abs/1805.11090)\n\n## Instructions\n\n### Setup\n\nInstall the required libraries:\n```\npip install -r requirements.txt\n```\n### ImageNet Experiment\nDownload `Inception-v3` model checkpoint\n\n```\npython setup_inception.py\n```\n\nYou can download test images from [ImageNet test set](http://jaina.cs.ucdavis.edu/datasets/adv/imagenet/img.tar.gz).\n\nTo run the attack without dimensionality reduction and adaptive parameter scaling\n```\n python main.py --input_dir=./images/ --test_size=1 \\\n    --eps=0.05 --alpha=0.15 --mutation_rate=0.005  \\\n    --max_steps=500000 --output_dir=attack_outputs  \\\n    --pop_size=6 --target=704 --adaptive=False\n```\n\n![Attack example with no dimensionality reduction](attack_example_no_dimred.png)\n**Original class:** Squirrl, **Adversarial class**: Parking Meter, **Number of queries**=74,171\n\n\n**For more query efficiency**\n\nRun attack with dimensionality reduction and adaptive parameter scaling\n\n```\npython main.py --input_dir=./images/ --test_size=1 \\\n    --eps=0.05 --alpha=0.15 --mutation_rate=0.10  \\\n    --max_steps=100000 --output_dir=attack_outputs \\\n    --pop_size=6 --target=704 --adaptive=True --resize_dim=96\n```\n\n![Attack example](attack_example.png)\n**Original class:** Squirrl, **Adversarial class**: Parking Meter, **Number of queries**=11,696\n\n\n**More options**:\n* If you want to test on a single image, add the FLAG: `--test_example=xx`.\n* To specify a target class, instead of using a random target, add the flag `--target=xx`.\n\n---\n### MNIST and CIFAR-10 Experiments\n\nFirst, you need to train the classification models on MNIST and CIFAR-10 datasets.\n\n```\npython train_models.py\n```\n\n### Attacking MNIST Model\n\n```\n python main.py --model=mnist --test_size=1000 --mutation_rate=0.30 --alpha=0.5 --adaptive=False --max_steps=10000 --eps=0.30  --output_dir=mnist_output --pop_size=4  --temp=0.1\n```\n\n### Attacking CIFAR-10 Model:\n\n```\npython main.py --model=cifar10 --test_size=1000 --mutation_rate=0.05 --alpha=0.25 --adaptive=False --max_steps=10000 --eps=0.05  --output_dir=cifar10_output --pop_size=4  --temp=0.1\n```\n\n## Maintainer:\n* This project is maintained by: Moustafa Alzantot [(malzantot)](https://github.com/malzantot)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnesl%2Fadversarial_genattack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnesl%2Fadversarial_genattack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnesl%2Fadversarial_genattack/lists"}