secmlt.adv.evasion.advlib_attacks package#

Submodules#

secmlt.adv.evasion.advlib_attacks.advlib_base module#

Generic wrapper for Adversarial Library evasion attacks.

class secmlt.adv.evasion.advlib_attacks.advlib_base.BaseAdvLibEvasionAttack(advlib_attack: Callable[..., torch.Tensor], epsilon: float = inf, y_target: int | None = None, lb: float = 0.0, ub: float = 1.0, trackers: Tracker | list[Tracker] | None = None, **kwargs)[source]#

Bases: BaseEvasionAttack

Generic wrapper for Adversarial Library Evasion attacks.

secmlt.adv.evasion.advlib_attacks.advlib_ddn module#

Wrapper of the DDN attack implemented in Adversarial Library.

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

Bases: BaseAdvLibEvasionAttack

Wrapper of the Adversarial Library implementation of the DDN attack.

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

  • eps_init (float, optional) – Initial L2 norm of the perturbation. The default value is 8/255.

  • 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]#

Return the perturbation models available for this attack.

secmlt.adv.evasion.advlib_attacks.advlib_fmn module#

Wrapper of the FMN attack implemented in Adversarial Library.

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

Bases: BaseAdvLibEvasionAttack

Wrapper of the Adversarial Library 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.advlib_attacks.advlib_pgd module#

Wrapper of the PGD attack implemented in Adversarial Library.

class secmlt.adv.evasion.advlib_attacks.advlib_pgd.PGDAdvLib(perturbation_model: str, epsilon: float, num_steps: int, random_start: bool, step_size: float, restarts: int = 1, loss_function: str = 'ce', y_target: int | None = None, lb: float = 0.0, ub: float = 1.0, **kwargs)[source]#

Bases: BaseAdvLibEvasionAttack

Wrapper of the Adversarial Library 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 Adversarial Library for evasion attacks.