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

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

上级 a30128b6
......@@ -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):
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册