duoergun0729 / adversarial_examples Goto Github PK
View Code? Open in Web Editor NEW对抗样本
对抗样本
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(_l099/size)+1
l1 = int(99np.sum(np.abs(img[0] - img_adv[0])) / np.sum(np.abs(img[0]))) + 1
#l2 = int(99np.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?
对5-fgm-tensorflow-pb中攻击后图像进行保存,重新输入到模型进行识别时,结果显示未攻击成功。
运行9-advbox-mnist-fgsm代码报错查了一些博客说是python版本的问题具体解决方法还是不清楚
TypeError: true_divide() received an invalid combination of arguments - got (numpy.ndarray, int), but expected one of:
我在运行cleverhans部分代码时候,发现正确的运行环境应该配置cleverhans==3.0.0或者3.0.1,兜哥在书中写的是2.1.0.
当我试着运行robust_physical_attack.ipynb时,发现FileNotFoundError: [Errno 2] No such file or directory: 'data/stop_red_mask.npy'
兜哥您好,我在复现您的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_)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.