ain-soph / trojanzoo

TrojanZoo provides a universal pytorch platform to conduct security researches (especially backdoor attacks/defenses) of image classification in deep learning.
https://ain-soph.github.io/trojanzoo
GNU General Public License v3.0
274 stars 62 forks source link

Using a custom model #162

Closed GorkaAbad closed 1 year ago

GorkaAbad commented 2 years ago

Hi, Can I use a custom poisoned model for evaluating it against a defense, i.e., Neural Cleanse?

I'm trying to implement it with no success. I'm checking the documentation and the code but I cannot understand how to make it work. Can someone provide more info on this?

Thanks in advance

ain-soph commented 2 years ago

There are certain modules in trojanzoo workflow: dataset, model, mark, attack, defense.

Since you have already got a poisoned model, please import it in model module.

Afterwards, you could use all existing defenses with setting attack as --attack badnet (it's okay that your attack is actually not badnet). You need to provide mark image or tensor to mark module to make sure the ASR validation is correct.

GorkaAbad commented 2 years ago

Okay, I think I make it work for my use case. However, I cannot see the anomaly score for my model when using Neural Cleanse. Is there anything similar in trojanzoo?

Thanks in advance

ain-soph commented 2 years ago

MAD is the anomaly score.

ain-soph commented 1 year ago

If you have no question, plz close this issue.