SugarRuy / HashStash

15 stars 4 forks source link

No pictures of results after running #2

Open Meredith98 opened 3 years ago

Meredith98 commented 3 years ago

I just download the snapshot and save_for_load. Then I run myGetAdv.py, but why I can't get any pictures? Following is all I get after running myGetAdv.py, could u please tell what should I do to get the same results with u?

E:\anaconda3\python.exe C:/Users/Administrator/Desktop/机器学习/HashStash-master/HashNet/pytorch/src/myGetAdv.py Files already downloaded and verified Files already downloaded and verified E:\anaconda3\lib\site-packages\torch\nn\modules\loss.py:96: UserWarning: Using a target size (torch.Size([48])) that is different to the input size (torch.Size([1, 48])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size. return F.l1_loss(input, target, reduction=self.reduction) ...non-targeted iterative FGSM begin.... initial distance 0.0 epoch 0 loss: 0.31584808 Hamming distance: 0.0 epoch 1 loss: 1.110921 Hamming distance: 29.0 epoch 2 loss: 1.2478293 Hamming distance: 27.0 Final Hamming distance : 34.0 Original Image: [[ 72 4854 4 6 3 3 8 1 81 227]] [5259] Original Code Difference: [[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.

                                              1. 0.]] Adversarial Image: [[ 9 2 211 1189 146 4406 94 80 20 4]] [6161]

Process finished with exit code 0

SugarRuy commented 3 years ago

Hi Meredith98, Please save the ### adv ### Variable after line 353 in myGetAdv.py files. The adv images are created from lines 343 to 352.

You may also want to replace line 307 adv_method = 'hdm' with adv_method = 'cbwm' to use the method mentioned in our paper.

Please let me know if you have any questions.