Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

freq_mask_path and space_mask_path #2

Closed
llllly26 opened this issue Apr 9, 2024 · 7 comments
Closed

freq_mask_path and space_mask_path #2

llllly26 opened this issue Apr 9, 2024 · 7 comments

Comments

@llllly26
Copy link

llllly26 commented Apr 9, 2024

Hi,
I want to know that, If I want to use freq_mask and space_mask on my own datasets, how can I generate it?
Thanks!

@AwakerMhy
Copy link
Collaborator

You can calculate the average value over the dataset for each pixel in each image to generate the space_mask, and calculate the average amptitude over the dataset of each frequency component in each image after Fourier transform for the freq_mask, as mentioned in Sec 4.3 of our paper. Emprically, we find that about 200 images randomly sampled from the dataset is enough for calculating both masks.

@llllly26
Copy link
Author

llllly26 commented Apr 9, 2024

You can calculate the average value over the dataset for each pixel in each image to generate the space_mask, and calculate the average amptitude over the dataset of each frequency component in each image after Fourier transform for the freq_mask, as mentioned in Sec 4.3 of our paper. Emprically, we find that about 200 images randomly sampled from the dataset is enough for calculating both masks.

thanks!
By the way, could you release code about this? These parameters are necessary to generate high quality image, so I hope to keep align with your work.

@AwakerMhy
Copy link
Collaborator

Sure, I will add a demo about how to calculate the masks soon.

@AwakerMhy
Copy link
Collaborator

We have added the file mask_gen_demo.py.py, which is a demo showing how to generate frequency and space mask for an image dataset. We take CIFAR10 as an example. We hope you find it helpful.

@llllly26
Copy link
Author

llllly26 commented Apr 9, 2024

We have added the file mask_gen_demo.py.py, which is a demo showing how to generate frequency and space mask for an image dataset. We take CIFAR10 as an example. We hope you find it helpful.

thanks!

@llllly26 llllly26 closed this as completed Apr 9, 2024
@llllly26
Copy link
Author

llllly26 commented Apr 10, 2024

We have added the file mask_gen_demo.py.py, which is a demo showing how to generate frequency and space mask for an image dataset. We take CIFAR10 as an example. We hope you find it helpful.

Sorry @AwakerMhy , another confusion that, if different categories of images are different scale, need to [padding] and [mask] to same shape, but without using torchvision.transforms to Resize, in this scenario, does it make sense to calculate average?

@AwakerMhy
Copy link
Collaborator

For other datasets in which the raw images has different sizes, you need to resize them to have the same size and before calculating the masks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants