Giter VIP home page Giter VIP logo

alias-free-torch's People

Contributors

junjun3518 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

alias-free-torch's Issues

2D Filter Jinc appears to be wrong

Here is a plot of the generated 1D sinc filter kernel.
sinc looks right

Here is a plot of the generated 2D jinc filter kernel.
jinc looks wrong

I'd expect it to look more like a series of rings or ripples, rather than a donut or torus.

jinc filtered noise fft

The FFT output for randn noise put through the 2D filter doesn't look right either.

change jinc to sinc in 2d filter

Changing filter_ = 2 * cutoff * window * jinc(2 * cutoff * time) to filter_ = 2 * cutoff * window * sinc(2 * cutoff * time) in kaiser_jinc_filter2d makes a more familiar kernel.

change jinc to sinc in 2d filter fft out

And the FFT output for randn noise put through this 2D filter looks about how I'd expect.

Batched resampling for the new implementation

Hi, thank you very much for the contribution.

I think the new implementation of resample.Upsample1d and resample.Downsample1d breaks batched resampling when using groups=C without expanding the filter to match the shape. Perhaps the implementation should be like the below (maybe similar goes to 2d):

Upsample1d.forward()

    # x: [B,C,T]
    def forward(self, x):
        B, C, T = x.shape
        x = F.pad(x, (self.pad, self.pad), mode='reflect')
        # TConv with filter expanded to C with C groups for depthwise op
        x = self.ratio * F.conv_transpose1d(
            x, self.filter.expand(C, -1, -1), stride=self.stride, groups=C)
        pad_left = self.pad * self.stride + (self.kernel_size -
                                             self.stride) // 2
        pad_right = self.pad * self.stride + (self.kernel_size - self.stride +
                                              1) // 2
        x = x[..., pad_left:-pad_right]

LowPassFilter1d.forward()

    #input [B,C,T]
    def forward(self, x):
        B, C, T = x.shape
        if self.padding:
            x = F.pad(x, (self.left_pad, self.right_pad),
                      mode=self.padding_mode)
        # Conv with filter expanded to C with C groups for depthwise op
        out = F.conv1d(x, self.filter.expand(C, -1, -1), stride=self.stride, groups=C) # typo 'groupds' btw
        return out

Could you check the correctness? Thanks again for the implementation!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.