repo stringlengths 1 99 | file stringlengths 13 215 | code stringlengths 12 59.2M | file_length int64 12 59.2M | avg_line_length float64 3.82 1.48M | max_line_length int64 12 2.51M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
AdaInt | AdaInt-main/mmedit/models/components/refiners/deepfill_refiner.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmedit.models.builder import build_component
from mmedit.models.registry import COMPONENTS
@COMPONENTS.register_module()
class DeepFillRefiner(nn.Module):
"""Refiner used in DeepFill model.
... | 2,844 | 36.434211 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/components/refiners/mlp_refiner.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.runner import load_checkpoint
from mmedit.models.registry import COMPONENTS
from mmedit.utils import get_root_logger
@COMPONENTS.register_module()
class MLPRefiner(nn.Module):
"""Multilayer perceptrons (MLPs), refiner used in LIIF.
... | 1,887 | 30.466667 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/components/refiners/plain_refiner.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn.utils.weight_init import xavier_init
from mmedit.models.registry import COMPONENTS
@COMPONENTS.register_module()
class PlainRefiner(nn.Module):
"""Simple refiner from Deep Image Matting.
Args:
conv_chann... | 1,848 | 31.438596 | 77 | py |
AdaInt | AdaInt-main/mmedit/models/components/discriminators/light_cnn.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.runner import load_checkpoint
from mmedit.models.registry import COMPONENTS
from mmedit.utils import get_root_logger
class MaxFeature(nn.Module):
"""Conv2d or Linear layer with max feature selector
Generate feature ... | 4,156 | 31.732283 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/components/discriminators/multi_layer_disc.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.runner import load_checkpoint
from mmedit.models.common import LinearModule
from mmedit.models.registry import COMPONENTS
from mmedit.utils import get_root_logger
@COMPONENTS.register_module()
class MultiL... | 6,522 | 37.370588 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/components/discriminators/patch_disc.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule, build_conv_layer
from mmcv.runner import load_checkpoint
from mmedit.models.common import generation_init_weights
from mmedit.models.registry import COMPONENTS
from mmedit.utils import get_root_logger
@COMPONENTS.r... | 4,809 | 34.62963 | 77 | py |
AdaInt | AdaInt-main/mmedit/models/components/discriminators/deepfill_disc.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import normal_init
from mmcv.runner import load_checkpoint
from mmedit.models import build_component
from mmedit.models.registry import COMPONENTS
from mmedit.utils import get_root_logger
@COMPONENTS.register_module()
class DeepFillv... | 2,465 | 34.228571 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/components/discriminators/ttsr_disc.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.runner import load_checkpoint
from mmedit.models.registry import COMPONENTS
from mmedit.utils import get_root_logger
@COMPONENTS.register_module()
class TTSRDiscriminator(nn.Module):
"""A discriminator for TTSR.
Args:
in... | 2,341 | 33.441176 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/components/discriminators/gl_disc.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.runner import load_checkpoint
from mmedit.models.registry import COMPONENTS
from mmedit.utils import get_root_logger
from .multi_layer_disc import MultiLayerDiscriminator
@COMPONENTS.register_module()
class GLDiscs(nn.Module... | 2,385 | 33.57971 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/components/discriminators/modified_vgg.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.runner import load_checkpoint
from mmedit.models.registry import COMPONENTS
from mmedit.utils import get_root_logger
@COMPONENTS.register_module()
class ModifiedVGG(nn.Module):
"""A modified VGG discriminator with input size 128 x 12... | 4,504 | 36.857143 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/mattors/base_mattor.py | # Copyright (c) OpenMMLab. All rights reserved.
import logging
import os.path as osp
from abc import abstractmethod
from pathlib import Path
import mmcv
import numpy as np
from mmcv import ConfigDict
from mmcv.utils import print_log
from mmedit.core.evaluation import connectivity, gradient_error, mse, sad
from ..base... | 10,076 | 36.460967 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/mattors/utils.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
def get_unknown_tensor(trimap, meta):
"""Get 1-channel unknown area tensor from the 3 or 1-channel trimap tensor.
Args:
trimap (Tensor): Tensor with shape (N, 3, H, W) or (N, 1, H, W).
Returns:
Tensor: Unknown area mask of shap... | 1,878 | 31.964912 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/mattors/gca.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.runner import auto_fp16
from ..builder import build_loss
from ..registry import MODELS
from .base_mattor import BaseMattor
from .utils import get_unknown_tensor
@MODELS.register_module()
class GCA(BaseMattor):
"""Guided Contextual Attention i... | 4,173 | 38.377358 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/mattors/indexnet.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.runner import auto_fp16
from ..builder import build_loss
from ..registry import MODELS
from .base_mattor import BaseMattor
from .utils import get_unknown_tensor
@MODELS.register_module()
class IndexNet(BaseMattor):
"""IndexNet matting model.
... | 4,642 | 39.025862 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/mattors/dim.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.runner import auto_fp16
from ..builder import build_loss
from ..registry import MODELS
from .base_mattor import BaseMattor
from .utils import get_unknown_tensor
@MODELS.register_module()
class DIM(BaseMattor):
"""Deep Image Matting model.
... | 6,584 | 40.15625 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/synthesizers/pix2pix.py | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import mmcv
import numpy as np
import torch
from mmcv.runner import auto_fp16
from mmedit.core import tensor2img
from ..base import BaseModel
from ..builder import build_backbone, build_component, build_loss
from ..common import set_requires_grad
f... | 12,394 | 35.031977 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/synthesizers/cycle_gan.py | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import mmcv
import numpy as np
import torch.nn as nn
from mmcv.parallel import MMDistributedDataParallel
from mmcv.runner import auto_fp16
from mmedit.core import tensor2img
from ..base import BaseModel
from ..builder import build_backbone, build_c... | 17,833 | 36.864119 | 80 | py |
AdaInt | AdaInt-main/mmedit/models/transformers/search_transformer.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmedit.models.registry import COMPONENTS
@COMPONENTS.register_module()
class SearchTransformer(nn.Module):
"""Search texture reference by transformer.
Include relevance embedding, hard-att... | 3,859 | 33.159292 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/losses/pixelwise_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from ..registry import LOSSES
from .utils import masked_loss
_reduction_modes = ['none', 'mean', 'sum']
@masked_loss
def l1_loss(pred, target):
"""L1 loss.
Args:
pred (Tensor): Predict... | 7,356 | 32.13964 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/losses/feature_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.runner import load_checkpoint
from mmedit.models.components.discriminators import LightCNN
from mmedit.utils import get_root_logger
from ..registry import LOSSES
class LightCNNFeature(nn.Module):
"""Feature of LightCNN.
... | 2,913 | 29.354167 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/losses/gradient_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from ..registry import LOSSES
from .pixelwise_loss import l1_loss
_reduction_modes = ['none', 'mean', 'sum']
@LOSSES.register_module()
class GradientLoss(nn.Module):
"""Gradient loss.
Args:
... | 1,971 | 35.518519 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/losses/utils.py | # Copyright (c) OpenMMLab. All rights reserved.
import functools
import torch.nn.functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Returns:
Tensor: R... | 3,743 | 31.275862 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/losses/gan_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.autograd as autograd
import torch.nn as nn
from ..registry import LOSSES
@LOSSES.register_module()
class GANLoss(nn.Module):
"""Define GAN loss.
Args:
gan_type (str): Support 'vanilla', 'lsgan', 'wgan', 'hinge'.
real_l... | 5,851 | 29.164948 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/losses/composition_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from ..registry import LOSSES
from .pixelwise_loss import charbonnier_loss, l1_loss, mse_loss
_reduction_modes = ['none', 'mean', 'sum']
@LOSSES.register_module()
class L1CompositionLoss(nn.Module):
"""L1 composition loss.
Args:
... | 6,647 | 41.343949 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/losses/perceptual_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torchvision.models.vgg as vgg
from mmcv.runner import load_checkpoint
from torch.nn import functional as F
from mmedit.utils import get_root_logger
from ..registry import LOSSES
class PerceptualVGG(nn.Module):
"""VGG networ... | 9,372 | 34.236842 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/two_stage_encoder_decoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import constant_init, normal_init
from mmcv.runner import auto_fp16, load_checkpoint
from mmcv.utils.parrots_wrapper import _BatchNorm
from mmedit.models.builder import build_backbone, build_component
from mmedit.models.re... | 3,656 | 36.701031 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/pconv_encoder_decoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.runner import auto_fp16, load_checkpoint
from mmedit.models.builder import build_component
from mmedit.models.registry import BACKBONES
from mmedit.utils import get_root_logger
@BACKBONES.register_module()
class PConvEncoderDecoder(nn.Mo... | 1,809 | 30.206897 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/gl_encoder_decoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.runner import auto_fp16, load_checkpoint
from mmedit.models.builder import build_component
from mmedit.models.registry import BACKBONES
from mmedit.utils import get_root_logger
@BACKBONES.register_module()
class GLEncoderDecoder(nn.Modul... | 2,246 | 30.647887 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/simple_encoder_decoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmedit.models.builder import build_component
from mmedit.models.registry import BACKBONES
@BACKBONES.register_module()
class SimpleEncoderDecoder(nn.Module):
"""Simple encoder-decoder model from matting.
Args:
encoder (dict):... | 1,056 | 26.815789 | 62 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/decoders/pconv_decoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmedit.models.common import MaskConvModule
from mmedit.models.registry import COMPONENTS
@COMPONENTS.register_module()
class PConvDecoder(nn.Module):
"""Decoder with partial conv.
About th... | 3,632 | 29.788136 | 77 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/decoders/gl_decoder.py | # Copyright (c) OpenMMLab. All rights reserved.
from functools import partial
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmedit.models.registry import COMPONENTS
@COMPONENTS.register_module()
class GLDecoder(nn.Module):
"""Decoder used in Global&Local model.
This implementation... | 3,067 | 26.392857 | 76 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/decoders/indexnet_decoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, kaiming_init, normal_init
from mmedit.models.common import DepthwiseSeparableConvModule
from mmedit.models.registry import COMPONENTS
class IndexedUpsample(... | 4,517 | 31.271429 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/decoders/plain_decoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn.utils.weight_init import xavier_init
from torch.autograd import Function
from torch.nn.modules.pooling import _MaxUnpoolNd
from torch.nn.modules.utils import _pair
from mmedit.models.registr... | 7,874 | 35.971831 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/decoders/resnet_dec.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule, constant_init
from mmedit.models.common import GCAModule
from mmedit.models.registry import COMPONENTS
from ..encoders.resnet_enc import BasicBlock
class BasicBlockDec(BasicBlock):
"""Basic residual block for d... | 13,932 | 35.283854 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/decoders/fba_decoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, constant_init, kaiming_init
from mmcv.runner import load_checkpoint
from mmcv.utils.parrots_wrapper import _BatchNorm
from mmedit.models.registry import COMPONENTS
from mmedit.utils import get_root_logge... | 7,073 | 32.84689 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/decoders/deepfill_decoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from functools import partial
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, build_activation_layer
from mmedit.models.common import SimpleGatedConvModule
from mmedit.models.registry import COMPONENTS
@C... | 3,506 | 33.722772 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/necks/gl_dilation.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmedit.models.common import SimpleGatedConvModule
from mmedit.models.registry import COMPONENTS
@COMPONENTS.register_module()
class GLDilationNeck(nn.Module):
"""Dilation Backbone used in Global&Local model... | 2,029 | 31.741935 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/necks/contextual_attention_neck.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmedit.models.common import SimpleGatedConvModule
from mmedit.models.common.contextual_attention import ContextualAttentionModule
from mmedit.models.registry import COMPONENTS
@COMPONENTS.register_module()
clas... | 2,544 | 32.933333 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/encoders/resnet.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import (build_activation_layer, build_conv_layer,
build_norm_layer, constant_init, kaiming_init)
from mmcv.runner import load_checkpoint
from mmcv.utils.parrots_wrapper import _B... | 16,103 | 32.690377 | 94 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/encoders/vgg.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn.utils.weight_init import constant_init, xavier_init
from mmcv.runner import load_checkpoint
from mmedit.models.common import ASPP
from mmedit.models.registry import COMPONENTS
from mmedit.utils import get_root_logger
@COMPONENTS.regi... | 3,662 | 32.605505 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/encoders/pconv_encoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.utils.parrots_wrapper import _BatchNorm
from mmedit.models.common import MaskConvModule
from mmedit.models.registry import COMPONENTS
@COMPONENTS.register_module()
class PConvEncoder(nn.Module):
"""Encoder with partial conv.
Abo... | 4,200 | 30.825758 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/encoders/indexnet_encoder.py | # Copyright (c) OpenMMLab. All rights reserved.
from functools import partial
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, constant_init, xavier_init
from mmcv.runner import load_checkpoint
from mmcv.utils.parrots_wrapper import SyncBatchNorm
from mmedit.models.c... | 18,597 | 33.893058 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/encoders/deepfill_encoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmedit.models.common import SimpleGatedConvModule
from mmedit.models.registry import COMPONENTS
@COMPONENTS.register_module()
class DeepFillEncoder(nn.Module):
"""Encoder used in DeepFill model.
This i... | 2,817 | 35.128205 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/encoders/resnet_enc.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, build_activation_layer, constant_init
from mmcv.runner import load_checkpoint
from mmedit.models.common import GCAModule
from mmedit.models.registry import COMPONENTS
from mmedit.utils... | 18,843 | 34.689394 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/encoder_decoders/encoders/gl_encoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmedit.models.registry import COMPONENTS
@COMPONENTS.register_module()
class GLEncoder(nn.Module):
"""Encoder used in Global&Local model.
This implementation follows:
Globally and locally Consisten... | 1,579 | 28.259259 | 76 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/generation_backbones/resnet_generator.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.runner import load_checkpoint
from mmedit.models.common import (ResidualBlockWithDropout,
generation_init_weights)
from mmedit.models.registry import BACKBONES
from mmedit.u... | 5,640 | 35.869281 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/generation_backbones/unet_generator.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.runner import load_checkpoint
from mmedit.models.common import (UnetSkipConnectionBlock,
generation_init_weights)
from mmedit.models.registry import BACKBONES
from mmedit.utils import get_root_logger
@BA... | 4,803 | 36.826772 | 78 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/sr_backbones/dic_net.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.runner import load_checkpoint
from mmedit.models.common import make_layer
from mmedit.models.extractors import FeedbackHourglass, reduce_to_five_heatmaps
from mmedit.models.registry import BACKBONES
from mmedit.utils import ge... | 15,107 | 30.672956 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/sr_backbones/sr_resnet.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.runner import load_checkpoint
from mmedit.models.common import (PixelShufflePack, ResidualBlockNoBN,
default_init_weights, make_layer)
from mmedit.models.registry import BACKBONES
from mmedit.utils import ... | 4,792 | 35.869231 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/sr_backbones/glean_styleganv2.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
from mmcv.runner import load_checkpoint
from mmedit.models.backbones.sr_backbones.rrdb_net import RRDB
from mmedit.models.builder import build_component
from mmedit.models.common import PixelShufflePack, make_layer
fr... | 13,402 | 39.370482 | 167 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/sr_backbones/ttsr_net.py | from functools import partial
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import build_conv_layer
from mmcv.runner import load_checkpoint
from mmedit.models.common import (PixelShufflePack, ResidualBlockNoBN,
make_layer)
from mmedit.models.registr... | 14,685 | 32.377273 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/sr_backbones/rdn.py | import torch
from mmcv.runner import load_checkpoint
from torch import nn
from mmedit.models.registry import BACKBONES
from mmedit.utils import get_root_logger
class DenseLayer(nn.Module):
"""Dense layer
Args:
in_channels (int): Channel number of inputs.
out_channels (int): Channel number of... | 6,394 | 30.81592 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/sr_backbones/liif_net.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.runner import load_checkpoint
from mmedit.datasets.pipelines.utils import make_coord
from mmedit.models.builder import build_backbone, build_component
from mmedit.models.registry import BACKBONES
from mmedit.utils import get_root_logger
cla... | 10,596 | 31.80805 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/sr_backbones/basicvsr_pp.py | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import constant_init
from mmcv.ops import ModulatedDeformConv2d, modulated_deform_conv2d
from mmcv.runner import load_checkpoint
from mmedit.models.backbones.sr_backbones.ba... | 17,313 | 37.820628 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/sr_backbones/tdan_net.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, constant_init
from mmcv.ops import DeformConv2d, DeformConv2dPack, deform_conv2d
from mmcv.runner import load_checkpoint
from torch.nn.modules.utils import _pair
from mmedit.models.common import (PixelSh... | 6,755 | 38.976331 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/sr_backbones/rrdb_net.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.runner import load_checkpoint
from mmedit.models.common import default_init_weights, make_layer
from mmedit.models.registry import BACKBONES
from mmedit.utils import get_root_logger
class Resi... | 6,214 | 33.91573 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/sr_backbones/basicvsr_net.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import load_checkpoint
from mmedit.models.common import (PixelShufflePack, ResidualBlockNoBN,
flow_warp, make_layer)
from... | 14,148 | 32.608076 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/sr_backbones/duf.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class DynamicUpsamplingFilter(nn.Module):
"""Dynamic upsampling filter used in DUF.
Ref: https://github.com/yhjo09/VSR-DUF.
It only supports input with 3 channels. And it ... | 2,697 | 40.507692 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/sr_backbones/tof.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import load_checkpoint
from mmedit.models.common import flow_warp
from mmedit.models.registry import BACKBONES
from mmedit.utils import get_root_logger
c... | 8,157 | 30.019011 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/sr_backbones/srcnn.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.runner import load_checkpoint
from mmedit.models.registry import BACKBONES
from mmedit.utils import get_root_logger
@BACKBONES.register_module()
class SRCNN(nn.Module):
"""SRCNN network structure for image super resolution.
SRCN... | 3,259 | 33.315789 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/sr_backbones/iconvsr.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import load_checkpoint
from mmedit.models.common import (PixelShufflePack, ResidualBlockNoBN,
flow_warp, make_layer)
from... | 15,171 | 37.410127 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/sr_backbones/edvr_net.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, constant_init, kaiming_init
from mmcv.ops import ModulatedDeformConv2d, modulated_deform_conv2d
from mmcv.runner import load_checkpoint
from torch.nn.modules.utils import _pair
from mmedit.models.common ... | 18,974 | 38.863445 | 79 | py |
AdaInt | AdaInt-main/mmedit/models/backbones/sr_backbones/edsr.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
import torch.nn as nn
from mmcv.runner import load_checkpoint
from mmedit.models.common import (PixelShufflePack, ResidualBlockNoBN,
make_layer)
from mmedit.models.registry import BACKBONES
from mmedit.utils imp... | 4,622 | 33.759398 | 79 | py |
AdaInt | AdaInt-main/mmedit/datasets/base_dataset.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from abc import ABCMeta, abstractmethod
from torch.utils.data import Dataset
from .pipelines import Compose
class BaseDataset(Dataset, metaclass=ABCMeta):
"""Base class for datasets.
All datasets should subclass it.
All subclasses should overw... | 2,006 | 24.405063 | 73 | py |
AdaInt | AdaInt-main/mmedit/datasets/builder.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import platform
import random
from functools import partial
import numpy as np
import torch
from mmcv.parallel import collate
from mmcv.runner import get_dist_info
from mmcv.utils import build_from_cfg
from torch.utils.data import ConcatDataset, DataLoader
f... | 6,059 | 32.854749 | 78 | py |
AdaInt | AdaInt-main/mmedit/datasets/samplers/distributed_sampler.py | # Copyright (c) OpenMMLab. All rights reserved.
from __future__ import division
import math
import torch
from torch.utils.data import DistributedSampler as _DistributedSampler
class DistributedSampler(_DistributedSampler):
"""DistributedSampler inheriting from `torch.utils.data.DistributedSampler`.
In pytor... | 2,146 | 36.666667 | 80 | py |
AdaInt | AdaInt-main/mmedit/datasets/pipelines/crop.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import numpy as np
from torch.nn.modules.utils import _pair
from ..registry import PIPELINES
from .utils import random_choose_unknown
@PIPELINES.register_module()
class Crop:
"""Crop data to specific size for training.
Args:
keys (Sequence[... | 21,871 | 36.516295 | 79 | py |
AdaInt | AdaInt-main/mmedit/datasets/pipelines/augmentation.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import math
import numbers
import os.path as osp
import cv2
import mmcv
import numpy as np
from ..registry import PIPELINES
@PIPELINES.register_module()
class Resize:
"""Resize data to a specific size for training or resize the images to fit
the ne... | 43,396 | 35.194329 | 79 | py |
AdaInt | AdaInt-main/mmedit/datasets/pipelines/utils.py | # Copyright (c) OpenMMLab. All rights reserved.
import logging
import numpy as np
import torch
from mmcv.utils import print_log
_integer_types = (
np.byte,
np.ubyte, # 8 bits
np.short,
np.ushort, # 16 bits
np.intc,
np.uintc, # 16 or 32 or 64 bits
np.int_,
np.uint, # 32 or 64 bits
... | 4,623 | 28.832258 | 79 | py |
AdaInt | AdaInt-main/mmedit/datasets/pipelines/random_down_sampling.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
import numpy as np
import torch
from mmcv import imresize
from ..registry import PIPELINES
@PIPELINES.register_module()
class RandomDownSampling:
"""Generate LQ image from GT (and crop), which will randomly pick a scale.
Args:
scale_min (f... | 4,735 | 36.587302 | 79 | py |
AdaInt | AdaInt-main/mmedit/datasets/pipelines/formating.py | # Copyright (c) OpenMMLab. All rights reserved.
from collections.abc import Sequence
import mmcv
import numpy as np
import torch
from mmcv.parallel import DataContainer as DC
from torch.nn import functional as F
from ..registry import PIPELINES
def to_tensor(data):
"""Convert objects of various python types to ... | 8,262 | 30.299242 | 78 | py |
AdaInt | AdaInt-main/mmedit/datasets/pipelines/generate_assistant.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
from ..registry import PIPELINES
from .utils import make_coord
@PIPELINES.register_module()
class GenerateHeatmap:
"""Generate heatmap from keypoint.
Args:
keypoint (str): Key of keypoint in dict.
ori_size (int |... | 6,056 | 34.629412 | 78 | py |
threeML | threeML-master/docs/conf.py | # -*- coding: utf-8 -*-
#
# The Multi-Mission Maximum Likelihood framework documentation build configuration file, created by
# sphinx-quickstart on Fri Feb 5 12:26:57 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are pres... | 7,087 | 26.053435 | 99 | py |
LPCNet | LPCNet-master/torch/rdovae/fec_encoder.py | """
/* Copyright (c) 2022 Amazon
Written by Jan Buethe and Jean-Marc Valin */
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this... | 8,102 | 36.864486 | 195 | py |
LPCNet | LPCNet-master/torch/rdovae/train_rdovae.py | """
/* Copyright (c) 2022 Amazon
Written by Jan Buethe */
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions ... | 12,531 | 45.243542 | 183 | py |
LPCNet | LPCNet-master/torch/rdovae/import_rdovae_weights.py | """
/* Copyright (c) 2022 Amazon
Written by Jan Buethe */
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions ... | 6,175 | 42.188811 | 121 | py |
LPCNet | LPCNet-master/torch/rdovae/export_rdovae_weights.py | """
/* Copyright (c) 2022 Amazon
Written by Jan Buethe */
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions ... | 10,783 | 40.79845 | 190 | py |
LPCNet | LPCNet-master/torch/rdovae/rdovae/rdovae.py | """
/* Copyright (c) 2022 Amazon
Written by Jan Buethe */
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions ... | 22,020 | 34.806504 | 138 | py |
LPCNet | LPCNet-master/torch/rdovae/rdovae/dataset.py | """
/* Copyright (c) 2022 Amazon
Written by Jan Buethe */
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions ... | 2,949 | 41.753623 | 130 | py |
LPCNet | LPCNet-master/training_tf2/plc_loader.py | #!/usr/bin/python3
'''Copyright (c) 2021-2022 Amazon
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the fo... | 3,853 | 51.081081 | 132 | py |
LPCNet | LPCNet-master/training_tf2/pade.py | # Optimizing a rational function to optimize a tanh() approximation
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, GRU, Dense, Embedding, Reshape, Concatenate, Lambda, Conv1D, Multiply, Add, Bidirectional, MaxPooling1D, Activation
import ... | 2,448 | 33.492958 | 158 | py |
LPCNet | LPCNet-master/training_tf2/train_lpcnet.py | #!/usr/bin/python3
'''Copyright (c) 2018 Mozilla
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the follow... | 9,660 | 43.934884 | 192 | py |
LPCNet | LPCNet-master/training_tf2/rdovae.py | #!/usr/bin/python3
'''Copyright (c) 2022 Amazon
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the followi... | 16,016 | 41.826203 | 205 | py |
LPCNet | LPCNet-master/training_tf2/train_plc.py | #!/usr/bin/python3
'''Copyright (c) 2021-2022 Amazon
Copyright (c) 2018-2019 Mozilla
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice,... | 7,883 | 38.818182 | 236 | py |
LPCNet | LPCNet-master/training_tf2/mdense.py | from tensorflow.keras import backend as K
from tensorflow.keras.layers import Layer, InputSpec
from tensorflow.keras import activations
from tensorflow.keras import initializers, regularizers, constraints
import numpy as np
import math
class MDense(Layer):
def __init__(self, outputs,
channels... | 4,384 | 44.677083 | 86 | py |
LPCNet | LPCNet-master/training_tf2/dataloader.py | import numpy as np
from tensorflow.keras.utils import Sequence
from ulaw import lin2ulaw
def lpc2rc(lpc):
#print("shape is = ", lpc.shape)
order = lpc.shape[-1]
rc = 0*lpc
for i in range(order, 0, -1):
rc[:,:,i-1] = lpc[:,:,-1]
ki = rc[:,:,i-1:i].repeat(i-1, axis=2)
lpc = (lpc[:... | 2,023 | 39.48 | 134 | py |
LPCNet | LPCNet-master/training_tf2/dump_lpcnet.py | #!/usr/bin/python3
'''Copyright (c) 2017-2018 Mozilla
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the f... | 17,029 | 42.77892 | 206 | py |
LPCNet | LPCNet-master/training_tf2/tf_funcs.py | """
Tensorflow/Keras helper functions to do the following:
1. \mu law <-> Linear domain conversion
2. Differentiable prediction from the input signal and LP coefficients
3. Differentiable transformations Reflection Coefficients (RCs) <-> LP Coefficients
"""
from tensorflow.keras.layers import Lambda, Multip... | 2,796 | 38.394366 | 131 | py |
LPCNet | LPCNet-master/training_tf2/test_plc.py | #!/usr/bin/python3
'''Copyright (c) 2021-2022 Amazon
Copyright (c) 2018-2019 Mozilla
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice,... | 3,577 | 37.473118 | 141 | py |
LPCNet | LPCNet-master/training_tf2/lpcnet.py | #!/usr/bin/python3
'''Copyright (c) 2018 Mozilla
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the follow... | 15,031 | 43.211765 | 213 | py |
LPCNet | LPCNet-master/training_tf2/lossfuncs.py | """
Custom Loss functions and metrics for training/analysis
"""
from tf_funcs import *
import tensorflow as tf
# The following loss functions all expect the lpcnet model to output the lpc prediction
# Computing the excitation by subtracting the lpc prediction from the target, followed by minimizing the cross entropy... | 4,244 | 41.029703 | 140 | py |
LPCNet | LPCNet-master/training_tf2/dump_plc.py | #!/usr/bin/python3
'''Copyright (c) 2021-2022 Amazon
Copyright (c) 2017-2018 Mozilla
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice,... | 12,293 | 40.393939 | 206 | py |
LPCNet | LPCNet-master/training_tf2/parameters.py | """ module for handling extra model parameters for tf.keras models """
import tensorflow as tf
def set_parameter(model, parameter_name, parameter_value, dtype='float32'):
""" stores parameter_value as non-trainable weight with name parameter_name:0 """
weights = [weight for weight in model.weights if we... | 1,176 | 38.233333 | 131 | py |
LPCNet | LPCNet-master/training_tf2/decode_rdovae.py | #!/usr/bin/python3
'''Copyright (c) 2021-2022 Amazon
Copyright (c) 2018-2019 Mozilla
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice,... | 4,267 | 37.107143 | 143 | py |
LPCNet | LPCNet-master/training_tf2/lpcnet_plc.py | #!/usr/bin/python3
'''Copyright (c) 2021-2022 Amazon
Copyright (c) 2018-2019 Mozilla
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice,... | 4,941 | 47.45098 | 173 | py |
LPCNet | LPCNet-master/training_tf2/uniform_noise.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 2,591 | 31.810127 | 80 | py |
LPCNet | LPCNet-master/training_tf2/dump_rdovae.py | """
/* Copyright (c) 2022 Amazon
Written by Jan Buethe */
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions ... | 8,104 | 25.486928 | 133 | py |
LPCNet | LPCNet-master/training_tf2/train_rdovae.py | #!/usr/bin/python3
'''Copyright (c) 2021-2022 Amazon
Copyright (c) 2018-2019 Mozilla
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice,... | 6,163 | 39.552632 | 205 | py |
LPCNet | LPCNet-master/training_tf2/encode_rdovae.py | #!/usr/bin/python3
'''Copyright (c) 2021-2022 Amazon
Copyright (c) 2018-2019 Mozilla
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice,... | 4,965 | 38.412698 | 143 | py |
LPCNet | LPCNet-master/training_tf2/diffembed.py | """
Modification of Tensorflow's Embedding Layer:
1. Not restricted to be the first layer of a model
2. Differentiable (allows non-integer lookups)
- For non integer lookup, this layer linearly interpolates between the adjacent embeddings in the following way to preserver gradient flow
- E =... | 1,921 | 38.22449 | 146 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.