Skip to content

Commit

Permalink
(#3) Defense: Add processing logic for exformer and exmotd
Browse files Browse the repository at this point in the history
  • Loading branch information
betarixm committed May 25, 2022
1 parent 0362f11 commit ba1ee67
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/defense/process.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from utils.logging import concat_batch_images
from defense.models import Reformer, Denoiser, Motd
from defense.models import Reformer, Denoiser, Motd, ExMotd

import tensorflow as tf

Expand Down Expand Up @@ -30,7 +30,7 @@
type=str,
help="Defense method",
required=True,
choices=["reformer", "denoiser", "motd"],
choices=["reformer", "exformer", "denoiser", "motd", "exmotd"],
)

parser.add_argument(
Expand Down Expand Up @@ -59,19 +59,32 @@
input_shape=input_shape,
intensity=args.intensity[0],
)
elif args.defense == "exformer":
defense_model = Reformer(
"defense_exformer_cifar10",
input_shape=input_shape,
intensity=args.intensity[0],
)
elif args.defense == "denoiser":
defense_model = Denoiser(
f"defense_denoiser_{args.dataset}",
input_shape=input_shape,
intensity=args.intensity[0],
)
else:
elif args.defense == "motd":
defense_model = Motd(
f"defense_motd_{args.dataset}",
input_shape=input_shape,
dataset=args.dataset,
intensities=args.intensity,
)
else:
defense_model = ExMotd(
f"defense_exmotd_{args.dataset}",
input_shape=input_shape,
dataset=args.dataset,
intensities=args.intensity,
)

defense_model.compile()
defense_model.load()
Expand Down

0 comments on commit ba1ee67

Please sign in to comment.