Browse Source

Fix several issues of python-api

tags/v1.2.1
jin-xiulang 4 years ago
parent
commit
4b41a52a3a
2 changed files with 6 additions and 6 deletions
  1. +5
    -5
      mindarmour/adv_robustness/evaluations/attack_evaluation.py
  2. +1
    -1
      mindarmour/adv_robustness/evaluations/defense_evaluation.py

+ 5
- 5
mindarmour/adv_robustness/evaluations/attack_evaluation.py View File

@@ -136,10 +136,10 @@ class AttackEvaluate:
- float, return average l0, l2, or linf distance of all success
adversarial examples, return value includes following cases.

- If return value :math:`>=` 0, average lp distance. The lower,
- If return value :math:`>=` 0, average lp distance. The lower,
the more successful the attack is.

- If return value is -1, there is no success adversarial examples.
- If return value is -1, there is no success adversarial examples.
"""
idxes = self._success_idxes
success_num = idxes.shape[0]
@@ -164,10 +164,10 @@ class AttackEvaluate:
Returns:
- float, average structural similarity.

- If return value ranges between (0, 1), the higher, the more
successful the attack is.
- If return value ranges between (0, 1), the higher, the more
successful the attack is.

- If return value is -1: there is no success adversarial examples.
- If return value is -1: there is no success adversarial examples.
"""
success_num = self._success_idxes.shape[0]
if success_num == 0:


+ 1
- 1
mindarmour/adv_robustness/evaluations/defense_evaluation.py View File

@@ -106,7 +106,7 @@ class DefenseEvaluate:
Returns:
- float, the lower, the more successful the defense is.

- If return value == -1, len(idxes) == 0.
- If return value == -1, len(idxes) == 0.
"""
idxes = np.arange(self._num_samples)
cond1 = np.argmax(self._def_preds, axis=1) == self._true_labels


Loading…
Cancel
Save