mridc.collections.reconstruction.models.mwcnn package

Submodules

mridc.collections.reconstruction.models.mwcnn.mwcnn module

class mridc.collections.reconstruction.models.mwcnn.mwcnn.ConvBlock(in_channels: int, out_channels: int, kernel_size: int, bias: bool = True, batchnorm: bool = False, activation: Module = ReLU(inplace=True), scale: Optional[float] = 1.0)[source]

Bases: Module

Convolution Block for MWCNN as implemented in Liu, Pengju, et al.

References

Liu, Pengju, et al. “Multi-Level Wavelet-CNN for Image Restoration.” ArXiv:1805.07071 [Cs], May 2018. arXiv.org, http://arxiv.org/abs/1805.07071.

forward(x: Tensor) Tensor[source]

Performs forward pass of ConvBlock.

Parameters

x (Input with shape (N, C, H, W).) –

Return type

Output with shape (N, C’, H’, W’).

training: bool
class mridc.collections.reconstruction.models.mwcnn.mwcnn.DWT[source]

Bases: Module

2D Discrete Wavelet Transform as implemented in Liu, Pengju, et al.

References

Liu, Pengju, et al. “Multi-Level Wavelet-CNN for Image Restoration.” ArXiv:1805.07071 [Cs], May 2018. arXiv.org, http://arxiv.org/abs/1805.07071.

static forward(x: Tensor) Tensor[source]

Computes DWT(x) given tensor x.

Parameters

x (Input tensor.) –

Return type

DWT of x.

training: bool
class mridc.collections.reconstruction.models.mwcnn.mwcnn.DilatedConvBlock(in_channels: int, dilations: Tuple[int, int], kernel_size: int, out_channels: Optional[int] = None, bias: bool = True, batchnorm: bool = False, activation: Module = ReLU(inplace=True), scale: Optional[float] = 1.0)[source]

Bases: Module

Double dilated Convolution Block fpr MWCNN as implemented in Liu, Pengju, et al.

References

Liu, Pengju, et al. “Multi-Level Wavelet-CNN for Image Restoration.” ArXiv:1805.07071 [Cs], May 2018. arXiv.org, http://arxiv.org/abs/1805.07071.

forward(x: Tensor) Tensor[source]

Performs forward pass of DilatedConvBlock.

Parameters

x (Input with shape (N, C, H, W).) –

Return type

Output with shape (N, C’, H’, W’).

training: bool
class mridc.collections.reconstruction.models.mwcnn.mwcnn.IWT[source]

Bases: Module

2D Inverse Wavelet Transform as implemented in Liu, Pengju, et al.

References

Liu, Pengju, et al. “Multi-Level Wavelet-CNN for Image Restoration.” ArXiv:1805.07071 [Cs], May 2018. arXiv.org, http://arxiv.org/abs/1805.07071.

forward(x: Tensor) Tensor[source]

Computes IWT(x) given tensor x.

Parameters

x (Input tensor.) –

Return type

IWT of x.

training: bool
class mridc.collections.reconstruction.models.mwcnn.mwcnn.MWCNN(input_channels: int, first_conv_hidden_channels: int, num_scales: int = 4, bias: bool = True, batchnorm: bool = False, activation: Module = ReLU(inplace=True))[source]

Bases: Module

Multi-level Wavelet CNN (MWCNN) implementation as implemented in Liu, Pengju, et al.

References

Liu, Pengju, et al. “Multi-Level Wavelet-CNN for Image Restoration.” ArXiv:1805.07071 [Cs], May 2018. arXiv.org, http://arxiv.org/abs/1805.07071.

static crop_to_shape(x, shape)[source]

Crop the input to the given shape.

Parameters
  • x (Input tensor.) –

  • shape (Tuple of (height, width).) –

Return type

Cropped tensor.

forward(input_tensor: Tensor, res: bool = False) Tensor[source]

Computes forward pass of MWCNN.

Parameters
  • input_tensor (Input tensor.) – torch.tensor

  • res (If True, residual connection is applied to the output.) – bool, Default: False.

Return type

Output tensor.

static pad(x)[source]

Pad the input with zeros.

Parameters

x (Input tensor.) –

Return type

Padded tensor.

training: bool

Module contents