Open ruixin-han opened 3 years ago
As you could see in code, images need to be resized to a size of 400x400 before feeding into the NN. As I can remember, you can use a patch of any size, but I was testing on patches of a size 140x140 pixels. If you want to feed only one picture to the NN and to apply LGS method, you need to apply all of the transforms, that are defined at the top of the .ipynb file. Also you need to unsqueeze the img tensor, because the NN expects a batch of images as an argument.
Thank you very much for your reply.I'm Ruixin Han,a student of Zhejiang University of Technology in China. I am currently studying how to defend against patch attacks, especially in physical world. Thank you for sharing the code, it helped me a lot. I will modify the code according to your suggestions.
Ruixin Han
------------------ 原始邮件 ------------------ 发件人: "Sychev @.>; 发送时间: 2021年9月12日(星期天) 晚上7:49 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [metallurk/local_gradients_smoothing] Load local pictures (#3)
As you could see in code, images need to be resized to a size of 400x400 before feeding into the NN. As I can remember, you can use a patch of any size, but I was testing on patches of a size 140x140 pixels. If you want to feed only one picture to the NN and to apply LGS method, you need to apply all of the transforms, that are defined at the top of the .ipynb file. Also you need to unsqueeze the img tensor, because the NN expects a batch of images as an argument.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
After loading the local image, an error of image dimension mismatch will be reported: RuntimeError: The size of tensor a (640) must match the size of tensor b (480) at non-singleton dimension 3. Errors can be eliminated after transposing, but the final result is messy.