MCPcopy Create free account

hub / github.com/THUYimingLi/BackdoorBox / functions

Functions664 in github.com/THUYimingLi/BackdoorBox

↓ 2 callersMethodadjust_learning_rate
(self, optimizer, epoch, step, len_epoch)
core/attacks/base.py:106
↓ 2 callersFunctionany2tensor
Convert strpath, PIL.Image.Image, numpy.ndarray, torch.Tensor image(s) to a torch.Tensor. Args: imgs (list[strpath] | list[PIL.Image.Imag
core/utils/any2tensor.py:36
↓ 2 callersMethodattention_map
(self, fm, eps=1e-6)
core/defenses/NAD.py:46
↓ 2 callersFunctioncompute_normal_loss
(model, criterion, inputs, labels, grads)
core/attacks/Blind.py:105
↓ 2 callersMethodconstruct_poisoned_dataset
(self, dataset, batch_size, num_workers, device, NC=False)
core/attacks/Blind.py:860
↓ 2 callersMethodcreate_atkmodel
Return the generator of backdoor trigger.
core/attacks/LIRA.py:423
↓ 2 callersMethodcreate_bd
Construct the backdoored samples by the backdoor trigger mask generator and backdoor trigger pattern generator. Args: inp
core/attacks/IAD.py:872
↓ 2 callersMethodcreate_cross
Construct the cross samples to implement the diversity loss in [1]. Args: inputs1 (torch.Tensor): Benign samples.
core/attacks/IAD.py:895
↓ 2 callersFunctiongenerate_poisoned_trainset
(trainset, poison_set, poison_deltas, y_target, poison_ids)
core/attacks/SleeperAgent.py:214
↓ 2 callersFunctionget_gradient
Compute the gradient of criterion(model) w.r.t to given data.
core/attacks/SleeperAgent.py:157
↓ 2 callersFunctionget_secret_acc
The accurate for the steganography secret. Args: secret_true (torch.Tensor): Label of the steganography secret. secret_pred (torc
core/attacks/ISSBA.py:493
↓ 2 callersMethodget_target_transform
Return the attacker-specified target label.
core/attacks/LIRA.py:390
↓ 2 callersFunctioninit_model
(model)
tests/test_SleeperAgent.py:41
↓ 2 callersMethodnormalize_pattern
(self, x)
core/attacks/IAD.py:233
↓ 2 callersMethodpredict
Apply unet defense method to input data and get the predicts. Args: model (torch.nn.Module): Network. data (torch.Ten
core/defenses/REFINE.py:303
↓ 2 callersFunctionprepare_dataset
prepare benign datasets and source datasets and patched(poisoned) datasets
core/attacks/SleeperAgent.py:249
↓ 2 callersMethodreset_grad
(self, optimizer, d_optimizer)
core/attacks/ISSBA.py:655
↓ 2 callersMethodreset_parameters
(self)
core/models/curves.py:92
↓ 2 callersMethodreset_running_stats
(self)
core/models/curves.py:201
↓ 2 callersFunctiontest
(model_name, dataset_name, attack_name, defense_name, benign_dataset, attacked_dataset, defense, y_target)
tests/test_SCALE_UP.py:40
↓ 2 callersMethodtest
Test the pruned model. Args: schedule (dict): Schedule for testing.
core/defenses/Pruning.py:135
↓ 2 callersMethodtest
Uniform test API for any model and any dataset. Args: model (torch.nn.Module): Network. dataset (torch.utils.data.Dat
core/defenses/ABL.py:311
↓ 2 callersMethodtest
Test the finetuning model. Args: schedule (dict): Schedule for testing.
core/defenses/FineTuning.py:173
↓ 2 callersMethodtrain_encoder_decoder
Train the image steganography encoder and decoder. Args: train_only (bool): Whether to only train the image steganography encoder
core/attacks/ISSBA.py:659
↓ 2 callersMethodtrain_test
Test the victim model using the backdoor trigger generator in training process. Args: atkmodel (torch.nn.Module): Backdoo
core/attacks/LIRA.py:695
↓ 1 callersFunctionCreatePoisonedDataset
(benign_dataset, y_target, poisoned_rate, pattern, weight, poisoned_transform_index, poisoned_target_transform
core/attacks/LabelConsistent.py:389
↓ 1 callersFunctionCreatePoisonedTrainDataset
(benign_dataset, y_target, poisoned_rate, poisoned_transform_index, poisoned_target_transform_index)
core/attacks/BATT.py:388
↓ 1 callersFunctionCreatePoisonedTrainDataset
(benign_dataset, y_target, poisoned_rate, pattern, weight, poisoned_transform_index, poisoned_target_transform
core/attacks/PhysicalBA.py:212
↓ 1 callersFunctionGetPoisonedImageNetDataset
( benign_dataset: DatasetFolder, target_label: Union[str, int], poisoned_rate: float, transfor
core/attacks/BAAT.py:471
↓ 1 callersFunctionGetPoisonedVggFace2Dataset
( benign_dataset: DatasetFolder, target_label: Union[str, int], poisoned_rate: float, transfor
core/attacks/BAAT.py:449
↓ 1 callersFunctionRandomPad
(sum_w, sum_h, fill=0)
core/defenses/ShrinkPad.py:19
↓ 1 callersMethod__call__
(self, *input, **kwargs)
core/utils/torchattacks/attack.py:195
↓ 1 callersMethod__init__
(self, p)
core/defenses/NAD.py:37
↓ 1 callersMethod__init__
(self, train_dataset=None, test_dataset=None, model=None,
core/defenses/Pruning.py:44
↓ 1 callersMethod__init__
(self, model, loss, poisoned_trainset,
core/defenses/ABL.py:117
↓ 1 callersMethod__init__
(self, model, xi=0.02, seed=666, deterministic=False)
core/defenses/FLARE.py:73
↓ 1 callersMethod__init__
(self)
core/models/autoencoder.py:11
↓ 1 callersFunction_check_bn
(module, flag)
core/defenses/MCR.py:34
↓ 1 callersMethod_check_input_dim
(self, input)
core/models/curves.py:214
↓ 1 callersMethod_compute_l2
(self)
core/models/curves.py:312
↓ 1 callersMethod_detect
(self, inputs)
core/defenses/IBD_PSC.py:176
↓ 1 callersMethod_detect
(self, inputs)
core/defenses/SCALE_UP.py:140
↓ 1 callersMethod_get_adv_dataset
(self, dataset, adv_model, adv_dataset_dir, adv_transform, eps, alpha, steps, y_target, poisoned_rate)
core/attacks/LabelConsistent.py:543
↓ 1 callersMethod_get_attribute_identifier
Return a sanitized, file-safe string identifier for the given attribute.
core/attacks/BAAT.py:129
↓ 1 callersMethod_get_attribute_identifier
(self, attribute_description: Union[str, Path])
core/attacks/BAAT.py:379
↓ 1 callersMethod_get_denormalize
(self, dataset_name)
core/attacks/IAD.py:205
↓ 1 callersFunction_get_momenta
(module, momenta)
core/defenses/MCR.py:47
↓ 1 callersMethod_get_normalize
(self, dataset_name)
core/attacks/IAD.py:216
↓ 1 callersMethod_initialize_weights
(self)
core/models/vgg.py:21
↓ 1 callersMethod_load_checkpoint
Load all necessary model checkpoints from the checkpoint directory.
core/attacks/BAAT.py:101
↓ 1 callersMethod_make_layers
(self, cfg)
core/attacks/LIRA.py:82
↓ 1 callersMethod_make_layers
(self, cfg)
tests/test_LIRA.py:50
↓ 1 callersMethod_next_point
(cur_val, grad, n)
core/attacks/Blind.py:258
↓ 1 callersFunction_ntuple
Copy from PyTorch since internal function is not importable See ``nn/modules/utils.py:6`` Args: n (int): Number of repetitions x.
core/attacks/ISSBA.py:69
↓ 1 callersMethod_predict
(self, model, data, device, batch_size, num_workers)
core/defenses/AutoEncoderDefense.py:192
↓ 1 callersMethod_predict
(self, data, device, batch_size)
core/defenses/REFINE.py:278
↓ 1 callersMethod_predict
(self, model, data, device, batch_size, num_workers)
core/defenses/ShrinkPad.py:86
↓ 1 callersMethod_prepare_attribute_latents
Pre-process the attribute description (e.g., text or image) into a latent representation. This is pre-computed for efficiency when pr
core/attacks/BAAT.py:106
↓ 1 callersMethod_prepare_attribute_latents
(self, attribute_description: Dict[str, str])
core/attacks/BAAT.py:267
↓ 1 callersMethod_prepare_attribute_latents
(self, attribute_description: Union[str, Path])
core/attacks/BAAT.py:367
↓ 1 callersMethod_projection2simplex
Given y, it solves argmin_z |y-z|_2 st \sum z = 1 , 1 >= z_i >= 0 for all i
core/attacks/Blind.py:241
↓ 1 callersFunction_set_momenta
(module, momenta)
core/defenses/MCR.py:51
↓ 1 callersMethod_set_seed
(self, seed, deterministic)
core/defenses/base.py:22
↓ 1 callersMethod_set_seed
(self, seed, deterministic)
core/attacks/base.py:72
↓ 1 callersFunction_test
(model, dataset, device, batch_size=16, num_workers=8)
core/utils/test.py:22
↓ 1 callersMethod_test
(self, dataset, device, batch_size=16, num_workers=8, loss_func=torch.nn.BCELoss(reduction='none'))
core/defenses/AutoEncoderDefense.py:53
↓ 1 callersMethod_test
(self, model, dataset, device, batch_size=16, num_workers=8)
core/defenses/ABL.py:282
↓ 1 callersMethod_test
(self, dataset, device, batch_size=16, num_workers=8, loss_func=torch.nn.BCELoss(reduction='none'), supconloss
core/defenses/REFINE.py:98
↓ 1 callersMethod_test
(self, model, dataset, coeffs_t, device, batch_size=16, num_workers=8)
core/defenses/MCR.py:280
↓ 1 callersMethod_test
(self, dataset, device, batch_size=16, num_workers=8, model=None, atkmodel=None)
core/attacks/LIRA.py:916
↓ 1 callersMethod_to_uint
r""" Function for changing the return type. Return images as int.
core/utils/torchattacks/attack.py:154
↓ 1 callersMethod_train
(self, dataset, portion, schedule)
core/defenses/NAD.py:107
↓ 1 callersMethod_train
(self, trainset, schedule)
core/defenses/CutMix.py:83
↓ 1 callersMethod_train
(self, dataset, portion, schedule=None, settings=None)
core/defenses/MCR.py:151
↓ 1 callersMethod_transform_label
r""" Function for changing the attack mode.
core/utils/torchattacks/attack.py:131
↓ 1 callersFunctionaccuracy
Computes the precision@k for the specified values of k
core/defenses/REFINE.py:426
↓ 1 callersFunctionadjust_learning_rate
(lr, optimizer, epoch)
core/defenses/FineTuning.py:28
↓ 1 callersMethodadjust_learning_rate
(self, optimizer, epoch)
core/defenses/NAD.py:101
↓ 1 callersMethodadjust_learning_rate
(self, optimizer, epoch)
core/defenses/CutMix.py:59
↓ 1 callersMethodadjust_learning_rate
(self, optimizer, epoch)
core/defenses/MCR.py:145
↓ 1 callersMethodadjust_learning_rate
(self, optimizer, epoch)
core/attacks/ISSBA.py:649
↓ 1 callersMethodadjust_tune_learning_rate
(self, optimizer, epoch)
core/defenses/NAD.py:95
↓ 1 callersFunctionbatched_step
Take a step toward minmizing the current target loss.
core/attacks/SleeperAgent.py:204
↓ 1 callersMethodbuild_grid
https://discuss.pytorch.org/t/cropping-a-minibatch-of-images-each-image-a-bit-differently/12247/5.
core/attacks/SleeperAgent.py:62
↓ 1 callersMethodcal_like
(self, copym, imgs, wo_layer_num=1)
core/defenses/FLARE.py:94
↓ 1 callersMethodcalculate_likelihood
(self, activations, bn_mean, bn_var, epsilon=1e-5)
core/defenses/FLARE.py:26
↓ 1 callersFunctioncheck_bn
(model)
core/defenses/MCR.py:38
↓ 1 callersMethodclear_grad
Clear the gradient of model parameters.
core/attacks/LIRA.py:397
↓ 1 callersFunctionclosure
This function will be evaluated on all GPUs.
core/attacks/SleeperAgent.py:191
↓ 1 callersFunctioncompute_backdoor_loss
(model, criterion, inputs_back, labels_back, grads=None)
core/attacks/Blind.py:128
↓ 1 callersMethodcompute_blind_loss
(self, x, y, attack=True)
core/attacks/Blind.py:756
↓ 1 callersFunctioncompute_confusion_matrix
(precited,expected)
core/utils/compute_metric.py:5
↓ 1 callersFunctioncompute_indexes
(tp, fp, tn, fn)
core/utils/compute_metric.py:19
↓ 1 callersFunctioncompute_nc_evasion_loss
(nc_model, model, inputs, labels, grads=None)
core/attacks/Blind.py:117
↓ 1 callersMethodcount_BN_layers
(self)
core/defenses/IBD_PSC.py:60
↓ 1 callersMethodcraft_poison_dataset
craft poison dataset
core/attacks/SleeperAgent.py:365
↓ 1 callersMethodcreate_net
Return the victim model architecture.
core/attacks/LIRA.py:406
↓ 1 callersMethoddeepfool_target
:param image: Image of size CxHxW :param num_classes: number of classes (limits the number of classes to test against, by defau
core/attacks/TUAP.py:538
↓ 1 callersFunctiondefine_objective
Implement the closure here.
core/attacks/SleeperAgent.py:189
↓ 1 callersMethoddenormalize_pattern
(self, x)
core/attacks/IAD.py:238
← previousnext →101–200 of 664, ranked by callers