Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/JonasGeiping/data-poisoning
/ functions
Functions
297 in github.com/JonasGeiping/data-poisoning
⨍
Functions
297
◇
Types & classes
63
↓ 30 callers
Function
_maybe
Retrieve stat if it was recorded. Return empty string otherwise.
forest/utils.py:135
↓ 18 callers
Method
step
Step through a model epoch. Optionally: minimize target loss.
forest/victims/victim_single.py:110
↓ 16 callers
Function
criterion
(outputs, labels)
forest/victims/training.py:96
↓ 12 callers
Method
_set_locations
Fix locations where we’ll put the patches.
forest/victims/batched_attacks.py:332
↓ 12 callers
Method
get_target
Return only the target and its id. Args: index (int): Index Returns: tuple: (target, idx) where target is cl
forest/data/datasets.py:276
↓ 12 callers
Method
train
Clean (pre)-training of the chosen model, no poisoning involved.
forest/victims/victim_base.py:98
↓ 12 callers
Method
validate
Check poison on a new initialization(s), depending on the scenario.
forest/victims/victim_base.py:138
↓ 10 callers
Method
_patch
(self, inputs, labels, patches, x_locations, y_locations)
forest/victims/batched_attacks.py:445
↓ 9 callers
Function
bypass_last_layer
Hacky way of separating features and classification head for many models. Patch this function if problems appear.
forest/utils.py:64
↓ 8 callers
Function
_save_image
(sample, index, filename, train=True)
forest/gcloud.py:43
↓ 8 callers
Method
eval
Switch everything into evaluation mode.
forest/victims/victim_base.py:160
↓ 8 callers
Method
initialize_poison
Initialize according to args.init. Propagate initialization in distributed settings.
forest/data/kettle_base.py:206
↓ 8 callers
Function
set_random_seed
233 = 144 + 89 is my favorite number.
forest/utils.py:231
↓ 7 callers
Method
_create_patch
(self, patch_shape)
forest/victims/batched_attacks.py:341
↓ 7 callers
Method
_initialize_model
(self, model_name, pretrain=False)
forest/victims/victim_base.py:172
↓ 7 callers
Method
_random_derangement
(self, n)
forest/victims/batched_attacks.py:411
↓ 7 callers
Function
label_name
(label)
forest/gcloud.py:49
↓ 7 callers
Function
resnet_picker
Pick an appropriate resnet architecture for MNIST/CIFAR.
forest/victims/models.py:189
↓ 6 callers
Method
_init_perturbation
(self, input_shape)
forest/victims/batched_attacks.py:101
↓ 6 callers
Method
reinitialize_last_layer
(self, seed=None)
forest/victims/victim_base.py:83
↓ 5 callers
Method
_step
Single epoch. Can't say I'm a fan of this interface, but ...
forest/victims/victim_base.py:187
↓ 5 callers
Method
attack
Attack within given constraints with task as in _objective.
forest/victims/batched_attacks.py:266
↓ 5 callers
Function
bypass_last_layer
Hacky way of separating features and classification head for many models. Patch this function if problems appear.
plotting/featurespace_visualizations.py:154
↓ 5 callers
Method
corrected_loss
Compute the corrected loss under consideration of the mixing.
forest/data/mixing_data_augmentations.py:38
↓ 5 callers
Method
gradient
Compute the gradient of criterion(model) w.r.t to given data.
forest/victims/victim_base.py:53
↓ 4 callers
Function
_command
(idx, name, ensemble, model, add_options)
scripts/benchmark_gen.py:13
↓ 4 callers
Method
_init_optimizer
(self, delta_iterable)
forest/victims/batched_attacks.py:128
↓ 4 callers
Method
_iterate
Validate a given poison by training the model and checking target accuracy.
forest/victims/victim_base.py:164
↓ 4 callers
Method
_passenger_loss
Compute the blind passenger loss term.
forest/witchcoven/witch_matching.py:39
↓ 4 callers
Method
export_poison
Export poisons in either packed mode (just ids and raw data) or in full export mode, exporting all images. In full export mode, export data i
forest/data/kettle_base.py:261
↓ 4 callers
Function
get_defense
(args)
forest/filtering_defenses.py:5
↓ 4 callers
Function
get_model
Retrieve an appropriate architecture.
forest/victims/models.py:13
↓ 4 callers
Function
get_optimizers
Construct optimizer as given in defs.
forest/victims/training.py:284
↓ 4 callers
Method
load_feature_representation
(self)
forest/victims/victim_base.py:92
↓ 4 callers
Method
lookup_poison_indices
Given a list of ids, retrieve the appropriate poison perturbation from poison delta and apply it.
forest/data/kettle_base.py:248
↓ 4 callers
Method
reset_trainset
(self, new_ids)
forest/data/kettle_base.py:241
↓ 4 callers
Function
softmax
Compute the softmax of each element along an axis of X. Parameters ---------- X: ND-Array. Probably should be floats. theta (opt
plotting/featurespace_visualizations.py:249
↓ 4 callers
Function
training_strategy
Parse training strategy.
forest/hyperparameters.py:7
↓ 3 callers
Method
__init__
Implement differentiable mixup, mixing nway-many examples with the given mixing factor alpha.
forest/data/mixing_data_augmentations.py:17
↓ 3 callers
Function
_get_poisoned_features
(kettle, victim, poison_delta, dryrun=False)
forest/filtering_defenses.py:14
↓ 3 callers
Method
_initialize_brew
Implement common initialization operations for brewing.
forest/witchcoven/witch_base.py:83
↓ 3 callers
Method
_objective
Evaluate Gradient Alignment and descend.
forest/victims/batched_attacks.py:291
↓ 3 callers
Method
_pgd_step
PGD step.
forest/witchcoven/witch_base.py:316
↓ 3 callers
Function
_split_data
Split data for meta update steps and other defenses.
forest/victims/training.py:242
↓ 3 callers
Method
brew
Recipe interface.
forest/witchcoven/witch_base.py:40
↓ 3 callers
Method
compute
Compute function on all models. Function has arguments: model, ...
forest/victims/victim_base.py:58
↓ 3 callers
Function
construct_attack
Interface for this submodule.
forest/victims/batched_attacks.py:10
↓ 3 callers
Function
construct_datasets
Construct datasets with appropriate transforms.
forest/data/datasets.py:20
↓ 3 callers
Function
convnet
Define a simple ConvNet. This architecture only really works for CIFAR10.
forest/victims/models.py:96
↓ 3 callers
Method
distributed_control
Control distributed poison brewing, no-op in single network training.
forest/victims/victim_base.py:65
↓ 3 callers
Method
get_num_workers
Check devices and set an appropriate number of workers.
forest/data/kettle_base.py:132
↓ 3 callers
Method
initialize
(self, seed=None)
forest/victims/victim_base.py:80
↓ 3 callers
Method
patch_targets
Backdoor trigger attacks need to patch kettle.targets.
forest/witchcoven/witch_base.py:333
↓ 3 callers
Method
retrain
Check poison on the initialization it was brewed on.
forest/victims/victim_base.py:122
↓ 3 callers
Method
sync_gradients
Sync gradients of given variable. No-op for single network training.
forest/victims/victim_base.py:70
↓ 2 callers
Method
__init__
(self, dataset, delta)
forest/data/datasets.py:147
↓ 2 callers
Method
_patch
(self, inputs, labels, patches, x_locations, y_locations)
forest/victims/batched_attacks.py:498
↓ 2 callers
Method
_patch
(self, inputs, labels, patches, x_locations, y_locations)
forest/victims/batched_attacks.py:538
↓ 2 callers
Method
_patch
(self, inputs, labels, patches, x_locations, y_locations)
forest/victims/batched_attacks.py:583
↓ 2 callers
Method
_rand_bbox
(size, lmb)
forest/data/mixing_data_augmentations.py:73
↓ 2 callers
Method
_set_locations
.Fix locations where we’ll put the patches.
forest/victims/batched_attacks.py:391
↓ 2 callers
Function
alexnet_metapoison
AlexNet variant as used in MetaPoison.
forest/victims/models.py:117
↓ 2 callers
Function
automl_interface
(setup, kettle, poison_delta)
forest/gcloud.py:437
↓ 2 callers
Function
average_dicts
Average entries in a list of dictionaries.
forest/utils.py:35
↓ 2 callers
Function
f
(x)
forest/witchcoven/witch_convex_polytope.py:80
↓ 2 callers
Function
get_features
(model, data, poison_delta)
plotting/brew_and_visualize_poison.py:30
↓ 2 callers
Function
linear_model
Define the simplest linear model.
forest/victims/models.py:82
↓ 2 callers
Method
prepare_diff_data_augmentations
Load differentiable data augmentations separately from usual torchvision.transforms.
forest/data/kettle_base.py:149
↓ 2 callers
Method
print_status
(self)
forest/data/kettle_base.py:105
↓ 2 callers
Function
upload_to_automl
(dataset_id, project_id, csvpath, wait_for_response=True)
forest/gcloud.py:231
↓ 1 callers
Method
__init__
Initialize as usual. Layers and strides are scriptable.
forest/victims/models.py:247
↓ 1 callers
Method
__init__
( self, in_planes, out_planes, expansion, stride, train_dp,
forest/victims/mobilenet.py:23
↓ 1 callers
Method
_apply_patch
(self, temp_targets)
forest/victims/batched_attacks.py:304
↓ 1 callers
Method
_batched_step
Take a step toward minmizing the current target loss.
forest/witchcoven/witch_htbd.py:105
↓ 1 callers
Method
_batched_step
Take a step toward minmizing the current target loss.
forest/witchcoven/witch_base.py:210
↓ 1 callers
Method
_brew
Run generalized iterative routine.
forest/witchcoven/witch_base.py:62
↓ 1 callers
Method
_choose_poisons_benchmark
(self, setup_dict)
forest/data/kettle_benchmark_experiment.py:37
↓ 1 callers
Method
_choose_poisons_deterministic
(self, target_id)
forest/data/kettle_det_experiment.py:44
↓ 1 callers
Method
_choose_poisons_randomly
Subconstruct poison and targets. The behavior is different for poisons and targets. We still consider poisons to be part of the original trai
forest/data/kettle_random_experiment.py:110
↓ 1 callers
Method
_create_patch
(self, patch_shape)
forest/victims/batched_attacks.py:400
↓ 1 callers
Method
_create_patch
(self, inputs, patch_shapes)
forest/victims/batched_attacks.py:570
↓ 1 callers
Method
_create_patch
(self, patch_shape)
forest/witchcoven/witch_patch.py:40
↓ 1 callers
Method
_create_patch
(self, patch_shape)
forest/witchcoven/witch_htbd.py:201
↓ 1 callers
Method
_define_objective
Implement the closure here.
forest/witchcoven/witch_htbd.py:179
↓ 1 callers
Method
_define_objective
Implement the closure here.
forest/witchcoven/witch_base.py:309
↓ 1 callers
Method
_define_objective
Implement the closure here.
forest/witchcoven/witch_matching.py:275
↓ 1 callers
Method
_get_mask
(self, inputs)
forest/victims/batched_attacks.py:712
↓ 1 callers
Method
_get_temp_targets
(self, kettle)
forest/witchcoven/witch_htbd.py:237
↓ 1 callers
Function
_gradient_matching
Compute the blind passenger loss term.
forest/utils.py:48
↓ 1 callers
Method
_hide_gradient
Enforce batch-wise privacy if necessary. This is attacking a defense discussed in Hong et al., 2020 We enforce privacy on mini batche
forest/witchcoven/witch_matching.py:126
↓ 1 callers
Method
_index_mapping
(self, inputs, temp_targets)
forest/victims/batched_attacks.py:317
↓ 1 callers
Method
_index_mapping
(self, model, inputs, temp_targets)
forest/witchcoven/witch_htbd.py:246
↓ 1 callers
Method
_initialize_brew
(self, victim, kettle)
forest/witchcoven/witch_matching.py:310
↓ 1 callers
Function
_label_to_onehot
(target, num_classes=100)
forest/utils.py:83
↓ 1 callers
Function
_least_squares_simplex
Implement the inner loop of Algorithm 1.
forest/witchcoven/witch_convex_polytope.py:66
↓ 1 callers
Method
_load_metapoison_files
Load a metapoison package. xtrain: CIFAR-10 training set images with a subset of them poisoned/perturbed ytrain: CIFAR-10 training se
forest/data/kettle_external.py:57
↓ 1 callers
Method
_make_layers
(self, in_planes, train_dp=0, test_dp=0, droplayer=0, bdp=0)
forest/victims/mobilenet.py:140
↓ 1 callers
Method
_make_layers
(self, cfg, in_channels)
forest/victims/vgg.py:56
↓ 1 callers
Method
_objective
(self, inputs, labels, temp_targets, temp_fake_labels)
forest/victims/batched_attacks.py:98
↓ 1 callers
Method
_parse_threats_randomly
Parse the different threat models. The threat-models are [In order of expected difficulty]: single-class replicates the threat model
forest/data/kettle_random_experiment.py:55
next →
1–100 of 297, ranked by callers