Gandolfczjh / 3D2Fool

http://arxiv.org/abs/2403.17301
20 stars 2 forks source link

Adding car images with background? #5

Closed Saahil18 closed 3 weeks ago

Saahil18 commented 2 months ago

Hey, I was able to download the dataset background images from Baidu. Now do I need to use the attack.py file to put the car images with background images and create the dataset with the car as well. Is this the correct process please let me know. I would really appreciate that.

Gandolfczjh commented 1 month ago

Yes! In attack_base.py, we import the MyDataset class from data_loader_mde.py to create the data loader. We use the getitem function from MyDataset class to generate the renderer vehicle image and place it on the background image. Now we add some detailed descriptions for you to understand.

Saahil18 commented 1 month ago

Yes! In attack_base.py, we import the MyDataset class from data_loader_mde.py to create the data loader. We use the getitem function from MyDataset class to generate the renderer vehicle image and place it on the background image. Now we add some detailed descriptions for you to understand.

Thanks for the reply. I was able to run the scripts and augment car images with the background. However, the 3d mask was not rendered on the images of the car. It is due to some compatibility issues. I just wanted to ask you if you are planning to upload the final dataset with 3d adversarial patches augmented soon ?

Gandolfczjh commented 1 month ago

I have upload the texture seed in the main folder! There is no way to train the texture using the final adversarial dataset as the training dataset, as doing so does not convey the gradient and is meaningless.

Saahil18 commented 1 month ago

Ok, but the texture seed is not used anywhere in the code. It is not referenced in any parts. I know it is used in TC part but its not anywhere in the codes? I mean where do I put it so that the car images have that overlay.

Saahil18 commented 1 month ago

Thankyou for replying to my doubts and queries. Its very generous of you. I was able to run the attack code and it is rendering the car along with the background but the car is not wrapped with the texture as yours. If you could tell me whether the code (provided) itself creates the texture map and adds it over the car or we have to use the texture map png provided by you. If we have to use the texture png then how and where?

Thankyou

Gandolfczjh commented 1 month ago

Hello, questions are welcome. I think a careful look at the attack_base.py file will answer your question. Here we declare and initialize the texture seed camou_para, and augment it with the expand_kernel function.

    # continuous color
    camou_para = torch.rand([1, h, w, 3]).float().to(args.device)
    camou_para.requires_grad_(True)
    optimizer = optim.Adam([camou_para], lr=args.lr)
    camou_para1 = expand_kernel(camou_para.permute(0, 3, 1, 2)).permute(0, 2, 3, 1)

Our latest uploaded PNG file is the texture seed as tensor camou_para here. You can modify the code to read and convert the png file into a tensor and assign it to camou_para, then you can render the images shown in this paper.