提交 437e61c9 编写于 作者: Z ZhidanLiu

keep the type of parameters in fuzzing consistent with that in the called methods

上级 a30128b6
...@@ -117,21 +117,21 @@ class Fuzzer: ...@@ -117,21 +117,21 @@ class Fuzzer:
'Noise'] 'Noise']
self._attacks_list = ['FGSM', 'PGD', 'MDIIM'] self._attacks_list = ['FGSM', 'PGD', 'MDIIM']
self._attack_param_checklists = { self._attack_param_checklists = {
'FGSM': {'params': {'eps': {'dtype': [float, int], 'range': [0, 1]}, 'FGSM': {'params': {'eps': {'dtype': [float], 'range': [0, 1]},
'alpha': {'dtype': [float, int], 'alpha': {'dtype': [float],
'range': [0, 1]}, 'range': [0, 1]},
'bounds': {'dtype': [list, tuple]}}}, 'bounds': {'dtype': [tuple]}}},
'PGD': {'params': {'eps': {'dtype': [float, int], 'range': [0, 1]}, 'PGD': {'params': {'eps': {'dtype': [float], 'range': [0, 1]},
'eps_iter': {'dtype': [float, int], 'eps_iter': {'dtype': [float],
'range': [0, 1e5]}, 'range': [0, 1]},
'nb_iter': {'dtype': [float, int], 'nb_iter': {'dtype': [int],
'range': [0, 1e5]}, 'range': [0, 1e5]},
'bounds': {'dtype': [list, tuple]}}}, 'bounds': {'dtype': [tuple]}}},
'MDIIM': { 'MDIIM': {
'params': {'eps': {'dtype': [float, int], 'range': [0, 1]}, 'params': {'eps': {'dtype': [float], 'range': [0, 1]},
'norm_level': {'dtype': [str]}, 'norm_level': {'dtype': [str]},
'prob': {'dtype': [float, int], 'range': [0, 1]}, 'prob': {'dtype': [float], 'range': [0, 1]},
'bounds': {'dtype': [list, tuple]}}}} 'bounds': {'dtype': [tuple]}}}}
def fuzzing(self, mutate_config, initial_seeds, coverage_metric='KMNC', def fuzzing(self, mutate_config, initial_seeds, coverage_metric='KMNC',
eval_metrics='auto', max_iters=10000, mutate_num_per_seed=20): eval_metrics='auto', max_iters=10000, mutate_num_per_seed=20):
......
...@@ -350,8 +350,10 @@ class Translate(ImageTransform): ...@@ -350,8 +350,10 @@ class Translate(ImageTransform):
Translate an image. Translate an image.
Args: Args:
x_bias ([int, float): X-direction translation, x=x+x_bias. Default: 0. x_bias ([int, float): X-direction translation, x=x+x_bias*image_length.
y_bias ([int, float): Y-direction translation, y=y+y_bias. Default: 0. 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): def __init__(self, x_bias=0, y_bias=0):
...@@ -363,8 +365,10 @@ class Translate(ImageTransform): ...@@ -363,8 +365,10 @@ class Translate(ImageTransform):
Set translate parameters. Set translate parameters.
Args: Args:
x_bias ([float, int]): X-direction translation, x=x+x_bias. Default: 0. x_bias ([float, int]): X-direction translation, x=x+x_bias*image_length.
y_bias ([float, int]): Y-direction translation, y=y+y_bias. Default: 0. 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. auto_param (bool): True if auto generate parameters. Default: False.
""" """
self.auto_param = auto_param self.auto_param = auto_param
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册