You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In theory, we can of course generate adversarial images in batches. However, since this method currently requires backpropagation through multiple diffusion steps, many intermediate calculation graphs are stored, so even if only a single image is processed, the memory usage is approximately 16GB. Thus with only my current equipment (a single Rtx3090), I'm afraid I am not able to test turning the code into batches.
However, if you have multiple GPUs or more memory, the most straightforward way I recommend is to use multiprocessing to process batches of images. It's easy and doesn't require modifying the core code.
This article proposes the Segment-wise Forwarding-Backwarding algorithm to address the memory issue in computational graphs, aiming to improve the efficiency of DiffAttack.
Thank you for sharing the article. I appreciate your insight in addressing the memory issue with Segment-wise Forwarding-Backwarding. However, it seems that this approach might prolong the optimization time, which might still fail to speed up the generation of the adversarial examples.
While I haven't delved into all the intricacies of the article, Segment-wise Forwarding-Backwarding seems akin to the commonly used gradient checkpointing trick. This method involves recalculating computational graphs during the backpropagation phase, leading to increased processing time, contingent on the number of checkpoints set.
@tanlingp's intention, I think, is to expedite the generation of adversarial examples by leveraging batch processing. Given the longer processing time per input associated with Segment-wise Forwarding-Backwarding (despite its reduced memory usage), it may not significantly enhance the speed, which is the primary concern here.
Nonetheless, I appreciate your contribution. Many thanks for sharing your insights.
Your code currently operates one image at a time, is it possible to adjust the batch_size operation? I look forward to hearing from you!
The text was updated successfully, but these errors were encountered: