From 092df4ae35f38f0b2729ae2d299b0ec883ee3558 Mon Sep 17 00:00:00 2001 From: Sterling Date: Wed, 25 Jan 2023 19:14:03 +0000 Subject: [PATCH 01/26] clip triggered audio in case it was out of range --- armory/art_experimental/attacks/poison_loader_audio.py | 1 + 1 file changed, 1 insertion(+) diff --git a/armory/art_experimental/attacks/poison_loader_audio.py b/armory/art_experimental/attacks/poison_loader_audio.py index 2c2946f47..0156b587d 100644 --- a/armory/art_experimental/attacks/poison_loader_audio.py +++ b/armory/art_experimental/attacks/poison_loader_audio.py @@ -60,6 +60,7 @@ def insert(self, x: np.ndarray) -> np.ndarray: raise ValueError("Shift + Backdoor length is greater than audio's length.") audio[shift : shift + bd_length] += self.scaled_trigger + audio = np.clip(audio, -1.0, 1.0) return audio.astype(original_dtype) From c983c2c74fcac28868ddad6dcc880b69f51ea2e6 Mon Sep 17 00:00:00 2001 From: Sterling Date: Wed, 25 Jan 2023 20:12:50 +0000 Subject: [PATCH 02/26] additions to audio resnet to use it as explanatory bean model --- .../tf_graph/audio_resnet50.py | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/armory/baseline_models/tf_graph/audio_resnet50.py b/armory/baseline_models/tf_graph/audio_resnet50.py index befc741b1..c8049ddef 100644 --- a/armory/baseline_models/tf_graph/audio_resnet50.py +++ b/armory/baseline_models/tf_graph/audio_resnet50.py @@ -19,7 +19,7 @@ def get_spectrogram(audio): return spectrogram # shape (124, 129, 1) -def make_audio_resnet(**kwargs) -> tf.keras.Model: +def make_audio_resnet(sequential=True, **kwargs) -> tf.keras.Model: inputs = keras.Input(shape=(16000,)) spectrogram = Lambda(lambda audio: get_spectrogram(audio))(inputs) @@ -32,8 +32,10 @@ def make_audio_resnet(**kwargs) -> tf.keras.Model: ) model = keras.Model(resnet.inputs, resnet.outputs) - # ART's TensorFlowV2Classifier get_activations() requires a Sequential model - model = keras.Sequential([model]) + if sequential: + # ART's TensorFlowV2Classifier get_activations() requires a Sequential model + model = keras.Sequential([model]) + model.compile( optimizer=tf.keras.optimizers.Adam(), loss=tf.keras.losses.SparseCategoricalCrossentropy(), @@ -47,12 +49,7 @@ def get_art_model( model_kwargs: dict, wrapper_kwargs: dict, weights_path: Optional[str] = None ): - if weights_path: - raise ValueError( - "This model is implemented for poisoning and does not (yet) load saved weights." - ) - - model = make_audio_resnet(**model_kwargs) + model = make_audio_resnet(sequential=True, **model_kwargs) loss_object = losses.SparseCategoricalCrossentropy() @@ -73,3 +70,14 @@ def train_step(model, samples, labels): ) return art_classifier + + +def get_unwrapped_model( + weights_path: str, + **model_kwargs, +): + # This is used for the explanatory model for the poisoning fairness metrics + model = make_audio_resnet(sequential=False, **model_kwargs) + model.load_weights(weights_path) + + return model From 638e09e3bb3cdb758d99bd073ffab091e46ee331 Mon Sep 17 00:00:00 2001 From: Sterling Date: Wed, 25 Jan 2023 20:15:37 +0000 Subject: [PATCH 03/26] speech commands explanatory model, and adapt code to handle audio and tf models --- armory/metrics/poisoning.py | 81 +++++++++++++++++++++++++++---------- 1 file changed, 60 insertions(+), 21 deletions(-) diff --git a/armory/metrics/poisoning.py b/armory/metrics/poisoning.py index 61ef25e0c..eb6cfe64e 100644 --- a/armory/metrics/poisoning.py +++ b/armory/metrics/poisoning.py @@ -4,11 +4,20 @@ from PIL import Image import numpy as np import torch +import tensorflow as tf from armory.data.utils import maybe_download_weights_from_s3 # An armory user may request one of these models under 'adhoc'/'explanatory_model' EXPLANATORY_MODEL_CONFIGS = explanatory_model_configs = { + "speech_commands_explanatory_model": { + "module": "armory.baseline_models.tf_graph.audio_resnet50", + "name": "get_unwrapped_model", + "data_modality": "audio", + "activation_layer": "avg_pool", + "model_framework": "tensorflow", + "weights_file": "speech_commands_explanatory_model_resnet50_bean.h5", + }, "cifar10_silhouette_model": { "model_kwargs": { "data_means": [0.4914, 0.4822, 0.4465], @@ -46,6 +55,9 @@ class ExplanatoryModel: def __init__( self, explanatory_model, + data_modality="image", + framework="pytorch", + activation_layer=None, resize_image=True, size=(224, 224), resample=Image.BILINEAR, @@ -54,6 +66,9 @@ def __init__( if not callable(explanatory_model): raise ValueError(f"explanatory_model {explanatory_model} is not callable") self.explanatory_model = explanatory_model + self.data_modality = data_modality + self.framework = framework + self.activation_layer = activation_layer self.resize_image = bool(resize_image) self.size = size self.resample = resample @@ -79,6 +94,9 @@ def from_config(cls, model_config, **kwargs): raise ValueError(f"config key {k} is required") module, name, weights_file = (model_config.pop(k) for k in keys) model_kwargs = model_config.pop("model_kwargs", {}) + data_modality = model_config.pop("data_modality", "image") + framework = model_config.pop("model_framework", "pytorch") + activation_layer = model_config.pop("activation_layer", None) weights_path = maybe_download_weights_from_s3( weights_file, auto_expand_tars=True @@ -86,8 +104,19 @@ def from_config(cls, model_config, **kwargs): model_module = import_module(module) model_fn = getattr(model_module, name) explanatory_model = model_fn(weights_path, **model_kwargs) + if framework == "tensorflow" and activation_layer is not None: + explanatory_model = tf.keras.Model( + explanatory_model.layers[0].input, + explanatory_model.get_layer(activation_layer).output, + ) - return cls(explanatory_model, **model_config) + return cls( + explanatory_model, + data_modality, + framework, + activation_layer, + **model_config, + ) def get_activations(self, x, batch_size: int = None): """ @@ -96,24 +125,31 @@ def get_activations(self, x, batch_size: int = None): if batch_size, batch inputs and then concatenate """ activations = [] - with torch.no_grad(): - if batch_size: - batch_size = int(batch_size) - if batch_size < 1: - raise ValueError("batch_size must be false or a positive int") - else: - batch_size = len(x) - - for i in range(0, len(x), batch_size): - x_batch = x[i : i + batch_size] + if batch_size: + batch_size = int(batch_size) + if batch_size < 1: + raise ValueError("batch_size must be false or a positive int") + else: + batch_size = len(x) + + for i in range(0, len(x), batch_size): + x_batch = x[i : i + batch_size] + + if self.framework == "pytorch": + with torch.no_grad(): + x_batch = self.preprocess(x_batch) + activation, _ = self.explanatory_model(x_batch) + activations.append(activation.detach().cpu().numpy()) + + elif self.framework == "tensorflow": x_batch = self.preprocess(x_batch) - activation, _ = self.explanatory_model(x_batch) - activations.append(activation.detach().cpu().numpy()) + activation = self.explanatory_model(x_batch, training=False) + activations.append(activation.numpy()) return np.concatenate(activations) @staticmethod - def _preprocess( + def _preprocess_image( x, resize_image=True, size=(224, 224), resample=Image.BILINEAR, device=DEVICE ): if np.issubdtype(x.dtype, np.floating): @@ -145,10 +181,13 @@ def preprocess(self, x): """ Preprocess a batch of images """ - return type(self)._preprocess( - x, - self.resize_image, - self.size, - resample=self.resample, - device=self.device, - ) + if self.data_modality == "image": + return type(self)._preprocess_image( + x, + self.resize_image, + self.size, + resample=self.resample, + device=self.device, + ) + elif self.data_modality == "audio": + return x From 0664e22e6701b0853bea1f56efed362e26976eba Mon Sep 17 00:00:00 2001 From: Sterling Date: Wed, 25 Jan 2023 20:41:33 +0000 Subject: [PATCH 04/26] update pytest for new function name --- tests/unit/test_poisoning_metrics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_poisoning_metrics.py b/tests/unit/test_poisoning_metrics.py index 4f69a5714..90a57ebdd 100644 --- a/tests/unit/test_poisoning_metrics.py +++ b/tests/unit/test_poisoning_metrics.py @@ -68,7 +68,7 @@ def test_explanatory_model(): def test_preprocess(): x = np.random.rand(10, 32, 32, 3).astype(np.float32) - x_ = poisoning.ExplanatoryModel._preprocess(x) + x_ = poisoning.ExplanatoryModel._preprocess_image(x) assert x_.shape == (10, 224, 224, 3) assert x_.max() <= 1 assert x_.min() >= 0 From ef149a52b0002293dfc3fbe6237ad8e07d92c871 Mon Sep 17 00:00:00 2001 From: Sterling Date: Thu, 26 Jan 2023 15:16:49 +0000 Subject: [PATCH 05/26] add unit test for speech commands --- tests/unit/test_poisoning_metrics.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/unit/test_poisoning_metrics.py b/tests/unit/test_poisoning_metrics.py index 90a57ebdd..0f7dcbf25 100644 --- a/tests/unit/test_poisoning_metrics.py +++ b/tests/unit/test_poisoning_metrics.py @@ -21,16 +21,19 @@ def test_explanatory_model(): "cifar10_silhouette_model", "gtsrb_silhouette_model", "resisc10_silhouette_model", + "speech_commands_explanatory_model", ] data_sizes = [ (10, 32, 32, 3), (10, 48, 48, 3), (10, 256, 256, 3), + (10, 16000), ] activation_shapes = [ (10, 512), (10, 1184), (10, 512), + (10, 2048), ] for config_key, data_size, activation_shape in zip( From 73dd376a4181e012fe0ba8fb1ded7f79644c7c44 Mon Sep 17 00:00:00 2001 From: Sterling Date: Thu, 26 Jan 2023 15:21:49 +0000 Subject: [PATCH 06/26] update constructor and variable name --- armory/metrics/poisoning.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/armory/metrics/poisoning.py b/armory/metrics/poisoning.py index eb6cfe64e..8a2827301 100644 --- a/armory/metrics/poisoning.py +++ b/armory/metrics/poisoning.py @@ -56,7 +56,7 @@ def __init__( self, explanatory_model, data_modality="image", - framework="pytorch", + model_framework="pytorch", activation_layer=None, resize_image=True, size=(224, 224), @@ -67,13 +67,19 @@ def __init__( raise ValueError(f"explanatory_model {explanatory_model} is not callable") self.explanatory_model = explanatory_model self.data_modality = data_modality - self.framework = framework + self.model_framework = model_framework self.activation_layer = activation_layer self.resize_image = bool(resize_image) self.size = size self.resample = resample self.device = device + if self.model_framework == "tensorflow" and self.activation_layer is not None: + self.explanatory_model = tf.keras.Model( + explanatory_model.layers[0].input, + explanatory_model.get_layer(self.activation_layer).output, + ) + @classmethod def from_config(cls, model_config, **kwargs): if isinstance(model_config, str): @@ -95,7 +101,7 @@ def from_config(cls, model_config, **kwargs): module, name, weights_file = (model_config.pop(k) for k in keys) model_kwargs = model_config.pop("model_kwargs", {}) data_modality = model_config.pop("data_modality", "image") - framework = model_config.pop("model_framework", "pytorch") + model_framework = model_config.pop("model_framework", "pytorch") activation_layer = model_config.pop("activation_layer", None) weights_path = maybe_download_weights_from_s3( @@ -104,16 +110,11 @@ def from_config(cls, model_config, **kwargs): model_module = import_module(module) model_fn = getattr(model_module, name) explanatory_model = model_fn(weights_path, **model_kwargs) - if framework == "tensorflow" and activation_layer is not None: - explanatory_model = tf.keras.Model( - explanatory_model.layers[0].input, - explanatory_model.get_layer(activation_layer).output, - ) return cls( explanatory_model, data_modality, - framework, + model_framework, activation_layer, **model_config, ) @@ -135,13 +136,13 @@ def get_activations(self, x, batch_size: int = None): for i in range(0, len(x), batch_size): x_batch = x[i : i + batch_size] - if self.framework == "pytorch": + if self.model_framework == "pytorch": with torch.no_grad(): x_batch = self.preprocess(x_batch) activation, _ = self.explanatory_model(x_batch) activations.append(activation.detach().cpu().numpy()) - elif self.framework == "tensorflow": + elif self.model_framework == "tensorflow": x_batch = self.preprocess(x_batch) activation = self.explanatory_model(x_batch, training=False) activations.append(activation.numpy()) From 94b26a033618eea5a0053e48645f00492bc305bc Mon Sep 17 00:00:00 2001 From: Sterling Date: Thu, 26 Jan 2023 17:21:04 +0000 Subject: [PATCH 07/26] call explanatory models 'explanatory_model' instead of 'silhouette_model' --- armory/metrics/poisoning.py | 6 +++--- scenario_configs/eval1-4/poisoning/gtsrb_scenario_clbd.json | 2 +- .../eval1-4/poisoning/gtsrb_scenario_clbd_bullethole.json | 2 +- .../eval1-4/poisoning/gtsrb_scenario_clbd_defended.json | 2 +- .../eval1-4/poisoning/resisc10_poison_dlbd.json | 2 +- .../cifar10_dlbd_copyright_activation_defense.json | 2 +- .../copyright/cifar10_dlbd_copyright_perfect_filter.json | 2 +- .../copyright/cifar10_dlbd_copyright_random_filter.json | 2 +- .../cifar10_dlbd_copyright_spectral_signature_defense.json | 2 +- .../dlbd/copyright/cifar10_dlbd_copyright_undefended.json | 2 +- .../cifar10_dlbd_watermark_activation_defense.json | 2 +- .../watermark/cifar10_dlbd_watermark_perfect_filter.json | 2 +- .../watermark/cifar10_dlbd_watermark_random_filter.json | 2 +- .../cifar10_dlbd_watermark_spectral_signature_defense.json | 2 +- .../dlbd/watermark/cifar10_dlbd_watermark_undefended.json | 2 +- .../cifar10_witches_brew_activation_defense.json | 2 +- .../witches_brew/cifar10_witches_brew_perfect_filter.json | 2 +- .../witches_brew/cifar10_witches_brew_random_filter.json | 2 +- .../cifar10_witches_brew_spectral_signature_defense.json | 2 +- .../witches_brew/cifar10_witches_brew_undefended.json | 2 +- .../gtsrb_clbd_bullet_holes_activation_defense.json | 2 +- .../gtsrb_clbd_bullet_holes_perfect_filter.json | 2 +- .../bullet_holes/gtsrb_clbd_bullet_holes_random_filter.json | 2 +- .../gtsrb_clbd_bullet_holes_spectral_signature_defense.json | 2 +- .../bullet_holes/gtsrb_clbd_bullet_holes_undefended.json | 2 +- .../gtsrb_clbd_peace_sign_activation_defense.json | 2 +- .../peace_sign/gtsrb_clbd_peace_sign_perfect_filter.json | 2 +- .../peace_sign/gtsrb_clbd_peace_sign_random_filter.json | 2 +- .../gtsrb_clbd_peace_sign_spectral_signature_defense.json | 2 +- .../clbd/peace_sign/gtsrb_clbd_peace_sign_undefended.json | 2 +- .../gtsrb_dlbd_bullet_holes_activation_defense.json | 2 +- .../gtsrb_dlbd_bullet_holes_perfect_filter.json | 2 +- .../bullet_holes/gtsrb_dlbd_bullet_holes_random_filter.json | 2 +- .../gtsrb_dlbd_bullet_holes_spectral_signature_defense.json | 2 +- .../bullet_holes/gtsrb_dlbd_bullet_holes_undefended.json | 2 +- .../gtsrb_dlbd_peace_sign_activation_defense.json | 2 +- .../peace_sign/gtsrb_dlbd_peace_sign_perfect_filter.json | 2 +- .../peace_sign/gtsrb_dlbd_peace_sign_random_filter.json | 2 +- .../gtsrb_dlbd_peace_sign_spectral_signature_defense.json | 2 +- .../dlbd/peace_sign/gtsrb_dlbd_peace_sign_undefended.json | 2 +- .../witches_brew/gtsrb_witches_brew_activation_defense.json | 2 +- .../witches_brew/gtsrb_witches_brew_perfect_filter.json | 2 +- .../witches_brew/gtsrb_witches_brew_random_filter.json | 2 +- .../gtsrb_witches_brew_spectral_signature_defense.json | 2 +- .../gtsrb/witches_brew/gtsrb_witches_brew_undefended.json | 2 +- scenario_configs/eval5/poisoning/cifar10_poison_dlbd.json | 2 +- scenario_configs/eval5/poisoning/cifar10_witches_brew.json | 2 +- .../eval5/poisoning/gtsrb_dlbd_baseline_keras.json | 2 +- .../eval5/poisoning/gtsrb_dlbd_baseline_pytorch.json | 2 +- scenario_configs/eval5/poisoning/gtsrb_witches_brew.json | 2 +- .../cifar10_sleeper_agent_p10_activation_defense.json | 2 +- .../cifar10_sleeper_agent_p10_dpinstahide.json | 2 +- .../cifar10_sleeper_agent_p10_perfect_filter.json | 2 +- .../cifar10_sleeper_agent_p10_random_filter.json | 2 +- ...far10_sleeper_agent_p10_spectral_signatures_defense.json | 2 +- .../sleeper_agent/cifar10_sleeper_agent_p00_undefended.json | 2 +- .../sleeper_agent/cifar10_sleeper_agent_p01_undefended.json | 2 +- .../sleeper_agent/cifar10_sleeper_agent_p05_undefended.json | 2 +- .../sleeper_agent/cifar10_sleeper_agent_p10_undefended.json | 2 +- .../sleeper_agent/cifar10_sleeper_agent_p20_undefended.json | 2 +- .../sleeper_agent/cifar10_sleeper_agent_p30_undefended.json | 2 +- .../sleeper_agent/cifar10_sleeper_agent_p50_undefended.json | 2 +- tests/unit/test_poisoning_metrics.py | 6 +++--- 63 files changed, 67 insertions(+), 67 deletions(-) diff --git a/armory/metrics/poisoning.py b/armory/metrics/poisoning.py index 8a2827301..3637eb52d 100644 --- a/armory/metrics/poisoning.py +++ b/armory/metrics/poisoning.py @@ -18,7 +18,7 @@ "model_framework": "tensorflow", "weights_file": "speech_commands_explanatory_model_resnet50_bean.h5", }, - "cifar10_silhouette_model": { + "cifar10_explanatory_model": { "model_kwargs": { "data_means": [0.4914, 0.4822, 0.4465], "data_stds": [0.2471, 0.2435, 0.2616], @@ -29,14 +29,14 @@ "resize_image": False, "weights_file": "cifar10_explanatory_model_resnet18_bean.pt", }, - "gtsrb_silhouette_model": { + "gtsrb_explanatory_model": { "model_kwargs": {}, "module": "armory.baseline_models.pytorch.micronnet_gtsrb_bean_regularization", "name": "get_model", "resize_image": False, "weights_file": "gtsrb_explanatory_model_micronnet_bean.pt", }, - "resisc10_silhouette_model": { + "resisc10_explanatory_model": { "model_kwargs": { "data_means": [0.39382024, 0.4159701, 0.40887499], "data_stds": [0.18931773, 0.18901625, 0.19651154], diff --git a/scenario_configs/eval1-4/poisoning/gtsrb_scenario_clbd.json b/scenario_configs/eval1-4/poisoning/gtsrb_scenario_clbd.json index 85dc64de8..582f60254 100644 --- a/scenario_configs/eval1-4/poisoning/gtsrb_scenario_clbd.json +++ b/scenario_configs/eval1-4/poisoning/gtsrb_scenario_clbd.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "poison_dataset": true, "source_class": 1, "split_id": 0, diff --git a/scenario_configs/eval1-4/poisoning/gtsrb_scenario_clbd_bullethole.json b/scenario_configs/eval1-4/poisoning/gtsrb_scenario_clbd_bullethole.json index 16a1d5b52..568fa9d35 100644 --- a/scenario_configs/eval1-4/poisoning/gtsrb_scenario_clbd_bullethole.json +++ b/scenario_configs/eval1-4/poisoning/gtsrb_scenario_clbd_bullethole.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "poison_dataset": true, "source_class": 1, "split_id": 0, diff --git a/scenario_configs/eval1-4/poisoning/gtsrb_scenario_clbd_defended.json b/scenario_configs/eval1-4/poisoning/gtsrb_scenario_clbd_defended.json index 0a2489870..231fe90e5 100644 --- a/scenario_configs/eval1-4/poisoning/gtsrb_scenario_clbd_defended.json +++ b/scenario_configs/eval1-4/poisoning/gtsrb_scenario_clbd_defended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "poison_dataset": true, "source_class": 1, "split_id": 0, diff --git a/scenario_configs/eval1-4/poisoning/resisc10_poison_dlbd.json b/scenario_configs/eval1-4/poisoning/resisc10_poison_dlbd.json index 92ae3869b..547691db9 100644 --- a/scenario_configs/eval1-4/poisoning/resisc10_poison_dlbd.json +++ b/scenario_configs/eval1-4/poisoning/resisc10_poison_dlbd.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "resisc10_silhouette_model", + "explanatory_model": "resisc10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_activation_defense.json b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_activation_defense.json index 8c81dcb80..a50a7a395 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_activation_defense.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_activation_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_perfect_filter.json b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_perfect_filter.json index c2bfeffb3..443cbf4dc 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_perfect_filter.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_perfect_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_random_filter.json b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_random_filter.json index 4ccc423c0..ce5bd993b 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_random_filter.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_random_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fit_defense_classifier_outside_defense": false, "fraction_poisoned": 0.1, "poison_dataset": true, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_spectral_signature_defense.json b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_spectral_signature_defense.json index 0b72a68c5..f25b25c27 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_spectral_signature_defense.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_spectral_signature_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_undefended.json b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_undefended.json index 0e649c354..7f578aaab 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_undefended.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/copyright/cifar10_dlbd_copyright_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_activation_defense.json b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_activation_defense.json index a0b4fff16..fdb2d38e8 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_activation_defense.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_activation_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_perfect_filter.json b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_perfect_filter.json index 001f12cbc..ed6e53fa4 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_perfect_filter.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_perfect_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_random_filter.json b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_random_filter.json index e6fda6bbc..3bcff8ede 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_random_filter.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_random_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fit_defense_classifier_outside_defense": false, "fraction_poisoned": 0.1, "poison_dataset": true, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_spectral_signature_defense.json b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_spectral_signature_defense.json index b184e6c9c..509b42419 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_spectral_signature_defense.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_spectral_signature_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_undefended.json b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_undefended.json index d2f0d00d8..925e51188 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_undefended.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/dlbd/watermark/cifar10_dlbd_watermark_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_activation_defense.json b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_activation_defense.json index 14f3f2d48..334ea571f 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_activation_defense.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_activation_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": [ diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_perfect_filter.json b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_perfect_filter.json index 1c48c0bc3..ac8245dd6 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_perfect_filter.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_perfect_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": [ diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_random_filter.json b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_random_filter.json index 808afa07c..b7cc9fcca 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_random_filter.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_random_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fit_defense_classifier_outside_defense": false, "fraction_poisoned": 0.1, "poison_dataset": true, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_spectral_signature_defense.json b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_spectral_signature_defense.json index 1bee80af1..c3b2f4908 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_spectral_signature_defense.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_spectral_signature_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": [ diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_undefended.json b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_undefended.json index 18ed94ca0..cacd8e609 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_undefended.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/cifar10/witches_brew/cifar10_witches_brew_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": [ diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_activation_defense.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_activation_defense.json index a9f4dd826..e9767799e 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_activation_defense.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_activation_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "poison_dataset": true, "source_class": 1, "split_id": 0, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_perfect_filter.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_perfect_filter.json index ff8ea228a..e5ef2ce72 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_perfect_filter.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_perfect_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "poison_dataset": true, "source_class": 1, "split_id": 0, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_random_filter.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_random_filter.json index 47e8faa87..42a999aae 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_random_filter.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_random_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fit_defense_classifier_outside_defense": false, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_spectral_signature_defense.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_spectral_signature_defense.json index 806c62549..9d7cc98f7 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_spectral_signature_defense.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_spectral_signature_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "poison_dataset": true, "source_class": 1, "split_id": 0, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_undefended.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_undefended.json index 05ff51d4c..4c5fea615 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_undefended.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/bullet_holes/gtsrb_clbd_bullet_holes_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "poison_dataset": true, "source_class": 1, "split_id": 0, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_activation_defense.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_activation_defense.json index 004ba4006..f22a3a5d1 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_activation_defense.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_activation_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "poison_dataset": true, "source_class": 1, "split_id": 0, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_perfect_filter.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_perfect_filter.json index 06bca5699..f250e8f33 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_perfect_filter.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_perfect_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "poison_dataset": true, "source_class": 1, "split_id": 0, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_random_filter.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_random_filter.json index 8ed4435e7..3f7b91029 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_random_filter.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_random_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fit_defense_classifier_outside_defense": false, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_spectral_signature_defense.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_spectral_signature_defense.json index 4958064ba..7e408ffe2 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_spectral_signature_defense.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_spectral_signature_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "poison_dataset": true, "source_class": 1, "split_id": 0, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_undefended.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_undefended.json index a7f980675..43f291367 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_undefended.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/clbd/peace_sign/gtsrb_clbd_peace_sign_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "poison_dataset": true, "source_class": 1, "split_id": 0, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_activation_defense.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_activation_defense.json index 1c9ef0078..f121d0cdf 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_activation_defense.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_activation_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_perfect_filter.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_perfect_filter.json index 633f698a9..c11204312 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_perfect_filter.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_perfect_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_random_filter.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_random_filter.json index 4c802aff5..8d8db0c6b 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_random_filter.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_random_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fit_defense_classifier_outside_defense": false, "fraction_poisoned": 0.1, "poison_dataset": true, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_spectral_signature_defense.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_spectral_signature_defense.json index 85d861d01..1c9ca11ea 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_spectral_signature_defense.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_spectral_signature_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_undefended.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_undefended.json index f9a90aea8..a0b6b8bc2 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_undefended.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/bullet_holes/gtsrb_dlbd_bullet_holes_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_activation_defense.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_activation_defense.json index ba6b3c040..cc72f0107 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_activation_defense.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_activation_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_perfect_filter.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_perfect_filter.json index fa9be3aca..d7771c848 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_perfect_filter.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_perfect_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_random_filter.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_random_filter.json index ad83c0919..64738770e 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_random_filter.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_random_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fit_defense_classifier_outside_defense": false, "fraction_poisoned": 0.1, "poison_dataset": true, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_spectral_signature_defense.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_spectral_signature_defense.json index d01c5e76f..d0a6e77f2 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_spectral_signature_defense.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_spectral_signature_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_undefended.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_undefended.json index ad60d9dd6..4c1436ba5 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_undefended.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/dlbd/peace_sign/gtsrb_dlbd_peace_sign_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_activation_defense.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_activation_defense.json index 80dafa9be..fdd93c243 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_activation_defense.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_activation_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fraction_poisoned": 0.01, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_perfect_filter.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_perfect_filter.json index e37ca581e..964293649 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_perfect_filter.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_perfect_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fraction_poisoned": 0.01, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_random_filter.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_random_filter.json index 0557f2ea2..bc0971933 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_random_filter.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_random_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fit_defense_classifier_outside_defense": false, "fraction_poisoned": 0.01, "poison_dataset": true, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_spectral_signature_defense.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_spectral_signature_defense.json index 0c87e39c1..367428039 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_spectral_signature_defense.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_spectral_signature_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fraction_poisoned": 0.01, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_undefended.json b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_undefended.json index 8de841057..027a85fa6 100644 --- a/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_undefended.json +++ b/scenario_configs/eval5/poisoning/baseline_defenses/gtsrb/witches_brew/gtsrb_witches_brew_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fraction_poisoned": 0.01, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/cifar10_poison_dlbd.json b/scenario_configs/eval5/poisoning/cifar10_poison_dlbd.json index 3d4b7379a..c0ade563c 100644 --- a/scenario_configs/eval5/poisoning/cifar10_poison_dlbd.json +++ b/scenario_configs/eval5/poisoning/cifar10_poison_dlbd.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval5/poisoning/cifar10_witches_brew.json b/scenario_configs/eval5/poisoning/cifar10_witches_brew.json index dc8e1c9ec..ab4e7cd09 100644 --- a/scenario_configs/eval5/poisoning/cifar10_witches_brew.json +++ b/scenario_configs/eval5/poisoning/cifar10_witches_brew.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": [ diff --git a/scenario_configs/eval5/poisoning/gtsrb_dlbd_baseline_keras.json b/scenario_configs/eval5/poisoning/gtsrb_dlbd_baseline_keras.json index 3333d9841..c7720d8d8 100644 --- a/scenario_configs/eval5/poisoning/gtsrb_dlbd_baseline_keras.json +++ b/scenario_configs/eval5/poisoning/gtsrb_dlbd_baseline_keras.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/gtsrb_dlbd_baseline_pytorch.json b/scenario_configs/eval5/poisoning/gtsrb_dlbd_baseline_pytorch.json index 8417da5fb..e37b2f619 100644 --- a/scenario_configs/eval5/poisoning/gtsrb_dlbd_baseline_pytorch.json +++ b/scenario_configs/eval5/poisoning/gtsrb_dlbd_baseline_pytorch.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval5/poisoning/gtsrb_witches_brew.json b/scenario_configs/eval5/poisoning/gtsrb_witches_brew.json index 9a00c03cb..efd02102a 100644 --- a/scenario_configs/eval5/poisoning/gtsrb_witches_brew.json +++ b/scenario_configs/eval5/poisoning/gtsrb_witches_brew.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": true, "experiment_id": 0, - "explanatory_model": "gtsrb_silhouette_model", + "explanatory_model": "gtsrb_explanatory_model", "fraction_poisoned": 0.01, "poison_dataset": true, "source_class": 1, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_activation_defense.json b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_activation_defense.json index 0eb4b38e8..e168d83a6 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_activation_defense.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_activation_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_dpinstahide.json b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_dpinstahide.json index 2efc5cacd..f0f814264 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_dpinstahide.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_dpinstahide.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fit_defense_classifier_outside_defense": false, "fraction_poisoned": 0.1, "poison_dataset": true, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_perfect_filter.json b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_perfect_filter.json index 23a9e3ff8..9a8efbf31 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_perfect_filter.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_perfect_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_random_filter.json b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_random_filter.json index db406e780..6ea9eb0af 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_random_filter.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_random_filter.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fit_defense_classifier_outside_defense": false, "fraction_poisoned": 0.1, "poison_dataset": true, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_spectral_signatures_defense.json b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_spectral_signatures_defense.json index 1aad0d1f2..207402d34 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_spectral_signatures_defense.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_spectral_signatures_defense.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p00_undefended.json b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p00_undefended.json index d263c91a1..d54f07f1f 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p00_undefended.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p00_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0, "poison_dataset": false, "source_class": 0, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p01_undefended.json b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p01_undefended.json index 30ed778a8..ae503b45f 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p01_undefended.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p01_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.01, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p05_undefended.json b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p05_undefended.json index 399550b0c..caf6b0f66 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p05_undefended.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p05_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.05, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p10_undefended.json b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p10_undefended.json index 787fc0c38..3ad650cd0 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p10_undefended.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p10_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p20_undefended.json b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p20_undefended.json index 6a4962da0..ab7834cc2 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p20_undefended.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p20_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.2, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p30_undefended.json b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p30_undefended.json index 30be8c1d5..2add4e06f 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p30_undefended.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p30_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.3, "poison_dataset": true, "source_class": 0, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p50_undefended.json b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p50_undefended.json index d5c318ce2..bc2915f1f 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p50_undefended.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p50_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": "cifar10_silhouette_model", + "explanatory_model": "cifar10_explanatory_model", "fraction_poisoned": 0.5, "poison_dataset": true, "source_class": 0, diff --git a/tests/unit/test_poisoning_metrics.py b/tests/unit/test_poisoning_metrics.py index 0f7dcbf25..d8d436669 100644 --- a/tests/unit/test_poisoning_metrics.py +++ b/tests/unit/test_poisoning_metrics.py @@ -18,9 +18,9 @@ def test_explanatory_model(): config_keys = [ - "cifar10_silhouette_model", - "gtsrb_silhouette_model", - "resisc10_silhouette_model", + "cifar10_explanatory_model", + "gtsrb_explanatory_model", + "resisc10_explanatory_model", "speech_commands_explanatory_model", ] data_sizes = [ From f790f07d01b3b05a6c8e2a570ceb511458aabb8b Mon Sep 17 00:00:00 2001 From: Sterling Date: Tue, 31 Jan 2023 14:40:29 +0000 Subject: [PATCH 08/26] better kwargs arrangement and comments --- armory/metrics/poisoning.py | 74 ++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/armory/metrics/poisoning.py b/armory/metrics/poisoning.py index 3637eb52d..6278f2dd4 100644 --- a/armory/metrics/poisoning.py +++ b/armory/metrics/poisoning.py @@ -11,11 +11,12 @@ # An armory user may request one of these models under 'adhoc'/'explanatory_model' EXPLANATORY_MODEL_CONFIGS = explanatory_model_configs = { "speech_commands_explanatory_model": { - "module": "armory.baseline_models.tf_graph.audio_resnet50", - "name": "get_unwrapped_model", - "data_modality": "audio", "activation_layer": "avg_pool", + "data_modality": "audio", "model_framework": "tensorflow", + "module": "armory.baseline_models.tf_graph.audio_resnet50", + "name": "get_unwrapped_model", + "preprocess_kwargs": {}, "weights_file": "speech_commands_explanatory_model_resnet50_bean.h5", }, "cifar10_explanatory_model": { @@ -26,14 +27,14 @@ }, "module": "armory.baseline_models.pytorch.resnet18_bean_regularization", "name": "get_model", - "resize_image": False, + "preprocess_kwargs": {}, "weights_file": "cifar10_explanatory_model_resnet18_bean.pt", }, "gtsrb_explanatory_model": { "model_kwargs": {}, "module": "armory.baseline_models.pytorch.micronnet_gtsrb_bean_regularization", "name": "get_model", - "resize_image": False, + "preprocess_kwargs": {}, "weights_file": "gtsrb_explanatory_model_micronnet_bean.pt", }, "resisc10_explanatory_model": { @@ -44,6 +45,9 @@ }, "module": "armory.baseline_models.pytorch.resnet18_bean_regularization", "name": "get_model", + "preprocess_kwargs": { + "resize_image": True, + }, "weights_file": "resisc10_explanatory_model_resnet18_bean.pt", }, } @@ -58,27 +62,41 @@ def __init__( data_modality="image", model_framework="pytorch", activation_layer=None, - resize_image=True, - size=(224, 224), - resample=Image.BILINEAR, - device=DEVICE, + preprocess_kwargs={}, ): + """ + explanatory_model: A callable pytorch or tensorflow model used to produce + activations for silhouette analysis + data_modality: one of "image" or "audio" (more options to be added as needed) + model_framework: "pytorch" or "tensorflow" + activation_layer: name of the layer of the model from which to draw activations + (currently only for tensorflow models). + If None, uses the final output layer. + preprocess_kwargs: keyword arguments for the preprocessing function + """ if not callable(explanatory_model): raise ValueError(f"explanatory_model {explanatory_model} is not callable") + if model_framework not in ("pytorch", "tensorflow"): + raise ValueError( + f"model_framework should be 'pytorch' or 'tensorflow', not '{model_framework}'" + ) self.explanatory_model = explanatory_model self.data_modality = data_modality self.model_framework = model_framework self.activation_layer = activation_layer - self.resize_image = bool(resize_image) - self.size = size - self.resample = resample - self.device = device - - if self.model_framework == "tensorflow" and self.activation_layer is not None: - self.explanatory_model = tf.keras.Model( - explanatory_model.layers[0].input, - explanatory_model.get_layer(self.activation_layer).output, - ) + self.preprocess_kwargs = preprocess_kwargs + + if self.activation_layer is not None: + if self.model_framework == "tensorflow": + # Set explanatory_model to return activations from internal layer + self.explanatory_model = tf.keras.Model( + explanatory_model.layers[0].input, + explanatory_model.get_layer(self.activation_layer).output, + ) + else: + raise ValueError( + "Currently, 'activation_layer' can only be specified for a tensorflow model, not pytorch." + ) @classmethod def from_config(cls, model_config, **kwargs): @@ -100,9 +118,6 @@ def from_config(cls, model_config, **kwargs): raise ValueError(f"config key {k} is required") module, name, weights_file = (model_config.pop(k) for k in keys) model_kwargs = model_config.pop("model_kwargs", {}) - data_modality = model_config.pop("data_modality", "image") - model_framework = model_config.pop("model_framework", "pytorch") - activation_layer = model_config.pop("activation_layer", None) weights_path = maybe_download_weights_from_s3( weights_file, auto_expand_tars=True @@ -113,9 +128,6 @@ def from_config(cls, model_config, **kwargs): return cls( explanatory_model, - data_modality, - model_framework, - activation_layer, **model_config, ) @@ -151,7 +163,7 @@ def get_activations(self, x, batch_size: int = None): @staticmethod def _preprocess_image( - x, resize_image=True, size=(224, 224), resample=Image.BILINEAR, device=DEVICE + x, resize_image=False, size=(224, 224), resample=Image.BILINEAR, device=DEVICE ): if np.issubdtype(x.dtype, np.floating): if x.min() < 0.0 or x.max() > 1.0: @@ -185,10 +197,12 @@ def preprocess(self, x): if self.data_modality == "image": return type(self)._preprocess_image( x, - self.resize_image, - self.size, - resample=self.resample, - device=self.device, + **self.preprocess_kwargs, ) elif self.data_modality == "audio": return x + + else: + raise ValueError( + f"There is no preprocessing function for data_modality '{self.data_modality}'. Please set data_modality to 'image' or 'audio', or implement preprocessing for data_modality '{self.data_modality}'" + ) From 0487ef5b7476b48fd54c7163020c49a8ff7281f3 Mon Sep 17 00:00:00 2001 From: Sterling Date: Tue, 31 Jan 2023 14:41:15 +0000 Subject: [PATCH 09/26] update unit test --- tests/unit/test_poisoning_metrics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_poisoning_metrics.py b/tests/unit/test_poisoning_metrics.py index d8d436669..78d7804e5 100644 --- a/tests/unit/test_poisoning_metrics.py +++ b/tests/unit/test_poisoning_metrics.py @@ -71,7 +71,7 @@ def test_explanatory_model(): def test_preprocess(): x = np.random.rand(10, 32, 32, 3).astype(np.float32) - x_ = poisoning.ExplanatoryModel._preprocess_image(x) + x_ = poisoning.ExplanatoryModel._preprocess_image(x, resize_image=True) assert x_.shape == (10, 224, 224, 3) assert x_.max() <= 1 assert x_.min() >= 0 From 33a3c2f5e94e6503c9aeb8294c18ca6bf723abd2 Mon Sep 17 00:00:00 2001 From: Sterling Date: Tue, 31 Jan 2023 14:44:17 +0000 Subject: [PATCH 10/26] add explanatory model to audio configs --- .../eval6/poisoning/audio_dlbd/audio_p00_undefended.json | 2 +- .../eval6/poisoning/audio_dlbd/audio_p01_undefended.json | 6 ++---- .../eval6/poisoning/audio_dlbd/audio_p05_undefended.json | 2 +- .../eval6/poisoning/audio_dlbd/audio_p10_undefended.json | 2 +- .../eval6/poisoning/audio_dlbd/audio_p20_undefended.json | 2 +- .../eval6/poisoning/audio_dlbd/audio_p30_undefended.json | 2 +- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p00_undefended.json b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p00_undefended.json index f72899d72..91f53e552 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p00_undefended.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p00_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": null, + "explanatory_model": "speech_commands_explanatory_model", "fraction_poisoned": 0, "poison_dataset": false, "source_class": 11, diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p01_undefended.json b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p01_undefended.json index 03629aa1b..6e6db4ab2 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p01_undefended.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p01_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": null, + "explanatory_model": "speech_commands_explanatory_model", "fraction_poisoned": 0.01, "poison_dataset": true, "source_class": 11, @@ -46,9 +46,7 @@ "wrapper_kwargs": {} }, "scenario": { - "kwargs": { - "fit_generator": false - }, + "kwargs": {}, "module": "armory.scenarios.poison", "name": "Poison" }, diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p05_undefended.json b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p05_undefended.json index 1d3736884..30c31d1a7 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p05_undefended.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p05_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": null, + "explanatory_model": "speech_commands_explanatory_model", "fraction_poisoned": 0.05, "poison_dataset": true, "source_class": 11, diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p10_undefended.json b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p10_undefended.json index 94e6cb6ac..c6492e794 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p10_undefended.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p10_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": null, + "explanatory_model": "speech_commands_explanatory_model", "fraction_poisoned": 0.1, "poison_dataset": true, "source_class": 11, diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p20_undefended.json b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p20_undefended.json index 01525f88a..ffb8d4f42 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p20_undefended.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p20_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": null, + "explanatory_model": "speech_commands_explanatory_model", "fraction_poisoned": 0.2, "poison_dataset": true, "source_class": 11, diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p30_undefended.json b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p30_undefended.json index 7dd5142a1..fc51107d8 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p30_undefended.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p30_undefended.json @@ -3,7 +3,7 @@ "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, - "explanatory_model": null, + "explanatory_model": "speech_commands_explanatory_model", "fraction_poisoned": 0.3, "poison_dataset": true, "source_class": 11, From 720d127d22767cc5a9282cf30f110c8246bea89e Mon Sep 17 00:00:00 2001 From: Sterling Date: Wed, 1 Feb 2023 13:48:13 +0000 Subject: [PATCH 11/26] kwargs update --- armory/metrics/poisoning.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/armory/metrics/poisoning.py b/armory/metrics/poisoning.py index 6278f2dd4..3eeb43df1 100644 --- a/armory/metrics/poisoning.py +++ b/armory/metrics/poisoning.py @@ -16,7 +16,6 @@ "model_framework": "tensorflow", "module": "armory.baseline_models.tf_graph.audio_resnet50", "name": "get_unwrapped_model", - "preprocess_kwargs": {}, "weights_file": "speech_commands_explanatory_model_resnet50_bean.h5", }, "cifar10_explanatory_model": { @@ -27,14 +26,11 @@ }, "module": "armory.baseline_models.pytorch.resnet18_bean_regularization", "name": "get_model", - "preprocess_kwargs": {}, "weights_file": "cifar10_explanatory_model_resnet18_bean.pt", }, "gtsrb_explanatory_model": { - "model_kwargs": {}, "module": "armory.baseline_models.pytorch.micronnet_gtsrb_bean_regularization", "name": "get_model", - "preprocess_kwargs": {}, "weights_file": "gtsrb_explanatory_model_micronnet_bean.pt", }, "resisc10_explanatory_model": { @@ -62,7 +58,7 @@ def __init__( data_modality="image", model_framework="pytorch", activation_layer=None, - preprocess_kwargs={}, + preprocess_kwargs=None, ): """ explanatory_model: A callable pytorch or tensorflow model used to produce @@ -84,7 +80,7 @@ def __init__( self.data_modality = data_modality self.model_framework = model_framework self.activation_layer = activation_layer - self.preprocess_kwargs = preprocess_kwargs + self.preprocess_kwargs = preprocess_kwargs if preprocess_kwargs else {} if self.activation_layer is not None: if self.model_framework == "tensorflow": From 9684ad940d2be147fa76d43e0f49e58cc1175c2a Mon Sep 17 00:00:00 2001 From: Sterling Date: Thu, 2 Feb 2023 15:09:11 +0000 Subject: [PATCH 12/26] add resnet version for sleeper agent --- armory/baseline_models/pytorch/resnet18.py | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/armory/baseline_models/pytorch/resnet18.py b/armory/baseline_models/pytorch/resnet18.py index 6b3ec558b..14d151ff1 100644 --- a/armory/baseline_models/pytorch/resnet18.py +++ b/armory/baseline_models/pytorch/resnet18.py @@ -89,6 +89,10 @@ def get_art_model_sgd( model_kwargs: dict, wrapper_kwargs: dict, weights_path: Optional[str] = None ) -> PyTorchClassifier: + """Returns the same model as get_art_model, but with the SGD optimizer. + Some poisoning attacks were found to be brittle with regard to optimizer. + """ + model = OuterModel(weights_path=weights_path, **model_kwargs) lr = wrapper_kwargs.pop("learning_rate", 0.1) @@ -107,3 +111,57 @@ def get_art_model_sgd( clip_values=(0.0, 1.0), ) return wrapped_model + + +class SleeperAgentVersion(torch.nn.Module): + def __init__( + self, + **model_kwargs, + ): + """This version of the Resnet imitates that found in the ART example notebook for the Sleeper Agent attack: + https://github.com/Trusted-AI/adversarial-robustness-toolbox/blob/main/notebooks/poisoning_attack_sleeper_agent_pytorch.ipynb + + This attack is somewhat brittle and is not successful against the above torchvision.models.resnet18 with the current attack parameters. + """ + + data_means = model_kwargs.pop("data_means", CIFAR10_MEANS) + data_stds = model_kwargs.pop("data_stds", CIFAR10_STDS) + + super().__init__() + self.inner_model = models.ResNet( + models.resnet.BasicBlock, [2, 2, 2, 2], num_classes=10 + ) + + self.data_means = torch.tensor(data_means, dtype=torch.float32, device=DEVICE) + self.data_stdev = torch.tensor(data_stds, dtype=torch.float32, device=DEVICE) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + x_norm = ((x - self.data_means) / self.data_stdev).permute(0, 3, 1, 2) + output = self.inner_model(x_norm) + + return output + + +def get_art_model_cifar_sleeper_agent( + model_kwargs: dict, wrapper_kwargs: dict, weights_path: Optional[str] = None +) -> PyTorchClassifier: + """Return model specific for sleeper agent poisoning on Cifar10""" + + model = SleeperAgentVersion(weights_path=weights_path, **model_kwargs) + lr = wrapper_kwargs.pop("learning_rate", 0.1) + optimizer = torch.optim.SGD( + model.parameters(), lr=lr, momentum=0.9, weight_decay=5e-4, nesterov=True + ) + + wrapped_model = PyTorchClassifier( + model, + loss=torch.nn.CrossEntropyLoss(), + optimizer=optimizer, + input_shape=wrapper_kwargs.pop( + "input_shape", (224, 224, 3) + ), # default to imagenet shape + channels_first=False, + **wrapper_kwargs, + clip_values=(0.0, 1.0), + ) + return wrapped_model From 83b3aed75c4b743975afbadbe199d314b2d77031 Mon Sep 17 00:00:00 2001 From: Sterling Date: Thu, 2 Feb 2023 15:11:39 +0000 Subject: [PATCH 13/26] update sleeper agent configs --- .../cifar10_sleeper_agent_p10_activation_defense.json | 9 ++++----- .../cifar10_sleeper_agent_p10_dpinstahide.json | 9 ++++----- .../cifar10_sleeper_agent_p10_perfect_filter.json | 9 ++++----- .../cifar10_sleeper_agent_p10_random_filter.json | 9 ++++----- ...10_sleeper_agent_p10_spectral_signatures_defense.json | 9 ++++----- .../cifar10_sleeper_agent_p00_undefended.json | 9 ++++----- .../cifar10_sleeper_agent_p01_undefended.json | 9 ++++----- .../cifar10_sleeper_agent_p05_undefended.json | 9 ++++----- .../cifar10_sleeper_agent_p10_undefended.json | 9 ++++----- .../cifar10_sleeper_agent_p20_undefended.json | 9 ++++----- .../cifar10_sleeper_agent_p30_undefended.json | 9 ++++----- .../cifar10_sleeper_agent_p50_undefended.json | 9 ++++----- 12 files changed, 48 insertions(+), 60 deletions(-) diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_activation_defense.json b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_activation_defense.json index e168d83a6..fd87cebdb 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_activation_defense.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_activation_defense.json @@ -1,5 +1,5 @@ { - "_description": "CIFAR10 poison image classification, sleeper agent attack", + "_description": "CIFAR10 poison image classification, sleeper agent attack, activation defense", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, @@ -50,7 +50,7 @@ "name": "SleeperAgentAttack" }, "dataset": { - "batch_size": 512, + "batch_size": 128, "framework": "numpy", "module": "armory.data.datasets", "name": "cifar10" @@ -72,7 +72,6 @@ "fit": true, "fit_kwargs": {}, "model_kwargs": { - "cifar_stem": true, "data_means": [ 0.4914, 0.4822, @@ -87,7 +86,7 @@ "pretrained": false }, "module": "armory.baseline_models.pytorch.resnet18", - "name": "get_art_model", + "name": "get_art_model_cifar_sleeper_agent", "weights_file": null, "wrapper_kwargs": { "input_shape": [ @@ -95,7 +94,7 @@ 32, 3 ], - "learning_rate": 0.001, + "learning_rate": 0.1, "nb_classes": 10 } }, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_dpinstahide.json b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_dpinstahide.json index f0f814264..90409e022 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_dpinstahide.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_dpinstahide.json @@ -1,5 +1,5 @@ { - "_description": "CIFAR10 poison image classification, sleeper agent attack", + "_description": "CIFAR10 poison image classification, sleeper agent attack, DP Instahide defense", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, @@ -51,7 +51,7 @@ "name": "SleeperAgentAttack" }, "dataset": { - "batch_size": 512, + "batch_size": 128, "framework": "numpy", "module": "armory.data.datasets", "name": "cifar10" @@ -83,7 +83,6 @@ "fit": true, "fit_kwargs": {}, "model_kwargs": { - "cifar_stem": true, "data_means": [ 0.4914, 0.4822, @@ -98,7 +97,7 @@ "pretrained": false }, "module": "armory.baseline_models.pytorch.resnet18", - "name": "get_art_model", + "name": "get_art_model_cifar_sleeper_agent", "weights_file": null, "wrapper_kwargs": { "input_shape": [ @@ -106,7 +105,7 @@ 32, 3 ], - "learning_rate": 0.001, + "learning_rate": 0.1, "nb_classes": 10 } }, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_perfect_filter.json b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_perfect_filter.json index 9a8efbf31..661a54d9a 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_perfect_filter.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_perfect_filter.json @@ -1,5 +1,5 @@ { - "_description": "CIFAR10 poison image classification, sleeper agent attack", + "_description": "CIFAR10 poison image classification, sleeper agent attack, perfect filter", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, @@ -50,7 +50,7 @@ "name": "SleeperAgentAttack" }, "dataset": { - "batch_size": 512, + "batch_size": 128, "framework": "numpy", "module": "armory.data.datasets", "name": "cifar10" @@ -68,7 +68,6 @@ "fit": true, "fit_kwargs": {}, "model_kwargs": { - "cifar_stem": true, "data_means": [ 0.4914, 0.4822, @@ -83,7 +82,7 @@ "pretrained": false }, "module": "armory.baseline_models.pytorch.resnet18", - "name": "get_art_model", + "name": "get_art_model_cifar_sleeper_agent", "weights_file": null, "wrapper_kwargs": { "input_shape": [ @@ -91,7 +90,7 @@ 32, 3 ], - "learning_rate": 0.001, + "learning_rate": 0.1, "nb_classes": 10 } }, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_random_filter.json b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_random_filter.json index 6ea9eb0af..69ebd7138 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_random_filter.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_random_filter.json @@ -1,5 +1,5 @@ { - "_description": "CIFAR10 poison image classification, sleeper agent attack", + "_description": "CIFAR10 poison image classification, sleeper agent attack, random filter", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, @@ -51,7 +51,7 @@ "name": "SleeperAgentAttack" }, "dataset": { - "batch_size": 512, + "batch_size": 128, "framework": "numpy", "module": "armory.data.datasets", "name": "cifar10" @@ -69,7 +69,6 @@ "fit": true, "fit_kwargs": {}, "model_kwargs": { - "cifar_stem": true, "data_means": [ 0.4914, 0.4822, @@ -84,7 +83,7 @@ "pretrained": false }, "module": "armory.baseline_models.pytorch.resnet18", - "name": "get_art_model", + "name": "get_art_model_cifar_sleeper_agent", "weights_file": null, "wrapper_kwargs": { "input_shape": [ @@ -92,7 +91,7 @@ 32, 3 ], - "learning_rate": 0.001, + "learning_rate": 0.1, "nb_classes": 10 } }, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_spectral_signatures_defense.json b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_spectral_signatures_defense.json index 207402d34..89e995696 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_spectral_signatures_defense.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/baseline_defenses/cifar10_sleeper_agent_p10_spectral_signatures_defense.json @@ -1,5 +1,5 @@ { - "_description": "CIFAR10 poison image classification, sleeper agent attack", + "_description": "CIFAR10 poison image classification, sleeper agent attack, spectral signatures defense", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, @@ -50,7 +50,7 @@ "name": "SleeperAgentAttack" }, "dataset": { - "batch_size": 512, + "batch_size": 128, "framework": "numpy", "module": "armory.data.datasets", "name": "cifar10" @@ -68,7 +68,6 @@ "fit": true, "fit_kwargs": {}, "model_kwargs": { - "cifar_stem": true, "data_means": [ 0.4914, 0.4822, @@ -83,7 +82,7 @@ "pretrained": false }, "module": "armory.baseline_models.pytorch.resnet18", - "name": "get_art_model", + "name": "get_art_model_cifar_sleeper_agent", "weights_file": null, "wrapper_kwargs": { "input_shape": [ @@ -91,7 +90,7 @@ 32, 3 ], - "learning_rate": 0.001, + "learning_rate": 0.1, "nb_classes": 10 } }, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p00_undefended.json b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p00_undefended.json index d54f07f1f..105705587 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p00_undefended.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p00_undefended.json @@ -1,5 +1,5 @@ { - "_description": "CIFAR10 poison image classification, sleeper agent attack", + "_description": "CIFAR10 poison image classification, sleeper agent attack, undefended", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, @@ -50,7 +50,7 @@ "name": "SleeperAgentAttack" }, "dataset": { - "batch_size": 512, + "batch_size": 128, "framework": "numpy", "module": "armory.data.datasets", "name": "cifar10" @@ -61,7 +61,6 @@ "fit": true, "fit_kwargs": {}, "model_kwargs": { - "cifar_stem": true, "data_means": [ 0.4914, 0.4822, @@ -76,7 +75,7 @@ "pretrained": false }, "module": "armory.baseline_models.pytorch.resnet18", - "name": "get_art_model", + "name": "get_art_model_cifar_sleeper_agent", "weights_file": null, "wrapper_kwargs": { "input_shape": [ @@ -84,7 +83,7 @@ 32, 3 ], - "learning_rate": 0.001, + "learning_rate": 0.1, "nb_classes": 10 } }, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p01_undefended.json b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p01_undefended.json index ae503b45f..c6e6b5aa1 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p01_undefended.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p01_undefended.json @@ -1,5 +1,5 @@ { - "_description": "CIFAR10 poison image classification, sleeper agent attack", + "_description": "CIFAR10 poison image classification, sleeper agent attack, undefended", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, @@ -50,7 +50,7 @@ "name": "SleeperAgentAttack" }, "dataset": { - "batch_size": 512, + "batch_size": 128, "framework": "numpy", "module": "armory.data.datasets", "name": "cifar10" @@ -61,7 +61,6 @@ "fit": true, "fit_kwargs": {}, "model_kwargs": { - "cifar_stem": true, "data_means": [ 0.4914, 0.4822, @@ -76,7 +75,7 @@ "pretrained": false }, "module": "armory.baseline_models.pytorch.resnet18", - "name": "get_art_model", + "name": "get_art_model_cifar_sleeper_agent", "weights_file": null, "wrapper_kwargs": { "input_shape": [ @@ -84,7 +83,7 @@ 32, 3 ], - "learning_rate": 0.001, + "learning_rate": 0.1, "nb_classes": 10 } }, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p05_undefended.json b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p05_undefended.json index caf6b0f66..c7cede80f 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p05_undefended.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p05_undefended.json @@ -1,5 +1,5 @@ { - "_description": "CIFAR10 poison image classification, sleeper agent attack", + "_description": "CIFAR10 poison image classification, sleeper agent attack, undefended", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, @@ -50,7 +50,7 @@ "name": "SleeperAgentAttack" }, "dataset": { - "batch_size": 512, + "batch_size": 128, "framework": "numpy", "module": "armory.data.datasets", "name": "cifar10" @@ -61,7 +61,6 @@ "fit": true, "fit_kwargs": {}, "model_kwargs": { - "cifar_stem": true, "data_means": [ 0.4914, 0.4822, @@ -76,7 +75,7 @@ "pretrained": false }, "module": "armory.baseline_models.pytorch.resnet18", - "name": "get_art_model", + "name": "get_art_model_cifar_sleeper_agent", "weights_file": null, "wrapper_kwargs": { "input_shape": [ @@ -84,7 +83,7 @@ 32, 3 ], - "learning_rate": 0.001, + "learning_rate": 0.1, "nb_classes": 10 } }, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p10_undefended.json b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p10_undefended.json index 3ad650cd0..815c4f7a3 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p10_undefended.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p10_undefended.json @@ -1,5 +1,5 @@ { - "_description": "CIFAR10 poison image classification, sleeper agent attack", + "_description": "CIFAR10 poison image classification, sleeper agent attack, undefended", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, @@ -50,7 +50,7 @@ "name": "SleeperAgentAttack" }, "dataset": { - "batch_size": 512, + "batch_size": 128, "framework": "numpy", "module": "armory.data.datasets", "name": "cifar10" @@ -61,7 +61,6 @@ "fit": true, "fit_kwargs": {}, "model_kwargs": { - "cifar_stem": true, "data_means": [ 0.4914, 0.4822, @@ -76,7 +75,7 @@ "pretrained": false }, "module": "armory.baseline_models.pytorch.resnet18", - "name": "get_art_model", + "name": "get_art_model_cifar_sleeper_agent", "weights_file": null, "wrapper_kwargs": { "input_shape": [ @@ -84,7 +83,7 @@ 32, 3 ], - "learning_rate": 0.001, + "learning_rate": 0.1, "nb_classes": 10 } }, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p20_undefended.json b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p20_undefended.json index ab7834cc2..33ccab3a2 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p20_undefended.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p20_undefended.json @@ -1,5 +1,5 @@ { - "_description": "CIFAR10 poison image classification, sleeper agent attack", + "_description": "CIFAR10 poison image classification, sleeper agent attack, undefended", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, @@ -50,7 +50,7 @@ "name": "SleeperAgentAttack" }, "dataset": { - "batch_size": 512, + "batch_size": 128, "framework": "numpy", "module": "armory.data.datasets", "name": "cifar10" @@ -61,7 +61,6 @@ "fit": true, "fit_kwargs": {}, "model_kwargs": { - "cifar_stem": true, "data_means": [ 0.4914, 0.4822, @@ -76,7 +75,7 @@ "pretrained": false }, "module": "armory.baseline_models.pytorch.resnet18", - "name": "get_art_model", + "name": "get_art_model_cifar_sleeper_agent", "weights_file": null, "wrapper_kwargs": { "input_shape": [ @@ -84,7 +83,7 @@ 32, 3 ], - "learning_rate": 0.001, + "learning_rate": 0.1, "nb_classes": 10 } }, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p30_undefended.json b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p30_undefended.json index 2add4e06f..dd2c23ab2 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p30_undefended.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p30_undefended.json @@ -1,5 +1,5 @@ { - "_description": "CIFAR10 poison image classification, sleeper agent attack", + "_description": "CIFAR10 poison image classification, sleeper agent attack, undefended", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, @@ -50,7 +50,7 @@ "name": "SleeperAgentAttack" }, "dataset": { - "batch_size": 512, + "batch_size": 128, "framework": "numpy", "module": "armory.data.datasets", "name": "cifar10" @@ -61,7 +61,6 @@ "fit": true, "fit_kwargs": {}, "model_kwargs": { - "cifar_stem": true, "data_means": [ 0.4914, 0.4822, @@ -76,7 +75,7 @@ "pretrained": false }, "module": "armory.baseline_models.pytorch.resnet18", - "name": "get_art_model", + "name": "get_art_model_cifar_sleeper_agent", "weights_file": null, "wrapper_kwargs": { "input_shape": [ @@ -84,7 +83,7 @@ 32, 3 ], - "learning_rate": 0.001, + "learning_rate": 0.1, "nb_classes": 10 } }, diff --git a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p50_undefended.json b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p50_undefended.json index bc2915f1f..f5268d749 100644 --- a/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p50_undefended.json +++ b/scenario_configs/eval6/poisoning/sleeper_agent/cifar10_sleeper_agent_p50_undefended.json @@ -1,5 +1,5 @@ { - "_description": "CIFAR10 poison image classification, sleeper agent attack", + "_description": "CIFAR10 poison image classification, sleeper agent attack, undefended", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, @@ -50,7 +50,7 @@ "name": "SleeperAgentAttack" }, "dataset": { - "batch_size": 512, + "batch_size": 128, "framework": "numpy", "module": "armory.data.datasets", "name": "cifar10" @@ -61,7 +61,6 @@ "fit": true, "fit_kwargs": {}, "model_kwargs": { - "cifar_stem": true, "data_means": [ 0.4914, 0.4822, @@ -76,7 +75,7 @@ "pretrained": false }, "module": "armory.baseline_models.pytorch.resnet18", - "name": "get_art_model", + "name": "get_art_model_cifar_sleeper_agent", "weights_file": null, "wrapper_kwargs": { "input_shape": [ @@ -84,7 +83,7 @@ 32, 3 ], - "learning_rate": 0.001, + "learning_rate": 0.1, "nb_classes": 10 } }, From d76a28711166e46fa3fc9de23e5fdcc3aeebd7eb Mon Sep 17 00:00:00 2001 From: Sterling Date: Thu, 2 Feb 2023 15:14:36 +0000 Subject: [PATCH 14/26] comments --- armory/baseline_models/pytorch/resnet18.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/armory/baseline_models/pytorch/resnet18.py b/armory/baseline_models/pytorch/resnet18.py index 14d151ff1..8c0576bc2 100644 --- a/armory/baseline_models/pytorch/resnet18.py +++ b/armory/baseline_models/pytorch/resnet18.py @@ -121,7 +121,8 @@ def __init__( """This version of the Resnet imitates that found in the ART example notebook for the Sleeper Agent attack: https://github.com/Trusted-AI/adversarial-robustness-toolbox/blob/main/notebooks/poisoning_attack_sleeper_agent_pytorch.ipynb - This attack is somewhat brittle and is not successful against the above torchvision.models.resnet18 with the current attack parameters. + Sleeper Agent is somewhat brittle and is not successful against the above torchvision.models.resnet18 + with the current attack parameters; hence the inclusion of this version. """ data_means = model_kwargs.pop("data_means", CIFAR10_MEANS) @@ -145,7 +146,7 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: def get_art_model_cifar_sleeper_agent( model_kwargs: dict, wrapper_kwargs: dict, weights_path: Optional[str] = None ) -> PyTorchClassifier: - """Return model specific for sleeper agent poisoning on Cifar10""" + """Return Resnet version specific for sleeper agent poisoning on Cifar10""" model = SleeperAgentVersion(weights_path=weights_path, **model_kwargs) lr = wrapper_kwargs.pop("learning_rate", 0.1) From 687ede0a6fc6434174ff69c1aa372cc38d2e6044 Mon Sep 17 00:00:00 2001 From: Sterling Date: Thu, 2 Feb 2023 15:22:15 +0000 Subject: [PATCH 15/26] format --- armory/baseline_models/pytorch/resnet18.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/armory/baseline_models/pytorch/resnet18.py b/armory/baseline_models/pytorch/resnet18.py index 8c0576bc2..112829b86 100644 --- a/armory/baseline_models/pytorch/resnet18.py +++ b/armory/baseline_models/pytorch/resnet18.py @@ -121,7 +121,7 @@ def __init__( """This version of the Resnet imitates that found in the ART example notebook for the Sleeper Agent attack: https://github.com/Trusted-AI/adversarial-robustness-toolbox/blob/main/notebooks/poisoning_attack_sleeper_agent_pytorch.ipynb - Sleeper Agent is somewhat brittle and is not successful against the above torchvision.models.resnet18 + Sleeper Agent is somewhat brittle and is not successful against the above torchvision.models.resnet18 with the current attack parameters; hence the inclusion of this version. """ From 90654d01aa2058ecda1f946190f1ec0bc5a513dc Mon Sep 17 00:00:00 2001 From: Sterling Date: Thu, 2 Feb 2023 18:24:53 +0000 Subject: [PATCH 16/26] update description in audio configs --- .../eval6/poisoning/audio_dlbd/audio_p00_undefended.json | 2 +- .../eval6/poisoning/audio_dlbd/audio_p01_undefended.json | 2 +- .../eval6/poisoning/audio_dlbd/audio_p05_undefended.json | 2 +- .../eval6/poisoning/audio_dlbd/audio_p10_undefended.json | 2 +- .../eval6/poisoning/audio_dlbd/audio_p20_undefended.json | 2 +- .../eval6/poisoning/audio_dlbd/audio_p30_undefended.json | 2 +- .../baseline_defenses/audio_p10_activation_defense.json | 2 +- .../audio_dlbd/baseline_defenses/audio_p10_dpinstahide.json | 2 +- .../audio_dlbd/baseline_defenses/audio_p10_perfect_filter.json | 2 +- .../audio_dlbd/baseline_defenses/audio_p10_random_filter.json | 2 +- .../baseline_defenses/audio_p10_spectral_signature_defense.json | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p00_undefended.json b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p00_undefended.json index 91f53e552..03aa75c66 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p00_undefended.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p00_undefended.json @@ -1,5 +1,5 @@ { - "_description": "Speech Commands DLBD poison audio classification", + "_description": "Speech Commands DLBD poison audio classification, undefended", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p01_undefended.json b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p01_undefended.json index 6e6db4ab2..06d344593 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p01_undefended.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p01_undefended.json @@ -1,5 +1,5 @@ { - "_description": "Speech Commands DLBD poison audio classification", + "_description": "Speech Commands DLBD poison audio classification, undefended", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p05_undefended.json b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p05_undefended.json index 30c31d1a7..2cbaaaaa2 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p05_undefended.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p05_undefended.json @@ -1,5 +1,5 @@ { - "_description": "Speech Commands DLBD poison audio classification", + "_description": "Speech Commands DLBD poison audio classification, undefended", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p10_undefended.json b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p10_undefended.json index c6492e794..701f86798 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p10_undefended.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p10_undefended.json @@ -1,5 +1,5 @@ { - "_description": "Speech Commands DLBD poison audio classification", + "_description": "Speech Commands DLBD poison audio classification, undefended", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p20_undefended.json b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p20_undefended.json index ffb8d4f42..fa91de51b 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p20_undefended.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p20_undefended.json @@ -1,5 +1,5 @@ { - "_description": "Speech Commands DLBD poison audio classification", + "_description": "Speech Commands DLBD poison audio classification, undefended", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p30_undefended.json b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p30_undefended.json index fc51107d8..e29bb9faf 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/audio_p30_undefended.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/audio_p30_undefended.json @@ -1,5 +1,5 @@ { - "_description": "Speech Commands DLBD poison audio classification", + "_description": "Speech Commands DLBD poison audio classification, undefended", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_activation_defense.json b/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_activation_defense.json index 42cccb191..51dea568e 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_activation_defense.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_activation_defense.json @@ -1,5 +1,5 @@ { - "_description": "Speech Commands DLBD poison audio classification", + "_description": "Speech Commands DLBD poison audio classification, activation defense", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_dpinstahide.json b/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_dpinstahide.json index 29428170a..3dffcd2b3 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_dpinstahide.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_dpinstahide.json @@ -1,5 +1,5 @@ { - "_description": "Speech Commands DLBD poison audio classification", + "_description": "Speech Commands DLBD poison audio classification, DP Instahide defense", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_perfect_filter.json b/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_perfect_filter.json index b6a67f459..17dce65af 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_perfect_filter.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_perfect_filter.json @@ -1,5 +1,5 @@ { - "_description": "Speech Commands DLBD poison audio classification", + "_description": "Speech Commands DLBD poison audio classification, perfect filter", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_random_filter.json b/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_random_filter.json index 5da66c19e..5e61eeff4 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_random_filter.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_random_filter.json @@ -1,5 +1,5 @@ { - "_description": "Speech Commands DLBD poison audio classification", + "_description": "Speech Commands DLBD poison audio classification, random filter", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, diff --git a/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_spectral_signature_defense.json b/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_spectral_signature_defense.json index 6ce89d096..06a6f08a5 100644 --- a/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_spectral_signature_defense.json +++ b/scenario_configs/eval6/poisoning/audio_dlbd/baseline_defenses/audio_p10_spectral_signature_defense.json @@ -1,5 +1,5 @@ { - "_description": "Speech Commands DLBD poison audio classification", + "_description": "Speech Commands DLBD poison audio classification, spectral signatures defense", "adhoc": { "compute_fairness_metrics": false, "experiment_id": 0, From 208ad53b6b01e782ef8afe43c0c694808599a2a6 Mon Sep 17 00:00:00 2001 From: Sterling Date: Thu, 2 Feb 2023 20:22:28 +0000 Subject: [PATCH 17/26] better class name --- armory/baseline_models/pytorch/resnet18.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/armory/baseline_models/pytorch/resnet18.py b/armory/baseline_models/pytorch/resnet18.py index 112829b86..0cae79417 100644 --- a/armory/baseline_models/pytorch/resnet18.py +++ b/armory/baseline_models/pytorch/resnet18.py @@ -113,7 +113,7 @@ def get_art_model_sgd( return wrapped_model -class SleeperAgentVersion(torch.nn.Module): +class ResnetForCifarSleeperAgent(torch.nn.Module): def __init__( self, **model_kwargs, @@ -146,9 +146,9 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: def get_art_model_cifar_sleeper_agent( model_kwargs: dict, wrapper_kwargs: dict, weights_path: Optional[str] = None ) -> PyTorchClassifier: - """Return Resnet version specific for sleeper agent poisoning on Cifar10""" + """Return ART-wrapped Resnet version specific for sleeper agent poisoning on Cifar10""" - model = SleeperAgentVersion(weights_path=weights_path, **model_kwargs) + model = ResnetForCifarSleeperAgent(weights_path=weights_path, **model_kwargs) lr = wrapper_kwargs.pop("learning_rate", 0.1) optimizer = torch.optim.SGD( model.parameters(), lr=lr, momentum=0.9, weight_decay=5e-4, nesterov=True From 2db1520523be24031c8efbee44cc479954ee534d Mon Sep 17 00:00:00 2001 From: Sterling Date: Fri, 3 Feb 2023 18:35:27 +0000 Subject: [PATCH 18/26] carla metrics return mean and per-image data --- armory/metrics/task.py | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/armory/metrics/task.py b/armory/metrics/task.py index af68cf958..81475ee0a 100644 --- a/armory/metrics/task.py +++ b/armory/metrics/task.py @@ -1225,74 +1225,98 @@ def object_detection_hallucinations_per_image( @populationwise def carla_od_hallucinations_per_image( - y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5 + y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, mean=True, per_image=True ): """ CARLA object detection datasets contains class labels 1-4, with class 4 representing the green screen/patch itself, which should not be treated as an object class. """ class_list = [1, 2, 3] - return object_detection_hallucinations_per_image( + result = object_detection_hallucinations_per_image( y_list, y_pred_list, iou_threshold=iou_threshold, score_threshold=score_threshold, class_list=class_list, ) + if not mean and not per_image: + raise ValueError("At least one of 'mean' and 'per_image' must be true") + if mean and per_image: + return {"mean":np.mean(np.array(result)), "per_image":result} + + return np.mean(np.array(result)) if mean else result @populationwise def carla_od_disappearance_rate( - y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5 + y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, mean=True, per_image=True ): """ CARLA object detection datasets contains class labels 1-4, with class 4 representing the green screen/patch itself, which should not be treated as an object class. """ class_list = [1, 2, 3] - return object_detection_disappearance_rate( + result = object_detection_disappearance_rate( y_list, y_pred_list, iou_threshold=iou_threshold, score_threshold=score_threshold, class_list=class_list, ) + if not mean and not per_image: + raise ValueError("At least one of 'mean' and 'per_image' must be true") + if mean and per_image: + return {"mean":np.mean(np.array(result)), "per_image":result} + + return np.mean(np.array(result)) if mean else result @populationwise def carla_od_true_positive_rate( - y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5 + y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, mean=True, per_image=True ): """ CARLA object detection datasets contains class labels 1-4, with class 4 representing the green screen/patch itself, which should not be treated as an object class. """ class_list = [1, 2, 3] - return object_detection_true_positive_rate( + result = object_detection_true_positive_rate( y_list, y_pred_list, iou_threshold=iou_threshold, score_threshold=score_threshold, class_list=class_list, ) + if not mean and not per_image: + raise ValueError("At least one of 'mean' and 'per_image' must be true") + if mean and per_image: + return {"mean":np.mean(np.array(result)), "per_image":result} + + return np.mean(np.array(result)) if mean else result @populationwise def carla_od_misclassification_rate( - y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5 + y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, mean=True, per_image=True ): """ CARLA object detection datasets contains class labels 1-4, with class 4 representing the green screen/patch itself, which should not be treated as an object class. """ class_list = [1, 2, 3] - return object_detection_misclassification_rate( + result = object_detection_misclassification_rate( y_list, y_pred_list, iou_threshold=iou_threshold, score_threshold=score_threshold, class_list=class_list, ) + if not mean and not per_image: + raise ValueError("At least one of 'mean' and 'per_image' must be true") + if mean and per_image: + return {"mean":np.mean(np.array(result)), "per_image":result} + + return np.mean(np.array(result)) if mean else result @populationwise From 5a08863580a3d1afcc23de7d3ea5daba5c94bb07 Mon Sep 17 00:00:00 2001 From: Sterling Date: Fri, 3 Feb 2023 18:50:00 +0000 Subject: [PATCH 19/26] format --- armory/metrics/task.py | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/armory/metrics/task.py b/armory/metrics/task.py index 81475ee0a..63d4d37a7 100644 --- a/armory/metrics/task.py +++ b/armory/metrics/task.py @@ -1225,7 +1225,12 @@ def object_detection_hallucinations_per_image( @populationwise def carla_od_hallucinations_per_image( - y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, mean=True, per_image=True + y_list, + y_pred_list, + iou_threshold=0.5, + score_threshold=0.5, + mean=True, + per_image=True, ): """ CARLA object detection datasets contains class labels 1-4, with class 4 representing @@ -1242,14 +1247,19 @@ def carla_od_hallucinations_per_image( if not mean and not per_image: raise ValueError("At least one of 'mean' and 'per_image' must be true") if mean and per_image: - return {"mean":np.mean(np.array(result)), "per_image":result} + return {"mean": np.mean(np.array(result)), "per_image": result} return np.mean(np.array(result)) if mean else result @populationwise def carla_od_disappearance_rate( - y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, mean=True, per_image=True + y_list, + y_pred_list, + iou_threshold=0.5, + score_threshold=0.5, + mean=True, + per_image=True, ): """ CARLA object detection datasets contains class labels 1-4, with class 4 representing @@ -1266,14 +1276,19 @@ def carla_od_disappearance_rate( if not mean and not per_image: raise ValueError("At least one of 'mean' and 'per_image' must be true") if mean and per_image: - return {"mean":np.mean(np.array(result)), "per_image":result} + return {"mean": np.mean(np.array(result)), "per_image": result} return np.mean(np.array(result)) if mean else result @populationwise def carla_od_true_positive_rate( - y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, mean=True, per_image=True + y_list, + y_pred_list, + iou_threshold=0.5, + score_threshold=0.5, + mean=True, + per_image=True, ): """ CARLA object detection datasets contains class labels 1-4, with class 4 representing @@ -1290,14 +1305,19 @@ def carla_od_true_positive_rate( if not mean and not per_image: raise ValueError("At least one of 'mean' and 'per_image' must be true") if mean and per_image: - return {"mean":np.mean(np.array(result)), "per_image":result} + return {"mean": np.mean(np.array(result)), "per_image": result} return np.mean(np.array(result)) if mean else result @populationwise def carla_od_misclassification_rate( - y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, mean=True, per_image=True + y_list, + y_pred_list, + iou_threshold=0.5, + score_threshold=0.5, + mean=True, + per_image=True, ): """ CARLA object detection datasets contains class labels 1-4, with class 4 representing @@ -1314,7 +1334,7 @@ def carla_od_misclassification_rate( if not mean and not per_image: raise ValueError("At least one of 'mean' and 'per_image' must be true") if mean and per_image: - return {"mean":np.mean(np.array(result)), "per_image":result} + return {"mean": np.mean(np.array(result)), "per_image": result} return np.mean(np.array(result)) if mean else result From 0e344602740fe48f4735c1d60247df2209906898 Mon Sep 17 00:00:00 2001 From: Sterling Date: Fri, 3 Feb 2023 19:26:07 +0000 Subject: [PATCH 20/26] move changes from carla functions to general OD functions --- armory/metrics/task.py | 128 +++++++++++++++++++++++++++++------------ 1 file changed, 92 insertions(+), 36 deletions(-) diff --git a/armory/metrics/task.py b/armory/metrics/task.py index 63d4d37a7..1e1f6c302 100644 --- a/armory/metrics/task.py +++ b/armory/metrics/task.py @@ -1100,7 +1100,13 @@ def _object_detection_get_tpr_mr_dr_hr( @populationwise def object_detection_true_positive_rate( - y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, class_list=None + y_list, + y_pred_list, + iou_threshold=0.5, + score_threshold=0.5, + class_list=None, + mean=True, + per_image=True, ): """ Computes object detection true positive rate: the percent of ground-truth boxes which @@ -1126,12 +1132,30 @@ def object_detection_true_positive_rate( score_threshold=score_threshold, class_list=class_list, ) - return true_positive_rate_per_img + if not mean and not per_image: + raise ValueError("At least one of 'mean' and 'per_image' must be true") + if mean and per_image: + return { + "mean": np.mean(np.array(true_positive_rate_per_img)), + "per_image": true_positive_rate_per_img, + } + + return ( + np.mean(np.array(true_positive_rate_per_img)) + if mean + else true_positive_rate_per_img + ) @populationwise def object_detection_misclassification_rate( - y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, class_list=None + y_list, + y_pred_list, + iou_threshold=0.5, + score_threshold=0.5, + class_list=None, + mean=True, + per_image=True, ): """ Computes object detection misclassification rate: the percent of ground-truth boxes which @@ -1157,12 +1181,30 @@ def object_detection_misclassification_rate( score_threshold=score_threshold, class_list=class_list, ) - return misclassification_rate_per_image + if not mean and not per_image: + raise ValueError("At least one of 'mean' and 'per_image' must be true") + if mean and per_image: + return { + "mean": np.mean(np.array(misclassification_rate_per_image)), + "per_image": misclassification_rate_per_image, + } + + return ( + np.mean(np.array(misclassification_rate_per_image)) + if mean + else misclassification_rate_per_image + ) @populationwise def object_detection_disappearance_rate( - y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, class_list=None + y_list, + y_pred_list, + iou_threshold=0.5, + score_threshold=0.5, + class_list=None, + mean=True, + per_image=True, ): """ Computes object detection disappearance rate: the percent of ground-truth boxes for which @@ -1189,12 +1231,30 @@ def object_detection_disappearance_rate( score_threshold=score_threshold, class_list=class_list, ) - return disappearance_rate_per_img + if not mean and not per_image: + raise ValueError("At least one of 'mean' and 'per_image' must be true") + if mean and per_image: + return { + "mean": np.mean(np.array(disappearance_rate_per_img)), + "per_image": disappearance_rate_per_img, + } + + return ( + np.mean(np.array(disappearance_rate_per_img)) + if mean + else disappearance_rate_per_img + ) @populationwise def object_detection_hallucinations_per_image( - y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, class_list=None + y_list, + y_pred_list, + iou_threshold=0.5, + score_threshold=0.5, + class_list=None, + mean=True, + per_image=True, ): """ Computes object detection hallucinations per image: the number of predicted boxes per image @@ -1220,7 +1280,19 @@ def object_detection_hallucinations_per_image( score_threshold=score_threshold, class_list=class_list, ) - return hallucinations_per_image + if not mean and not per_image: + raise ValueError("At least one of 'mean' and 'per_image' must be true") + if mean and per_image: + return { + "mean": np.mean(np.array(hallucinations_per_image)), + "per_image": hallucinations_per_image, + } + + return ( + np.mean(np.array(hallucinations_per_image)) + if mean + else hallucinations_per_image + ) @populationwise @@ -1237,19 +1309,15 @@ def carla_od_hallucinations_per_image( the green screen/patch itself, which should not be treated as an object class. """ class_list = [1, 2, 3] - result = object_detection_hallucinations_per_image( + return object_detection_hallucinations_per_image( y_list, y_pred_list, iou_threshold=iou_threshold, score_threshold=score_threshold, class_list=class_list, + mean=mean, + per_image=per_image, ) - if not mean and not per_image: - raise ValueError("At least one of 'mean' and 'per_image' must be true") - if mean and per_image: - return {"mean": np.mean(np.array(result)), "per_image": result} - - return np.mean(np.array(result)) if mean else result @populationwise @@ -1266,19 +1334,15 @@ def carla_od_disappearance_rate( the green screen/patch itself, which should not be treated as an object class. """ class_list = [1, 2, 3] - result = object_detection_disappearance_rate( + return object_detection_disappearance_rate( y_list, y_pred_list, iou_threshold=iou_threshold, score_threshold=score_threshold, class_list=class_list, + mean=mean, + per_image=per_image, ) - if not mean and not per_image: - raise ValueError("At least one of 'mean' and 'per_image' must be true") - if mean and per_image: - return {"mean": np.mean(np.array(result)), "per_image": result} - - return np.mean(np.array(result)) if mean else result @populationwise @@ -1295,19 +1359,15 @@ def carla_od_true_positive_rate( the green screen/patch itself, which should not be treated as an object class. """ class_list = [1, 2, 3] - result = object_detection_true_positive_rate( + return object_detection_true_positive_rate( y_list, y_pred_list, iou_threshold=iou_threshold, score_threshold=score_threshold, class_list=class_list, + mean=mean, + per_image=per_image, ) - if not mean and not per_image: - raise ValueError("At least one of 'mean' and 'per_image' must be true") - if mean and per_image: - return {"mean": np.mean(np.array(result)), "per_image": result} - - return np.mean(np.array(result)) if mean else result @populationwise @@ -1324,19 +1384,15 @@ def carla_od_misclassification_rate( the green screen/patch itself, which should not be treated as an object class. """ class_list = [1, 2, 3] - result = object_detection_misclassification_rate( + return object_detection_misclassification_rate( y_list, y_pred_list, iou_threshold=iou_threshold, score_threshold=score_threshold, class_list=class_list, + mean=mean, + per_image=per_image, ) - if not mean and not per_image: - raise ValueError("At least one of 'mean' and 'per_image' must be true") - if mean and per_image: - return {"mean": np.mean(np.array(result)), "per_image": result} - - return np.mean(np.array(result)) if mean else result @populationwise From 75fc69d7f04aa76b7618786d514b63408c8a43bb Mon Sep 17 00:00:00 2001 From: Sterling Date: Sat, 4 Feb 2023 13:08:31 +0000 Subject: [PATCH 21/26] reverting --- armory/metrics/task.py | 124 ++++------------------------------------- 1 file changed, 12 insertions(+), 112 deletions(-) diff --git a/armory/metrics/task.py b/armory/metrics/task.py index 1e1f6c302..af68cf958 100644 --- a/armory/metrics/task.py +++ b/armory/metrics/task.py @@ -1100,13 +1100,7 @@ def _object_detection_get_tpr_mr_dr_hr( @populationwise def object_detection_true_positive_rate( - y_list, - y_pred_list, - iou_threshold=0.5, - score_threshold=0.5, - class_list=None, - mean=True, - per_image=True, + y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, class_list=None ): """ Computes object detection true positive rate: the percent of ground-truth boxes which @@ -1132,30 +1126,12 @@ def object_detection_true_positive_rate( score_threshold=score_threshold, class_list=class_list, ) - if not mean and not per_image: - raise ValueError("At least one of 'mean' and 'per_image' must be true") - if mean and per_image: - return { - "mean": np.mean(np.array(true_positive_rate_per_img)), - "per_image": true_positive_rate_per_img, - } - - return ( - np.mean(np.array(true_positive_rate_per_img)) - if mean - else true_positive_rate_per_img - ) + return true_positive_rate_per_img @populationwise def object_detection_misclassification_rate( - y_list, - y_pred_list, - iou_threshold=0.5, - score_threshold=0.5, - class_list=None, - mean=True, - per_image=True, + y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, class_list=None ): """ Computes object detection misclassification rate: the percent of ground-truth boxes which @@ -1181,30 +1157,12 @@ def object_detection_misclassification_rate( score_threshold=score_threshold, class_list=class_list, ) - if not mean and not per_image: - raise ValueError("At least one of 'mean' and 'per_image' must be true") - if mean and per_image: - return { - "mean": np.mean(np.array(misclassification_rate_per_image)), - "per_image": misclassification_rate_per_image, - } - - return ( - np.mean(np.array(misclassification_rate_per_image)) - if mean - else misclassification_rate_per_image - ) + return misclassification_rate_per_image @populationwise def object_detection_disappearance_rate( - y_list, - y_pred_list, - iou_threshold=0.5, - score_threshold=0.5, - class_list=None, - mean=True, - per_image=True, + y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, class_list=None ): """ Computes object detection disappearance rate: the percent of ground-truth boxes for which @@ -1231,30 +1189,12 @@ def object_detection_disappearance_rate( score_threshold=score_threshold, class_list=class_list, ) - if not mean and not per_image: - raise ValueError("At least one of 'mean' and 'per_image' must be true") - if mean and per_image: - return { - "mean": np.mean(np.array(disappearance_rate_per_img)), - "per_image": disappearance_rate_per_img, - } - - return ( - np.mean(np.array(disappearance_rate_per_img)) - if mean - else disappearance_rate_per_img - ) + return disappearance_rate_per_img @populationwise def object_detection_hallucinations_per_image( - y_list, - y_pred_list, - iou_threshold=0.5, - score_threshold=0.5, - class_list=None, - mean=True, - per_image=True, + y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, class_list=None ): """ Computes object detection hallucinations per image: the number of predicted boxes per image @@ -1280,29 +1220,12 @@ def object_detection_hallucinations_per_image( score_threshold=score_threshold, class_list=class_list, ) - if not mean and not per_image: - raise ValueError("At least one of 'mean' and 'per_image' must be true") - if mean and per_image: - return { - "mean": np.mean(np.array(hallucinations_per_image)), - "per_image": hallucinations_per_image, - } - - return ( - np.mean(np.array(hallucinations_per_image)) - if mean - else hallucinations_per_image - ) + return hallucinations_per_image @populationwise def carla_od_hallucinations_per_image( - y_list, - y_pred_list, - iou_threshold=0.5, - score_threshold=0.5, - mean=True, - per_image=True, + y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5 ): """ CARLA object detection datasets contains class labels 1-4, with class 4 representing @@ -1315,19 +1238,12 @@ def carla_od_hallucinations_per_image( iou_threshold=iou_threshold, score_threshold=score_threshold, class_list=class_list, - mean=mean, - per_image=per_image, ) @populationwise def carla_od_disappearance_rate( - y_list, - y_pred_list, - iou_threshold=0.5, - score_threshold=0.5, - mean=True, - per_image=True, + y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5 ): """ CARLA object detection datasets contains class labels 1-4, with class 4 representing @@ -1340,19 +1256,12 @@ def carla_od_disappearance_rate( iou_threshold=iou_threshold, score_threshold=score_threshold, class_list=class_list, - mean=mean, - per_image=per_image, ) @populationwise def carla_od_true_positive_rate( - y_list, - y_pred_list, - iou_threshold=0.5, - score_threshold=0.5, - mean=True, - per_image=True, + y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5 ): """ CARLA object detection datasets contains class labels 1-4, with class 4 representing @@ -1365,19 +1274,12 @@ def carla_od_true_positive_rate( iou_threshold=iou_threshold, score_threshold=score_threshold, class_list=class_list, - mean=mean, - per_image=per_image, ) @populationwise def carla_od_misclassification_rate( - y_list, - y_pred_list, - iou_threshold=0.5, - score_threshold=0.5, - mean=True, - per_image=True, + y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5 ): """ CARLA object detection datasets contains class labels 1-4, with class 4 representing @@ -1390,8 +1292,6 @@ def carla_od_misclassification_rate( iou_threshold=iou_threshold, score_threshold=score_threshold, class_list=class_list, - mean=mean, - per_image=per_image, ) From 3d751b7568635fb49fc799035f99a5ac4e7f1def Mon Sep 17 00:00:00 2001 From: Sterling Date: Sat, 4 Feb 2023 13:29:46 +0000 Subject: [PATCH 22/26] use batchwise decorator --- armory/metrics/task.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/armory/metrics/task.py b/armory/metrics/task.py index af68cf958..607846544 100644 --- a/armory/metrics/task.py +++ b/armory/metrics/task.py @@ -1223,7 +1223,7 @@ def object_detection_hallucinations_per_image( return hallucinations_per_image -@populationwise +@batchwise def carla_od_hallucinations_per_image( y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5 ): @@ -1241,7 +1241,7 @@ def carla_od_hallucinations_per_image( ) -@populationwise +@batchwise def carla_od_disappearance_rate( y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5 ): @@ -1259,7 +1259,7 @@ def carla_od_disappearance_rate( ) -@populationwise +@batchwise def carla_od_true_positive_rate( y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5 ): @@ -1277,7 +1277,7 @@ def carla_od_true_positive_rate( ) -@populationwise +@batchwise def carla_od_misclassification_rate( y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5 ): From 40ebf67394095ed44465f5d3e193aa9a4478cd85 Mon Sep 17 00:00:00 2001 From: Sterling Date: Mon, 6 Feb 2023 14:22:04 +0000 Subject: [PATCH 23/26] remove metrics wrt benign predictions --- armory/scenarios/carla_object_detection.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/armory/scenarios/carla_object_detection.py b/armory/scenarios/carla_object_detection.py index 9a6ad60ef..4b4eea1b6 100644 --- a/armory/scenarios/carla_object_detection.py +++ b/armory/scenarios/carla_object_detection.py @@ -72,11 +72,6 @@ def run_attack(self): self.x_adv, self.y_target, self.y_pred_adv = x_adv, y_target, y_pred_adv - def load_metrics(self): - super().load_metrics() - # measure adversarial results using benign predictions as labels - self.metrics_logger.add_tasks_wrt_benign_predictions() - def _load_sample_exporter_with_boxes(self): return ObjectDetectionExporter( self.export_dir, From 6d831fb8e8a53bfac48400f859e506dbd0e8118f Mon Sep 17 00:00:00 2001 From: Sterling Date: Mon, 6 Feb 2023 14:22:36 +0000 Subject: [PATCH 24/26] add description of metrics wrt benign predictions to metrics doc --- docs/metrics.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/metrics.md b/docs/metrics.md index a4d0577c3..377fdd860 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -128,6 +128,13 @@ These metrics typically take a list or array of results as their single argument The `apricot`, `carla`, and `dapricot` metrics are effectively the `object_detection` metrics with parameters adapted to those respective scenarios. +As mentioned, these functions generally compare `y_pred` against `y`, that is, the metric compares a benign or adversarial prediction to the ground truth. It is also possible to use these metrics to compare adversarial predictions against benign predictions. This is not enabled in off-the-shelf Armory code, but can be easily implemented through one small code modification, by simply adding ```self.metrics_logger.add_tasks_wrt_benign_predictions()``` to the ```load_metrics()``` function of the scenario. For example, if you create a new scenario inheriting ```scenario.py```, you can implement ```load_metrics()``` this way: +``` +def load_metrics(self): + super().load_metrics() + self.metrics_logger.add_tasks_wrt_benign_predictions() +``` + | Name | Namespace | Description | |-------|-------|-------| | `categorical_accuracy` | `task.batch.categorical_accuracy` | Categorical Accuracy | From c256509ef0c0fe242cb37430557e54634df925a1 Mon Sep 17 00:00:00 2001 From: Sterling Date: Mon, 6 Feb 2023 14:25:10 +0000 Subject: [PATCH 25/26] batchwise decorator for general (non-carla) OD metrics --- armory/metrics/task.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/armory/metrics/task.py b/armory/metrics/task.py index 607846544..a90c8a5ae 100644 --- a/armory/metrics/task.py +++ b/armory/metrics/task.py @@ -1098,7 +1098,7 @@ def _object_detection_get_tpr_mr_dr_hr( ) -@populationwise +@batchwise def object_detection_true_positive_rate( y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, class_list=None ): @@ -1129,7 +1129,7 @@ def object_detection_true_positive_rate( return true_positive_rate_per_img -@populationwise +@batchwise def object_detection_misclassification_rate( y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, class_list=None ): @@ -1160,7 +1160,7 @@ def object_detection_misclassification_rate( return misclassification_rate_per_image -@populationwise +@batchwise def object_detection_disappearance_rate( y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, class_list=None ): @@ -1192,7 +1192,7 @@ def object_detection_disappearance_rate( return disappearance_rate_per_img -@populationwise +@batchwise def object_detection_hallucinations_per_image( y_list, y_pred_list, iou_threshold=0.5, score_threshold=0.5, class_list=None ): From 233fcb563d3a1d837bf3b27652b9c2496e855e4a Mon Sep 17 00:00:00 2001 From: Sterling Date: Mon, 6 Feb 2023 14:29:18 +0000 Subject: [PATCH 26/26] update namespace descrptions in metrics doc --- docs/metrics.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/metrics.md b/docs/metrics.md index 377fdd860..6cf2b5aad 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -149,17 +149,17 @@ def load_metrics(self): | `video_tracking_mean_iou` | `task.batch.video_tracking_mean_iou` | Mean IOU between ground-truth and predicted boxes, averaged over all frames for a video | | `video_tracking_mean_success_rate` | `task.batch.video_tracking_mean_success_rate` | Mean success rate averaged over all multiple IOU thresholds and all frames | | `object_detection_AP_per_class` | `task.population.object_detection_AP_per_class` | Object Detection average precision per class | -| `object_detection_disappearance_rate` | `task.population.object_detection_disappearance_rate` | Object Detection Disappearance Rate | -| `object_detection_hallucinations_per_image` | `task.population.object_detection_hallucinations_per_image` | Object Detection Hallucinations Per Image | +| `object_detection_disappearance_rate` | `task.batch.object_detection_disappearance_rate` | Object Detection Disappearance Rate | +| `object_detection_hallucinations_per_image` | `task.batch.object_detection_hallucinations_per_image` | Object Detection Hallucinations Per Image | | `object_detection_mAP` | `task.population.object_detection_mAP` | Object Detection mean average precision | -| `object_detection_misclassification_rate` | `task.population.object_detection_misclassification_rate` | Object Detection Misclassification Rate | -| `object_detection_true_positive_rate` | `task.population.object_detection_true_positive_rate` | Object Detection True Positive Rate | +| `object_detection_misclassification_rate` | `task.batch.object_detection_misclassification_rate` | Object Detection Misclassification Rate | +| `object_detection_true_positive_rate` | `task.batch.object_detection_true_positive_rate` | Object Detection True Positive Rate | | `apricot_patch_targeted_AP_per_class` | `task.population.apricot_patch_targeted_AP_per_class` | OD metric applied to apricot scenario | | `carla_od_AP_per_class` | `task.population.carla_od_AP_per_class` | OD metric applied to carla scenario | -| `carla_od_disappearance_rate` | `task.population.carla_od_disappearance_rate` | OD metric applied to carla scenario | -| `carla_od_hallucinations_per_image` | `task.population.carla_od_hallucinations_per_image` | OD metric applied to carla scenario | -| `carla_od_misclassification_rate` | `task.population.carla_od_misclassification_rate` | OD metric applied to carla scenario | -| `carla_od_true_positive_rate` | `task.population.carla_od_true_positive_rate` | OD metric applied to carla scenario | +| `carla_od_disappearance_rate` | `task.batch.carla_od_disappearance_rate` | OD metric applied to carla scenario | +| `carla_od_hallucinations_per_image` | `task.batch.carla_od_hallucinations_per_image` | OD metric applied to carla scenario | +| `carla_od_misclassification_rate` | `task.batch.carla_od_misclassification_rate` | OD metric applied to carla scenario | +| `carla_od_true_positive_rate` | `task.batch.carla_od_true_positive_rate` | OD metric applied to carla scenario | | `dapricot_patch_target_success` | `task.population.dapricot_patch_target_success` | OD metric applied to dapricot scenario | | `dapricot_patch_targeted_AP_per_class` | `task.population.dapricot_patch_targeted_AP_per_class` | OD metric applied to dapricot scenario | | `abstains` | `task.batch.abstains` | Takes a batch matrix of inputs and returns 1 for each row that are all 0 (abstention) |