mirror of
https://gitee.com/mindspore/mindarmour.git
synced 2025-12-06 11:59:05 +08:00
@@ -571,7 +571,7 @@ mindarmour.adv_robustness.attacks
|
||||
- **targeted** (bool) - 如果为 ``True``,则为目标攻击。如果为 ``False``,则为无目标攻击。 `model_type` 为 ``'detection'`` 时仅支持无目标攻击,默认值:``False``。
|
||||
- **sparse** (bool) - 如果为 ``True``,则输入标签为稀疏编码。如果为 ``False``,则输入标签为one-hot编码。默认值:``True``。
|
||||
- **model_type** (str) - 目标模型的类型。现在支持 ``'classification'`` 和 ``'detection'``。默认值: ``'classification'``。
|
||||
- **reserve_ratio** (Union[int, float]) - 攻击后可检测到的对象百分比,用于 `model_type`为 ``'detection'`` 模式的情况。保留比率应在(0, 1)的范围内。默认值:``0.3``。
|
||||
- **reserve_ratio** (Union[int, float]) - 攻击后可检测到的对象百分比,用于 `model_type` 为 ``'detection'`` 模式的情况。保留比率应在(0, 1)的范围内。默认值:``0.3``。
|
||||
|
||||
.. py:method:: generate(inputs, labels)
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ mindarmour.privacy.sup_privacy
|
||||
- **batch_num** (int) - 一个epoch中批次的数量,应等于num_samples/batch_size。默认值:``20``。
|
||||
- **start_epoch** (int) - 第一个抑制操作对应的epoch序号,0<start_epoch<=end_epoch<=100。默认值:``3``。
|
||||
- **mask_times** (int) - 抑制操作的数量。默认值:``1000``。
|
||||
- **lr** (Union[float, int]) - 学习率,在训练期间应保持不变。0<lr<=0.50. 默认值:0.05。此lr参数应与 `mindspore.nn.SGD() 的 `learning_rate` 参数相同。
|
||||
- **lr** (Union[float, int]) - 学习率,在训练期间应保持不变。0<lr<=0.50. 默认值:0.05。此lr参数应与 `mindspore.nn.SGD()` 的 `learning_rate` 参数相同。
|
||||
- **sparse_end** (float) - 要到达的稀疏性,0.0<=sparse_start<sparse_end<1.0。默认值:``0.90``。
|
||||
- **sparse_start** (Union[float, int]) - 抑制操作启动时对应的稀疏性,0.0<=sparse_start<sparse_end<1.0。默认值:``0.0``。
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ MindArmour的可靠性方法。
|
||||
|
||||
参数:
|
||||
- **model** (Model) - 需要评估模型。
|
||||
- **fi_type** (list) - 故障注入的类型,包括 ``'bitflips_random'``(随机翻转)、``'bitflips_designated'``(翻转关键位)、``'random'``、``'zeros'``、``'nan'``、``'inf'``、``'anti_activation'``、``'precision_loss'`` 等。
|
||||
- **fi_type** (list) - 故障注入的类型,包括 ``'bitflips_random'`` (随机翻转)、 ``'bitflips_designated'`` (翻转关键位)、 ``'random'``、 ``'zeros'``、 ``'nan'``、 ``'inf'``、 ``'anti_activation'``、 ``'precision_loss'`` 等。
|
||||
- **fi_mode** (list) - 故障注入的模式。可选值: ``'single_layer'``、 ``'all_layer'`` 。
|
||||
- **fi_size** (list) - 故障注入的次数,表示需要注入多少值。
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ class AdversarialDefenseWithAttacks(AdversarialDefense):
|
||||
bounds (tuple): Upper and lower bounds of data. In form of (clip_min,
|
||||
clip_max). Default: ``(0.0, 1.0)``.
|
||||
replace_ratio (float): Ratio of replacing original samples with
|
||||
adversarial, which must be between 0 and 1. Default: `` 0.5``.
|
||||
adversarial, which must be between 0 and 1. Default: ``0.5``.
|
||||
|
||||
Raises:
|
||||
ValueError: If replace_ratio is not between 0 and 1.
|
||||
|
||||
Reference in New Issue
Block a user