mahyarnajibi / freeadversarialtraining Goto Github PK
View Code? Open in Web Editor NEWPyTorch Implementation of Adversarial Training for Free!
License: Other
PyTorch Implementation of Adversarial Training for Free!
License: Other
I am facing memory leak issue due to the gradient calculation of the noise_batch tensor. Is there any specific PyTorch version required to avoid this issue?
The existed code do not normalize both train and valid data.
FreeAdversarialTraining/main_free.py
Line 111 in d707740
in paper, g_{adv} is x's gradient, but in code, it's delta's ?
the code is
FreeAdversarialTraining/main_free.py
Line 198 in d707740
Hi, your work is great! I have tried to run Free-8 with WideResNet34-10 on CIFAR10 using PyTorch.
My experiment settings: m=8, clip_epsilon=8.0 and fgsm_step=2.0. I trained 240 epochs. Initial learning rate is 0.1 and learning rate decays 10 times at 100//8 epoch and 150//8 epoch. SGD optimizer, momentum 0.9 and weight_decay 2e-4. And I set torch.backends.cudnn.benchmark = False and torch.backends.cudnn.deterministic = True.
The experiment results: clean validation accuracy is about 88.5, but adversarial validation accuracy is only about 43. Is there something wrong with my settings? Could you please provide more detail information?
FreeAdversarialTraining/main_free.py
Line 183 in d707740
is in1.clamp_(0, 1.0) should be in1.clamp_(0, 255.0) ? As "in1" has not been normalized yet.
Hi,
Thank you for providing the code. I modified the code a little by only changing the dataset/dataloader to CIFAR-10 and network architecture to WideResNet32-10/ResNet-50 to reproduce the free adversarial training results on CIFAR-10. Unfortunately, I failed to get the expected results. The top1 test accuracy of natural images and the top1 accuracy againt PGD attacks are far away from that the article reported, less than 20% and 10% respectively.
Here is the modified code and the training logs are attached.
resnet50_log.txt
WRN_32_10_log.txt
Is there any way to access pre-trained models?
Thanks for your great work.
I notice the training script mainfree.py does not support multi-gpus training, however the TensorFlow version does.
Is there any technical issue?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.