advsecurenet.shared.types.configs.attack_configs package
advsecurenet.shared.types.configs.attack_configs.attack_config module
- class advsecurenet.shared.types.configs.attack_configs.attack_config.AttackConfig(*, device: ~advsecurenet.shared.types.configs.device_config.DeviceConfig = <factory>, targeted: bool = False)
Bases:
object
This dataclass is used to store the base configuration of the attacks. It contains the device configuration and a flag to indicate if the attack is targeted or not.
- device: DeviceConfig
- targeted: bool = False
advsecurenet.shared.types.configs.attack_configs.attacker_config module
- class advsecurenet.shared.types.configs.attack_configs.attacker_config.AttackerConfig(model: ~torch.nn.modules.module.Module, attack: ~advsecurenet.attacks.base.adversarial_attack.AdversarialAttack, dataloader: ~torch.utils.data.dataloader.DataLoader | ~advsecurenet.shared.types.configs.dataloader_config.DataLoaderConfig, device: ~advsecurenet.shared.types.configs.device_config.DeviceConfig, return_adversarial_images: bool | None = False, evaluators: list[str] | None = <factory>)
Bases:
object
Configuration class for the Attacker module.
- attack: AdversarialAttack
- dataloader: DataLoader | DataLoaderConfig
- device: DeviceConfig
- model: Module
advsecurenet.shared.types.configs.attack_configs.cw_attack_config module
- class advsecurenet.shared.types.configs.attack_configs.cw_attack_config.CWAttackConfig(*, device: ~advsecurenet.shared.types.configs.device_config.DeviceConfig = <factory>, targeted: bool = False, c_init: float = 0.1, kappa: float = 0, learning_rate: float = 0.01, max_iterations: int = 10, abort_early: bool = False, binary_search_steps: int = 10, clip_min: float = 0, clip_max: float = 1, c_lower: float = 1e-06, c_upper: float = 1, patience: int = 5)
Bases:
AttackConfig
Carlini-Wagner attack configuration.
- abort_early: bool = False
- binary_search_steps: int = 10
- c_init: float = 0.1
- c_lower: float = 1e-06
- c_upper: float = 1
- clip_max: float = 1
- clip_min: float = 0
- kappa: float = 0
- learning_rate: float = 0.01
- max_iterations: int = 10
- patience: int = 5
advsecurenet.shared.types.configs.attack_configs.decision_boundary_attack_config module
- class advsecurenet.shared.types.configs.attack_configs.decision_boundary_attack_config.DecisionBoundaryAttackConfig(*, device: advsecurenet.shared.types.configs.device_config.DeviceConfig = <factory>, targeted: bool = False, initial_delta: float = 0.1, initial_epsilon: float = 0.1, max_delta_trials: int = 20, max_epsilon_trials: int = 20, max_iterations: int = 1000, max_initialization_trials: int = 100, step_adapt: float = 0.9, verbose: bool = False, early_stopping: bool = True, early_stopping_threshold: float = 0.0001, early_stopping_patience: int = 10)
Bases:
AttackConfig
- early_stopping: bool = True
- early_stopping_patience: int = 10
- early_stopping_threshold: float = 0.0001
- initial_delta: float = 0.1
- initial_epsilon: float = 0.1
- max_delta_trials: int = 20
- max_epsilon_trials: int = 20
- max_initialization_trials: int = 100
- max_iterations: int = 1000
- step_adapt: float = 0.9
- targeted: bool = False
- verbose: bool = False
advsecurenet.shared.types.configs.attack_configs.deepfool_attack_config module
- class advsecurenet.shared.types.configs.attack_configs.deepfool_attack_config.DeepFoolAttackConfig(*, device: ~advsecurenet.shared.types.configs.device_config.DeviceConfig = <factory>, targeted: bool = False, num_classes: int = 10, overshoot: float = 0.02, max_iterations: int = 50)
Bases:
AttackConfig
DeepFool attack configuration.
- max_iterations: int = 50
- num_classes: int = 10
- overshoot: float = 0.02
advsecurenet.shared.types.configs.attack_configs.fgsm_attack_config module
- class advsecurenet.shared.types.configs.attack_configs.fgsm_attack_config.FgsmAttackConfig(*, device: ~advsecurenet.shared.types.configs.device_config.DeviceConfig = <factory>, targeted: bool = False, epsilon: float = 0.3)
Bases:
AttackConfig
FGSM attack configuration.
- epsilon: float = 0.3
advsecurenet.shared.types.configs.attack_configs.lots_attack_config module
- class advsecurenet.shared.types.configs.attack_configs.lots_attack_config.LotsAttackConfig(*, device: ~advsecurenet.shared.types.configs.device_config.DeviceConfig = <factory>, targeted: bool = False, deep_feature_layer: str, mode: ~advsecurenet.shared.types.configs.attack_configs.lots_attack_config.LotsAttackMode = LotsAttackMode.SINGLE, epsilon: float = 0.1, learning_rate: float = 0.00392156862745098, max_iterations: int = 1000, verbose: bool = True)
Bases:
AttackConfig
Configuration class for LotsAttack.
- deep_feature_layer
The deep feature layer to be used.
- Type:
str
- mode
The mode of the LotsAttack. Defaults to LotsAttackMode.SINGLE.
- Type:
- epsilon
The epsilon value for the attack. Defaults to 0.1.
- Type:
float
- learning_rate
The learning rate for the attack. Defaults to 1./255.
- Type:
float
- max_iterations
The maximum number of iterations for the attack. Defaults to 1000.
- Type:
int
- verbose
Whether to print verbose output during the attack. Defaults to True.
- Type:
bool
- device
The device to be used for the attack.
- Type:
torch.device
- deep_feature_layer: str
- epsilon: float = 0.1
- learning_rate: float = 0.00392156862745098
- max_iterations: int = 1000
- mode: LotsAttackMode = 'single'
- verbose: bool = True
- class advsecurenet.shared.types.configs.attack_configs.lots_attack_config.LotsAttackMode(value)
Bases:
Enum
- Enum class for the mode of the LotsAttack. Possible values are:
ITERATIVE: Iterative mode. Runs the attack for the specified number of iterations.
SINGLE: Single mode. Runs the attack for a single iteration.
- ITERATIVE = 'iterative'
- SINGLE = 'single'
advsecurenet.shared.types.configs.attack_configs.pgd_attack_config module
- class advsecurenet.shared.types.configs.attack_configs.pgd_attack_config.PgdAttackConfig(*, device: ~advsecurenet.shared.types.configs.device_config.DeviceConfig = <factory>, targeted: bool = False, epsilon: float = 0.3, alpha: float = 0.00784313725490196, num_iter: int = 40)
Bases:
AttackConfig
PGD attack configuration.
- alpha: float = 0.00784313725490196
- epsilon: float = 0.3
- num_iter: int = 40