code
stringlengths
17
6.64M
@DATASETS.register_module() class AdobeComp1kDataset(BaseMattingDataset): 'Adobe composition-1k dataset.\n\n The dataset loads (alpha, fg, bg) data and apply specified transforms to\n the data. You could specify whether composite merged image online or load\n composited merged image in pipeline.\n\n E...
@DATASETS.register_module() class RepeatDataset(): 'A wrapper of repeated dataset.\n\n The length of repeated dataset will be `times` larger than the original\n dataset. This is useful when the data loading time is long but the dataset\n is small. Using RepeatDataset can reduce the data loading time betw...
@DATASETS.register_module() class GenerationPairedDataset(BaseGenerationDataset): "General paired image folder dataset for image generation.\n\n It assumes that the training directory is '/path/to/data/train'.\n During test time, the directory is '/path/to/data/test'. '/path/to/data'\n can be initialized...
@DATASETS.register_module() class GenerationUnpairedDataset(BaseGenerationDataset): "General unpaired image folder dataset for image generation.\n\n It assumes that the training directory of images from domain A is\n '/path/to/data/trainA', and that from domain B is '/path/to/data/trainB',\n respectively...
@DATASETS.register_module() class ImgInpaintingDataset(BaseDataset): 'Image dataset for inpainting.\n ' def __init__(self, ann_file, pipeline, data_prefix=None, test_mode=False): super().__init__(pipeline, test_mode) self.ann_file = str(ann_file) self.data_prefix = str(data_prefix)...
@DATASETS.register_module() class LDPPQFDataset(BaseSRDataset): 'LDP PQF dataset for compressed video quality enhancement.\n\n The dataset loads three LQ (Low-Quality) frames and a center GT\n (Ground-Truth) frame. Then it applies specified transforms and finally\n returns a dict containing paired data a...
@DATASETS.register_module() class LDPNonPQFDataset(BaseSRDataset): 'LDP non-PQF dataset for compressed video quality enhancement.\n\n The dataset loads three LQ (Low-Quality) frames and a center GT\n (Ground-Truth) frame. Then it applies specified transforms and finally\n returns a dict containing paired...
def get_rotated_sigma_matrix(sig_x, sig_y, theta): 'Calculate the rotated sigma matrix (two dimensional matrix).\n\n Args:\n sig_x (float): Standard deviation along the horizontal direction.\n sig_y (float): Standard deviation along the vertical direction.\n theta (float): Rotation in radi...
def _mesh_grid(kernel_size): 'Generate the mesh grid, centering at zero.\n\n Args:\n kernel_size (int): The size of the kernel.\n\n Returns:\n x_grid (ndarray): x-coordinates with shape (kernel_size, kernel_size).\n y_grid (ndarray): y-coordiantes with shape (kernel_size, kernel_size).\...
def calculate_gaussian_pdf(sigma_matrix, grid): 'Calculate PDF of the bivariate Gaussian distribution.\n\n Args:\n sigma_matrix (ndarray): The variance matrix with shape (2, 2).\n grid (ndarray): Coordinates generated by :func:`_mesh_grid`,\n with shape (K, K, 2), where K is the kernel...
def bivariate_gaussian(kernel_size, sig_x, sig_y=None, theta=None, grid=None, is_isotropic=True): "Generate a bivariate isotropic or anisotropic Gaussian kernel.\n\n In isotropic mode, only `sig_x` is used. `sig_y` and `theta` are\n ignored.\n\n Args:\n kernel_size (int): The size of the kernel\n ...
def bivariate_generalized_gaussian(kernel_size, sig_x, sig_y=None, theta=None, beta=1, grid=None, is_isotropic=True): "Generate a bivariate generalized Gaussian kernel.\n\n Described in `Parameter Estimation For Multivariate Generalized\n Gaussian Distributions` by Pascal et. al (2013). In isotropic mode,\n...
def bivariate_plateau(kernel_size, sig_x, sig_y, theta, beta, grid=None, is_isotropic=True): 'Generate a plateau-like anisotropic kernel.\n\n This kernel has a form of 1 / (1+x^(beta)).\n Ref: https://stats.stackexchange.com/questions/203629/is-there-a-plateau-shaped-distribution # noqa\n In the isotrop...
def random_bivariate_gaussian_kernel(kernel_size, sigma_x_range, sigma_y_range, rotation_range, noise_range=None, is_isotropic=True): 'Randomly generate bivariate isotropic or anisotropic Gaussian kernels.\n\n In the isotropic mode, only `sigma_x_range` is used. `sigma_y_range` and\n `rotation_range` is ign...
def random_bivariate_generalized_gaussian_kernel(kernel_size, sigma_x_range, sigma_y_range, rotation_range, beta_range, noise_range=None, is_isotropic=True): 'Randomly generate bivariate generalized Gaussian kernels.\n\n In the isotropic mode, only `sigma_x_range` is used. `sigma_y_range` and\n `rotation_ra...
def random_bivariate_plateau_kernel(kernel_size, sigma_x_range, sigma_y_range, rotation_range, beta_range, noise_range=None, is_isotropic=True): 'Randomly generate bivariate plateau kernels.\n\n In the isotropic mode, only `sigma_x_range` is used. `sigma_y_range` and\n `rotation_range` is ignored.\n\n Ar...
def random_circular_lowpass_kernel(omega_range, kernel_size, pad_to=0): ' Generate a 2D Sinc filter\n\n Reference: https://dsp.stackexchange.com/questions/58301/2-d-circularly-symmetric-low-pass-filter # noqa\n\n Args:\n omega_range (tuple): The cutoff frequency in radian (pi is max).\n kerne...
def random_mixed_kernels(kernel_list, kernel_prob, kernel_size, sigma_x_range=[0.6, 5], sigma_y_range=[0.6, 5], rotation_range=[(- np.pi), np.pi], beta_gaussian_range=[0.5, 8], beta_plateau_range=[1, 2], omega_range=[0, np.pi], noise_range=None): "Randomly generate a kernel.\n\n\n Args:\n kernel_list (l...
@PIPELINES.register_module() class Compose(): 'Compose a data pipeline with a sequence of transforms.\n\n Args:\n transforms (list[dict | callable]):\n Either config dicts of transforms or transform objects.\n ' def __init__(self, transforms): assert isinstance(transforms, Seq...
def to_tensor(data): 'Convert objects of various python types to :obj:`torch.Tensor`.\n\n Supported types are: :class:`numpy.ndarray`, :class:`torch.Tensor`,\n :class:`Sequence`, :class:`int` and :class:`float`.\n ' if isinstance(data, torch.Tensor): return data if isinstance(data, np.nda...
@PIPELINES.register_module() class ToTensor(): 'Convert some values in results dict to `torch.Tensor` type\n in data loader pipeline.\n\n Args:\n keys (Sequence[str]): Required keys to be converted.\n ' def __init__(self, keys): self.keys = keys def __call__(self, results): ...
@PIPELINES.register_module() class ImageToTensor(): 'Convert image type to `torch.Tensor` type.\n\n Args:\n keys (Sequence[str]): Required keys to be converted.\n to_float32 (bool): Whether convert numpy image array to np.float32\n before converted to tensor. Default: True.\n ' ...
@PIPELINES.register_module() class FramesToTensor(ImageToTensor): 'Convert frames type to `torch.Tensor` type.\n\n It accepts a list of frames, converts each to `torch.Tensor` type and then\n concatenates in a new dimension (dim=0).\n\n Args:\n keys (Sequence[str]): Required keys to be converted.\...
@PIPELINES.register_module() class GetMaskedImage(): "Get masked image.\n\n Args:\n img_name (str): Key for clean image.\n mask_name (str): Key for mask image. The mask shape should be\n (h, w, 1) while '1' indicate holes and '0' indicate valid\n regions.\n " def __i...
@PIPELINES.register_module() class FormatTrimap(): 'Convert trimap (tensor) to one-hot representation.\n\n It transforms the trimap label from (0, 128, 255) to (0, 1, 2). If\n ``to_onehot`` is set to True, the trimap will convert to one-hot tensor of\n shape (3, H, W). Required key is "trimap", added or ...
@PIPELINES.register_module() class Collect(): 'Collect data from the loader relevant to the specific task.\n\n This is usually the last stage of the data loader pipeline. Typically keys\n is set to some subset of "img", "gt_labels".\n\n The "img_meta" item is always populated. The contents of the "meta"...
@PIPELINES.register_module() class Normalize(): 'Normalize images with the given mean and std value.\n\n Required keys are the keys in attribute "keys", added or modified keys are\n the keys in attribute "keys" and these keys with postfix \'_norm_cfg\'.\n It also supports normalizing a list of images.\n\...
@PIPELINES.register_module() class RescaleToZeroOne(): 'Transform the images into a range between 0 and 1.\n\n Required keys are the keys in attribute "keys", added or modified keys are\n the keys in attribute "keys".\n It also supports rescaling a list of images.\n\n Args:\n keys (Sequence[str...
class DistributedSampler(_DistributedSampler): 'DistributedSampler inheriting from `torch.utils.data.DistributedSampler`.\n\n In pytorch of lower versions, there is no `shuffle` argument. This child\n class will port one to DistributedSampler.\n ' def __init__(self, dataset, num_replicas=None, rank=...
@DATASETS.register_module() class SRAnnotationDataset(BaseSRDataset): 'General paired image dataset with an annotation file for image\n restoration.\n\n The dataset loads lq (Low Quality) and gt (Ground-Truth) image pairs,\n applies specified transforms and finally returns a dict containing paired\n d...
@DATASETS.register_module() class SRFacialLandmarkDataset(BaseSRDataset): 'Facial image and landmark dataset with an annotation file for image\n restoration.\n\n The dataset loads gt (Ground-Truth) image, shape of image, face box, and\n landmark. Applies specified transforms and finally returns a dict\n ...
@DATASETS.register_module() class SRFolderDataset(BaseSRDataset): 'General paired image folder dataset for image restoration.\n\n The dataset loads lq (Low Quality) and gt (Ground-Truth) image pairs,\n applies specified transforms and finally returns a dict containing paired\n data and other information....
@DATASETS.register_module() class SRFolderGTDataset(BaseSRDataset): 'General ground-truth image folder dataset for image restoration.\n\n The dataset loads gt (Ground-Truth) image only,\n applies specified transforms and finally returns a dict containing paired\n data and other information.\n\n This i...
@DATASETS.register_module() class SRFolderMultipleGTDataset(BaseSRDataset): "General dataset for video super resolution, used for recurrent networks.\n\n The dataset loads several LQ (Low-Quality) frames and GT (Ground-Truth)\n frames. Then it applies specified transforms and finally returns a dict\n con...
@DATASETS.register_module() class SRFolderRefDataset(BaseSRDataset): '\n General paired image folder dataset for reference-based image restoration.\n\n The dataset loads ref (reference) image pairs\n Must contain: ref (reference)\n Optional: GT (Ground-Truth), LQ (Low Quality), or both\n ...
@DATASETS.register_module() class SRFolderVideoDataset(BaseSRDataset): "General dataset for video SR, used for sliding-window framework.\n\n The dataset loads several LQ (Low-Quality) frames and one GT (Ground-Truth)\n frames. Then it applies specified transforms and finally returns a dict\n containing p...
@DATASETS.register_module() class SRLDVDataset(BaseSRDataset): 'LDV dataset for video super resolution.\n\n The dataset loads several LQ (Low-Quality) frames and a center GT\n (Ground-Truth) frame. Then it applies specified transforms and finally\n returns a dict containing paired data and other informat...
@DATASETS.register_module() class SRLmdbDataset(BaseSRDataset): 'General paired image lmdb dataset for image restoration.\n\n The dataset loads lq (Low Quality) and gt (Ground-Truth) image pairs,\n applies specified transforms and finally returns a dict containing paired\n data and other information.\n\n...
@DATASETS.register_module() class SRREDSDataset(BaseSRDataset): "REDS dataset for video super resolution.\n\n The dataset loads several LQ (Low-Quality) frames and a center GT\n (Ground-Truth) frame. Then it applies specified transforms and finally\n returns a dict containing paired data and other inform...
@DATASETS.register_module() class SRREDSMultipleGTDataset(BaseSRDataset): "REDS dataset for video super resolution for recurrent networks.\n\n The dataset loads several LQ (Low-Quality) frames and GT (Ground-Truth)\n frames. Then it applies specified transforms and finally returns a dict\n containing pai...
@DATASETS.register_module() class SRTestMultipleGTDataset(BaseSRDataset): 'Test dataset for video super resolution for recurrent networks.\n\n It assumes all video sequences under the root directory is used for test.\n\n The dataset loads several LQ (Low-Quality) frames and GT (Ground-Truth)\n frames. Th...
@DATASETS.register_module() class SRVid4Dataset(BaseSRDataset): "Vid4 dataset for video super resolution.\n\n The dataset loads several LQ (Low-Quality) frames and a center GT\n (Ground-Truth) frame. Then it applies specified transforms and finally\n returns a dict containing paired data and other inform...
@DATASETS.register_module() class SRVimeo90KDataset(BaseSRDataset): 'Vimeo90K dataset for video super resolution.\n\n The dataset loads several LQ (Low-Quality) frames and a center GT\n (Ground-Truth) frame. Then it applies specified transforms and finally\n returns a dict containing paired data and othe...
@DATASETS.register_module() class SRVimeo90KMultipleGTDataset(BaseSRDataset): 'Vimeo90K dataset for video super resolution for recurrent networks.\n\n The dataset loads several LQ (Low-Quality) frames and GT (Ground-Truth)\n frames. Then it applies specified transforms and finally returns a dict\n contai...
@DATASETS.register_module() class VFIVimeo90KDataset(BaseVFIDataset): 'Vimeo90K dataset for video frame interpolation.\n\n The dataset loads two input frames and a center GT (Ground-Truth) frame.\n Then it applies specified transforms and finally returns a dict containing\n paired data and other informat...
@BACKBONES.register_module() class AOTEncoderDecoder(GLEncoderDecoder): 'Encoder-Decoder used in AOT-GAN model.\n\n This implementation follows:\n Aggregated Contextual Transformations for High-Resolution Image Inpainting\n The architecture of the encoder-decoder is:\n (conv2d x 3) --> (dilated co...
@COMPONENTS.register_module() class AOTDecoder(nn.Module): 'Decoder used in AOT-GAN model.\n\n This implementation follows:\n Aggregated Contextual Transformations for High-Resolution Image Inpainting\n\n Args:\n in_channels (int, optional): Channel number of input feature.\n Default: 2...
@COMPONENTS.register_module() class DeepFillDecoder(nn.Module): 'Decoder used in DeepFill model.\n\n This implementation follows:\n Generative Image Inpainting with Contextual Attention\n\n Args:\n in_channels (int): The number of input channels.\n conv_type (str): The type of conv module. ...
@COMPONENTS.register_module() class GLDecoder(nn.Module): 'Decoder used in Global&Local model.\n\n This implementation follows:\n Globally and locally Consistent Image Completion\n\n Args:\n in_channels (int): Channel number of input feature.\n norm_cfg (dict): Config dict to build norm lay...
class IndexedUpsample(nn.Module): "Indexed upsample module.\n\n Args:\n in_channels (int): Input channels.\n out_channels (int): Output channels.\n kernel_size (int, optional): Kernel size of the convolution layer.\n Defaults to 5.\n norm_cfg (dict, optional): Config dict...
@COMPONENTS.register_module() class IndexNetDecoder(nn.Module): def __init__(self, in_channels, kernel_size=5, norm_cfg=dict(type='BN'), separable_conv=False): super().__init__() if separable_conv: conv_module = DepthwiseSeparableConvModule else: conv_module = Conv...
@COMPONENTS.register_module() class PConvDecoder(nn.Module): "Decoder with partial conv.\n\n About the details for this architecture, pls see:\n Image Inpainting for Irregular Holes Using Partial Convolutions\n\n Args:\n num_layers (int): The number of convolutional layers. Default: 7.\n in...
class MaxUnpool2dop(Function): 'We warp the `torch.nn.functional.max_unpool2d`\n with an extra `symbolic` method, which is needed while exporting to ONNX.\n Users should not call this function directly.\n ' @staticmethod def forward(ctx, input, indices, kernel_size, stride, padding, output_size)...
class MaxUnpool2d(_MaxUnpoolNd): 'This module is modified from Pytorch `MaxUnpool2d` module.\n Args:\n kernel_size (int or tuple): Size of the max pooling window.\n stride (int or tuple): Stride of the max pooling window.\n Default: None (It is set to `kernel_size` by default).\n paddin...
@COMPONENTS.register_module() class PlainDecoder(nn.Module): 'Simple decoder from Deep Image Matting.\n\n Args:\n in_channels (int): Channel num of input features.\n ' def __init__(self, in_channels): super().__init__() self.deconv6_1 = nn.Conv2d(in_channels, 512, kernel_size=1) ...
class BasicBlockDec(BasicBlock): 'Basic residual block for decoder.\n\n For decoder, we use ConvTranspose2d with kernel_size 4 and padding 1 for\n conv1. And the output channel of conv1 is modified from `out_channels` to\n `in_channels`.\n ' def build_conv1(self, in_channels, out_channels, kernel...
@COMPONENTS.register_module() class ResNetDec(nn.Module): 'ResNet decoder for image matting.\n\n This class is adopted from https://github.com/Yaoyi-Li/GCA-Matting.\n\n Args:\n block (str): Type of residual block. Currently only `BasicBlockDec` is\n implemented.\n layers (list[int])...
@COMPONENTS.register_module() class ResShortcutDec(ResNetDec): 'ResNet decoder for image matting with shortcut connection.\n\n ::\n\n feat1 --------------------------- conv2 --- out\n |\n feat2 ---------------------- conv1\n |...
@COMPONENTS.register_module() class ResGCADecoder(ResShortcutDec): 'ResNet decoder with shortcut connection and gca module.\n\n ::\n\n feat1 ---------------------------------------- conv2 --- out\n |\n feat2 ----------------------------------- co...
@COMPONENTS.register_module() class AOTEncoder(nn.Module): 'Encoder used in AOT-GAN model.\n\n This implementation follows:\n Aggregated Contextual Transformations for High-Resolution Image Inpainting\n\n Args:\n in_channels (int, optional): Channel number of input feature.\n Default: 4...
@COMPONENTS.register_module() class DeepFillEncoder(nn.Module): 'Encoder used in DeepFill model.\n\n This implementation follows:\n Generative Image Inpainting with Contextual Attention\n\n Args:\n in_channels (int): The number of input channels. Default: 5.\n conv_type (str): The type of c...
@COMPONENTS.register_module() class GLEncoder(nn.Module): 'Encoder used in Global&Local model.\n\n This implementation follows:\n Globally and locally Consistent Image Completion\n\n Args:\n norm_cfg (dict): Config dict to build norm layer.\n act_cfg (dict): Config dict for activation layer...
def build_index_block(in_channels, out_channels, kernel_size, stride=2, padding=0, groups=1, norm_cfg=dict(type='BN'), use_nonlinear=False, expansion=1): "Build an conv block for IndexBlock.\n\n Args:\n in_channels (int): The input channels of the block.\n out_channels (int): The output channels ...
class HolisticIndexBlock(nn.Module): "Holistic Index Block.\n\n From https://arxiv.org/abs/1908.00672.\n\n Args:\n in_channels (int): Input channels of the holistic index block.\n kernel_size (int): Kernel size of the conv layers. Default: 2.\n padding (int): Padding number of the conv ...
class DepthwiseIndexBlock(nn.Module): "Depthwise index block.\n\n From https://arxiv.org/abs/1908.00672.\n\n Args:\n in_channels (int): Input channels of the holistic index block.\n kernel_size (int): Kernel size of the conv layers. Default: 2.\n padding (int): Padding number of the con...
class InvertedResidual(nn.Module): 'Inverted residual layer for indexnet encoder.\n\n It basically is a depthwise separable conv module. If `expand_ratio` is not\n one, then a conv module of kernel_size 1 will be inserted to change the\n input channels to `in_channels * expand_ratio`.\n\n Args:\n ...
@COMPONENTS.register_module() class IndexNetEncoder(nn.Module): "Encoder for IndexNet.\n\n Please refer to https://arxiv.org/abs/1908.00672.\n\n Args:\n in_channels (int, optional): Input channels of the encoder.\n out_stride (int, optional): Output stride of the encoder. For\n exam...
@COMPONENTS.register_module() class PConvEncoder(nn.Module): "Encoder with partial conv.\n\n About the details for this architecture, pls see:\n Image Inpainting for Irregular Holes Using Partial Convolutions\n\n Args:\n in_channels (int): The number of input channels. Default: 3.\n num_lay...
class BasicBlock(nn.Module): 'Basic block for ResNet.' expansion = 1 def __init__(self, inplanes, planes, stride=1, dilation=1, downsample=None, act_cfg=dict(type='ReLU'), conv_cfg=None, norm_cfg=dict(type='BN'), with_cp=False): super(BasicBlock, self).__init__() (self.norm1_name, norm1) ...
class Bottleneck(nn.Module): 'Bottleneck block for ResNet.' expansion = 4 def __init__(self, inplanes, planes, stride=1, dilation=1, downsample=None, act_cfg=dict(type='ReLU'), conv_cfg=None, norm_cfg=dict(type='BN'), with_cp=False): super(Bottleneck, self).__init__() self.inplanes = inpl...
class ResNet(nn.Module): 'General ResNet.\n\n This class is adopted from\n https://github.com/open-mmlab/mmsegmentation/blob/master/mmseg/models/backbones/resnet.py.\n\n Args:\n depth (int): Depth of resnet, from {18, 34, 50, 101, 152}.\n in_channels (int): Number of input image channels. D...
@COMPONENTS.register_module() class VGG16(nn.Module): 'Customized VGG16 Encoder.\n\n A 1x1 conv is added after the original VGG16 conv layers. The indices of\n max pooling layers are returned for unpooling layers in decoders.\n\n Args:\n in_channels (int): Number of input channels.\n batch_...
@BACKBONES.register_module() class GLEncoderDecoder(nn.Module): 'Encoder-Decoder used in Global&Local model.\n\n This implementation follows:\n Globally and locally Consistent Image Completion\n\n The architecture of the encoder-decoder is: (conv2d x 6) --> (dilated conv2d x 4) --> (conv2d or deco...
@COMPONENTS.register_module() class AOTBlockNeck(nn.Module): 'Dilation backbone used in AOT-GAN model.\n\n This implementation follows:\n Aggregated Contextual Transformations for High-Resolution Image Inpainting\n\n Args:\n in_channels (int, optional): Channel number of input feature.\n ...
class AOTBlock(nn.Module): 'AOT Block which constitutes the dilation backbone.\n\n This implementation follows:\n Aggregated Contextual Transformations for High-Resolution Image Inpainting\n\n The AOT Block adopts the split-transformation-merge strategy:\n Splitting: A kernel with 256 output channels ...
@COMPONENTS.register_module() class ContextualAttentionNeck(nn.Module): "Neck with contextual attention module.\n\n Args:\n in_channels (int): The number of input channels.\n conv_type (str): The type of conv module. In DeepFillv1 model, the\n `conv_type` should be 'conv'. In DeepFillv...
@COMPONENTS.register_module() class GLDilationNeck(nn.Module): 'Dilation Backbone used in Global&Local model.\n\n This implementation follows:\n Globally and locally Consistent Image Completion\n\n Args:\n in_channels (int): Channel number of input feature.\n conv_type (str): The type of co...
@BACKBONES.register_module() class PConvEncoderDecoder(nn.Module): 'Encoder-Decoder with partial conv module.\n\n Args:\n encoder (dict): Config of the encoder.\n decoder (dict): Config of the decoder.\n ' def __init__(self, encoder, decoder): super().__init__() self.encod...
@BACKBONES.register_module() class SimpleEncoderDecoder(nn.Module): 'Simple encoder-decoder model from matting.\n\n Args:\n encoder (dict): Config of the encoder.\n decoder (dict): Config of the decoder.\n ' def __init__(self, encoder, decoder): super().__init__() self.enc...
@BACKBONES.register_module() class ResnetGenerator(nn.Module): "Construct a Resnet-based generator that consists of residual blocks\n between a few downsampling/upsampling operations.\n\n Args:\n in_channels (int): Number of channels in input images.\n out_channels (int): Number of channels in...
@BACKBONES.register_module() class UnetGenerator(nn.Module): "Construct the Unet-based generator from the innermost layer to the\n outermost layer, which is a recursive process.\n\n Args:\n in_channels (int): Number of channels in input images.\n out_channels (int): Number of channels in outpu...
@BACKBONES.register_module() class ARCNN(nn.Module): 'ARCNN network structure.\n\n Paper: https://arxiv.org/pdf/1504.06993.pdf\n\n Args:\n in_channels (int): Channel number of inputs.\n Default: 3.\n mid_channels_1 (int): Channel number of the first intermediate\n feature...
@BACKBONES.register_module() class CBDNet(nn.Module): 'CBDNet network structure.\n\n Args:\n in_channels (int): Channel number of inputs.\n Default: 3.\n mid_channels_1 (int): Channel number of the first intermediate\n features.\n Default: 64.\n mid_channel...
@BACKBONES.register_module() class DCAD(nn.Module): 'DCAD network structure.\n\n Paper: https://ieeexplore.ieee.org/document/7923714\n\n Args:\n in_channels (int): Channel number of inputs.\n out_channels (int): Channel number of outputs.\n mid_channels (int): Channel number of intermed...
class FeedbackBlock(nn.Module): 'Feedback Block of DIC\n\n It has a style of:\n\n ::\n ----- Module ----->\n ^ |\n |____________|\n\n Args:\n mid_channels (int): Number of channels in the intermediate features.\n num_blocks (int): Number of blocks.\n ...
class FeedbackBlockCustom(FeedbackBlock): 'Custom feedback block, will be used as the first feedback block.\n\n Args:\n in_channels (int): Number of channels in the input features.\n mid_channels (int): Number of channels in the intermediate features.\n num_blocks (int): Number of blocks.\...
class GroupResBlock(nn.Module): 'ResBlock with Group Conv.\n\n Args:\n in_channels (int): Channel number of input features.\n out_channels (int): Channel number of output features.\n mid_channels (int): Channel number of intermediate features.\n groups (int): Number of blocked conne...
class FeatureHeatmapFusingBlock(nn.Module): ' Fusing Feature and Heatmap.\n\n Args:\n in_channels (int): Number of channels in the input features.\n num_heatmaps (int): Number of heatmap.\n num_blocks (int): Number of blocks.\n mid_channels (int | None): Number of channels in the in...
class FeedbackBlockHeatmapAttention(FeedbackBlock): 'Feedback block with HeatmapAttention.\n\n Args:\n in_channels (int): Number of channels in the input features.\n mid_channels (int): Number of channels in the intermediate features.\n num_blocks (int): Number of blocks.\n upscale_...
@BACKBONES.register_module() class DICNet(nn.Module): 'DIC network structure for face super-resolution.\n\n Paper: Deep Face Super-Resolution with Iterative Collaboration between\n Attentive Recovery and Landmark Estimation\n\n Args:\n in_channels (int): Number of channels in the input image\n...
@BACKBONES.register_module() class DnCNN(nn.Module): 'DnCNN network structure.\n\n Args:\n in_channels (int): Channel number of inputs.\n out_channels (int): Channel number of outputs.\n mid_channels (int): Channel number of intermediate features.\n Default: 64.\n num_blo...
class DynamicUpsamplingFilter(nn.Module): 'Dynamic upsampling filter used in DUF.\n\n Ref: https://github.com/yhjo09/VSR-DUF.\n It only supports input with 3 channels. And it applies the same filters\n to 3 channels.\n\n Args:\n filter_size (tuple): Filter size of generated filters.\n ...
class UpsampleModule(nn.Sequential): 'Upsample module used in EDSR.\n\n Args:\n scale (int): Scale factor. Supported scales: 2^n and 3.\n mid_channels (int): Channel number of intermediate features.\n ' def __init__(self, scale, mid_channels): modules = [] if ((scale & (sc...
@BACKBONES.register_module() class EDSR(nn.Module): 'EDSR network structure.\n\n Paper: Enhanced Deep Residual Networks for Single Image Super-Resolution.\n Ref repo: https://github.com/thstkdgus35/EDSR-PyTorch\n\n Args:\n in_channels (int): Channel number of inputs.\n out_channels (int): C...
class ResidualDenseBlock(nn.Module): 'Residual Dense Block.\n\n Used in RRDB block in ESRGAN.\n\n Args:\n mid_channels (int): Channel number of intermediate features.\n growth_channels (int): Channels for each growth.\n ' def __init__(self, mid_channels=64, growth_channels=32): ...
class RRDB(nn.Module): 'Residual in Residual Dense Block.\n\n Used in RRDB-Net in ESRGAN.\n\n Args:\n mid_channels (int): Channel number of intermediate features.\n growth_channels (int): Channels for each growth.\n ' def __init__(self, mid_channels, growth_channels=32): super(...
@BACKBONES.register_module() class RRDBNet(nn.Module): 'Networks consisting of Residual in Residual Dense Block, which is used\n in ESRGAN and Real-ESRGAN.\n\n ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks.\n Real-ESRGAN: Training Real-World Blind Super-Resolution with Pure Synthetic ...
@BACKBONES.register_module() class MSRResNet(nn.Module): 'Modified SRResNet.\n\n A compacted version modified from SRResNet in "Photo-Realistic Single\n Image Super-Resolution Using a Generative Adversarial Network".\n\n It uses residual blocks without BN, similar to EDSR.\n Currently, it supports x2,...
@BACKBONES.register_module() class SRCNN(nn.Module): 'SRCNN network structure for image super resolution.\n\n SRCNN has three conv layers. For each layer, we can define the\n `in_channels`, `out_channels` and `kernel_size`.\n The input image will first be upsampled with a bicubic upsampler, and then\n ...
class SFE(nn.Module): 'Structural Feature Encoder\n\n Backbone of Texture Transformer Network for Image Super-Resolution.\n\n Args:\n in_channels (int): Number of channels in the input image\n mid_channels (int): Channel number of intermediate features\n num_blocks (int): Block number i...