basicsr.archs.ridnet_arch¶
- class basicsr.archs.ridnet_arch.ChannelAttention(mid_channels, squeeze_factor=16)[source]¶
Bases:
Module
Channel attention.
- Parameters:
num_feat (int) – Channel number of intermediate features.
squeeze_factor (int) – Channel squeeze factor. Default:
- forward(x)[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¶
- class basicsr.archs.ridnet_arch.EAM(in_channels, mid_channels, out_channels)[source]¶
Bases:
Module
Enhancement attention modules (EAM) in RIDNet.
This module contains a merge-and-run unit, a residual block, an enhanced residual block and a feature attention unit.
- merge¶
The merge-and-run unit.
- block1¶
The residual block.
- block2¶
The enhanced residual block.
- ca¶
The feature/channel attention unit.
- forward(x)[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¶
- class basicsr.archs.ridnet_arch.EResidualBlockNoBN(in_channels, out_channels)[source]¶
Bases:
Module
Enhanced Residual block without BN.
There are three convolution layers in residual branch.
- forward(x)[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¶
- class basicsr.archs.ridnet_arch.MeanShift(rgb_range, rgb_mean, rgb_std, sign=-1, requires_grad=True)[source]¶
Bases:
Conv2d
Data normalization with mean and std.
- Parameters:
rgb_range (int) – Maximum value of RGB.
rgb_mean (list[float]) – Mean for RGB channels.
rgb_std (list[float]) – Std for RGB channels.
sign (int) – For subtraction, sign is -1, for addition, sign is 1. Default: -1.
requires_grad (bool) – Whether to update the self.weight and self.bias. Default: True.
- bias: Tensor | None¶
- dilation: Tuple[int, ...]¶
- groups: int¶
- in_channels: int¶
- kernel_size: Tuple[int, ...]¶
- out_channels: int¶
- output_padding: Tuple[int, ...]¶
- padding: str | Tuple[int, ...]¶
- padding_mode: str¶
- stride: Tuple[int, ...]¶
- transposed: bool¶
- weight: Tensor¶
- class basicsr.archs.ridnet_arch.MergeRun(in_channels, out_channels, kernel_size=3, stride=1, padding=1)[source]¶
Bases:
Module
Merge-and-run unit.
This unit contains two branches with different dilated convolutions, followed by a convolution to process the concatenated features.
Paper: Real Image Denoising with Feature Attention Ref git repo: https://github.com/saeed-anwar/RIDNet
- forward(x)[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¶
- class basicsr.archs.ridnet_arch.RIDNet(in_channels, mid_channels, out_channels, num_block=4, img_range=255.0, rgb_mean=(0.4488, 0.4371, 0.404), rgb_std=(1.0, 1.0, 1.0))[source]¶
Bases:
Module
RIDNet: Real Image Denoising with Feature Attention.
Ref git repo: https://github.com/saeed-anwar/RIDNet
- Parameters:
in_channels (int) – Channel number of inputs.
mid_channels (int) – Channel number of EAM modules. Default: 64.
out_channels (int) – Channel number of outputs.
num_block (int) – Number of EAM. Default: 4.
img_range (float) – Image range. Default: 255.
rgb_mean (tuple[float]) – Image mean in RGB orders. Default: (0.4488, 0.4371, 0.4040), calculated from DIV2K dataset.
- forward(x)[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¶