https://github.com/kahsolt/retreaval-based-adversarial-defense
Adversarial defense by retreaval-based methods
https://github.com/kahsolt/retreaval-based-adversarial-defense
adversarial-defense image-classification pgd-attack retreaval-based
Last synced: about 1 month ago
JSON representation
Adversarial defense by retreaval-based methods
- Host: GitHub
- URL: https://github.com/kahsolt/retreaval-based-adversarial-defense
- Owner: Kahsolt
- License: mit
- Created: 2023-12-01T10:34:51.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-01-25T09:33:44.000Z (over 1 year ago)
- Last Synced: 2025-02-22T19:49:40.925Z (over 1 year ago)
- Topics: adversarial-defense, image-classification, pgd-attack, retreaval-based
- Language: Python
- Homepage:
- Size: 272 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Retreaval-based-Adversarial-Defense
Adversarial defense by retreaval-based methods
----
⚠ status: it is seemingly a degenerated version of the MAE defense which also failed against PGD attack, leaving for future research :(
Ideas of the retreaval-based methods:
- [x] input pixel patch
- [x] input pixel textual patch (f')
- [ ] cnn fmap patch
- [ ] cnn fmap textual patch
### quick start
⚪ Preparation
- download the datasets [here](https://pan.quark.cn/s/cb9b0dbd64f7), unzip to `data/` folder
- NIPS17 & ssa-cwa-200: clean and pre-generated adversarial images from [Attack-Bard](https://github.com/thu-ml/Attack-Bard)
- imagenet-1k: 1000 cherry-picked images from the imagenet validation set
⚪ Warmup
- run `vis_NIPS17.py`, try understand what happens
- run `run_NIPS17_clf.py`, try understand what happens
- run `run.py`, try understand what happens
- run `run.py --atk`, try understand what happens
⚪ Your Tasks
> Use `imagenet-1k` as the ref-data to remove adv noise on `ssa-cwa-200` (pregen adv of `NIPS17`)
> Our final goal: let `run.py --atk --dfn` work! :)
- [x] implement `defenses.vector_db`
- [x] implement `defenses.img_hifreq`
- [x] implement `defenses.patch_replace`
#### references
- rvc-project: [https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI)
- the-ever-lasting-adversarial-war: [https://github.com/Kahsolt/the-ever-lasting-adversarial-war](https://github.com/Kahsolt/the-ever-lasting-adversarial-war)
----
by Armit
2023/10/26