Browse Source

!172 Fix an issue of ImageInversionAttack.

From: @jxlang910
Reviewed-by: @liu_luobin,@pkuliuliu
Signed-off-by: @pkuliuliu
tags/v1.2.0-rc1
mindspore-ci-bot Gitee 4 years ago
parent
commit
1d73d5766d
2 changed files with 8 additions and 1 deletions
  1. +2
    -1
      mindarmour/privacy/evaluation/__init__.py
  2. +6
    -0
      mindarmour/privacy/evaluation/inversion_attack.py

+ 2
- 1
mindarmour/privacy/evaluation/__init__.py View File

@@ -17,5 +17,6 @@ given model.
"""

from .membership_inference import MembershipInference
from .inversion_attack import ImageInversionAttack

__all__ = ['MembershipInference']
__all__ = ['MembershipInference', 'ImageInversionAttack']

+ 6
- 0
mindarmour/privacy/evaluation/inversion_attack.py View File

@@ -111,6 +111,12 @@ class ImageInversionAttack:
for shape_dim in input_shape:
check_int_positive('shape_dim', shape_dim)
self._input_bound = check_param_multi_types('input_bound', input_bound, [list, tuple])
for value_bound in self._input_bound:
check_param_multi_types('value_bound', value_bound, [float, int])
if self._input_bound[0] > self._input_bound[1]:
msg = 'input_bound[0] should not be larger than input_bound[1], but got them as {} and {}'.format(
self._input_bound[0], self._input_bound[1])
raise ValueError(msg)

def generate(self, target_features, iters=100):
"""


Loading…
Cancel
Save