diff --git a/mindarmour/fuzzing/fuzzing.py b/mindarmour/fuzzing/fuzzing.py index 3b8bcfc612f2879a620c3a155177267f9bbee0ec..2acc08220409aedbaacaf2daf82e46bc097705ea 100644 --- a/mindarmour/fuzzing/fuzzing.py +++ b/mindarmour/fuzzing/fuzzing.py @@ -117,21 +117,21 @@ class Fuzzer: 'Noise'] self._attacks_list = ['FGSM', 'PGD', 'MDIIM'] self._attack_param_checklists = { - 'FGSM': {'params': {'eps': {'dtype': [float, int], 'range': [0, 1]}, - 'alpha': {'dtype': [float, int], + 'FGSM': {'params': {'eps': {'dtype': [float], 'range': [0, 1]}, + 'alpha': {'dtype': [float], 'range': [0, 1]}, - 'bounds': {'dtype': [list, tuple]}}}, - 'PGD': {'params': {'eps': {'dtype': [float, int], 'range': [0, 1]}, - 'eps_iter': {'dtype': [float, int], - 'range': [0, 1e5]}, - 'nb_iter': {'dtype': [float, int], + 'bounds': {'dtype': [tuple]}}}, + 'PGD': {'params': {'eps': {'dtype': [float], 'range': [0, 1]}, + 'eps_iter': {'dtype': [float], + 'range': [0, 1]}, + 'nb_iter': {'dtype': [int], 'range': [0, 1e5]}, - 'bounds': {'dtype': [list, tuple]}}}, + 'bounds': {'dtype': [tuple]}}}, 'MDIIM': { - 'params': {'eps': {'dtype': [float, int], 'range': [0, 1]}, + 'params': {'eps': {'dtype': [float], 'range': [0, 1]}, 'norm_level': {'dtype': [str]}, - 'prob': {'dtype': [float, int], 'range': [0, 1]}, - 'bounds': {'dtype': [list, tuple]}}}} + 'prob': {'dtype': [float], 'range': [0, 1]}, + 'bounds': {'dtype': [tuple]}}}} def fuzzing(self, mutate_config, initial_seeds, coverage_metric='KMNC', eval_metrics='auto', max_iters=10000, mutate_num_per_seed=20): diff --git a/mindarmour/fuzzing/image_transform.py b/mindarmour/fuzzing/image_transform.py index 77ff6d01c0faa95a3046ae540bbf621e5dbdff85..0ba0f1fb50b9f4a8dcb052287a0d41c9eb3d136f 100644 --- a/mindarmour/fuzzing/image_transform.py +++ b/mindarmour/fuzzing/image_transform.py @@ -350,8 +350,10 @@ class Translate(ImageTransform): Translate an image. Args: - x_bias ([int, float): X-direction translation, x=x+x_bias. Default: 0. - y_bias ([int, float): Y-direction translation, y=y+y_bias. Default: 0. + x_bias ([int, float): X-direction translation, x=x+x_bias*image_length. + Default: 0. + y_bias ([int, float): Y-direction translation, y=y+y_bias*image_wide. + Default: 0. """ def __init__(self, x_bias=0, y_bias=0): @@ -363,8 +365,10 @@ class Translate(ImageTransform): Set translate parameters. Args: - x_bias ([float, int]): X-direction translation, x=x+x_bias. Default: 0. - y_bias ([float, int]): Y-direction translation, y=y+y_bias. Default: 0. + x_bias ([float, int]): X-direction translation, x=x+x_bias*image_length. + Default: 0. + y_bias ([float, int]): Y-direction translation, y=y+y_bias*image_wide. + Default: 0. auto_param (bool): True if auto generate parameters. Default: False. """ self.auto_param = auto_param