adding on-the-fly patching images for backdoor attacks #1881
-
Hi, thanks for the contribution of pytorch-image-models for boostraping DNN researching! I'm recently doing some research regarding backdoor attack on DNNs e.g.BadNets, basically backdoors can be added by patching the image with a small amount of pixel altering (trigger pattern), and I'm using pytorch-image-models as my starting point, but I wang to be able to add trigger patterns on image (e.g. adding a 3x3 checker board onto the input data), what is the best location for me to add the code? Because the dataset transforms for input might remove the 'trigger' if added before loading the dataset, i want to add the trigger on-the-fly (maybe after transformation), where can I put the code? any suggestions, Thank you very much! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
after transforms, before model could be hacked in here in the train loop https://github.com/huggingface/pytorch-image-models/blob/main/train.py#L896 If you need something in the middle of the transforms (after resize, rand-aug but before say normalize) you'd need to inject into the transforms at the end of secondary/start of final transform lists https://github.com/huggingface/pytorch-image-models/blob/main/timm/data/transforms_factory.py#L114-L116 |
Beta Was this translation helpful? Give feedback.
after transforms, before model could be hacked in here in the train loop https://github.com/huggingface/pytorch-image-models/blob/main/train.py#L896
If you need something in the middle of the transforms (after resize, rand-aug but before say normalize) you'd need to inject into the transforms at the end of secondary/start of final transform lists https://github.com/huggingface/pytorch-image-models/blob/main/timm/data/transforms_factory.py#L114-L116