Closed anirban-nath closed 1 year ago
Hi!
case
group, or in general?Hi, I was asking more in a general sense. I am new to model attacks but I have to perform one within a short amount of time to generate some results.
I also have one other follow-up question. So, the specifics of my model are that it's a multi-task model that generates two separate losses (a dice loss for segmentation and a cross-entropy loss for classification), which I then add to make one loss and then perform backprop throughout the model to train for the two tasks simultaneously.
In this attack implementation, I run into two issues: -
In the regularizers.py
file, the class TotalVariation
is called where there is an attribute self.groups
that is defined as self.groups = 6 if self.double_opponents else 3
. This declaration causes an error in diffs = torch.nn.functional.conv2d(tensor, self.weight, None, stride=1, padding=1, dilation=1, groups=self.groups)
I get the error that my image is expected to have 3 channels but the code only found one (presumably because my image is in grayscale. As a workaround, I set self.groups=1
. Is this correct? Also, what is double_opponents
?
Currently the model I am working on is CNN based, but I will be working on a Transformer model after this. I want to perform the APRIL attack on it but the example APRIL file shows that the model there is specified as a very standard Vision Transformer. Is it possible to perform the APRIL attack on a custom transformer model?
In general transformers, the attack has to be adapted to be optimization-based with an analytic part. The original paper has more details. Thanks for the heads-up. I will definitely look into the paper. Besides APRIL, are there other attacks that I can perform on custom vision transformers, ideally with little changes to the
minimal_example.py
code?
Just to clarify, in principle, all optimization-based attacks in this repo can also be used against vision transformers, as they are general-purpose attacks that do not depend on the architecture of the model. That said, architecture-specific attacks can be stronger. Another vision transformer-specific attack is gradVIT (although not yet implemented in this repo): https://arxiv.org/abs/2203.11894#.
Thank you for your answers.
In my use case, all aspects of my model are custom and I used a medical image dataset to train my model. I am using the
minimal_example.py
file as a template for designing the attack but I have a few trivial questions: -data_cfg_default
, what are the three numbers supposed to mean?