anuragranj / flowattack

Attacking Optical Flow (ICCV 2019)
https://flowattack.is.tue.mpg.de
Other
59 stars 16 forks source link

Scores of provided patches #2

Open andraghetti opened 4 years ago

andraghetti commented 4 years ago

Hi, thank you for the code.

I tried to run test_path.py on the provided patch with a tiny change on the code in order to the patch as png instead of the format you dump during training.

The change is here, instead of patch = torch.load(args.patch_path)

im = np.array(Image.open(args.patch_path).convert('RGB'))
im = np.transpose(im, (2, 0, 1))
im = np.expand_dims(im, 0)
patch = torch.from_numpy(im)
patch_init = torch.from_numpy(im)

I tested both Upatch1 and Upatch2 on FlowNetC with this command: python test_patch.py --patch_path patches/Upatch.png --flownet FlowNetC. (--name is not important)

  1. upatch1:

    epe,    adv_epe,    cos_sim, adv_cos_sim
    14.5157,    34.4716,     0.8562,     0.4959
  2. upatch2:

    epe,    adv_epe,    cos_sim, adv_cos_sim
    14.5157,    17.7255,     0.8562,     0.7827

These patches sizes don't have any comparison with the paper and it seems that they don't affect much the prediction. Especially because here the flow inside the patch is considered, while it shouldn't. Can you please provide your results or more patches with the smallest and biggest dimensions?

Thank you!

Edit: I ran the test on the second patch with --ignore_flow_mask=true:

    epe,    adv_epe,    cos_sim, adv_cos_sim
14.5157,    17.7804,     0.8562,     0.7963
anuragranj commented 4 years ago

Oh, here you need to take care of the normalization of the patch properly. The raw saves of the patch are already normalized. The effect should be such that you are pasting the normalized patch on the image.

As far as I remember, the patch is normalized to [-1, 1]. This loading of png-image of the patch normalizes it to [0,1]. That should be taken care of.