alias-free-gan-pytorch icon indicating copy to clipboard operation
alias-free-gan-pytorch copied to clipboard

about input fourier features.

Open lzhbrian opened this issue 3 years ago • 0 comments

Hi, thanks for the work. I have a question regarding the input fourier features. I think you might have included the margin into the target canvas (-0.5~0.5) ? That makes the input frequencies become relatively lower.

https://github.com/rosinality/alias-free-gan-pytorch/blob/d1a4c52ea0be9a6a853fe10e486402b276aef94b/model.py#L193-L199

A possible fix would be something like:

class FourierFeature(nn.Module):
    def __init__(self, size=16, margin=10, dim=512, cutoff=2, eps=1e-8):
        """
        size:   sampling rate (or feature map size)
        margin: expanded feature map margin size
        dim:    # channels
        cutoff: cutoff fc
        """
        super().__init__()

        normalized_margin = margin / size
        # -0.5-m ~ 0.5+m, uniform interplate 'size' (except the last one)
        # note the margin here, target canvas was -0.5~0.5, extended canvas should be larger
        coords = torch.linspace(- 0.5 - normalized_margin, 
                                  0.5 + normalized_margin, 
                                size + 2 * margin + 1)[:-1]

lzhbrian avatar Sep 18 '21 12:09 lzhbrian