generated from ashleve/lightning-hydra-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Lp-bounded patch adversary for object detection (#242)
* Create a folder for attack.composer. * Add composer modules for unbounded patch adversary. * Add config of Adam optimizer. * Add LoadCoords for patch adversary. * Add a config of unbounded patch adversary. * Add a datamodule config for carla patch adversary. * Fix the simple Linf projection. * Add composer module PertImageBase for Lp bounded patch adversary. * Add config of lp-bounded patch adversary. * Formatting
- Loading branch information
Showing
6 changed files
with
114 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pert_image_base: | ||
_target_: mart.attack.composer.PertImageBase | ||
fpath: ??? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
_target_: mart.attack.projector.Lp | ||
# p is actually torch.inf by default. | ||
p: | ||
_target_: builtins.float | ||
_args_: ["inf"] | ||
eps: ??? |
55 changes: 55 additions & 0 deletions
55
mart/configs/attack/object_detection_lp_patch_adversary.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
defaults: | ||
- adversary | ||
- /optimizer@optimizer: adam | ||
- enforcer: default | ||
- composer: default | ||
- composer/perturber/initializer: uniform | ||
- composer/perturber/projector: linf | ||
- composer/modules: | ||
[ | ||
pert_rect_size, | ||
pert_extract_rect, | ||
pert_image_base, | ||
pert_rect_perspective, | ||
overlay, | ||
] | ||
- gradient_modifier: sign | ||
- gain: rcnn_training_loss | ||
- objective: zero_ap | ||
- override /callbacks@callbacks: [progress_bar, image_visualizer] | ||
|
||
max_iters: ??? | ||
lr: ??? | ||
eps: ??? | ||
|
||
optimizer: | ||
maximize: True | ||
lr: ${..lr} | ||
|
||
enforcer: | ||
# No constraints with complex renderer in the pipeline. | ||
# TODO: Constraint on digital perturbation? | ||
constraints: {} | ||
|
||
composer: | ||
perturber: | ||
initializer: | ||
min: ${negate:${....eps}} | ||
max: ${....eps} | ||
projector: | ||
eps: ${....eps} | ||
modules: | ||
pert_image_base: | ||
fpath: ??? | ||
sequence: | ||
seq010: | ||
pert_rect_size: ["target.coords"] | ||
seq020: | ||
pert_extract_rect: | ||
["perturbation", "pert_rect_size.height", "pert_rect_size.width"] | ||
seq030: | ||
pert_image_base: ["pert_extract_rect"] | ||
seq040: | ||
pert_rect_perspective: ["pert_image_base", "input", "target.coords"] | ||
seq050: | ||
overlay: ["pert_rect_perspective", "input", "target.perturbable_mask"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters