idkiro / attack-imagenet Goto Github PK
View Code? Open in Web Editor NEWNo.2 solution of Tianchi ImageNet Adversarial Attack Challenge.
Home Page: https://tianchi.aliyun.com/competition/entrance/231761/introduction
License: MIT License
No.2 solution of Tianchi ImageNet Adversarial Attack Challenge.
Home Page: https://tianchi.aliyun.com/competition/entrance/231761/introduction
License: MIT License
where is the implement...
When I run your code, I get the following error:
TypeError: einsum() takes 2 positional arguments but 3 were given
def forward(self, x):
if self.embed:
theta = self.conv_theta(x)
phi = self.conv_phi(x)
else:
theta = x
phi = x
n_in, H, W = list(x.size())[1:]
if n_in > H*W or self.softmax:
f = torch.einsum('niab,nicd->nabcd', theta,phi)
if self.softmax:
shape = f.size()
f = f.view(-1, shape[2]*shape[3], shape[2]*shape[3])
f = f / math.sqrt(self.channel/2)
f = nn.functional.softmax(f, dim=-1)
f = f.view(shape)
f = torch.einsum('nabcd,nicd->niab', f, x)
else:
f = torch.einsum('nihw,njhw->nij', phi, x)
f = torch.einsum('nij,nihw->njhw', f, theta)
if not self.softmax:
f = f / (H*W)
y = self.bn(self.conv(f))
return x + y
Please help me solve this puzzle, thank you!
When I run simple_attack.py
.
There is an error:
simple_attack.py 85
model.cuda()module.py 260 cuda
return self._apply(lambda t: t.cuda(device))module.py 187 _apply
module._apply(fn)module.py 187 _apply
module._apply(fn)module.py 187 _apply
module._apply(fn)module.py 193 _apply
param.data = fn(param.data)module.py 260
return self._apply(lambda t: t.cuda(device))init.py 161 _lazy_init
_check_driver()init.py 75 _check_driver
raise AssertionError("Torch not compiled with CUDA enabled")AssertionError:
Torch not compiled with CUDA enabled
How to fix it?
请问您的代码生成的对抗样本的可迁移性是如何评估的呢?所攻击的黑盒模型是什么呢?
Tensorflow的模型如何转为PyTorc权重并使用的,代码可否发布一下。
When I run your code, I get this error:
RuntimeError: cuDNN error: CUDNN_STATUS_NOT_SUPPORTED. This error may appear if you passed in a non-contiguous input.
The error occurs when I run line 83 "loss.backward()" in attacker.py, I don't know what's going on here.
Maybe you know how to solve it?
is_better = loss < best_loss; best_loss[is_better] = loss[is_better]; best_delta[is_better] = delta.data[is_better]
Would you please tell me the meaning of this code?The following error was reported while running:
“too many indices for tensor of dimension 0”
请问为什么要给标签添加偏移量啊,是原始数据已经做过处理了吗,这个偏移量使我产生了类型的错误subscriptable,如果不予理会,会事得分降低吗。
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.