Giter Site home page Giter Site logo

adversarial_examples's Introduction

《AI安全之对抗样本入门》

编辑推荐

本书系统介绍对抗样本的基本原理,从相关的背景知识开始,包含搭建学习对抗样本的软硬件环境、常用工具,带领读者快速上手实践。本书作者在安全领域有多年实践经验,对业界常见的方法做了系统的归纳总结,包含大量案例,深入浅出,实践性强。

主要内容包括:

对抗样本相关的深度学习背景知识,如梯度、优化器、反向传递等。

如何搭建学习对抗样本的软硬件环境。

对抗样本领域的一些常见图像处理技巧。

常见的白盒攻击算法与黑盒攻击算法。

对抗样本在目标检测领域的应用。

对抗样本的常见加固算法。

常见的对抗样本工具以及如何搭建NIPS对抗样本竞赛环境。

如何站在巨人的肩膀上,快速生成自己的对抗样本,进行攻防对抗

内容简介

第1章介绍了深度学习的基础知识,重点介绍了与对抗样本相关的梯度、优化器、反向传递等知识点。

第2章介绍了如何搭建学习对抗样本的软硬件环境,虽然GPU不是必需的,但是使用GPU可以更加快速地验证你的想法。

第3章概括介绍了常见的深度学习框架,从TensorFlow、Keras、PyTorch到MXNet。

第4章介绍了图像处理领域的基础知识,这部分知识对于理解对抗样本领域的一些常见图像处理技巧非常有帮助。

第5章介绍了常见的白盒攻击算法,从基础的FGSM、DeepFool到经典的JSMA和CW。

第6章介绍了常见的黑盒攻击算法。

第7章介绍了对抗样本在目标识别领域的应用。

第8章介绍了对抗样本的常见抵御算法,与对抗样本一样,抵御对抗样本的技术也非常有趣。

第9章介绍了常见的对抗样本工具以及如何搭建NIPS 2017对抗防御环境和轻量级攻防对抗环境robust-ml,通过这章读者可以了解如何站在巨人的肩膀上,快速生成自己的对抗样本,进行攻防对抗。

作者简介

兜哥,百度安全实验室AI模型安全负责人,具有10余年安全从业经历,曾任百度基础架构安全负责人、Web安全产品线负责人。主要研究方向为对抗样本、生成对抗网络。著有AI安全畅销书籍《Web安全之机器学习入门》《Web安全之深度学习实战》《Web安全之强化学习与GAN》。著名开源AI安全工具箱AdvBox的作者,FreeBuf、雷锋网、安全客特邀专栏作家,知名安全自媒体“兜哥带你学安全”主编。

adversarial_examples's People

Contributors

duoergun0729 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

adversarial_examples's Issues

5-jsma-pytorch.ipynb代码在cuda上运行代码修改

兜哥您好,我在复现您的code/5-jsma-pytorch.ipynb代码时候,发现循环训练中最后一行
img.data[idx]=np.clip(img.data[idx], min_, max_)
该行代码在cuda上运行需要修改,img在cuda上运行的时候,因为img是cuda tensor,需要转化为cpu tensor,再进行numpy运算。
img.data[idx]=np.clip(img.data[idx].cpu(), min_, max_)

bug

对5-fgm-tensorflow-pb中攻击后图像进行保存,重新输入到模型进行识别时,结果显示未攻击成功。

TypeError: true_divide() received an invalid combination of arguments

运行9-advbox-mnist-fgsm代码报错查了一些博客说是python版本的问题具体解决方法还是不清楚
TypeError: true_divide() received an invalid combination of arguments - got (numpy.ndarray, int), but expected one of:

  • (Tensor input, Tensor other, *, Tensor out)
  • (Tensor input, Number other)
    didn't match because some of the arguments have invalid types: (numpy.ndarray, int)

计算L范数的相对值

https://github.com/duoergun0729/adversarial_examples/blob/master/code/tools.py
#计算相对量
#l0 = int(99len(np.where(np.abs(img[0] - img_adv[0])>0.5)[0]) / size ) + 1
l0=int(_l0
99/size)+1
l1 = int(99np.sum(np.abs(img[0] - img_adv[0])) / np.sum(np.abs(img[0]))) + 1
#l2 = int(99
np.linalg.norm(img[0] - img_adv[0]) / np.linalg.norm(img[0])) + 1
l2=int(99*_l2 / np.linalg.norm(img[0])) + 1
#linf = int(99np.max(np.abs(img[0] - img_adv[0])) / 255) + 1
linf = int(99
_linf / 255) + 1
print('Noise L_0 norm: {} {}%'.format(_l0,l0) )
print('Noise L_2 norm: {} {}%'.format(_l2,l2) )
print('Noise L_inf norm: {} {}%'.format(_linf,linf) )

为什么要乘99,以及为什么要加1?

9-cleverhans代码环境配置有误

我在运行cleverhans部分代码时候,发现正确的运行环境应该配置cleverhans==3.0.0或者3.0.1,兜哥在书中写的是2.1.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.