Comments (4)
不知道对不对,希望能帮到你
# pytorch版的model
def gradient(self, data, label):
...
...
#loss=self._loss(output, label)
ce = nn.CrossEntropyLoss()
loss=-ce(output, label) #这里多了一个负号
from advbox.
不知道对不对,希望能帮到你
# pytorch版的model def gradient(self, data, label): ... ... #loss=self._loss(output, label) ce = nn.CrossEntropyLoss() loss=-ce(output, label) #这里多了一个负号
谢谢回复,以下疑问:
nn.CrossEntropyLoss()里应该包含了negative log likelihood里的负号了对吧?那这里这个loss,加一个负号的意义在哪呢?难道仅仅为了不同子类调用时候的一致么?如果是这样,意味着其他model例如tf的model也多加了一个负号?不过我没有找到其他框架的model在哪里加了负号,能否指示一下,多谢了。
另贴上 cleverhans项目fast_gradient_method里target loss和非target loss的代码
# Compute loss
loss = softmax_cross_entropy_with_logits(labels=y, logits=logits)
if targeted:
loss = -loss
# Define gradient of loss wrt input
grad, = tf.gradients(loss, x)
optimal_perturbation = optimize_linear(grad, eps, ord)
# Add perturbation to original example to obtain adversarial example
adv_x = x + optimal_perturbation
from advbox.
就是pytorch这个特殊点 其他的框架木有这个问题
from advbox.
我今天也遇到这个问题了,我觉得这块应该是bug,我看 log 里面以前is_targeted_attack是减号,但是在ef59511b59a03755c33e712043f9c2211829191b 这个 commit 里面改了,所以能否查一下这是是否有问题?
from advbox.
Related Issues (20)
- models
- Training code for StealthTshirt HOT 4
- 01 HOT 1
- TypeError: 'filter' object is not subscriptable HOT 2
- This repository is violating the MIT license of Foolbox HOT 1
- TypeError: Can't instantiate abstract class EOTB_attack with abstract methods interpret_output HOT 5
- ODD Effectiveness HOT 1
- How to train my own adversarial sticker targetting a certain class with my own dataset? HOT 2
- error in running imagenet_example_cw.py HOT 1
- Single Pixel Attack Assertion Error HOT 2
- What is the difference between FGSM and BIM in the codes?(/FGSM seems to be an iterative method according to the codes) HOT 1
- mnist_tutorial_fgsm.py IndexError: index 4 is out of bounds for axis 0 with size 1 HOT 1
- 缺少一些东西
- EOT Parameters HOT 5
- bugs HOT 1
- How to use Deepfool and C&W in segmentation model?
- Some python packages have version conflicts
- Can StealthTshirt be used for generating new adversarial patches? HOT 1
- graphpipe-tf的docker使用了过低的tensorflow版本
- MIFGSM
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from advbox.