MedianFilter

class deepinv.models.MedianFilter(kernel_size=9, padding=0, same=True)[source]

Bases: Module

Median filter.

It computes the median value of a sliding window over the input tensor. The window is defined by the kernel size.

Parameters:
  • kernel_size (int) – size of pooling kernel, int or 2-tuple

  • padding – pool padding, int or 4-tuple (l, r, t, b) as in pytorch F.pad

  • same – override padding and enforce same padding, boolean

forward(x, sigma=None)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Examples using MedianFilter:

Image transforms for equivariance & augmentations

Image transforms for equivariance & augmentations

Building your custom sampling algorithm.

Building your custom sampling algorithm.