Coder Social home page Coder Social logo

idkiro / attack-imagenet Goto Github PK

View Code? Open in Web Editor NEW
40.0 40.0 9.0 53 KB

No.2 solution of Tianchi ImageNet Adversarial Attack Challenge.

Home Page: https://tianchi.aliyun.com/competition/entrance/231761/introduction

License: MIT License

Python 100.00%
adversarial-attacks deep-learning imagenet pytorch

attack-imagenet's People

Contributors

idkiro 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

Watchers

 avatar  avatar  avatar

attack-imagenet's Issues

Some error in "./utils/Resnet.py"

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!

Torch not compiled with CUDA enabled

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权重并使用的,代码可否发布一下。

RuntimeError: cuDNN error

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

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”

'NoneType' object is not subscriptable

请问为什么要给标签添加偏移量啊,是原始数据已经做过处理了吗,这个偏移量使我产生了类型的错误subscriptable,如果不予理会,会事得分降低吗。

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.