secmlt.adv.evasion.foolbox_attacks package#

Submodules#

secmlt.adv.evasion.foolbox_attacks.foolbox_base module#

Generic wrapper for Foolbox evasion attacks.

class secmlt.adv.evasion.foolbox_attacks.foolbox_base.BaseFoolboxEvasionAttack(foolbox_attack: type[Attack], epsilon: float = inf, y_target: int | None = None, lb: float = 0.0, ub: float = 1.0, trackers: Tracker | list[Tracker] | None = None)[source]#

Bases: BaseEvasionAttack

Generic wrapper for Foolbox Evasion attacks.

secmlt.adv.evasion.foolbox_attacks.foolbox_ddn module#

Wrapper of the DDN attack implemented in Foolbox.

class secmlt.adv.evasion.foolbox_attacks.foolbox_ddn.DDNFoolbox(num_steps: int, eps_init: float, gamma: float, y_target: int | None = None, lb: float = 0.0, ub: float = 1.0, **kwargs)[source]#

Bases: BaseFoolboxEvasionAttack

Wrapper of the Foolbox implementation of the DDN attack.

Parameters:
  • num_steps (int) – The number of iterations for the attack.

  • eps_init (float) – The initial L2 norm of the perturbation. Default is 8/255. The default value is None.

  • gamma (float, optional) – Step size for modifying the eps-ball. Will decay with cosine annealing.

  • y_target (int | None, optional) – The target label for the attack. If None, the attack is untargeted. The default value is None.

  • lb (float, optional) – The lower bound for the perturbation. The default value is 0.0.

  • ub (float, optional) – The upper bound for the perturbation. The default value is 1.0.

static get_perturbation_models() set[str][source]#

Check the perturbation models implemented for this attack.

secmlt.adv.evasion.foolbox_attacks.foolbox_fmn module#

Wrapper of the FMN attack implemented in Foolbox.

class secmlt.adv.evasion.foolbox_attacks.foolbox_fmn.FMNFoolbox(perturbation_model: str, num_steps: int, max_step_size: float, min_step_size: float | None = None, gamma: float = 0.05, y_target: int | None = None, lb: float = 0.0, ub: float = 1.0, **kwargs)[source]#

Bases: BaseFoolboxEvasionAttack

Wrapper of the Foolbox implementation of the FMN attack.

static get_perturbation_models() set[str][source]#

Check the perturbation models implemented for this attack.

Returns:

The list of perturbation models implemented for this attack.

Return type:

set[str]

secmlt.adv.evasion.foolbox_attacks.foolbox_pgd module#

Wrapper of the PGD attack implemented in Foolbox.

class secmlt.adv.evasion.foolbox_attacks.foolbox_pgd.PGDFoolbox(perturbation_model: str, epsilon: float, num_steps: int, step_size: float, random_start: bool, y_target: int | None = None, lb: float = 0.0, ub: float = 1.0, **kwargs)[source]#

Bases: BaseFoolboxEvasionAttack

Wrapper of the Foolbox implementation of the PGD attack.

static get_perturbation_models() set[str][source]#

Check the perturbation models implemented for this attack.

Returns:

The list of perturbation models implemented for this attack.

Return type:

set[str]

Module contents#

Wrappers of Foolbox library for evasion attacks.