MCPcopy Create free account

hub / github.com/THUYimingLi/BackdoorBox / functions

Functions664 in github.com/THUYimingLi/BackdoorBox

↓ 1 callersMethodedit_image
Edit a single image based on the provided attribute description and save it. If `attribute_description` is None, the pre-computed lat
core/attacks/BAAT.py:114
↓ 1 callersMethodeval_mask
Test the backdoor trigger mask generator. Args: modelM (torch.nn.Module): Backdoor trigger mask generator. te
core/attacks/IAD.py:829
↓ 1 callersFunctionextend_source
Extend source_set to #source_num samples, allowing more samples to poison
core/attacks/SleeperAgent.py:239
↓ 1 callersMethodfilter
filter out poisoned samples from poisoned dataset. Args: schedule (dict): schedule for spliting the dataset.
core/defenses/Spectral.py:73
↓ 1 callersMethodfind_min_norm_element
Given a list of vectors (vecs), this method finds the minimum norm element in the convex hull as min |u|_2 st. u = \sum c_i vecs[i]
core/attacks/Blind.py:275
↓ 1 callersMethodfinetune_model
Test the victim model using the backdoor trigger generator in training process. Args: atkmodel (torch.nn.Module): Backdoo
core/attacks/LIRA.py:759
↓ 1 callersMethodforward
r""" It defines the computation performed at every call. Should be overridden by all subclasses.
core/utils/torchattacks/attack.py:32
↓ 1 callersMethodfrozen
Frozen the layers which don't need to fine tuning.
core/defenses/FineTuning.py:71
↓ 1 callersFunctiongen_grid
Generate an identity grid with shape 1*height*height*2 and a noise grid with shape 1*height*height*2 according to the input height ``height`` and
tests/test_FineTuning.py:29
↓ 1 callersFunctiongen_grid
Generate an identity grid with shape 1*height*height*2 and a noise grid with shape 1*height*height*2 according to the input height ``height`` and
tests/test_Pruning.py:30
↓ 1 callersFunctiongen_grid
Generate an identity grid with shape 1*height*height*2 and a noise grid with shape 1*height*height*2 according to the input height ``height`` and
tests/test_Spectral.py:37
↓ 1 callersFunctiongen_grid
Generate an identity grid with shape 1*height*height*2 and a noise grid with shape 1*height*height*2 according to the input height ``height`` and
tests/test_ABL.py:146
↓ 1 callersMethodgen_poisoned_index
(self)
core/attacks/TUAP.py:259
↓ 1 callersMethodgen_poisoned_index
(self)
core/attacks/TUAP.py:346
↓ 1 callersMethodgen_poisoned_index
(self)
core/attacks/TUAP.py:432
↓ 1 callersMethodget_img
Get the encoded images with the trigger pattern. Args: path (str): The path of the saved image steganography encoder.
core/attacks/ISSBA.py:1099
↓ 1 callersMethodget_likehood
(self, wo_layer_num)
core/defenses/FLARE.py:134
↓ 1 callersMethodget_model
(self)
core/defenses/Pruning.py:146
↓ 1 callersMethodget_model
(self)
core/defenses/FineTuning.py:184
↓ 1 callersMethodget_modelG
Return the backdoor trigger pattern generator.
core/attacks/IAD.py:931
↓ 1 callersMethodget_modelM
Return the backdoor trigger mask generator.
core/attacks/IAD.py:924
↓ 1 callersFunctionget_passenger_loss
Compute the blind passenger loss term.
core/attacks/SleeperAgent.py:175
↓ 1 callersMethodget_scales
(cls, grads, losses, normalization_type, tasks)
core/attacks/Blind.py:376
↓ 1 callersMethodget_top_k
(self, k)
tests/test_BAAT.py:164
↓ 1 callersFunctiongradient_normalizers
(grads, losses, normalization_type)
core/attacks/Blind.py:388
↓ 1 callersMethodimport_base_parameters
(self, base_model, index)
core/models/curves.py:280
↓ 1 callersMethodinit_label_shuffle
(self)
core/defenses/REFINE.py:68
↓ 1 callersMethodinit_linear
(self)
core/models/curves.py:297
↓ 1 callersMethodinit_spc_norm
(self, valset)
core/defenses/SCALE_UP.py:49
↓ 1 callersFunctioninitialize_poison_deltas
uniformly initialize perturbation that will add to selected target image
core/attacks/SleeperAgent.py:142
↓ 1 callersFunctionis_pil_image
(img)
core/attacks/TUAP.py:50
↓ 1 callersMethodlabel_shuffle
(self, label)
core/defenses/REFINE.py:80
↓ 1 callersFunctionload_dict
(model_path)
tests/test_FLARE.py:98
↓ 1 callersFunctionload_dict
(model_path)
tests/test_SCALE_UP.py:118
↓ 1 callersFunctionload_dict
(model_path)
tests/test_IBD-PSC.py:119
↓ 1 callersMethodneural_cleanse_part1
(self, batch, batch_back)
core/attacks/Blind.py:805
↓ 1 callersFunctionnorm_loss
(mask_p_norm, model, grads=None)
core/attacks/Blind.py:153
↓ 1 callersFunctionprepare_poisonset
Add poison_deltas to poisoned_samples
core/attacks/SleeperAgent.py:224
↓ 1 callersMethodpreprocess
Perform AutoEncoder defense method on data and return the preprocessed data. Args: data (torch.Tensor): Input data (between 0.0 a
core/defenses/AutoEncoderDefense.py:175
↓ 1 callersMethodpreprocess
Perform ShrinkPad defense method on data and return the preprocessed data. Args: data (torch.Tensor): Input data. siz
core/defenses/ShrinkPad.py:62
↓ 1 callersMethodprob_start
(self, scale, sorted_indices, valset)
core/defenses/IBD_PSC.py:89
↓ 1 callersMethodprocess_directory
Processes a directory of images, applying the attribute edit to a subset of them. This is the "Template Method" that uses the abstrac
core/attacks/BAAT.py:140
↓ 1 callersMethodproj_lp
Project on the lp ball centered at 0 and of radius epsilon, SUPPORTS only p = 2 and p = Inf for now :param perturbation: Pert
core/attacks/TUAP.py:606
↓ 1 callersMethodrand_bbox
(self, size, lam)
core/defenses/CutMix.py:65
↓ 1 callersMethodrandom_crop_grid
https://discuss.pytorch.org/t/cropping-a-minibatch-of-images-each-image-a-bit-differently/12247/5.
core/attacks/SleeperAgent.py:69
↓ 1 callersFunctionread_image
(img_path, type=None)
tests/test_refool.py:29
↓ 1 callersMethodrepair
pruning. Args: schedule (dict): Schedule for testing.
core/defenses/Pruning.py:63
↓ 1 callersMethodrepair
Finetuning. Args: schedule (dict): Schedule for testing.
core/defenses/FineTuning.py:82
↓ 1 callersFunctionreplace_bn_with_ent
(model)
core/defenses/FLARE.py:46
↓ 1 callersMethodreset_parameters
(self)
core/models/curves.py:144
↓ 1 callersMethodreset_parameters
(self)
core/models/curves.py:207
↓ 1 callersMethodscale_losses
(self, loss_tasks, loss_values, scale)
core/attacks/Blind.py:799
↓ 1 callersFunctionselect_poison_ids
select samples from target class with large gradients
core/attacks/SleeperAgent.py:114
↓ 1 callersMethodset_return_type
r""" Set the return type of adversarial images: `int` or `float`. Arguments: type (str) : 'float' or 'int'. (DEFAULT : 'fl
core/utils/torchattacks/attack.py:71
↓ 1 callersMethodsplit_dataset
Split dataset into poisoned part and clean part. The ratio of poisoned part is controlled by split_ratio. Args: dataset (
core/defenses/ABL.py:227
↓ 1 callersFunctiontest
(model_name, dataset_name, attack_name, defense_name, benign_dataset, attacked_dataset, defense, y_target)
tests/test_FLARE.py:42
↓ 1 callersFunctionthp
(vector)
core/attacks/Blind.py:28
↓ 1 callersMethodtrain
(self, schedule=None)
core/attacks/Blind.py:501
↓ 1 callersMethodtrain
first pretrain/load a mdoel, then use to craft poisoned dataset under the priciple of gradient alignment, then used the poisoned dataset to train a ne
core/attacks/SleeperAgent.py:478
↓ 1 callersMethodtrain_autoencoder
(self, train_dataset, test_dataset, schedule)
core/defenses/AutoEncoderDefense.py:79
↓ 1 callersMethodtrain_mask_step
Train the backdoor trigger mask generator. Args: modelM (torch.nn.Module): Backdoor trigger mask generator. o
core/attacks/IAD.py:775
↓ 1 callersMethodtrain_step
Train the victim model and the backdoor trigger generator jointly. Args: atkmodel (torch.nn.Module): Backdoor trigger gen
core/attacks/LIRA.py:612
↓ 1 callersMethodtrain_step
Train the victim model and the backdoor trigger pattern generator jointly. Args: model (torch.nn.Module): Victim model.
core/attacks/IAD.py:547
↓ 1 callersMethodtrain_unet
(self, train_dataset, test_dataset, schedule)
core/defenses/REFINE.py:141
↓ 1 callersMethoduniversal_perturbation
:param delta: controls the desired fooling rate (default = 80% fooling rate) :param max_iter_uni: optional other termination criterio
core/attacks/TUAP.py:623
↓ 1 callersFunctionupdate_bn
(loader, model, device, **kwargs)
core/defenses/MCR.py:55
FunctionResNet
(num, num_classes=10)
core/models/resnet.py:98
Method__call__
(self, msg)
core/utils/log.py:5
Method__call__
Get the poisoned image. Args: img (PIL.Image.Image | numpy.ndarray | torch.Tensor): If img is numpy.ndarray or torch.Tensor, the
core/attacks/LabelConsistent.py:75
Method__call__
(self, img)
core/attacks/LabelConsistent.py:163
Method__call__
(self, img)
core/attacks/LabelConsistent.py:202
Method__call__
(self, y_target)
core/attacks/LabelConsistent.py:213
Method__call__
(self, y_target)
core/attacks/Refool.py:30
Method__call__
(self, y_target)
core/attacks/BATT.py:24
Method__call__
Get the poisoned image. Args: img (PIL.Image.Image | numpy.ndarray | torch.Tensor): If img is numpy.ndarray or torch.Tensor, the
core/attacks/BadNets.py:65
Method__call__
(self, img)
core/attacks/BadNets.py:153
Method__call__
(self, img)
core/attacks/BadNets.py:192
Method__call__
(self, y_target)
core/attacks/BadNets.py:203
Method__call__
(self, y_target)
core/attacks/BAAT.py:77
Method__call__
Get the poisoned image. Args: img (PIL.Image.Image | numpy.ndarray | torch.Tensor): If img is numpy.ndarray or torch.Tensor, the
core/attacks/TUAP.py:101
Method__call__
(self, img)
core/attacks/TUAP.py:172
Method__call__
(self, img)
core/attacks/TUAP.py:195
Method__call__
(self, y_target)
core/attacks/TUAP.py:206
Method__call__
(self, x)
core/attacks/ISSBA.py:42
Method__call__
Get the poisoned image. Args: img (PIL.Image.Image | numpy.ndarray | torch.Tensor): If img is numpy.ndarray or torch.Tensor, the
core/attacks/WaNet.py:77
Method__call__
(self, img)
core/attacks/WaNet.py:161
Method__call__
(self, img)
core/attacks/WaNet.py:199
Method__call__
(self, y_target)
core/attacks/WaNet.py:213
Method__call__
(self, targets)
core/attacks/LIRA.py:102
Method__call__
(self, targets)
core/attacks/IAD.py:34
Method__call__
(self, x)
core/attacks/IAD.py:75
Method__call__
(self, x)
core/attacks/IAD.py:99
Method__call__
Get the poisoned image. Args: img (PIL.Image.Image | numpy.ndarray | torch.Tensor): If img is numpy.ndarray or torch.Tensor, the
core/attacks/AdaptivePatch.py:65
Method__call__
(self, img)
core/attacks/AdaptivePatch.py:153
Method__call__
(self, img)
core/attacks/AdaptivePatch.py:192
Method__call__
(self, y_target)
core/attacks/AdaptivePatch.py:203
Method__call__
Get the poisoned image. Args: img (PIL.Image.Image | numpy.ndarray | torch.Tensor): If img is numpy.ndarray or torch.Tensor, the
core/attacks/Blended.py:64
Method__call__
(self, img)
core/attacks/Blended.py:152
Method__call__
(self, img)
core/attacks/Blended.py:191
Method__call__
(self, y_target)
core/attacks/Blended.py:202
← previousnext →201–300 of 664, ranked by callers