raoyongming / GFNet

[NeurIPS 2021] [T-PAMI] Global Filter Networks for Image Classification
https://gfnet.ivg-research.xyz/
MIT License
448 stars 42 forks source link

Visualization Code #8

Closed xiang-jian-wen closed 2 years ago

xiang-jian-wen commented 3 years ago

Hello sir: Thank you for your excellent work! Could you please provide visualization code? Thank you!

wl-zhao commented 3 years ago

Thanks for your interest. Actually, the visualization is quite simple. You can follow the steps below:

  1. Load the filter you want to visualize from the state_dict (the complex_weight)
  2. Convert the filter to complex using torch.view_as_complex
  3. Complete the other (symmetric) half of the filter. This can be implemented by first converting the filter back to the spatial domain via torch.irfft2 and then using torch.fft2 to obtain a filter in the spectral domain with shape (H, W)
  4. Visualize the modulus of the filter (as what we did in the paper, torch.abs). You can choose any color map you like.

We will add the visualization code later (perhaps after the CVPR submission deadline).

DonDominic commented 3 years ago

It seems that fftshift has been used to move the low-frequency component to the center, is that right?

wl-zhao commented 3 years ago

Yes, that's right.

RachelTeamo commented 2 years ago

The CVPR submission deadline has passed!! If it is convenient for you, can you update the visualization code? Thank you very much!^-^

wl-zhao commented 2 years ago

Hi, we have added the visualization code viz_freq.ipynb.

RachelTeamo commented 2 years ago

Ok, Thank you very much.

QiuPaul commented 2 years ago

Hi, we have added the visualization code viz_freq.ipynb.

hello , thanks for the code. But when i run it, it doesn't work, is there some restriction of software version? thanks

wl-zhao commented 2 years ago

hello , thanks for the code. But when i run it, it doesn't work, is there some restriction of software version? thanks

Hi, could you provide the error messages?

QiuPaul commented 2 years ago

     你好,邮件已收到,我会尽快给您回复..  谢谢!!!