Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of SmoothMix Training in the Randomized Smoothing Module #1668

Closed
wants to merge 78 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
73aee16
created smoothmix skeleton
asarj Apr 28, 2022
f9ee2b0
added drafted notebook cells for demo
asarj Apr 30, 2022
eb091bd
code cleanup, moved smoothmix to inside randomized_smoothing, and cre…
asarj May 1, 2022
f63eb64
fixed kwargs error
asarj May 1, 2022
7d01f80
fixed syntax errors in randomized_smoothing.pytorch
asarj May 1, 2022
c837e34
removed redundant references to noise_sd (scale = noise_sd)
asarj May 1, 2022
4b49a0d
removed extra reference to noise_sd
asarj May 1, 2022
cb0b400
added debugging statements in fit_pytorch
asarj May 1, 2022
0940066
updated demo notebook
asarj May 1, 2022
7f45d56
updated reference to SmoothPGD attack in fit_pytorch
asarj May 1, 2022
ce2b66f
fixed errors in implementation after testing in notebook
asarj May 1, 2022
44673b4
removed comments in notebook
asarj May 1, 2022
a5ab28c
finished notebook outline, began notebook execution
asarj May 1, 2022
2492ff3
debugging via print statements
asarj May 3, 2022
9903fc6
fixed broken unit test
asarj May 3, 2022
0a18619
updated testing script
asarj May 3, 2022
0215547
updated documentation across modules
asarj May 3, 2022
95b14e1
fixed unit test issues
asarj May 3, 2022
65f2649
minor adjustment to unit test fix
asarj May 3, 2022
e31bccc
updated documentation further
asarj May 3, 2022
2fb57be
moved train_method to kwargs, more debugging
asarj May 4, 2022
66fb339
added smoothmix unit test in randomized_smoothing module
asarj May 5, 2022
cdc6815
removed debugging test notebook script
asarj May 5, 2022
733404c
added demo notebook skeleton, renamed notebook housing verification o…
asarj May 6, 2022
fa16b0e
updated testing script
asarj May 3, 2022
41538fc
resolved lgtm errors
asarj May 6, 2022
bcb3988
removed debugging statements
asarj May 6, 2022
82943c1
Set `click==8.0.2` for style check workflow
Mar 31, 2022
37447ea
Cleaned up compare function and added documentation
LucaSchinnerl Apr 23, 2022
a7b8467
Added docstring of the ADAM optimizer for coordinate descent
LucaSchinnerl Apr 23, 2022
4e65038
add model definition and rerun the notebook
chao1995 Apr 28, 2022
fcf7eb3
Fixed formatting and added typing to compare function
LucaSchinnerl Apr 29, 2022
fe9fe9a
Fixed formatting
LucaSchinnerl Apr 29, 2022
1fb2ffc
fixing linting checks
asarj May 7, 2022
71fc65d
finalized demo notebook
asarj May 7, 2022
79a6c67
fixed demo notebook bugs
asarj May 8, 2022
aea206d
fixed demo notebook bugs
asarj May 8, 2022
406a9d2
Merge branch 'smoothmix' of github.com:Ethos-lab/adversarial-robustne…
asarj May 8, 2022
588d6be
remove downloaded cifar10 dataset
asarj May 9, 2022
de41f46
created smoothmix skeleton
asarj Apr 28, 2022
04a10d9
added drafted notebook cells for demo
asarj Apr 30, 2022
ea0dde0
code cleanup, moved smoothmix to inside randomized_smoothing, and cre…
asarj May 1, 2022
46ad0e0
fixed kwargs error
asarj May 1, 2022
bd37faa
fixed syntax errors in randomized_smoothing.pytorch
asarj May 1, 2022
c604944
removed redundant references to noise_sd (scale = noise_sd)
asarj May 1, 2022
f2b0141
removed extra reference to noise_sd
asarj May 1, 2022
c022088
added debugging statements in fit_pytorch
asarj May 1, 2022
352b618
updated demo notebook
asarj May 1, 2022
b2d01f1
updated reference to SmoothPGD attack in fit_pytorch
asarj May 1, 2022
87ee8a4
fixed errors in implementation after testing in notebook
asarj May 1, 2022
83c5a73
removed comments in notebook
asarj May 1, 2022
3ed50ce
finished notebook outline, began notebook execution
asarj May 1, 2022
066d26a
debugging via print statements
asarj May 3, 2022
37c8611
fixed broken unit test
asarj May 3, 2022
b9014e9
updated testing script
asarj May 3, 2022
a0132ec
updated documentation across modules
asarj May 3, 2022
2b6200f
fixed unit test issues
asarj May 3, 2022
8425bd4
minor adjustment to unit test fix
asarj May 3, 2022
411f934
updated documentation further
asarj May 3, 2022
6254b8c
moved train_method to kwargs, more debugging
asarj May 4, 2022
f3eded0
added smoothmix unit test in randomized_smoothing module
asarj May 5, 2022
8d6ea16
removed debugging test notebook script
asarj May 5, 2022
309f165
added demo notebook skeleton, renamed notebook housing verification o…
asarj May 6, 2022
051e309
updated testing script
asarj May 3, 2022
b19f7df
resolved lgtm errors
asarj May 6, 2022
e2cbde7
removed debugging statements
asarj May 6, 2022
aeaf9ed
fixing linting checks
asarj May 7, 2022
d89f59c
finalized demo notebook
asarj May 7, 2022
432912c
fixed demo notebook bugs
asarj May 8, 2022
07830f1
fixed demo notebook bugs
asarj May 8, 2022
3cff4f6
remove downloaded cifar10 dataset
asarj May 9, 2022
0965352
Merge branch 'dev_1.11.0' of github.com:Ethos-lab/adversarial-robustn…
asarj May 11, 2022
63db50d
Merge branch 'dev_1.11.0' of github.com:Ethos-lab/adversarial-robustn…
asarj May 11, 2022
fe023e0
Merge branch 'dev_1.11.0' of github.com:Ethos-lab/adversarial-robustn…
asarj May 11, 2022
44726e1
fixed latest linting checks
asarj May 11, 2022
c1c72ec
Merge branch 'smoothmix' of github.com:Ethos-lab/adversarial-robustne…
asarj May 11, 2022
57e7ded
fixed tensorflowfasterrcnn failing test
asarj May 11, 2022
d2fb08b
replaced torch ref in _requires_grad_() with string representation (a…
asarj May 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
resolved lgtm errors
Signed-off-by: Ajay Sarjoo <ajay.sarjoo@outlook.com>
asarj committed May 11, 2022
commit b19f7dfcc2a0603f64e43f6f03cefed528f4005e
Original file line number Diff line number Diff line change
@@ -32,7 +32,6 @@
from art.estimators.certification.randomized_smoothing.randomized_smoothing import RandomizedSmoothingMixin
import art.estimators.certification.randomized_smoothing.smoothmix.train_smoothmix as train_smoothmix
from art.defences.preprocessor.gaussian_augmentation import GaussianAugmentation
from art.attacks.evasion.iterative_method import BasicIterativeMethod
import torch

if TYPE_CHECKING:
Original file line number Diff line number Diff line change
@@ -27,13 +27,8 @@

"""

import numpy as np
import torch
from torch.autograd import Variable
from torch.nn import CrossEntropyLoss
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from typing import Optional


@@ -70,7 +65,7 @@ def __init__(

def attack(
self,
model: nn.Module,
model: torch.nn.Module,
inputs: torch.Tensor,
labels: torch.Tensor,
noises: torch.Tensor = None
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals

import logging
from typing import List, Optional, Tuple, Union, Generator, TYPE_CHECKING
from typing import Tuple, TYPE_CHECKING
import time # Remove after testing
import numpy as np

@@ -114,7 +114,6 @@ def fit_pytorch(self, x: np.ndarray, y: np.ndarray, batch_size: int, nb_epochs:
batch_time = AverageMeter() # Remove later
data_time = AverageMeter() # Remove later
losses = AverageMeter() # Remove later
losses_reg = AverageMeter() # Remove later
end = time.time() # Remove later

# Put the model in the training mode