nntoolbox.vision.components.upsample module

class nntoolbox.vision.components.upsample.PixelShuffleConvolutionLayer(in_channels: int, out_channels: int, upscale_factor: int, activation=<class 'torch.nn.modules.activation.ReLU'>, normalization=<class 'torch.nn.modules.batchnorm.BatchNorm2d'>, blur: bool = True)[source]

Bases: torch.nn.modules.container.Sequential

Upsample the image using normal convolution follow by pixel shuffling

References:

initialize_conv(conv, in_channels: int, out_channels: int, upscale_factor: int)[source]

Initialize according to: https://arxiv.org/pdf/1707.02937.pdf :param conv: :param in_channels: :param out_channels: :param upscale_factor: :return:

training: bool
class nntoolbox.vision.components.upsample.ResizeConvolutionalLayer(in_channels, out_channels, activation=<class 'torch.nn.modules.activation.ReLU'>, normalization=<class 'torch.nn.modules.batchnorm.BatchNorm2d'>, mode='bilinear')[source]

Bases: torch.nn.modules.module.Module

Upsample the image (using an interpolation algorithm), then pass to a conv layer

forward(input, out_h, out_w)[source]

Defines 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.

training: bool