python工具箱用于创建欺骗神经网络的敌对示例

foolbox的Python项目详细描述


…图片::https://readthedocs.org/projects/foolbox/badge/?version=latest
:目标:https://foolbox.readthedocs.io/en/latest/

。图片:https://travis-ci.org/bethgelab/foolbox.svg?branch=master
:目标:https://travis ci.org/bethgelab/foolbox

…图片::https://coveralls.io/repos/github/bethgelab/foolbox/badge.svg
:目标:https://coveralls.io/github/bethgelab/foolbox

…图片::https://badge.fury.io/py/foolbox.svg
:目标:https://badge.fury.io/py/foolbox





=
=
foolbox
=

foolbox是一个python工具箱,用于创建欺骗神经网络的对抗示例。它需要"python"、"numpy"和"scipy"。

代码块:bash

pip install foolbox

我们使用python 2.7、3.5和3.6进行测试。其他python版本也可以工作。**建议使用python 3!**

文档
----


文档可在readthedocs上获得:http://foolbox.readthedocs.io/


我们描述foolbox的论文在arxiv上:https://arxiv.org/abs/1707.04131

示例
-


。代码块:python

import foolbox
import keras
import numpy as np
from keras.applications.resnet50 import resnet50

=(np.array([104,116,123]),1)
fmodel=foolbox.models.kerasmodel(kmodel,bounds=(0,255),preprocessing=preprocessing)

通道,因为keras resnet50需要bgr而不是rgb
attack=foolbox.attacks.fgsm(fmodel)
departarial=attack(image[:,:,:-1],label)
看看"documentation<;https://foolbox.readthedocs.io/en/latest/user/examples.html>;` ` ` `.

代码块:python

1]
plt.axis('off')

plt.subflot(1,3,2)
plt.title('departarial')
plt.imshow(departarial[:,:,:-1]/255)::-1将bgr转换为rgb
plt.axis('off')

plt.subflot(1,3,3)
plt.title('difference')
difference=departarial[:,:,::-1]-图像
plt.imshow(difference/abs(difference.max()*0.2+0.5)
plt.axis('off')


plt.show()

图片::https://github.com/bethgelab/foolbox/raw/master/example.png




tensorflow、
pytorch、theano、千层面和mxnet等一系列其他深度学习软件包的接口都可用,例如

。代码块::python

model=foolbox.models.tensorflowmodel(images,logits,bounds=(0,255))
model=foolbox.models.pytorchmodel(torchmodel,bounds=(0,255),num_classes=1000)
特定的目标类或目标概率
原始类或目标类的值可以传递给攻击,例如

…代码块::python

criteria=foolbox.criteria.targetClass(22)
attack=foolbox.attacks.lbfgsattack(fmodel,criteria)

只需在"github<;https://github.com/bethgelab/foolbox/issues/new>;``上新建一期即可。

questions&faq
——

根据问题的性质,可以将其作为问题发布到"github"<;https://github.com/bethgelab/foolbox/issues/new>;`,也可以使用"foolbox"标记将其作为问题发布到"stack overflow"<;https://stackoverflow.com>;`。我们将尝试监视该标记,但如果您没有得到答案,请随时与我们联系。

https://foolbox.readthedocs.io/en/latest/index.html>;` `.


欢迎投稿
-



例如,caffe、caffe2或cntk,提供必要的包装材料。如果我们能提供任何帮助,请不要急于联系我们。

请考虑在结果出版物中引用它:

。代码块:

@article{rauber2017foolbox,
title={foolbox:a python toolbox to benchmarking the robustness of machine learning models},
author={rauber,jonas and brendel,wieland bethge,matthias},
journal={arxiv preprint arxiv:1707.04131},
year={2017},
url={http://arxiv.org/abs/1707.04131},
archiveprefix={arxiv},
eprint={1707.04131},
}


`
*`wieland brendel<;https://github.com/wielandbrendel>;`

----

图片::http://bethgelab.org/media/banners/benchmark_banner_small.png
:目标:https://robust.vision/benchmark

您可能想看看我们最近发布的"robust vision benchmark<;https://robust.vision/benchmark>;`。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Grid loadmask(true)在gxt中不起作用   java将字符串索引转换为整数   为什么Java泛型适用于基元数组,但不适用于基元数组?   java如何让Azure应用程序服务Tomcat将所有80/443流量转发到运行在同一应用程序服务上的JBoss   具有多个值的java转换映射到树?   java如何设置SQL server连接URL?   java设置了多个相互独立的JFrame   安全性在JAVA中如何使用RSAPrivateKey的密码短语?   java不能使用比Apache Velocity中更大的条件   如何在Java中打印字符串的所有排列   停止Android Studio自动导入java。sql。日期   对象简单计算器程序java   java如何在安卓中使用“&”符号作为字符串?   java Connect,为我的安卓应用程序从REST API发布和获取数据