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 |
|---|---|---|---|---|---|---|
ColBERT | ColBERT-master/colbert/modeling/tokenization/doc_tokenization.py | import torch
from transformers import BertTokenizerFast
from colbert.modeling.tokenization.utils import _split_into_batches, _sort_by_length
class DocTokenizer():
def __init__(self, doc_maxlen):
self.tok = BertTokenizerFast.from_pretrained('bert-base-uncased')
self.doc_maxlen = doc_maxlen
... | 2,248 | 34.140625 | 104 | py |
ColBERT | ColBERT-master/colbert/modeling/tokenization/query_tokenization.py | import torch
from transformers import BertTokenizerFast
from colbert.modeling.tokenization.utils import _split_into_batches
class QueryTokenizer():
def __init__(self, query_maxlen):
self.tok = BertTokenizerFast.from_pretrained('bert-base-uncased')
self.query_maxlen = query_maxlen
self.Q_... | 2,449 | 36.692308 | 115 | py |
ColBERT | ColBERT-master/colbert/modeling/tokenization/utils.py | import torch
def tensorize_triples(query_tokenizer, doc_tokenizer, queries, positives, negatives, bsize):
assert len(queries) == len(positives) == len(negatives)
assert bsize is None or len(queries) % bsize == 0
N = len(queries)
Q_ids, Q_mask = query_tokenizer.tensorize(queries)
D_ids, D_mask = d... | 1,833 | 34.269231 | 116 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tools/test.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import mmcv
import torch
from mmcv import Config, DictAction
from mmcv.parallel import MMDataParallel
from mmcv.runner import get_dist_info, init_dist, load_checkpoint
from mmedit.apis import multi_gpu_test, set_random_seed, single_gpu_test
fro... | 5,285 | 32.66879 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tools/onnx2tensorrt.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import os.path as osp
import warnings
from typing import Iterable, Optional
import cv2
import mmcv
import numpy as np
import onnxruntime as ort
import torch
from mmcv.ops import get_onnxruntime_op_path
from mmcv.tensorrt import (TRTWrapper, is_t... | 9,445 | 34.115242 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tools/publish_model.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import subprocess
import torch
from packaging import version
def parse_args():
parser = argparse.ArgumentParser(
description='Process a checkpoint to be published')
parser.add_argument('in_file', help='input checkpoint filename')
par... | 1,256 | 29.658537 | 78 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tools/pytorch2onnx.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import warnings
import cv2
import mmcv
import numpy as np
import onnx
import onnxruntime as rt
import torch
from mmcv.onnx import register_extra_symbolics
from mmcv.runner import load_checkpoint
from mmedit.datasets.pipelines import Compose
from mmedit.m... | 7,975 | 35.420091 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tools/deploy_test.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import warnings
from typing import Any
import mmcv
import torch
from mmcv import Config, DictAction
from mmcv.parallel import MMDataParallel
from torch import nn
from mmedit.apis import single_gpu_test
from mmedit.core.export import ONNXRuntimeEditing
fr... | 5,983 | 31.879121 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tools/train.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import copy
import os
import os.path as osp
import time
import mmcv
import torch
import torch.distributed as dist
from mmcv import Config, DictAction
from mmcv.runner import init_dist
from mmedit import __version__
from mmedit.apis import init_random_see... | 5,738 | 32.758824 | 78 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tools/deployment/mmedit_handler.py | # Copyright (c) OpenMMLab. All rights reserved.
import os
import random
import string
from io import BytesIO
import PIL.Image as Image
import torch
from ts.torch_handler.base_handler import BaseHandler
from mmedit.apis import init_model, restoration_inference
from mmedit.core import tensor2img
class MMEditHandler(B... | 2,099 | 34 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tools/deployment/mmedit2torchserve.py | # Copyright (c) OpenMMLab. All rights reserved.
from argparse import ArgumentParser, Namespace
from pathlib import Path
from tempfile import TemporaryDirectory
import mmcv
try:
from model_archiver.model_packaging import package_model
from model_archiver.model_packaging_utils import ModelExportUtils
except Imp... | 3,725 | 32.567568 | 76 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_inference.py | # Copyright (c) OpenMMLab. All rights reserved.
import os
import shutil
import pytest
import torch
from mmedit.apis import (init_model, restoration_video_inference,
video_interpolation_inference)
def test_restoration_video_inference():
if torch.cuda.is_available():
# recurrent f... | 5,333 | 36.829787 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_runtime/test_optimizer.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmedit.core import build_optimizers
class ExampleModel(nn.Module):
def __init__(self):
super().__init__()
self.model1 = nn.Conv2d(3, 8, kernel_size=3)
self.model2 = nn.Conv2d(3, 4, kernel_size=3)
... | 4,279 | 40.960784 | 78 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_runtime/test_visual_hook.py | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import tempfile
from unittest.mock import MagicMock
import mmcv
import numpy as np
import pytest
import torch
import torch.nn as nn
from torch.utils.data import DataLoader, Dataset
from mmedit.core import VisualizationHook
from mmedit.utils import ... | 2,480 | 28.891566 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_runtime/test_dataset_builder.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
from torch.utils.data import ConcatDataset, RandomSampler, SequentialSampler
from mmedit.datasets import (DATASETS, RepeatDataset, build_dataloader,
build_dataset)
from mmedit.datasets.samplers import DistributedSampler
@DATASE... | 4,660 | 32.056738 | 78 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_runtime/test_eval_hook.py | # Copyright (c) OpenMMLab. All rights reserved.
import logging
import tempfile
from unittest.mock import MagicMock
import mmcv.runner
import pytest
import torch
import torch.nn as nn
from mmcv.runner import obj_from_dict
from torch.utils.data import DataLoader, Dataset
from mmedit.core import EvalIterHook
class Exa... | 2,150 | 28.067568 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_runtime/test_apis.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmedit.apis.train import init_random_seed, set_random_seed
def test_init_random_seed():
init_random_seed(0, device='cpu')
init_random_seed(device='cpu')
# test on gpu
if torch.cuda.is_available():
init_random_seed(0, device='cu... | 482 | 24.421053 | 63 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_runtime/test_ema_hook.py | # Copyright (c) OpenMMLab. All rights reserved.
from copy import deepcopy
import pytest
import torch
import torch.nn as nn
from packaging import version
from torch.nn.parallel import DataParallel
from mmedit.core.hooks import ExponentialMovingAverageHook
class SimpleModule(nn.Module):
def __init__(self):
... | 8,288 | 33.682008 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_base_model.py | # Copyright (c) OpenMMLab. All rights reserved.
import unittest
from unittest.mock import patch
import pytest
import torch
from mmedit.models import BaseModel
class TestBaseModel(unittest.TestCase):
@patch.multiple(BaseModel, __abstractmethods__=set())
def test_parse_losses(self):
self.base_model =... | 1,059 | 29.285714 | 72 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_generation_backbones/test_generators.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import numpy as np
import pytest
import torch
from mmedit.models import build_backbone
from mmedit.models.common import (ResidualBlockWithDropout,
UnetSkipConnectionBlock)
def test_unet_skip_connection_block():
_cfg = ... | 10,368 | 27.17663 | 66 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_sr_backbones/test_real_basicvsr_net.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models.backbones.sr_backbones.real_basicvsr_net import \
RealBasicVSRNet
def test_real_basicvsr_net():
"""Test RealBasicVSR."""
# cpu
# is_fix_cleaning = False
real_basicvsr = RealBasicVSRNet(is_fix_cleaning=F... | 2,058 | 34.5 | 70 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_sr_backbones/test_sr_backbones.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
from mmedit.models.backbones import EDSR, SRCNN, MSRResNet, RRDBNet
from mmedit.models.components import ModifiedVGG
def test_srresnet_backbone():
"""Test SRResNet backbone."""
# x2 model
MSRResNet(
in_... | 7,196 | 26.469466 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_sr_backbones/test_duf.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models.backbones.sr_backbones.duf import DynamicUpsamplingFilter
def test_dynamic_upsampling_filter():
"""Test DynamicUpsamplingFilter."""
with pytest.raises(TypeError):
# The type of filter_size must be tuple
... | 1,223 | 33 | 76 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_sr_backbones/test_liif_net.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmedit.models import build_backbone
def test_liif_edsr():
model_cfg = dict(
type='LIIFEDSR',
encoder=dict(
type='EDSR',
in_channels=3,
out_channels=3,
mid_channels=64,
nu... | 2,884 | 25.227273 | 49 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_sr_backbones/test_iconvsr.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models.backbones.sr_backbones.iconvsr import IconVSR
def test_iconvsr():
"""Test IconVSR."""
# gpu (since IconVSR contains DCN, only GPU mode is available)
if torch.cuda.is_available():
iconvsr = IconVSR(
... | 1,695 | 30.407407 | 66 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_sr_backbones/test_tdan_net.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models.backbones.sr_backbones.tdan_net import TDANNet
def test_tdan_net():
"""Test TDANNet."""
# gpu (DCN is available only on GPU)
if torch.cuda.is_available():
tdan = TDANNet().cuda()
input_tensor = ... | 772 | 29.92 | 69 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_sr_backbones/test_basicvsr_net.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models.backbones.sr_backbones.basicvsr_net import BasicVSRNet
def test_basicvsr_net():
"""Test BasicVSR."""
# cpu
basicvsr = BasicVSRNet(
mid_channels=64, num_blocks=30, spynet_pretrained=None)
input_tenso... | 1,137 | 30.611111 | 74 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_sr_backbones/test_dic_net.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
import torch.nn as nn
from mmedit.models import build_backbone
from mmedit.models.backbones.sr_backbones.dic_net import (
FeedbackBlock, FeedbackBlockCustom, FeedbackBlockHeatmapAttention)
def test_feedback_block():
x1 = torch.rand(2,... | 2,496 | 24.222222 | 70 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_sr_backbones/test_glean_net.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models.backbones.sr_backbones.glean_styleganv2 import \
GLEANStyleGANv2
class TestGLEANNet:
@classmethod
def setup_class(cls):
cls.default_cfg = dict(in_size=16, out_size=256, style_channels=512)
cls.s... | 1,834 | 32.981481 | 78 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_sr_backbones/test_edvr_net.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models.backbones.sr_backbones.edvr_net import (EDVRNet,
PCDAlignment,
TSAFusion)
def test_pcd_alignment():
"... | 4,187 | 27.489796 | 76 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_sr_backbones/test_tof.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models.backbones import TOFlow
def test_tof():
"""Test TOFlow."""
# cpu
tof = TOFlow(adapt_official_weights=True)
input_tensor = torch.rand(1, 7, 3, 32, 32)
tof.init_weights(pretrained=None)
output = tof(i... | 937 | 26.588235 | 57 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_sr_backbones/test_rdn.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmedit.models import build_backbone
def test_rdn():
scale = 4
model_cfg = dict(
type='RDN',
in_channels=3,
out_channels=3,
mid_channels=64,
num_blocks=16,
upscale_factor=s... | 1,353 | 22.344828 | 56 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_sr_backbones/test_basicvsr_plusplus.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models.backbones.sr_backbones.basicvsr_pp import BasicVSRPlusPlus
def test_basicvsr_plusplus():
"""Test BasicVSR++."""
# cpu
model = BasicVSRPlusPlus(
mid_channels=64,
num_blocks=7,
is_low_res_... | 2,987 | 30.452632 | 77 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_vfi_backbones/test_cain_net.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models import build_backbone
def test_cain_net():
model_cfg = dict(type='CAINNet')
# build model
model = build_backbone(model_cfg)
# test attributes
assert model.__class__.__name__ == 'CAINNet'
# prepar... | 2,023 | 28.333333 | 56 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_vfi_backbones/test_tof_vfi_net.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models import build_backbone
def test_tof_vfi_net():
model_cfg = dict(type='TOFlowVFINet')
# build model
model = build_backbone(model_cfg)
# test attributes
assert model.__class__.__name__ == 'TOFlowVFINet'
... | 1,371 | 25.901961 | 77 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_encoder_decoders/test_gl_model.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models import build_backbone, build_component
from mmedit.models.backbones import GLDilationNeck
from mmedit.models.common import SimpleGatedConvModule
def test_gl_encdec():
input_x = torch.randn(1, 4, 256, 256)
template_c... | 2,945 | 30.010526 | 75 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_encoder_decoders/test_deepfill_encoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmedit.models.backbones import ContextualAttentionNeck, DeepFillEncoder
from mmedit.models.common import SimpleGatedConvModule
def test_deepfill_enc():
encoder = DeepFillEncoder()
x = torch.randn((2, 5, 256, 256))
outputs = encoder(x)
... | 3,966 | 34.738739 | 76 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_encoder_decoders/test_aot_model.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmedit.models import build_backbone
from mmedit.models.backbones.encoder_decoders.necks import AOTBlockNeck
def test_gl_encdec():
input_x = torch.randn(1, 4, 256, 256)
template_cfg = dict(type='AOTEncoderDecoder')
aot_encdec = build_backb... | 1,576 | 29.921569 | 71 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_encoder_decoders/test_deepfill_decoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmedit.models.backbones import DeepFillDecoder
def test_deepfill_dec():
decoder = DeepFillDecoder(128, out_act_cfg=None)
assert not decoder.with_out_activation
decoder = DeepFillDecoder(128)
x = torch.randn((2, 128, 64, 64))
inpu... | 1,533 | 34.674419 | 68 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_encoder_decoders/test_decoders.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
from mmedit.models.backbones import (VGG16, FBADecoder, IndexedUpsample,
IndexNetDecoder, IndexNetEncoder,
PlainDecoder, ResGCADecoder,
... | 8,503 | 33.710204 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_encoder_decoders/test_encoder_decoder.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
from mmedit.models.backbones import SimpleEncoderDecoder
def assert_dict_keys_equal(dictionary, target_keys):
"""Check if the keys of the dictionary is equal to the target key set."""
assert isinstance(dictionary, dict)
asser... | 3,362 | 35.956044 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_encoder_decoders/test_encoders.py | # Copyright (c) OpenMMLab. All rights reserved.
from collections.abc import Iterable
import numpy as np
import pytest
import torch
from mmcv.utils.parrots_wrapper import _BatchNorm
from mmedit.models.backbones import (VGG16, DepthwiseIndexBlock,
FBAResnetDilated, HolisticIndexBloc... | 24,631 | 38.22293 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_encoder_decoders/test_pconv_encdec.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmcv.utils.parrots_wrapper import _BatchNorm
from mmedit.models.backbones import PConvEncoder, PConvEncoderDecoder
def test_pconv_encdec():
pconv_enc_cfg = dict(type='PConvEncoder')
pconv_dec_cfg = dict(type='PConvDecoder')
... | 1,280 | 31.025 | 72 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_backbones/test_encoder_decoders/test_deepfill_encdec.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmedit.models.backbones import DeepFillEncoderDecoder, GLEncoderDecoder
from mmedit.models.components import DeepFillRefiner
def test_deepfill_encdec():
encdec = DeepFillEncoderDecoder()
assert isinstance(encdec.stage1, GLEncoderDecoder)
a... | 961 | 37.48 | 76 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_extractors/test_feedback_hour_glass.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models import build_component
from mmedit.models.extractors import Hourglass
from mmedit.models.extractors.feedback_hour_glass import (
ResBlock, reduce_to_five_heatmaps)
def test_res_block():
res_block = ResBlock(16, 32)... | 2,154 | 30.231884 | 68 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_extractors/test_lte.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models import build_component
def test_lte():
model_cfg = dict(
type='LTE',
requires_grad=False,
pixel_range=1.,
pretrained=None,
load_pretrained_vgg=False)
lte = build_component(mo... | 863 | 24.411765 | 47 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_synthesizers/test_cyclegan.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from unittest.mock import patch
import mmcv
import pytest
import torch
from mmcv.parallel import DataContainer as DC
from mmcv.runner import obj_from_dict
from mmedit.models import build_model
from mmedit.models.backbones import ResnetGenerator
from mmedit.m... | 23,294 | 40.747312 | 78 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_restorers/test_basicvsr_model.py | # Copyright (c) OpenMMLab. All rights reserved.
import tempfile
import mmcv
import pytest
import torch
from mmcv.runner import obj_from_dict
from mmedit.models import build_model
from mmedit.models.backbones.sr_backbones import BasicVSRNet
from mmedit.models.losses import MSELoss
def test_basicvsr_model():
mod... | 6,854 | 32.602941 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_restorers/test_real_basicvsr.py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest.mock import patch
import pytest
import torch
from mmcv.runner import obj_from_dict
from mmedit.models import build_model
from mmedit.models.backbones import RealBasicVSRNet
from mmedit.models.components import UNetDiscriminatorWithSpectralNorm
from mmedit.... | 8,475 | 39.361905 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_restorers/test_tdan.py | # Copyright (c) OpenMMLab. All rights reserved.
import tempfile
import mmcv
import pytest
import torch
from mmcv.runner import obj_from_dict
from mmedit.models import build_model
from mmedit.models.backbones import TDANNet
from mmedit.models.losses import MSELoss
def test_tdan_model():
model_cfg = dict(
... | 5,090 | 34.110345 | 77 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_restorers/test_real_esrgan.py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest.mock import patch
import pytest
import torch
from mmcv.runner import obj_from_dict
from mmedit.models import build_model
from mmedit.models.backbones import MSRResNet
from mmedit.models.components import ModifiedVGG
from mmedit.models.losses import GANLoss... | 10,264 | 38.480769 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_restorers/test_glean.py | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import pytest
import torch
from mmedit.models import build_model
def test_glean():
model_cfg = dict(
type='GLEAN',
generator=dict(
type='GLEANStyleGANv2',
in_size=16,
out_size=64,
style_ch... | 2,269 | 30.971831 | 78 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_restorers/test_liif.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
from mmcv.runner import obj_from_dict
from mmcv.utils.config import Config
from mmedit.models import build_model
from mmedit.models.registry import COMPONENTS
@COMPONENTS.register_module()
class BP(nn.Module):
"... | 4,114 | 33.579832 | 77 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_restorers/test_dic_model.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
from mmcv.runner import obj_from_dict
from mmcv.utils.config import Config
from mmedit.models.builder import build_model
def test_dic_model():
pretrained = 'https://download.openmmlab.com/mmediting/' + \
'restor... | 4,844 | 39.375 | 77 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_restorers/test_ttsr.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
from mmcv.runner import obj_from_dict
from mmcv.utils.config import Config
from mmedit.models import build_backbone, build_model
from mmedit.models.backbones.sr_backbones.ttsr_net import (CSFI2, CSFI3, SFE,
... | 7,308 | 33.63981 | 77 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_restorers/test_esrgan.py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest.mock import patch
import torch
from mmcv.runner import obj_from_dict
from mmedit.models import build_model
from mmedit.models.backbones import MSRResNet
from mmedit.models.components import ModifiedVGG
from mmedit.models.losses import GANLoss, L1Loss
def... | 7,807 | 39.666667 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_restorers/test_edvr_model.py | # Copyright (c) OpenMMLab. All rights reserved.
import tempfile
import mmcv
import pytest
import torch
from mmcv.runner import obj_from_dict
from mmedit.models import build_model
from mmedit.models.backbones import EDVRNet
from mmedit.models.losses import L1Loss
def test_edvr_model():
model_cfg = dict(
... | 6,625 | 35.406593 | 77 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_restorers/test_srgan.py | # Copyright (c) OpenMMLab. All rights reserved.
from unittest.mock import patch
import pytest
import torch
from mmcv.runner import obj_from_dict
from mmedit.models import build_model
from mmedit.models.backbones import MSRResNet
from mmedit.models.components import ModifiedVGG
from mmedit.models.losses import GANLoss... | 9,665 | 39.107884 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_restorers/test_basic_restorer.py | # Copyright (c) OpenMMLab. All rights reserved.
import tempfile
import mmcv
import pytest
import torch
from mmcv.runner import obj_from_dict
from mmedit.models import build_model
from mmedit.models.backbones import MSRResNet
from mmedit.models.losses import L1Loss
def test_basic_restorer():
model_cfg = dict(
... | 6,226 | 35.415205 | 77 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_video_interpolator/test_basic_interpolator.py | # Copyright (c) OpenMMLab. All rights reserved.
import tempfile
import mmcv
import pytest
import torch
import torch.nn as nn
from mmcv.runner import obj_from_dict
from mmedit.models import build_model
from mmedit.models.losses import L1Loss
from mmedit.models.registry import COMPONENTS
@COMPONENTS.register_module()... | 10,311 | 34.07483 | 78 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_video_interpolator/test_cain.py | # Copyright (c) OpenMMLab. All rights reserved.
import tempfile
import mmcv
import pytest
import torch
from mmcv.runner import obj_from_dict
from mmedit.models import build_model
from mmedit.models.backbones import CAINNet
from mmedit.models.losses import L1Loss
def test_cain():
model_cfg = dict(
type='... | 4,692 | 33.762963 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_mattors/test_mattors.py | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
from unittest.mock import patch
import mmcv
import numpy as np
import pytest
import torch
from mmedit.models import BaseMattor, build_model
def _get_model_cfg(fname):
"""
Grab configs necessary to create a model. These are deep copied to ... | 14,057 | 37.620879 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_losses/test_losses.py | # Copyright (c) OpenMMLab. All rights reserved.
import math
from unittest.mock import patch
import numpy
import numpy.testing as npt
import pytest
import torch
from mmedit.models import (CharbonnierCompLoss, CharbonnierLoss, DiscShiftLoss,
GANLoss, GaussianBlur, GradientLoss,
... | 18,730 | 34.542694 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_losses/test_feature_loss.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models.losses import LightCNNFeatureLoss
def test_light_cnn_feature_loss():
pretrained = 'https://download.openmmlab.com/mmediting/' + \
'restorers/dic/light_cnn_feature.pth'
pred = torch.rand((3, 3, 128, 128))
... | 1,600 | 28.648148 | 78 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_common/test_common_module.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
import torch.nn as nn
from mmedit.models.common import (ASPP, DepthwiseSeparableConvModule,
GCAModule, LinearModule, MaskConvModule,
PartialConv2d, SimpleGatedConvModule)
def... | 10,851 | 31.984802 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_common/test_img_normalize.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmedit.models.common import ImgNormalize
def test_normalize_layer():
rgb_mean = (1, 2, 3)
rgb_std = (1, 0.5, 0.25)
layer = ImgNormalize(1, rgb_mean, rgb_std)
x = torch.randn((2, 3, 64, 64))
y = layer(x)
x = x.permute((1, 0, 2, ... | 695 | 29.26087 | 69 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_common/test_sampling.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models.common import PixelShufflePack, pixel_unshuffle
def test_pixel_shuffle():
# test on cpu
model = PixelShufflePack(3, 3, 2, 3)
model.init_weights()
x = torch.rand(1, 3, 16, 16)
y = model(x)
assert y.s... | 988 | 23.121951 | 66 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_common/test_flow_warp.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models import flow_warp
def tensor_shift(x, shift=(1, 1), fill_val=0):
"""Shift tensor for testing flow_warp.
Args:
x (Tensor): the input tensor. The shape is (b, c, h, w].
shift (tuple): shift pixel.
... | 1,471 | 26.773585 | 76 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_common/test_model_utils.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import numpy as np
import pytest
import torch
import torch.nn as nn
from mmedit.models.common import (GANImageBuffer, extract_around_bbox,
extract_bbox_patch, generation_init_weights,
set_re... | 5,756 | 38.979167 | 78 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_common/test_ensemble.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
import torch.nn as nn
from mmedit.models.common import SpatialTemporalEnsemble
def test_ensemble_cpu():
model = nn.Identity()
# spatial ensemble of an image
ensemble = SpatialTemporalEnsemble(is_temporal_ensemb... | 2,575 | 36.882353 | 73 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_transformer/test_search_transformer.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmedit.models.builder import build_component
def test_search_transformer():
model_cfg = dict(type='SearchTransformer')
model = build_component(model_cfg)
lr_pad_level3 = torch.randn((2, 32, 32, 32))
ref_pad_level3 = torch.randn((2, 32... | 806 | 31.28 | 61 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_components/test_stylegan2.py | # Copyright (c) OpenMMLab. All rights reserved.
from copy import deepcopy
import pytest
import torch
import torch.nn as nn
from mmedit.models.components.stylegan2.common import get_module_device
from mmedit.models.components.stylegan2.generator_discriminator import (
StyleGAN2Discriminator, StyleGANv2Generator)
f... | 8,432 | 30.466418 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_components/test_refiners/test_mlp_refiner.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmedit.models.builder import build_component
def test_mlp_refiner():
model_cfg = dict(
type='MLPRefiner', in_dim=8, out_dim=3, hidden_list=[8, 8, 8, 8])
mlp = build_component(model_cfg)
# test attributes
... | 971 | 26.771429 | 73 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_components/test_refiners/test_matting_refiners.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
from mmedit.models import PlainRefiner
def assert_dict_keys_equal(dictionary, target_keys):
"""Check if the keys of the dictionary is equal to the target key set."""
assert isinstance(dictionary, dict)
assert set(dictionary.k... | 2,239 | 34.555556 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_components/test_refiners/test_deepfill_refiner.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmedit.models import (ContextualAttentionNeck, DeepFillDecoder,
DeepFillEncoder, DeepFillRefiner, GLDilationNeck)
def test_deepfill_refiner():
refiner = DeepFillRefiner()
x = torch.rand((2, 5, 256, 256))
mask = ... | 1,564 | 37.170732 | 76 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_components/test_discriminators/test_unet_disc.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models.components import UNetDiscriminatorWithSpectralNorm
def test_unet_disc_with_spectral_norm():
# cpu
disc = UNetDiscriminatorWithSpectralNorm(in_channels=3)
img = torch.randn(1, 3, 16, 16)
disc(img)
with ... | 680 | 24.222222 | 70 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_components/test_discriminators/test_light_cnn.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models.builder import build_component
from mmedit.models.components.discriminators.light_cnn import MaxFeature
def test_max_feature():
# cpu
conv2d = MaxFeature(16, 16, filter_type='conv2d')
x1 = torch.rand(3, 16, 16, ... | 1,475 | 27.384615 | 72 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_components/test_discriminators/test_discriminators.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import numpy as np
import pytest
import torch
from mmedit.models import build_component
def test_ttsr_dict():
cfg = dict(type='TTSRDiscriminator', in_channels=3, in_size=160)
net = build_component(cfg)
net.init_weights(pretrained=None)
# cp... | 4,322 | 26.01875 | 68 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_components/test_discriminators/test_deepfill_disc.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmedit.models.components import (DeepFillv1Discriminators,
MultiLayerDiscriminator)
def test_deepfillv1_disc():
model_config = dict(
global_disc_cfg=dict(
type='MultiLayerDisc... | 1,862 | 34.826923 | 68 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_components/test_discriminators/test_multi_layer_disc.py | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
import torch.nn as nn
from mmedit.models.components import MultiLayerDiscriminator
def test_multi_layer_disc():
with pytest.raises(AssertionError):
# fc_in_channels must be greater than 0
multi_disc = MultiLayerDiscriminat... | 3,133 | 34.613636 | 71 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_inpaintors/test_deepfill_inpaintor.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os
import tempfile
import pytest
import torch
from mmcv import Config
from mmedit.core import build_optimizers
from mmedit.models import DeepFillv1Inpaintor
def test_two_stage_inpaintor():
model = dict(
disc_input_with_mask=True,
... | 12,857 | 38.441718 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_inpaintors/test_gl_inpaintor.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv import Config
from mmedit.models import build_model
def test_gl_inpaintor():
cfg = Config.fromfile('tests/data/inpaintor_config/gl_test.py')
gl = build_model(cfg.model, train_cfg=cfg.train_cfg, test_cfg=cfg.test_cfg)
assert gl.__cla... | 2,138 | 37.196429 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_inpaintors/test_pconv_inpaintor.py | # Copyright (c) OpenMMLab. All rights reserved.
import os
import tempfile
from unittest.mock import patch
import pytest
import torch
from mmcv import Config
from mmedit.models import build_model
from mmedit.models.losses import PerceptualVGG
@patch.object(PerceptualVGG, 'init_weights')
def test_pconv_inpaintor(init... | 3,937 | 36.865385 | 74 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_inpaintors/test_two_stage_inpaintor.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os
import tempfile
import pytest
import torch
from mmcv import Config
from mmedit.core import build_optimizers
from mmedit.models import TwoStageInpaintor
def test_two_stage_inpaintor():
model = dict(
disc_input_with_mask=True,
e... | 14,419 | 38.184783 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_inpaintors/test_one_stage_inpaintor.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os
import tempfile
from unittest.mock import patch
import pytest
import torch
from mmcv import Config
from mmedit.models import build_model
from mmedit.models.backbones import GLEncoderDecoder
def test_one_stage_inpaintor():
cfg = Config.fromfil... | 6,045 | 39.306667 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_models/test_inpaintors/test_aot_inpaintor.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os
import tempfile
import pytest
import torch
from mmcv import Config
from mmedit.models import build_model
from mmedit.models.backbones.encoder_decoders import AOTEncoderDecoder
def test_aot_inpaintor():
cfg = Config.fromfile('tests/data/inpain... | 8,089 | 36.281106 | 75 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_data/test_datasets/test_repeat_dataset.py | # Copyright (c) OpenMMLab. All rights reserved.
from torch.utils.data import Dataset
from mmedit.datasets import RepeatDataset
def test_repeat_dataset():
class ToyDataset(Dataset):
def __init__(self):
super().__init__()
self.members = [1, 2, 3, 4, 5]
def __len__(self):
... | 623 | 23 | 50 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_data/test_pipelines/test_formating.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
from mmedit.datasets.pipelines import (Collect, FormatTrimap, GetMaskedImage,
ImageToTensor, ToTensor)
from mmedit.datasets.pipelines.formating import FramesToTensor
def check_keys_con... | 7,142 | 36.793651 | 78 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_data/test_pipelines/test_generate_assistant.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmedit.datasets.pipelines import (GenerateCoordinateAndCell,
GenerateHeatmap)
def test_generate_heatmap():
inputs = dict(landmark=[(1, 2), (3, 4)])
generate_heatmap = GenerateHeatmap('landmark', 4, 16)
... | 2,102 | 39.442308 | 77 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_data/test_pipelines/test_pipeline_utils.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
from mmedit.datasets.pipelines.utils import (adjust_gamma, dtype_range,
make_coord)
def test_adjust_gamma():
"""Test Gamma Correction
Adpted from
# https://github.co... | 3,075 | 36.512195 | 149 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_data/test_pipelines/test_augmentation.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os.path as osp
import numpy as np
import pytest
import torch
# yapf: disable
from mmedit.datasets.pipelines import (BinarizeImage, ColorJitter, CopyValues,
Flip, GenerateFrameIndices,
... | 35,573 | 41.860241 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_utils/test_tensor2img.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
from torchvision.utils import make_grid
from mmedit.core import tensor2img
def test_tensor2img():
tensor_4d_1 = torch.FloatTensor(2, 3, 4, 4).uniform_(0, 1)
tensor_4d_2 = torch.FloatTensor(1, 3, 4, 4).uniform_(0, 1)... | 3,609 | 41.97619 | 77 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_utils/test_pix2pix.py | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from unittest.mock import patch
import mmcv
import pytest
import torch
from mmcv.parallel import DataContainer as DC
from mmcv.runner import obj_from_dict
from mmedit.models import build_model
from mmedit.models.backbones import UnetGenerator
from mmedit.mod... | 16,144 | 38.864198 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/tests/test_utils/test_onnx_wraper.py | # Copyright (c) OpenMMLab. All rights reserved.
import os
import mmcv
import numpy as np
import pytest
import torch
from packaging import version
from mmedit.models import build_model
@pytest.mark.skipif(torch.__version__ == 'parrots', reason='skip parrots.')
@pytest.mark.skipif(
version.parse(torch.__version__... | 5,043 | 30.924051 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/demo/restoration_video_demo.py | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import cv2
import mmcv
import numpy as np
import torch
from mmedit.apis import init_model, restoration_video_inference
from mmedit.core import tensor2img
from mmedit.utils import modify_args
VIDEO_EXTENSIONS = ('.mp4', '.mov')
def parse_args... | 2,938 | 32.781609 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/mmedit/apis/test.py | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import pickle
import shutil
import tempfile
import mmcv
import torch
import torch.distributed as dist
from mmcv.runner import get_dist_info
def single_gpu_test(model,
data_loader,
save_image=False,
... | 7,852 | 32.417021 | 79 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/mmedit/apis/restoration_face_inference.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
from mmcv.parallel import collate, scatter
from mmedit.datasets.pipelines import Compose
try:
from facexlib.utils.face_restoration_helper import FaceRestoreHelper
has_facexlib = True
except ImportError:
has_facexlib = False
... | 3,069 | 33.494382 | 77 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/mmedit/apis/generation_inference.py | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
from mmcv.parallel import collate, scatter
from mmedit.core import tensor2img
from mmedit.datasets.pipelines import Compose
def generation_inference(model, img, img_unpaired=None):
"""Inference image with the model.
Args:
... | 2,229 | 34.967742 | 74 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/mmedit/apis/inpainting_inference.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.parallel import collate, scatter
from mmedit.datasets.pipelines import Compose
def inpainting_inference(model, masked_img, mask):
"""Inference image with the model.
Args:
model (nn.Module): The loaded model.
masked_img (s... | 1,546 | 29.94 | 70 | py |
BasicVSR_PlusPlus | BasicVSR_PlusPlus-master/mmedit/apis/restoration_inference.py | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.parallel import collate, scatter
from mmedit.datasets.pipelines import Compose
def restoration_inference(model, img, ref=None):
"""Inference image with the model.
Args:
model (nn.Module): The loaded model.
img (str): File... | 1,606 | 33.191489 | 72 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.