RobustART.noise.add_noise package


RobustART.noise.add_noise.add_noise module

Module contents

class RobustART.noise.add_noise.AddNoise(noise_type)

Bases: object

Add Noise for one image Support List: noise_list = [‘imagenet-s’, ‘imagenet-c’, ‘pgd_linf’, ‘pgd_l2’, ‘fgsm’, ‘autoattack_linf’, ‘mim_linf’, ‘pgd_l1’], you should choose a noise type when init

add_noise(image, label=None)
  • label – Provide the label when add adv noise

  • image – The file path of one image. Or a (n,w,h,3) numpy array of a batch of image


If the input is a file path, return a (w,h,3) numpy array of this image after

adding noise of specific noise_type Else return (n,w,h,3) numpy array batch of image


Every Noise has a default config dict, you can use this method to set config :param kwargs: dict of config to set