Skip to content

Kaiser FIR Filter

Kaiser FIR Filter¤

neojax.nn.kaiser_fir_filter.KaiserFIRFilter ¤

FIR Filter with Kaiser window.

Computes

\[ h_K(x) = 2 f_c \cdot \text{sinc}(2 f_c x) \cdot w_K(x) \]

where \(w_K(x)\) is the window function, \(f_c\) the cutoff frequency and \(h_K(x)\) is the practical approximation of \(\psi(x)\), the ideal continuous-time low-pass filter (as in appendix C of StyleGAN3 and scipy.signal.firwin).

Part of the filtered leaky ReLU of the CNO.

Parameters:

Name Type Description Default
cutoff_freq float | int

Cutoff frequency \(f_c\) (same unit as sampling_freq). Has to be in the open interval (0, sampling_freq / 2).

required
num_taps int

Discrete spatial locations, i.e. taps, where the filter is defined. Default is 12, as in the CNO configuration.

12
half_band_width float | int

Half-width of the transition band, i.e. \(f_h\). Same as scipy.signal.firwin's width / 2. Default is 0.8.

0.8
sampling_fac int

Up-/ and downsampling factor. Multiplication factor for num_taps and sampling_freq. Needed due to zero-padding or strided sampling. Default is 2.

2
sampling_freq float | int

The sampling frequency or rate \(s\)/\(f_s\). Default is 2.

2.0
normalize bool

Whether to normalize the filter, i.e. enforce \(\sum_i h_{K}\left[i\right] = 1\). Default is True.

True

Raises:

Type Description
ValueError

If cutoff_freq is not in (0, sampling_freq / 2).

Internal Attributes

These fields store the internal layer states.

  • _filter (tuple[float, ...]): The filter stencil.
Cite

Alias-Free Generative Adversarial Networks

@inproceedings{Karras2021,
    author = {Tero Karras and Miika Aittala and
    Samuli Laine and Erik H\"ark\"onen and
    Janne Hellsten and Jaakko Lehtinen and Timo Aila},
    title = {Alias-Free Generative Adversarial Networks},
    booktitle = {Proc. NeurIPS},
    year = {2021}
}
filter property ¤

Assembled static filter stencil tuple with shape (num_taps,).