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

filter_parameters not being set? #2

Open
jjparkcv opened this issue Jul 9, 2021 · 7 comments
Open

filter_parameters not being set? #2

jjparkcv opened this issue Jul 9, 2021 · 7 comments

Comments

@jjparkcv
Copy link

jjparkcv commented Jul 9, 2021

Hi, I'm trying to find out which cutoff frequencies you actually used for you experiments.

So, I tried to find where is the function 'filter_parameters' is being used, but I can't seem to find it.

Could you point me to where it is being set?

Thanks!

@rosinality
Copy link
Owner

filte_parameters I have used for 256px is:

sr_n = 256
cutoff_n = sr_n / 2

filter_parameters(
    n_layer=14,
    n_critical=2,
    sr_max=sr_n,
    cutoff=(2, cutoff_n),
    stopband=(2 ** 2.1, cutoff_n * 2 ** 0.3),
    channel_max=512,
    channel_base=2 ** 14
)

which is same with parameters from the papers.

@jjparkcv
Copy link
Author

Thanks for the reply @rosinality

Using your parameters, the 'filter_parameters' function outputs cutoff frequency as:
p['cutoffs'] =>
[2.0, 2.82842712474619, 4.0, 5.656854249492381, 7.999999999999999, 11.313708498984761, 16.0, 22.627416997969526, 31.999999999999996, 45.254833995939045, 64.00000000000001, 90.50966799187808, 128.0, 128.0]

However, according to the paper, the cutoff frequency is strictly a function of the resolution 's': f_c = s/2 − f_h, where f_h = (√2 − 1)(s/2). But I see that the first two elements of your cutoff frequency are different, even though their image resolutions 's' are the same.

Could you explain why is your cutoff frequency changes each layer? Perhaps I'm missing something from the paper?

Thank you in advance.

@rosinality
Copy link
Owner

I adapted flexible layer specifications (config T). Yon can find the formula from F.1 Flexible layer specifications.

@jjparkcv
Copy link
Author

Hi, thank you for your clarifications.

On a separate note, could you explain a bit about padding for upsampling and downsampling?
The paper says it avoids zero-padding because it introduces positional awareness of the CNN.
However, I notice that your 'upsample' function has padding passed to 'upfirdn2d'.

Is zero-padding is being used by the upsample method or some other padding?
Also, if there is padding being used, I wonder what's the point of using the 10-pixel margin?

Thank you again!

@jjparkcv
Copy link
Author

Ah, I think I get it. So the zero-padding is only affecting the margins, not the main signal?

@rosinality
Copy link
Owner

It is my guess. Using 10 pixel margin would be not enough to maintain canvas sizes, so I added zero paddings to the upsampling and downsampling. Definitely it could affect the pixels around the border, but I don't know how exactly authors used paddings or magins to prevent reducing canvas sizes.

@jjparkcv
Copy link
Author

I see. I think your guess is quite reasonable. Except I wonder if the unbalanced padding (i.e., different right and left padding) would introduce any bias. But other than that, the padding treatment looks quite elegant.

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