Code Monkey home page Code Monkey logo

Comments (6)

P2333 avatar P2333 commented on August 23, 2024

For Section 5.2 and Table 2, we follow the settings and code of Pang et al. 2021, and we substitute the KL divergence with SE.

from score.

Immortalise avatar Immortalise commented on August 23, 2024

Thank you so much for your prompt reply to my issue.

I implement the PGD-AT with SCORE by replacing the CE loss to LSE loss:

y_onehot = F.one_hot(y, num_classes=args.num_classes)
robust_output = model(adv_input)
logits_adv = F.softmax(robust_output, dim=1)
robust_loss = torch.sum((logits_adv - y_onehot) ** 2, dim=-1).mean()
opt.zero_grad()
robust_loss.backward()

I would also like to ask for your guidance on one more thing. Should the CE loss in PGD process be replaced as well? I noticed that in your code (trades.py/trades_loss_LSE), it is replaced.

Thank you again for your help. I appreciate your time and expertise.

from score.

P2333 avatar P2333 commented on August 23, 2024

Yes the CE loss in PGD should be replaced as well. This is because the objective of AT is a min-max problem, i.e., the minimization and maximization share the same objective function.

from score.

Immortalise avatar Immortalise commented on August 23, 2024

Yes the CE loss in PGD should be replaced as well. This is because the objective of AT is a min-max problem, i.e., the minimization and maximization share the same objective function.

I've tried for both,

the results are as follows:
Method Std Acc Robust Acc
PGD-AT 81.46 53.62
PGD-AT SCORE (Not replaced) 81.88 53.99
PGD-AT SCORE (replaced) 80.04 53.19

It seems that the CE loss in PGD should not be replaced?

I have been using BN mode as train() when using PGD. Could this be the reason why PGD-AT SCORE (replaced) is not performing as well as PGD-AT SCORE (not replaced)?

from score.

Immortalise avatar Immortalise commented on August 23, 2024

I tried to train PGD-AT & SCORE on CIFAR100, the results worse than vanilla PGD-AT.

Method Std Acc Robust Acc

PGD-AT 55.30 29.50
PGD-AT SCORE 29.28 22.32
PGD-AT SCORE w/o grad clip 36.46 25.20
PGD-AT SCORE (Not replaced) 42.96 27.01

It seems that the the CE loss in PGD should not be replaced as well?

Have you tried to run PGD-AT SCORE with CIFAR100? I wonder if I wrote the wrong code, but it seems not possible since for CIFAR10 it is right.

from score.

P2333 avatar P2333 commented on August 23, 2024

Hi, I find my scripts and upload them into https://github.com/P2333/SCORE/tree/main/without_DDPM, with running commands in README. You can check if there is any difference compared to your implementation.

from score.

Related Issues (4)

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.