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.
- Loading branch information
Showing
1 changed file
with
12 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,10 @@ CUDA_VISIBLE_DEVICES=0 anomalib test \ | |
└───────────────────────────┴───────────────────────────┘ | ||
``` | ||
|
||
```sh | ||
anomalib test --data anomalib.data.MVTec --data.category hazelnut --model WinClip --data.init_args.image_size 240 --data.init_args.eval_batch_size 16 "--metrics.pixel=[F1Score,AUROC]" | ||
``` | ||
|
||
3. Generate an adversary config file from MART. | ||
|
||
```sh | ||
|
@@ -72,6 +76,10 @@ attack.callbacks.progress_bar.enable=true \ | |
> anomalib_fgsm_linf_10.yaml | ||
``` | ||
|
||
```sh | ||
python -m mart.generate_config --config_dir="configs" --export_node=callbacks.adversary_connector --resolve=True callbacks=adversary_connector [email protected]_connector.batch_c15n=dict_imagenet_normalized callbacks.adversary_connector.adversary=$\{attack\} +attack=classification_fgsm_linf attack.objective=null attack.eps=10 attack.callbacks.progress_bar.enable=true +callbacks.adversary_connector.module_step_fn=validation_step attack.gain._call_with_args_.0=anomaly_maps attack.gain._call_with_args_.1=mask > anomalib_fgsm_linf_10.yaml | ||
``` | ||
|
||
4. Run attack. We add a MART callback that loads the attack config file we just generated [./anomalib_fgsm_linf_10.yaml](./anomalib_fgsm_linf_10.yaml). | ||
|
||
```sh | ||
|
@@ -94,3 +102,7 @@ CUDA_VISIBLE_DEVICES=0 anomalib test \ | |
│ pixel_F1Score │ 0.0955422893166542 │ | ||
└───────────────────────────┴───────────────────────────┘ | ||
``` | ||
|
||
```sh | ||
anomalib test --data anomalib.data.MVTec --data.category hazelnut --model WinClip --data.init_args.image_size 240 --data.init_args.eval_batch_size 16 "--metrics.pixel=[F1Score,AUROC]" --trainer.callbacks mart.utils.CallbackInstantiator --trainer.callbacks.cfg_path ./anomalib_fgsm_linf_10.yaml | ||
``` |