mmagic.models.editors.swinir.swinir_modules
¶
Module Contents¶
Classes¶
Image to Patch Embedding |
|
Image to Patch Unembedding |
|
Upsample module. |
|
UpsampleOneStep module (the difference with Upsample is that it always |
- class mmagic.models.editors.swinir.swinir_modules.PatchEmbed(img_size=224, patch_size=4, in_chans=3, embed_dim=96, norm_layer=None)[source]¶
Bases:
torch.nn.Module
Image to Patch Embedding :param img_size: Image size. Default: 224. :type img_size: int :param patch_size: Patch token size. Default: 4. :type patch_size: int :param in_chans: Number of input image channels. Default: 3. :type in_chans: int :param embed_dim: Number of linear projection output channels.
Default: 96.
- Parameters
norm_layer (nn.Module, optional) – Normalization layer. Default: None
- class mmagic.models.editors.swinir.swinir_modules.PatchUnEmbed(img_size=224, patch_size=4, in_chans=3, embed_dim=96, norm_layer=None)[source]¶
Bases:
torch.nn.Module
Image to Patch Unembedding :param img_size: Image size. Default: 224. :type img_size: int :param patch_size: Patch token size. Default: 4. :type patch_size: int :param in_chans: Number of input image channels. Default: 3. :type in_chans: int :param embed_dim: Number of linear projection output channels.
Default: 96.
- Parameters
norm_layer (nn.Module, optional) – Normalization layer. Default: None
- class mmagic.models.editors.swinir.swinir_modules.Upsample(scale, num_feat)[source]¶
Bases:
torch.nn.Sequential
Upsample module.
- Parameters
scale (int) – Scale factor. Supported scales: 2^n and 3.
num_feat (int) – Channel number of intermediate features.
- class mmagic.models.editors.swinir.swinir_modules.UpsampleOneStep(scale, num_feat, num_out_ch, input_resolution=None)[source]¶
Bases:
torch.nn.Sequential
UpsampleOneStep module (the difference with Upsample is that it always only has 1conv + 1pixelshuffle) Used in lightweight SR to save parameters.
- Parameters
scale (int) – Scale factor. Supported scales: 2^n and 3.
num_feat (int) – Channel number of intermediate features.
num_out_ch (int) – Channel number for PixelShuffle.
input_resolution (tuple[int], optional) – Input resolution. Default: None