FGSM、PGD、BIM对抗攻击算法实现资源
FGSM、PGD、BIM对抗攻击算法实现资源,需要按文章下载库 class BIM(Attack): def __init__(self, model, eps=8 / 255, alpha=2 / 255, steps=10): super().__init__("BIM", model) self.eps = eps self.alpha = alpha if steps == 0: self.steps = int(min(eps * 255 + 4, 1.25 * eps * 255)) else: self.steps = steps self.supported_mode = ["default", "targeted"]