Upload 138 files
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- .gitattributes+4
- Wav2Lip-HD/audio.pyAdded+139
- Wav2Lip-HD/basicsr/README.mdAdded+1
- Wav2Lip-HD/basicsr/__init__.pyAdded+12
- Wav2Lip-HD/basicsr/apply_sr.pyAdded+25
- Wav2Lip-HD/basicsr/archs/__init__.pyAdded+25
- Wav2Lip-HD/basicsr/archs/arch_util.pyAdded+227
- Wav2Lip-HD/basicsr/archs/dfdnet_arch.pyAdded+158
- Wav2Lip-HD/basicsr/archs/dfdnet_util.pyAdded+162
- Wav2Lip-HD/basicsr/archs/discriminator_arch.pyAdded+73
- Wav2Lip-HD/basicsr/archs/duf_arch.pyAdded+283
- Wav2Lip-HD/basicsr/archs/edsr_arch.pyAdded+61
- Wav2Lip-HD/basicsr/archs/edvr_arch.pyAdded+383
- Wav2Lip-HD/basicsr/archs/inception.pyAdded+307
- Wav2Lip-HD/basicsr/archs/rcan_arch.pyAdded+135
- Wav2Lip-HD/basicsr/archs/ridnet_arch.pyAdded+184
- Wav2Lip-HD/basicsr/archs/rrdbnet_arch.pyAdded+104
- Wav2Lip-HD/basicsr/archs/spynet_arch.pyAdded+96
- Wav2Lip-HD/basicsr/archs/srresnet_arch.pyAdded+68
- Wav2Lip-HD/basicsr/archs/stylegan2_arch.pyAdded+799
- Wav2Lip-HD/basicsr/archs/tof_arch.pyAdded+172
- Wav2Lip-HD/basicsr/archs/vgg_arch.pyAdded+161
- Wav2Lip-HD/basicsr/data/__init__.pyAdded+100
- Wav2Lip-HD/basicsr/data/data_sampler.pyAdded+48
- Wav2Lip-HD/basicsr/data/data_util.pyAdded+305
- Wav2Lip-HD/basicsr/data/degradations.pyAdded+347
- Wav2Lip-HD/basicsr/data/ffhq_dataset.pyAdded+63
- Wav2Lip-HD/basicsr/data/meta_info/meta_info_DIV2K800sub_GT.txtAdded
- Wav2Lip-HD/basicsr/data/meta_info/meta_info_REDS4_test_GT.txtAdded+4
- Wav2Lip-HD/basicsr/data/meta_info/meta_info_REDS_GT.txtAdded+270
- Wav2Lip-HD/basicsr/data/meta_info/meta_info_REDSofficial4_test_GT.txtAdded+4
- Wav2Lip-HD/basicsr/data/meta_info/meta_info_REDSval_official_test_GT.txtAdded+30
- Wav2Lip-HD/basicsr/data/meta_info/meta_info_Vimeo90K_test_GT.txtAdded
- Wav2Lip-HD/basicsr/data/meta_info/meta_info_Vimeo90K_test_fast_GT.txtAdded+1225
- Wav2Lip-HD/basicsr/data/meta_info/meta_info_Vimeo90K_test_medium_GT.txtAdded
- Wav2Lip-HD/basicsr/data/meta_info/meta_info_Vimeo90K_test_slow_GT.txtAdded+1613
- Wav2Lip-HD/basicsr/data/meta_info/meta_info_Vimeo90K_train_GT.txtAdded
- Wav2Lip-HD/basicsr/data/paired_image_dataset.pyAdded+101
- Wav2Lip-HD/basicsr/data/prefetch_dataloader.pyAdded+125
- Wav2Lip-HD/basicsr/data/reds_dataset.pyAdded+209
- Wav2Lip-HD/basicsr/data/single_image_dataset.pyAdded+65
- Wav2Lip-HD/basicsr/data/transforms.pyAdded+165
- Wav2Lip-HD/basicsr/data/video_test_dataset.pyAdded+287
- Wav2Lip-HD/basicsr/data/vimeo90k_dataset.pyAdded+126
- Wav2Lip-HD/basicsr/losses/__init__.pyAdded+26
- Wav2Lip-HD/basicsr/losses/loss_util.pyAdded+95
- Wav2Lip-HD/basicsr/losses/losses.pyAdded+423
- Wav2Lip-HD/basicsr/metrics/__init__.pyAdded+20
- Wav2Lip-HD/basicsr/metrics/fid.pyAdded+93
- Wav2Lip-HD/basicsr/metrics/metric_util.pyAdded+45
82 unmodified lines83848582 unmodified linesVietTTS/samples/speechify_8.wav filter=lfs diff=lfs merge=lfs -textVietTTS/samples/speechify_9.wav filter=lfs diff=lfs merge=lfs -textVietTTS/samples/zero_shot_prompt.wav filter=lfs diff=lfs merge=lfs -text82 unmodified lines8384858687888982 unmodified linesVietTTS/samples/speechify_8.wav filter=lfs diff=lfs merge=lfs -textVietTTS/samples/speechify_9.wav filter=lfs diff=lfs merge=lfs -textVietTTS/samples/zero_shot_prompt.wav filter=lfs diff=lfs merge=lfs -textWav2Lip-HD/checkpoints/pretrained.state filter=lfs diff=lfs merge=lfs -textWav2Lip-HD/temp/faulty_frame.jpg filter=lfs diff=lfs merge=lfs -textWav2Lip-HD/temp/result.avi filter=lfs diff=lfs merge=lfs -textWav2Lip-HD/temp/temp.wav filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139import librosa
import librosa.filters
import numpy as np
# import tensorflow as tf
from scipy import signal
from scipy.io import wavfile
from hparams import hparams as hp
def load_wav(path, sr):
return librosa.core.load(path, sr=sr)[0]
def save_wav(wav, path, sr):
wav *= 32767 / max(0.01, np.max(np.abs(wav)))
#proposed by @dsmiller
wavfile.write(path, sr, wav.astype(np.int16))
def save_wavenet_wav(wav, path, sr):
librosa.output.write_wav(path, wav, sr=sr)
def preemphasis(wav, k, preemphasize=True):
if preemphasize:
return signal.lfilter([1, -k], [1], wav)
return wav
def inv_preemphasis(wav, k, inv_preemphasize=True):
if inv_preemphasize:
return signal.lfilter([1], [1, -k], wav)
return wav
def get_hop_size():
hop_size = hp.hop_size
if hop_size is None:
assert hp.frame_shift_ms is not None
hop_size = int(hp.frame_shift_ms / 1000 * hp.sample_rate)
return hop_size
def linearspectrogram(wav):
D = _stft(preemphasis(wav, hp.preemphasis, hp.preemphasize))
S = _amp_to_db(np.abs(D)) - hp.ref_level_db
if hp.signal_normalization:
return _normalize(S)
return S
def melspectrogram(wav):
D = _stft(preemphasis(wav, hp.preemphasis, hp.preemphasize))
S = _amp_to_db(_linear_to_mel(np.abs(D))) - hp.ref_level_db
if hp.signal_normalization:
return _normalize(S)
return S
def _lws_processor():
import lws
return lws.lws(hp.n_fft, get_hop_size(), fftsize=hp.win_size, mode="speech")
def _stft(y):
if hp.use_lws:
return _lws_processor(hp).stft(y).T
else:
return librosa.stft(y=y, n_fft=hp.n_fft, hop_length=get_hop_size(), win_length=hp.win_size)
##########################################################
#Those are only correct when using lws!!! (This was messing with Wavenet quality for a long time!)
def num_frames(length, fsize, fshift):
"""Compute number of time frames of spectrogram
"""
pad = (fsize - fshift)
if length % fshift == 0:
M = (length + pad * 2 - fsize) // fshift + 1
else:
M = (length + pad * 2 - fsize) // fshift + 2
return M
def pad_lr(x, fsize, fshift):
"""Compute left and right padding
"""
M = num_frames(len(x), fsize, fshift)
pad = (fsize - fshift)
T = len(x) + 2 * pad
r = (M - 1) * fshift + fsize - T
return pad, pad + r
##########################################################
#Librosa correct padding
def librosa_pad_lr(x, fsize, fshift):
return 0, (x.shape[0] // fshift + 1) * fshift - x.shape[0]
# Conversions
_mel_basis = None
def _linear_to_mel(spectogram):
global _mel_basis
if _mel_basis is None:
_mel_basis = _build_mel_basis()
return np.dot(_mel_basis, spectogram)
# def _build_mel_basis():
# assert hp.fmax <= hp.sample_rate // 2
# return librosa.filters.mel(hp.sample_rate, hp.n_fft, n_mels=hp.num_mels,
# fmin=hp.fmin, fmax=hp.fmax)
def _build_mel_basis():
assert hp.fmax <= hp.sample_rate // 2
return librosa.filters.mel(sr=hp.sample_rate, n_fft=hp.n_fft, n_mels=hp.num_mels, fmin=hp.fmin, fmax=hp.fmax)
def _amp_to_db(x):
min_level = np.exp(hp.min_level_db / 20 * np.log(10))
return 20 * np.log10(np.maximum(min_level, x))
def _db_to_amp(x):
return np.power(10.0, (x) * 0.05)
def _normalize(S):
if hp.allow_clipping_in_normalization:
if hp.symmetric_mels:
return np.clip((2 * hp.max_abs_value) * ((S - hp.min_level_db) / (-hp.min_level_db)) - hp.max_abs_value,
-hp.max_abs_value, hp.max_abs_value)
else:
return np.clip(hp.max_abs_value * ((S - hp.min_level_db) / (-hp.min_level_db)), 0, hp.max_abs_value)
assert S.max() <= 0 and S.min() - hp.min_level_db >= 0
if hp.symmetric_mels:
return (2 * hp.max_abs_value) * ((S - hp.min_level_db) / (-hp.min_level_db)) - hp.max_abs_value
else:
return hp.max_abs_value * ((S - hp.min_level_db) / (-hp.min_level_db))
def _denormalize(D):
if hp.allow_clipping_in_normalization:
if hp.symmetric_mels:
return (((np.clip(D, -hp.max_abs_value,
hp.max_abs_value) + hp.max_abs_value) * -hp.min_level_db / (2 * hp.max_abs_value))
+ hp.min_level_db)
else:
return ((np.clip(D, 0, hp.max_abs_value) * -hp.min_level_db / hp.max_abs_value) + hp.min_level_db)
if hp.symmetric_mels:
return (((D + hp.max_abs_value) * -hp.min_level_db / (2 * hp.max_abs_value)) + hp.min_level_db)
else:
return ((D * -hp.min_level_db / hp.max_abs_value) + hp.min_level_db)1This folder is almost unmodified code from [BasicSR](https://github.com/xinntao/BasicSR.git) repository that provides solutions for image and video super resolution.123456789101112# https://github.com/xinntao/BasicSR
# flake8: noqa
from .archs import *
from .data import *
from .losses import *
from .metrics import *
from .models import *
from .ops import *
from .test import *
from .train import *
from .utils import *
# from .version import __gitsha__, __version__12345678910111213141516171819202122232425import cv2
import numpy as np
import torch
from basicsr.archs.rrdbnet_arch import RRDBNet
def init_sr_model(model_path):
model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32)
model.load_state_dict(torch.load(model_path)['params'], strict=True)
model.eval()
model = model.cuda()
return model
def enhance(model, image):
img = image.astype(np.float32) / 255.
img = torch.from_numpy(np.transpose(img[:, :, [2, 1, 0]], (2, 0, 1))).float()
img = img.unsqueeze(0).cuda()
with torch.no_grad():
output = model(img)
output = output.data.squeeze().float().cpu().clamp_(0, 1).numpy()
output = np.transpose(output[[2, 1, 0], :, :], (1, 2, 0))
output = (output * 255.0).round().astype(np.uint8)
return output12345678910111213141516171819202122232425import importlib
from copy import deepcopy
from os import path as osp
from basicsr.utils import get_root_logger, scandir
from basicsr.utils.registry import ARCH_REGISTRY
__all__ = ['build_network']
# automatically scan and import arch modules for registry
# scan all the files under the 'archs' folder and collect files ending with
# '_arch.py'
arch_folder = osp.dirname(osp.abspath(__file__))
arch_filenames = [osp.splitext(osp.basename(v))[0] for v in scandir(arch_folder) if v.endswith('_arch.py')]
# import all the arch modules
_arch_modules = [importlib.import_module(f'basicsr.archs.{file_name}') for file_name in arch_filenames]
def build_network(opt):
opt = deepcopy(opt)
network_type = opt.pop('type')
net = ARCH_REGISTRY.get(network_type)(**opt)
logger = get_root_logger()
logger.info(f'Network [{net.__class__.__name__}] is created.')
return net123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227import math
import torch
from torch import nn as nn
from torch.nn import functional as F
from torch.nn import init as init
from torch.nn.modules.batchnorm import _BatchNorm
from basicsr.ops.dcn import ModulatedDeformConvPack, modulated_deform_conv
from basicsr.utils import get_root_logger
@torch.no_grad()
def default_init_weights(module_list, scale=1, bias_fill=0, **kwargs):
"""Initialize network weights.
Args:
module_list (list[nn.Module] | nn.Module): Modules to be initialized.
scale (float): Scale initialized weights, especially for residual
blocks. Default: 1.
bias_fill (float): The value to fill bias. Default: 0
kwargs (dict): Other arguments for initialization function.
"""
if not isinstance(module_list, list):
module_list = [module_list]
for module in module_list:
for m in module.modules():
if isinstance(m, nn.Conv2d):
init.kaiming_normal_(m.weight, **kwargs)
m.weight.data *= scale
if m.bias is not None:
m.bias.data.fill_(bias_fill)
elif isinstance(m, nn.Linear):
init.kaiming_normal_(m.weight, **kwargs)
m.weight.data *= scale
if m.bias is not None:
m.bias.data.fill_(bias_fill)
elif isinstance(m, _BatchNorm):
init.constant_(m.weight, 1)
if m.bias is not None:
m.bias.data.fill_(bias_fill)
def make_layer(basic_block, num_basic_block, **kwarg):
"""Make layers by stacking the same blocks.
Args:
basic_block (nn.module): nn.module class for basic block.
num_basic_block (int): number of blocks.
Returns:
nn.Sequential: Stacked blocks in nn.Sequential.
"""
layers = []
for _ in range(num_basic_block):
layers.append(basic_block(**kwarg))
return nn.Sequential(*layers)
class ResidualBlockNoBN(nn.Module):
"""Residual block without BN.
It has a style of:
---Conv-ReLU-Conv-+-
|________________|
Args:
num_feat (int): Channel number of intermediate features.
Default: 64.
res_scale (float): Residual scale. Default: 1.
pytorch_init (bool): If set to True, use pytorch default init,
otherwise, use default_init_weights. Default: False.
"""
def __init__(self, num_feat=64, res_scale=1, pytorch_init=False):
super(ResidualBlockNoBN, self).__init__()
self.res_scale = res_scale
self.conv1 = nn.Conv2d(num_feat, num_feat, 3, 1, 1, bias=True)
self.conv2 = nn.Conv2d(num_feat, num_feat, 3, 1, 1, bias=True)
self.relu = nn.ReLU(inplace=True)
if not pytorch_init:
default_init_weights([self.conv1, self.conv2], 0.1)
def forward(self, x):
identity = x
out = self.conv2(self.relu(self.conv1(x)))
return identity + out * self.res_scale
class Upsample(nn.Sequential):
"""Upsample module.
Args:
scale (int): Scale factor. Supported scales: 2^n and 3.
num_feat (int): Channel number of intermediate features.
"""
def __init__(self, scale, num_feat):
m = []
if (scale & (scale - 1)) == 0: # scale = 2^n
for _ in range(int(math.log(scale, 2))):
m.append(nn.Conv2d(num_feat, 4 * num_feat, 3, 1, 1))
m.append(nn.PixelShuffle(2))
elif scale == 3:
m.append(nn.Conv2d(num_feat, 9 * num_feat, 3, 1, 1))
m.append(nn.PixelShuffle(3))
else:
raise ValueError(f'scale {scale} is not supported. ' 'Supported scales: 2^n and 3.')
super(Upsample, self).__init__(*m)
def flow_warp(x, flow, interp_mode='bilinear', padding_mode='zeros', align_corners=True):
"""Warp an image or feature map with optical flow.
Args:
x (Tensor): Tensor with size (n, c, h, w).
flow (Tensor): Tensor with size (n, h, w, 2), normal value.
interp_mode (str): 'nearest' or 'bilinear'. Default: 'bilinear'.
padding_mode (str): 'zeros' or 'border' or 'reflection'.
Default: 'zeros'.
align_corners (bool): Before pytorch 1.3, the default value is
align_corners=True. After pytorch 1.3, the default value is
align_corners=False. Here, we use the True as default.
Returns:
Tensor: Warped image or feature map.
"""
assert x.size()[-2:] == flow.size()[1:3]
_, _, h, w = x.size()
# create mesh grid
grid_y, grid_x = torch.meshgrid(torch.arange(0, h).type_as(x), torch.arange(0, w).type_as(x))
grid = torch.stack((grid_x, grid_y), 2).float() # W(x), H(y), 2
grid.requires_grad = False
vgrid = grid + flow
# scale grid to [-1,1]
vgrid_x = 2.0 * vgrid[:, :, :, 0] / max(w - 1, 1) - 1.0
vgrid_y = 2.0 * vgrid[:, :, :, 1] / max(h - 1, 1) - 1.0
vgrid_scaled = torch.stack((vgrid_x, vgrid_y), dim=3)
output = F.grid_sample(x, vgrid_scaled, mode=interp_mode, padding_mode=padding_mode, align_corners=align_corners)
# TODO, what if align_corners=False
return output
def resize_flow(flow, size_type, sizes, interp_mode='bilinear', align_corners=False):
"""Resize a flow according to ratio or shape.
Args:
flow (Tensor): Precomputed flow. shape [N, 2, H, W].
size_type (str): 'ratio' or 'shape'.
sizes (list[int | float]): the ratio for resizing or the final output
shape.
1) The order of ratio should be [ratio_h, ratio_w]. For
downsampling, the ratio should be smaller than 1.0 (i.e., ratio
< 1.0). For upsampling, the ratio should be larger than 1.0 (i.e.,
ratio > 1.0).
2) The order of output_size should be [out_h, out_w].
interp_mode (str): The mode of interpolation for resizing.
Default: 'bilinear'.
align_corners (bool): Whether align corners. Default: False.
Returns:
Tensor: Resized flow.
"""
_, _, flow_h, flow_w = flow.size()
if size_type == 'ratio':
output_h, output_w = int(flow_h * sizes[0]), int(flow_w * sizes[1])
elif size_type == 'shape':
output_h, output_w = sizes[0], sizes[1]
else:
raise ValueError(f'Size type should be ratio or shape, but got type {size_type}.')
input_flow = flow.clone()
ratio_h = output_h / flow_h
ratio_w = output_w / flow_w
input_flow[:, 0, :, :] *= ratio_w
input_flow[:, 1, :, :] *= ratio_h
resized_flow = F.interpolate(
input=input_flow, size=(output_h, output_w), mode=interp_mode, align_corners=align_corners)
return resized_flow
# TODO: may write a cpp file
def pixel_unshuffle(x, scale):
""" Pixel unshuffle.
Args:
x (Tensor): Input feature with shape (b, c, hh, hw).
scale (int): Downsample ratio.
Returns:
Tensor: the pixel unshuffled feature.
"""
b, c, hh, hw = x.size()
out_channel = c * (scale**2)
assert hh % scale == 0 and hw % scale == 0
h = hh // scale
w = hw // scale
x_view = x.view(b, c, h, scale, w, scale)
return x_view.permute(0, 1, 3, 5, 2, 4).reshape(b, out_channel, h, w)
class DCNv2Pack(ModulatedDeformConvPack):
"""Modulated deformable conv for deformable alignment.
Different from the official DCNv2Pack, which generates offsets and masks
from the preceding features, this DCNv2Pack takes another different
features to generate offsets and masks.
Ref:
Delving Deep into Deformable Alignment in Video Super-Resolution.
"""
def forward(self, x, feat):
out = self.conv_offset(feat)
o1, o2, mask = torch.chunk(out, 3, dim=1)
offset = torch.cat((o1, o2), dim=1)
mask = torch.sigmoid(mask)
offset_absmean = torch.mean(torch.abs(offset))
if offset_absmean > 50:
logger = get_root_logger()
logger.warning(f'Offset abs mean is {offset_absmean}, larger than 50.')
return modulated_deform_conv(x, offset, mask, self.weight, self.bias, self.stride, self.padding, self.dilation,
self.groups, self.deformable_groups)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.utils.spectral_norm as SpectralNorm
from basicsr.utils.registry import ARCH_REGISTRY
from .dfdnet_util import AttentionBlock, Blur, MSDilationBlock, UpResBlock, adaptive_instance_normalization
from .vgg_arch import VGGFeatureExtractor
class SFTUpBlock(nn.Module):
"""Spatial feature transform (SFT) with upsampling block."""
def __init__(self, in_channel, out_channel, kernel_size=3, padding=1):
super(SFTUpBlock, self).__init__()
self.conv1 = nn.Sequential(
Blur(in_channel),
SpectralNorm(nn.Conv2d(in_channel, out_channel, kernel_size, padding=padding)),
nn.LeakyReLU(0.04, True),
# The official codes use two LeakyReLU here, so 0.04 for equivalent
)
self.convup = nn.Sequential(
nn.Upsample(scale_factor=2, mode='bilinear', align_corners=False),
SpectralNorm(nn.Conv2d(out_channel, out_channel, kernel_size, padding=padding)),
nn.LeakyReLU(0.2, True),
)
# for SFT scale and shift
self.scale_block = nn.Sequential(
SpectralNorm(nn.Conv2d(in_channel, out_channel, 3, 1, 1)), nn.LeakyReLU(0.2, True),
SpectralNorm(nn.Conv2d(out_channel, out_channel, 3, 1, 1)))
self.shift_block = nn.Sequential(
SpectralNorm(nn.Conv2d(in_channel, out_channel, 3, 1, 1)), nn.LeakyReLU(0.2, True),
SpectralNorm(nn.Conv2d(out_channel, out_channel, 3, 1, 1)), nn.Sigmoid())
# The official codes use sigmoid for shift block, do not know why
def forward(self, x, updated_feat):
out = self.conv1(x)
# SFT
scale = self.scale_block(updated_feat)
shift = self.shift_block(updated_feat)
out = out * scale + shift
# upsample
out = self.convup(out)
return out
@ARCH_REGISTRY.register()
class DFDNet(nn.Module):
"""DFDNet: Deep Face Dictionary Network.
It only processes faces with 512x512 size.
"""
def __init__(self, num_feat, dict_path):
super().__init__()
self.parts = ['left_eye', 'right_eye', 'nose', 'mouth']
# part_sizes: [80, 80, 50, 110]
channel_sizes = [128, 256, 512, 512]
self.feature_sizes = np.array([256, 128, 64, 32])
self.vgg_layers = ['relu2_2', 'relu3_4', 'relu4_4', 'conv5_4']
self.flag_dict_device = False
# dict
self.dict = torch.load(dict_path)
# vgg face extractor
self.vgg_extractor = VGGFeatureExtractor(
layer_name_list=self.vgg_layers,
vgg_type='vgg19',
use_input_norm=True,
range_norm=True,
requires_grad=False)
# attention block for fusing dictionary features and input features
self.attn_blocks = nn.ModuleDict()
for idx, feat_size in enumerate(self.feature_sizes):
for name in self.parts:
self.attn_blocks[f'{name}_{feat_size}'] = AttentionBlock(channel_sizes[idx])
# multi scale dilation block
self.multi_scale_dilation = MSDilationBlock(num_feat * 8, dilation=[4, 3, 2, 1])
# upsampling and reconstruction
self.upsample0 = SFTUpBlock(num_feat * 8, num_feat * 8)
self.upsample1 = SFTUpBlock(num_feat * 8, num_feat * 4)
self.upsample2 = SFTUpBlock(num_feat * 4, num_feat * 2)
self.upsample3 = SFTUpBlock(num_feat * 2, num_feat)
self.upsample4 = nn.Sequential(
SpectralNorm(nn.Conv2d(num_feat, num_feat, 3, 1, 1)), nn.LeakyReLU(0.2, True), UpResBlock(num_feat),
UpResBlock(num_feat), nn.Conv2d(num_feat, 3, kernel_size=3, stride=1, padding=1), nn.Tanh())
def swap_feat(self, vgg_feat, updated_feat, dict_feat, location, part_name, f_size):
"""swap the features from the dictionary."""
# get the original vgg features
part_feat = vgg_feat[:, :, location[1]:location[3], location[0]:location[2]].clone()
# resize original vgg features
part_resize_feat = F.interpolate(part_feat, dict_feat.size()[2:4], mode='bilinear', align_corners=False)
# use adaptive instance normalization to adjust color and illuminations
dict_feat = adaptive_instance_normalization(dict_feat, part_resize_feat)
# get similarity scores
similarity_score = F.conv2d(part_resize_feat, dict_feat)
similarity_score = F.softmax(similarity_score.view(-1), dim=0)
# select the most similar features in the dict (after norm)
select_idx = torch.argmax(similarity_score)
swap_feat = F.interpolate(dict_feat[select_idx:select_idx + 1], part_feat.size()[2:4])
# attention
attn = self.attn_blocks[f'{part_name}_' + str(f_size)](swap_feat - part_feat)
attn_feat = attn * swap_feat
# update features
updated_feat[:, :, location[1]:location[3], location[0]:location[2]] = attn_feat + part_feat
return updated_feat
def put_dict_to_device(self, x):
if self.flag_dict_device is False:
for k, v in self.dict.items():
for kk, vv in v.items():
self.dict[k][kk] = vv.to(x)
self.flag_dict_device = True
def forward(self, x, part_locations):
"""
Now only support testing with batch size = 0.
Args:
x (Tensor): Input faces with shape (b, c, 512, 512).
part_locations (list[Tensor]): Part locations.
"""
self.put_dict_to_device(x)
# extract vggface features
vgg_features = self.vgg_extractor(x)
# update vggface features using the dictionary for each part
updated_vgg_features = []
batch = 0 # only supports testing with batch size = 0
for vgg_layer, f_size in zip(self.vgg_layers, self.feature_sizes):
dict_features = self.dict[f'{f_size}']
vgg_feat = vgg_features[vgg_layer]
updated_feat = vgg_feat.clone()
# swap features from dictionary
for part_idx, part_name in enumerate(self.parts):
location = (part_locations[part_idx][batch] // (512 / f_size)).int()
updated_feat = self.swap_feat(vgg_feat, updated_feat, dict_features[part_name], location, part_name,
f_size)
updated_vgg_features.append(updated_feat)
vgg_feat_dilation = self.multi_scale_dilation(vgg_features['conv5_4'])
# use updated vgg features to modulate the upsampled features with
# SFT (Spatial Feature Transform) scaling and shifting manner.
upsampled_feat = self.upsample0(vgg_feat_dilation, updated_vgg_features[3])
upsampled_feat = self.upsample1(upsampled_feat, updated_vgg_features[2])
upsampled_feat = self.upsample2(upsampled_feat, updated_vgg_features[1])
upsampled_feat = self.upsample3(upsampled_feat, updated_vgg_features[0])
out = self.upsample4(upsampled_feat)
return out123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.utils.spectral_norm as SpectralNorm
from torch.autograd import Function
class BlurFunctionBackward(Function):
@staticmethod
def forward(ctx, grad_output, kernel, kernel_flip):
ctx.save_for_backward(kernel, kernel_flip)
grad_input = F.conv2d(grad_output, kernel_flip, padding=1, groups=grad_output.shape[1])
return grad_input
@staticmethod
def backward(ctx, gradgrad_output):
kernel, kernel_flip = ctx.saved_tensors
grad_input = F.conv2d(gradgrad_output, kernel, padding=1, groups=gradgrad_output.shape[1])
return grad_input, None, None
class BlurFunction(Function):
@staticmethod
def forward(ctx, x, kernel, kernel_flip):
ctx.save_for_backward(kernel, kernel_flip)
output = F.conv2d(x, kernel, padding=1, groups=x.shape[1])
return output
@staticmethod
def backward(ctx, grad_output):
kernel, kernel_flip = ctx.saved_tensors
grad_input = BlurFunctionBackward.apply(grad_output, kernel, kernel_flip)
return grad_input, None, None
blur = BlurFunction.apply
class Blur(nn.Module):
def __init__(self, channel):
super().__init__()
kernel = torch.tensor([[1, 2, 1], [2, 4, 2], [1, 2, 1]], dtype=torch.float32)
kernel = kernel.view(1, 1, 3, 3)
kernel = kernel / kernel.sum()
kernel_flip = torch.flip(kernel, [2, 3])
self.kernel = kernel.repeat(channel, 1, 1, 1)
self.kernel_flip = kernel_flip.repeat(channel, 1, 1, 1)
def forward(self, x):
return blur(x, self.kernel.type_as(x), self.kernel_flip.type_as(x))
def calc_mean_std(feat, eps=1e-5):
"""Calculate mean and std for adaptive_instance_normalization.
Args:
feat (Tensor): 4D tensor.
eps (float): A small value added to the variance to avoid
divide-by-zero. Default: 1e-5.
"""
size = feat.size()
assert len(size) == 4, 'The input feature should be 4D tensor.'
n, c = size[:2]
feat_var = feat.view(n, c, -1).var(dim=2) + eps
feat_std = feat_var.sqrt().view(n, c, 1, 1)
feat_mean = feat.view(n, c, -1).mean(dim=2).view(n, c, 1, 1)
return feat_mean, feat_std
def adaptive_instance_normalization(content_feat, style_feat):
"""Adaptive instance normalization.
Adjust the reference features to have the similar color and illuminations
as those in the degradate features.
Args:
content_feat (Tensor): The reference feature.
style_feat (Tensor): The degradate features.
"""
size = content_feat.size()
style_mean, style_std = calc_mean_std(style_feat)
content_mean, content_std = calc_mean_std(content_feat)
normalized_feat = (content_feat - content_mean.expand(size)) / content_std.expand(size)
return normalized_feat * style_std.expand(size) + style_mean.expand(size)
def AttentionBlock(in_channel):
return nn.Sequential(
SpectralNorm(nn.Conv2d(in_channel, in_channel, 3, 1, 1)), nn.LeakyReLU(0.2, True),
SpectralNorm(nn.Conv2d(in_channel, in_channel, 3, 1, 1)))
def conv_block(in_channels, out_channels, kernel_size=3, stride=1, dilation=1, bias=True):
"""Conv block used in MSDilationBlock."""
return nn.Sequential(
SpectralNorm(
nn.Conv2d(
in_channels,
out_channels,
kernel_size=kernel_size,
stride=stride,
dilation=dilation,
padding=((kernel_size - 1) // 2) * dilation,
bias=bias)),
nn.LeakyReLU(0.2),
SpectralNorm(
nn.Conv2d(
out_channels,
out_channels,
kernel_size=kernel_size,
stride=stride,
dilation=dilation,
padding=((kernel_size - 1) // 2) * dilation,
bias=bias)),
)
class MSDilationBlock(nn.Module):
"""Multi-scale dilation block."""
def __init__(self, in_channels, kernel_size=3, dilation=(1, 1, 1, 1), bias=True):
super(MSDilationBlock, self).__init__()
self.conv_blocks = nn.ModuleList()
for i in range(4):
self.conv_blocks.append(conv_block(in_channels, in_channels, kernel_size, dilation=dilation[i], bias=bias))
self.conv_fusion = SpectralNorm(
nn.Conv2d(
in_channels * 4,
in_channels,
kernel_size=kernel_size,
stride=1,
padding=(kernel_size - 1) // 2,
bias=bias))
def forward(self, x):
out = []
for i in range(4):
out.append(self.conv_blocks[i](x))
out = torch.cat(out, 1)
out = self.conv_fusion(out) + x
return out
class UpResBlock(nn.Module):
def __init__(self, in_channel):
super(UpResBlock, self).__init__()
self.body = nn.Sequential(
nn.Conv2d(in_channel, in_channel, 3, 1, 1),
nn.LeakyReLU(0.2, True),
nn.Conv2d(in_channel, in_channel, 3, 1, 1),
)
def forward(self, x):
out = x + self.body(x)
return out12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273from torch import nn as nn
from basicsr.utils.registry import ARCH_REGISTRY
@ARCH_REGISTRY.register()
class VGGStyleDiscriminator128(nn.Module):
"""VGG style discriminator with input size 128 x 128.
It is used to train SRGAN and ESRGAN.
Args:
num_in_ch (int): Channel number of inputs. Default: 3.
num_feat (int): Channel number of base intermediate features.
Default: 64.
"""
def __init__(self, num_in_ch, num_feat):
super(VGGStyleDiscriminator128, self).__init__()
self.conv0_0 = nn.Conv2d(num_in_ch, num_feat, 3, 1, 1, bias=True)
self.conv0_1 = nn.Conv2d(num_feat, num_feat, 4, 2, 1, bias=False)
self.bn0_1 = nn.BatchNorm2d(num_feat, affine=True)
self.conv1_0 = nn.Conv2d(num_feat, num_feat * 2, 3, 1, 1, bias=False)
self.bn1_0 = nn.BatchNorm2d(num_feat * 2, affine=True)
self.conv1_1 = nn.Conv2d(num_feat * 2, num_feat * 2, 4, 2, 1, bias=False)
self.bn1_1 = nn.BatchNorm2d(num_feat * 2, affine=True)
self.conv2_0 = nn.Conv2d(num_feat * 2, num_feat * 4, 3, 1, 1, bias=False)
self.bn2_0 = nn.BatchNorm2d(num_feat * 4, affine=True)
self.conv2_1 = nn.Conv2d(num_feat * 4, num_feat * 4, 4, 2, 1, bias=False)
self.bn2_1 = nn.BatchNorm2d(num_feat * 4, affine=True)
self.conv3_0 = nn.Conv2d(num_feat * 4, num_feat * 8, 3, 1, 1, bias=False)
self.bn3_0 = nn.BatchNorm2d(num_feat * 8, affine=True)
self.conv3_1 = nn.Conv2d(num_feat * 8, num_feat * 8, 4, 2, 1, bias=False)
self.bn3_1 = nn.BatchNorm2d(num_feat * 8, affine=True)
self.conv4_0 = nn.Conv2d(num_feat * 8, num_feat * 8, 3, 1, 1, bias=False)
self.bn4_0 = nn.BatchNorm2d(num_feat * 8, affine=True)
self.conv4_1 = nn.Conv2d(num_feat * 8, num_feat * 8, 4, 2, 1, bias=False)
self.bn4_1 = nn.BatchNorm2d(num_feat * 8, affine=True)
self.linear1 = nn.Linear(num_feat * 8 * 4 * 4, 100)
self.linear2 = nn.Linear(100, 1)
# activation function
self.lrelu = nn.LeakyReLU(negative_slope=0.2, inplace=True)
def forward(self, x):
assert x.size(2) == 128 and x.size(3) == 128, (f'Input spatial size must be 128x128, '
f'but received {x.size()}.')
feat = self.lrelu(self.conv0_0(x))
feat = self.lrelu(self.bn0_1(self.conv0_1(feat))) # output spatial size: (64, 64)
feat = self.lrelu(self.bn1_0(self.conv1_0(feat)))
feat = self.lrelu(self.bn1_1(self.conv1_1(feat))) # output spatial size: (32, 32)
feat = self.lrelu(self.bn2_0(self.conv2_0(feat)))
feat = self.lrelu(self.bn2_1(self.conv2_1(feat))) # output spatial size: (16, 16)
feat = self.lrelu(self.bn3_0(self.conv3_0(feat)))
feat = self.lrelu(self.bn3_1(self.conv3_1(feat))) # output spatial size: (8, 8)
feat = self.lrelu(self.bn4_0(self.conv4_0(feat)))
feat = self.lrelu(self.bn4_1(self.conv4_1(feat))) # output spatial size: (4, 4)
feat = feat.view(feat.size(0), -1)
feat = self.lrelu(self.linear1(feat))
out = self.linear2(feat)
return out123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283import numpy as np
import torch
from torch import nn as nn
from torch.nn import functional as F
from basicsr.utils.registry import ARCH_REGISTRY
class DenseBlocksTemporalReduce(nn.Module):
"""A concatenation of 3 dense blocks with reduction in temporal dimension.
Note that the output temporal dimension is 6 fewer the input temporal
dimension, since there are 3 blocks.
Args:
num_feat (int): Number of channels in the blocks. Default: 64.
num_grow_ch (int): Growing factor of the dense blocks. Default: 32
adapt_official_weights (bool): Whether to adapt the weights
translated from the official implementation. Set to false if you
want to train from scratch. Default: False.
"""
def __init__(self, num_feat=64, num_grow_ch=32, adapt_official_weights=False):
super(DenseBlocksTemporalReduce, self).__init__()
if adapt_official_weights:
eps = 1e-3
momentum = 1e-3
else: # pytorch default values
eps = 1e-05
momentum = 0.1
self.temporal_reduce1 = nn.Sequential(
nn.BatchNorm3d(num_feat, eps=eps, momentum=momentum), nn.ReLU(inplace=True),
nn.Conv3d(num_feat, num_feat, (1, 1, 1), stride=(1, 1, 1), padding=(0, 0, 0), bias=True),
nn.BatchNorm3d(num_feat, eps=eps, momentum=momentum), nn.ReLU(inplace=True),
nn.Conv3d(num_feat, num_grow_ch, (3, 3, 3), stride=(1, 1, 1), padding=(0, 1, 1), bias=True))
self.temporal_reduce2 = nn.Sequential(
nn.BatchNorm3d(num_feat + num_grow_ch, eps=eps, momentum=momentum), nn.ReLU(inplace=True),
nn.Conv3d(
num_feat + num_grow_ch,
num_feat + num_grow_ch, (1, 1, 1),
stride=(1, 1, 1),
padding=(0, 0, 0),
bias=True), nn.BatchNorm3d(num_feat + num_grow_ch, eps=eps, momentum=momentum), nn.ReLU(inplace=True),
nn.Conv3d(num_feat + num_grow_ch, num_grow_ch, (3, 3, 3), stride=(1, 1, 1), padding=(0, 1, 1), bias=True))
self.temporal_reduce3 = nn.Sequential(
nn.BatchNorm3d(num_feat + 2 * num_grow_ch, eps=eps, momentum=momentum), nn.ReLU(inplace=True),
nn.Conv3d(
num_feat + 2 * num_grow_ch,
num_feat + 2 * num_grow_ch, (1, 1, 1),
stride=(1, 1, 1),
padding=(0, 0, 0),
bias=True), nn.BatchNorm3d(num_feat + 2 * num_grow_ch, eps=eps, momentum=momentum),
nn.ReLU(inplace=True),
nn.Conv3d(
num_feat + 2 * num_grow_ch, num_grow_ch, (3, 3, 3), stride=(1, 1, 1), padding=(0, 1, 1), bias=True))
def forward(self, x):
"""
Args:
x (Tensor): Input tensor with shape (b, num_feat, t, h, w).
Returns:
Tensor: Output with shape (b, num_feat + num_grow_ch * 3, 1, h, w).
"""
x1 = self.temporal_reduce1(x)
x1 = torch.cat((x[:, :, 1:-1, :, :], x1), 1)
x2 = self.temporal_reduce2(x1)
x2 = torch.cat((x1[:, :, 1:-1, :, :], x2), 1)
x3 = self.temporal_reduce3(x2)
x3 = torch.cat((x2[:, :, 1:-1, :, :], x3), 1)
return x3
class DenseBlocks(nn.Module):
""" A concatenation of N dense blocks.
Args:
num_feat (int): Number of channels in the blocks. Default: 64.
num_grow_ch (int): Growing factor of the dense blocks. Default: 32.
num_block (int): Number of dense blocks. The values are:
DUF-S (16 layers): 3
DUF-M (18 layers): 9
DUF-L (52 layers): 21
adapt_official_weights (bool): Whether to adapt the weights
translated from the official implementation. Set to false if you
want to train from scratch. Default: False.
"""
def __init__(self, num_block, num_feat=64, num_grow_ch=16, adapt_official_weights=False):
super(DenseBlocks, self).__init__()
if adapt_official_weights:
eps = 1e-3
momentum = 1e-3
else: # pytorch default values
eps = 1e-05
momentum = 0.1
self.dense_blocks = nn.ModuleList()
for i in range(0, num_block):
self.dense_blocks.append(
nn.Sequential(
nn.BatchNorm3d(num_feat + i * num_grow_ch, eps=eps, momentum=momentum), nn.ReLU(inplace=True),
nn.Conv3d(
num_feat + i * num_grow_ch,
num_feat + i * num_grow_ch, (1, 1, 1),
stride=(1, 1, 1),
padding=(0, 0, 0),
bias=True), nn.BatchNorm3d(num_feat + i * num_grow_ch, eps=eps, momentum=momentum),
nn.ReLU(inplace=True),
nn.Conv3d(
num_feat + i * num_grow_ch,
num_grow_ch, (3, 3, 3),
stride=(1, 1, 1),
padding=(1, 1, 1),
bias=True)))
def forward(self, x):
"""
Args:
x (Tensor): Input tensor with shape (b, num_feat, t, h, w).
Returns:
Tensor: Output with shape
(b, num_feat + num_block * num_grow_ch, t, h, w).
"""
for i in range(0, len(self.dense_blocks)):
y = self.dense_blocks[i](x)
x = torch.cat((x, y), 1)
return x
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 applies the same filters
to 3 channels.
Args:
filter_size (tuple): Filter size of generated filters.
The shape is (kh, kw). Default: (5, 5).
"""
def __init__(self, filter_size=(5, 5)):
super(DynamicUpsamplingFilter, self).__init__()
if not isinstance(filter_size, tuple):
raise TypeError('The type of filter_size must be tuple, ' f'but got type{filter_size}')
if len(filter_size) != 2:
raise ValueError('The length of filter size must be 2, ' f'but got {len(filter_size)}.')
# generate a local expansion filter, similar to im2col
self.filter_size = filter_size
filter_prod = np.prod(filter_size)
expansion_filter = torch.eye(int(filter_prod)).view(filter_prod, 1, *filter_size) # (kh*kw, 1, kh, kw)
self.expansion_filter = expansion_filter.repeat(3, 1, 1, 1) # repeat for all the 3 channels
def forward(self, x, filters):
"""Forward function for DynamicUpsamplingFilter.
Args:
x (Tensor): Input image with 3 channels. The shape is (n, 3, h, w).
filters (Tensor): Generated dynamic filters.
The shape is (n, filter_prod, upsampling_square, h, w).
filter_prod: prod of filter kenrel size, e.g., 1*5*5=25.
upsampling_square: similar to pixel shuffle,
upsampling_square = upsampling * upsampling
e.g., for x 4 upsampling, upsampling_square= 4*4 = 16
Returns:
Tensor: Filtered image with shape (n, 3*upsampling_square, h, w)
"""
n, filter_prod, upsampling_square, h, w = filters.size()
kh, kw = self.filter_size
expanded_input = F.conv2d(
x, self.expansion_filter.to(x), padding=(kh // 2, kw // 2), groups=3) # (n, 3*filter_prod, h, w)
expanded_input = expanded_input.view(n, 3, filter_prod, h, w).permute(0, 3, 4, 1,
2) # (n, h, w, 3, filter_prod)
filters = filters.permute(0, 3, 4, 1, 2) # (n, h, w, filter_prod, upsampling_square]
out = torch.matmul(expanded_input, filters) # (n, h, w, 3, upsampling_square)
return out.permute(0, 3, 4, 1, 2).view(n, 3 * upsampling_square, h, w)
@ARCH_REGISTRY.register()
class DUF(nn.Module):
"""Network architecture for DUF
Paper: Jo et.al. Deep Video Super-Resolution Network Using Dynamic
Upsampling Filters Without Explicit Motion Compensation, CVPR, 2018
Code reference:
https://github.com/yhjo09/VSR-DUF
For all the models below, 'adapt_official_weights' is only necessary when
loading the weights converted from the official TensorFlow weights.
Please set it to False if you are training the model from scratch.
There are three models with different model size: DUF16Layers, DUF28Layers,
and DUF52Layers. This class is the base class for these models.
Args:
scale (int): The upsampling factor. Default: 4.
num_layer (int): The number of layers. Default: 52.
adapt_official_weights_weights (bool): Whether to adapt the weights
translated from the official implementation. Set to false if you
want to train from scratch. Default: False.
"""
def __init__(self, scale=4, num_layer=52, adapt_official_weights=False):
super(DUF, self).__init__()
self.scale = scale
if adapt_official_weights:
eps = 1e-3
momentum = 1e-3
else: # pytorch default values
eps = 1e-05
momentum = 0.1
self.conv3d1 = nn.Conv3d(3, 64, (1, 3, 3), stride=(1, 1, 1), padding=(0, 1, 1), bias=True)
self.dynamic_filter = DynamicUpsamplingFilter((5, 5))
if num_layer == 16:
num_block = 3
num_grow_ch = 32
elif num_layer == 28:
num_block = 9
num_grow_ch = 16
elif num_layer == 52:
num_block = 21
num_grow_ch = 16
else:
raise ValueError(f'Only supported (16, 28, 52) layers, but got {num_layer}.')
self.dense_block1 = DenseBlocks(
num_block=num_block, num_feat=64, num_grow_ch=num_grow_ch,
adapt_official_weights=adapt_official_weights) # T = 7
self.dense_block2 = DenseBlocksTemporalReduce(
64 + num_grow_ch * num_block, num_grow_ch, adapt_official_weights=adapt_official_weights) # T = 1
channels = 64 + num_grow_ch * num_block + num_grow_ch * 3
self.bn3d2 = nn.BatchNorm3d(channels, eps=eps, momentum=momentum)
self.conv3d2 = nn.Conv3d(channels, 256, (1, 3, 3), stride=(1, 1, 1), padding=(0, 1, 1), bias=True)
self.conv3d_r1 = nn.Conv3d(256, 256, (1, 1, 1), stride=(1, 1, 1), padding=(0, 0, 0), bias=True)
self.conv3d_r2 = nn.Conv3d(256, 3 * (scale**2), (1, 1, 1), stride=(1, 1, 1), padding=(0, 0, 0), bias=True)
self.conv3d_f1 = nn.Conv3d(256, 512, (1, 1, 1), stride=(1, 1, 1), padding=(0, 0, 0), bias=True)
self.conv3d_f2 = nn.Conv3d(
512, 1 * 5 * 5 * (scale**2), (1, 1, 1), stride=(1, 1, 1), padding=(0, 0, 0), bias=True)
def forward(self, x):
"""
Args:
x (Tensor): Input with shape (b, 7, c, h, w)
Returns:
Tensor: Output with shape (b, 1, h * scale, w * scale)
"""
num_batches, num_imgs, _, h, w = x.size()
x = x.permute(0, 2, 1, 3, 4) # (b, c, 7, h, w) for Conv3D
x_center = x[:, :, num_imgs // 2, :, :]
x = self.conv3d1(x)
x = self.dense_block1(x)
x = self.dense_block2(x)
x = F.relu(self.bn3d2(x), inplace=True)
x = F.relu(self.conv3d2(x), inplace=True)
# residual image
res = self.conv3d_r2(F.relu(self.conv3d_r1(x), inplace=True))
# filter
filter_ = self.conv3d_f2(F.relu(self.conv3d_f1(x), inplace=True))
filter_ = F.softmax(filter_.view(num_batches, 25, self.scale**2, h, w), dim=1)
# dynamic filter
out = self.dynamic_filter(x_center, filter_)
out += res.squeeze_(2)
out = F.pixel_shuffle(out, self.scale)
return out12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061import torch
from torch import nn as nn
from basicsr.archs.arch_util import ResidualBlockNoBN, Upsample, make_layer
from basicsr.utils.registry import ARCH_REGISTRY
@ARCH_REGISTRY.register()
class EDSR(nn.Module):
"""EDSR network structure.
Paper: Enhanced Deep Residual Networks for Single Image Super-Resolution.
Ref git repo: https://github.com/thstkdgus35/EDSR-PyTorch
Args:
num_in_ch (int): Channel number of inputs.
num_out_ch (int): Channel number of outputs.
num_feat (int): Channel number of intermediate features.
Default: 64.
num_block (int): Block number in the trunk network. Default: 16.
upscale (int): Upsampling factor. Support 2^n and 3.
Default: 4.
res_scale (float): Used to scale the residual in residual block.
Default: 1.
img_range (float): Image range. Default: 255.
rgb_mean (tuple[float]): Image mean in RGB orders.
Default: (0.4488, 0.4371, 0.4040), calculated from DIV2K dataset.
"""
def __init__(self,
num_in_ch,
num_out_ch,
num_feat=64,
num_block=16,
upscale=4,
res_scale=1,
img_range=255.,
rgb_mean=(0.4488, 0.4371, 0.4040)):
super(EDSR, self).__init__()
self.img_range = img_range
self.mean = torch.Tensor(rgb_mean).view(1, 3, 1, 1)
self.conv_first = nn.Conv2d(num_in_ch, num_feat, 3, 1, 1)
self.body = make_layer(ResidualBlockNoBN, num_block, num_feat=num_feat, res_scale=res_scale, pytorch_init=True)
self.conv_after_body = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
self.upsample = Upsample(upscale, num_feat)
self.conv_last = nn.Conv2d(num_feat, num_out_ch, 3, 1, 1)
def forward(self, x):
self.mean = self.mean.type_as(x)
x = (x - self.mean) * self.img_range
x = self.conv_first(x)
res = self.conv_after_body(self.body(x))
res += x
x = self.conv_last(self.upsample(res))
x = x / self.img_range + self.mean
return x123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383import torch
from torch import nn as nn
from torch.nn import functional as F
from basicsr.utils.registry import ARCH_REGISTRY
from .arch_util import DCNv2Pack, ResidualBlockNoBN, make_layer
class PCDAlignment(nn.Module):
"""Alignment module using Pyramid, Cascading and Deformable convolution
(PCD). It is used in EDVR.
Ref:
EDVR: Video Restoration with Enhanced Deformable Convolutional Networks
Args:
num_feat (int): Channel number of middle features. Default: 64.
deformable_groups (int): Deformable groups. Defaults: 8.
"""
def __init__(self, num_feat=64, deformable_groups=8):
super(PCDAlignment, self).__init__()
# Pyramid has three levels:
# L3: level 3, 1/4 spatial size
# L2: level 2, 1/2 spatial size
# L1: level 1, original spatial size
self.offset_conv1 = nn.ModuleDict()
self.offset_conv2 = nn.ModuleDict()
self.offset_conv3 = nn.ModuleDict()
self.dcn_pack = nn.ModuleDict()
self.feat_conv = nn.ModuleDict()
# Pyramids
for i in range(3, 0, -1):
level = f'l{i}'
self.offset_conv1[level] = nn.Conv2d(num_feat * 2, num_feat, 3, 1, 1)
if i == 3:
self.offset_conv2[level] = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
else:
self.offset_conv2[level] = nn.Conv2d(num_feat * 2, num_feat, 3, 1, 1)
self.offset_conv3[level] = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
self.dcn_pack[level] = DCNv2Pack(num_feat, num_feat, 3, padding=1, deformable_groups=deformable_groups)
if i < 3:
self.feat_conv[level] = nn.Conv2d(num_feat * 2, num_feat, 3, 1, 1)
# Cascading dcn
self.cas_offset_conv1 = nn.Conv2d(num_feat * 2, num_feat, 3, 1, 1)
self.cas_offset_conv2 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
self.cas_dcnpack = DCNv2Pack(num_feat, num_feat, 3, padding=1, deformable_groups=deformable_groups)
self.upsample = nn.Upsample(scale_factor=2, mode='bilinear', align_corners=False)
self.lrelu = nn.LeakyReLU(negative_slope=0.1, inplace=True)
def forward(self, nbr_feat_l, ref_feat_l):
"""Align neighboring frame features to the reference frame features.
Args:
nbr_feat_l (list[Tensor]): Neighboring feature list. It
contains three pyramid levels (L1, L2, L3),
each with shape (b, c, h, w).
ref_feat_l (list[Tensor]): Reference feature list. It
contains three pyramid levels (L1, L2, L3),
each with shape (b, c, h, w).
Returns:
Tensor: Aligned features.
"""
# Pyramids
upsampled_offset, upsampled_feat = None, None
for i in range(3, 0, -1):
level = f'l{i}'
offset = torch.cat([nbr_feat_l[i - 1], ref_feat_l[i - 1]], dim=1)
offset = self.lrelu(self.offset_conv1[level](offset))
if i == 3:
offset = self.lrelu(self.offset_conv2[level](offset))
else:
offset = self.lrelu(self.offset_conv2[level](torch.cat([offset, upsampled_offset], dim=1)))
offset = self.lrelu(self.offset_conv3[level](offset))
feat = self.dcn_pack[level](nbr_feat_l[i - 1], offset)
if i < 3:
feat = self.feat_conv[level](torch.cat([feat, upsampled_feat], dim=1))
if i > 1:
feat = self.lrelu(feat)
if i > 1: # upsample offset and features
# x2: when we upsample the offset, we should also enlarge
# the magnitude.
upsampled_offset = self.upsample(offset) * 2
upsampled_feat = self.upsample(feat)
# Cascading
offset = torch.cat([feat, ref_feat_l[0]], dim=1)
offset = self.lrelu(self.cas_offset_conv2(self.lrelu(self.cas_offset_conv1(offset))))
feat = self.lrelu(self.cas_dcnpack(feat, offset))
return feat
class TSAFusion(nn.Module):
"""Temporal Spatial Attention (TSA) fusion module.
Temporal: Calculate the correlation between center frame and
neighboring frames;
Spatial: It has 3 pyramid levels, the attention is similar to SFT.
(SFT: Recovering realistic texture in image super-resolution by deep
spatial feature transform.)
Args:
num_feat (int): Channel number of middle features. Default: 64.
num_frame (int): Number of frames. Default: 5.
center_frame_idx (int): The index of center frame. Default: 2.
"""
def __init__(self, num_feat=64, num_frame=5, center_frame_idx=2):
super(TSAFusion, self).__init__()
self.center_frame_idx = center_frame_idx
# temporal attention (before fusion conv)
self.temporal_attn1 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
self.temporal_attn2 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
self.feat_fusion = nn.Conv2d(num_frame * num_feat, num_feat, 1, 1)
# spatial attention (after fusion conv)
self.max_pool = nn.MaxPool2d(3, stride=2, padding=1)
self.avg_pool = nn.AvgPool2d(3, stride=2, padding=1)
self.spatial_attn1 = nn.Conv2d(num_frame * num_feat, num_feat, 1)
self.spatial_attn2 = nn.Conv2d(num_feat * 2, num_feat, 1)
self.spatial_attn3 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
self.spatial_attn4 = nn.Conv2d(num_feat, num_feat, 1)
self.spatial_attn5 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
self.spatial_attn_l1 = nn.Conv2d(num_feat, num_feat, 1)
self.spatial_attn_l2 = nn.Conv2d(num_feat * 2, num_feat, 3, 1, 1)
self.spatial_attn_l3 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
self.spatial_attn_add1 = nn.Conv2d(num_feat, num_feat, 1)
self.spatial_attn_add2 = nn.Conv2d(num_feat, num_feat, 1)
self.lrelu = nn.LeakyReLU(negative_slope=0.1, inplace=True)
self.upsample = nn.Upsample(scale_factor=2, mode='bilinear', align_corners=False)
def forward(self, aligned_feat):
"""
Args:
aligned_feat (Tensor): Aligned features with shape (b, t, c, h, w).
Returns:
Tensor: Features after TSA with the shape (b, c, h, w).
"""
b, t, c, h, w = aligned_feat.size()
# temporal attention
embedding_ref = self.temporal_attn1(aligned_feat[:, self.center_frame_idx, :, :, :].clone())
embedding = self.temporal_attn2(aligned_feat.view(-1, c, h, w))
embedding = embedding.view(b, t, -1, h, w) # (b, t, c, h, w)
corr_l = [] # correlation list
for i in range(t):
emb_neighbor = embedding[:, i, :, :, :]
corr = torch.sum(emb_neighbor * embedding_ref, 1) # (b, h, w)
corr_l.append(corr.unsqueeze(1)) # (b, 1, h, w)
corr_prob = torch.sigmoid(torch.cat(corr_l, dim=1)) # (b, t, h, w)
corr_prob = corr_prob.unsqueeze(2).expand(b, t, c, h, w)
corr_prob = corr_prob.contiguous().view(b, -1, h, w) # (b, t*c, h, w)
aligned_feat = aligned_feat.view(b, -1, h, w) * corr_prob
# fusion
feat = self.lrelu(self.feat_fusion(aligned_feat))
# spatial attention
attn = self.lrelu(self.spatial_attn1(aligned_feat))
attn_max = self.max_pool(attn)
attn_avg = self.avg_pool(attn)
attn = self.lrelu(self.spatial_attn2(torch.cat([attn_max, attn_avg], dim=1)))
# pyramid levels
attn_level = self.lrelu(self.spatial_attn_l1(attn))
attn_max = self.max_pool(attn_level)
attn_avg = self.avg_pool(attn_level)
attn_level = self.lrelu(self.spatial_attn_l2(torch.cat([attn_max, attn_avg], dim=1)))
attn_level = self.lrelu(self.spatial_attn_l3(attn_level))
attn_level = self.upsample(attn_level)
attn = self.lrelu(self.spatial_attn3(attn)) + attn_level
attn = self.lrelu(self.spatial_attn4(attn))
attn = self.upsample(attn)
attn = self.spatial_attn5(attn)
attn_add = self.spatial_attn_add2(self.lrelu(self.spatial_attn_add1(attn)))
attn = torch.sigmoid(attn)
# after initialization, * 2 makes (attn * 2) to be close to 1.
feat = feat * attn * 2 + attn_add
return feat
class PredeblurModule(nn.Module):
"""Pre-dublur module.
Args:
num_in_ch (int): Channel number of input image. Default: 3.
num_feat (int): Channel number of intermediate features. Default: 64.
hr_in (bool): Whether the input has high resolution. Default: False.
"""
def __init__(self, num_in_ch=3, num_feat=64, hr_in=False):
super(PredeblurModule, self).__init__()
self.hr_in = hr_in
self.conv_first = nn.Conv2d(num_in_ch, num_feat, 3, 1, 1)
if self.hr_in:
# downsample x4 by stride conv
self.stride_conv_hr1 = nn.Conv2d(num_feat, num_feat, 3, 2, 1)
self.stride_conv_hr2 = nn.Conv2d(num_feat, num_feat, 3, 2, 1)
# generate feature pyramid
self.stride_conv_l2 = nn.Conv2d(num_feat, num_feat, 3, 2, 1)
self.stride_conv_l3 = nn.Conv2d(num_feat, num_feat, 3, 2, 1)
self.resblock_l3 = ResidualBlockNoBN(num_feat=num_feat)
self.resblock_l2_1 = ResidualBlockNoBN(num_feat=num_feat)
self.resblock_l2_2 = ResidualBlockNoBN(num_feat=num_feat)
self.resblock_l1 = nn.ModuleList([ResidualBlockNoBN(num_feat=num_feat) for i in range(5)])
self.upsample = nn.Upsample(scale_factor=2, mode='bilinear', align_corners=False)
self.lrelu = nn.LeakyReLU(negative_slope=0.1, inplace=True)
def forward(self, x):
feat_l1 = self.lrelu(self.conv_first(x))
if self.hr_in:
feat_l1 = self.lrelu(self.stride_conv_hr1(feat_l1))
feat_l1 = self.lrelu(self.stride_conv_hr2(feat_l1))
# generate feature pyramid
feat_l2 = self.lrelu(self.stride_conv_l2(feat_l1))
feat_l3 = self.lrelu(self.stride_conv_l3(feat_l2))
feat_l3 = self.upsample(self.resblock_l3(feat_l3))
feat_l2 = self.resblock_l2_1(feat_l2) + feat_l3
feat_l2 = self.upsample(self.resblock_l2_2(feat_l2))
for i in range(2):
feat_l1 = self.resblock_l1[i](feat_l1)
feat_l1 = feat_l1 + feat_l2
for i in range(2, 5):
feat_l1 = self.resblock_l1[i](feat_l1)
return feat_l1
@ARCH_REGISTRY.register()
class EDVR(nn.Module):
"""EDVR network structure for video super-resolution.
Now only support X4 upsampling factor.
Paper:
EDVR: Video Restoration with Enhanced Deformable Convolutional Networks
Args:
num_in_ch (int): Channel number of input image. Default: 3.
num_out_ch (int): Channel number of output image. Default: 3.
num_feat (int): Channel number of intermediate features. Default: 64.
num_frame (int): Number of input frames. Default: 5.
deformable_groups (int): Deformable groups. Defaults: 8.
num_extract_block (int): Number of blocks for feature extraction.
Default: 5.
num_reconstruct_block (int): Number of blocks for reconstruction.
Default: 10.
center_frame_idx (int): The index of center frame. Frame counting from
0. Default: Middle of input frames.
hr_in (bool): Whether the input has high resolution. Default: False.
with_predeblur (bool): Whether has predeblur module.
Default: False.
with_tsa (bool): Whether has TSA module. Default: True.
"""
def __init__(self,
num_in_ch=3,
num_out_ch=3,
num_feat=64,
num_frame=5,
deformable_groups=8,
num_extract_block=5,
num_reconstruct_block=10,
center_frame_idx=None,
hr_in=False,
with_predeblur=False,
with_tsa=True):
super(EDVR, self).__init__()
if center_frame_idx is None:
self.center_frame_idx = num_frame // 2
else:
self.center_frame_idx = center_frame_idx
self.hr_in = hr_in
self.with_predeblur = with_predeblur
self.with_tsa = with_tsa
# extract features for each frame
if self.with_predeblur:
self.predeblur = PredeblurModule(num_feat=num_feat, hr_in=self.hr_in)
self.conv_1x1 = nn.Conv2d(num_feat, num_feat, 1, 1)
else:
self.conv_first = nn.Conv2d(num_in_ch, num_feat, 3, 1, 1)
# extrat pyramid features
self.feature_extraction = make_layer(ResidualBlockNoBN, num_extract_block, num_feat=num_feat)
self.conv_l2_1 = nn.Conv2d(num_feat, num_feat, 3, 2, 1)
self.conv_l2_2 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
self.conv_l3_1 = nn.Conv2d(num_feat, num_feat, 3, 2, 1)
self.conv_l3_2 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
# pcd and tsa module
self.pcd_align = PCDAlignment(num_feat=num_feat, deformable_groups=deformable_groups)
if self.with_tsa:
self.fusion = TSAFusion(num_feat=num_feat, num_frame=num_frame, center_frame_idx=self.center_frame_idx)
else:
self.fusion = nn.Conv2d(num_frame * num_feat, num_feat, 1, 1)
# reconstruction
self.reconstruction = make_layer(ResidualBlockNoBN, num_reconstruct_block, num_feat=num_feat)
# upsample
self.upconv1 = nn.Conv2d(num_feat, num_feat * 4, 3, 1, 1)
self.upconv2 = nn.Conv2d(num_feat, 64 * 4, 3, 1, 1)
self.pixel_shuffle = nn.PixelShuffle(2)
self.conv_hr = nn.Conv2d(64, 64, 3, 1, 1)
self.conv_last = nn.Conv2d(64, 3, 3, 1, 1)
# activation function
self.lrelu = nn.LeakyReLU(negative_slope=0.1, inplace=True)
def forward(self, x):
b, t, c, h, w = x.size()
if self.hr_in:
assert h % 16 == 0 and w % 16 == 0, ('The height and width must be multiple of 16.')
else:
assert h % 4 == 0 and w % 4 == 0, ('The height and width must be multiple of 4.')
x_center = x[:, self.center_frame_idx, :, :, :].contiguous()
# extract features for each frame
# L1
if self.with_predeblur:
feat_l1 = self.conv_1x1(self.predeblur(x.view(-1, c, h, w)))
if self.hr_in:
h, w = h // 4, w // 4
else:
feat_l1 = self.lrelu(self.conv_first(x.view(-1, c, h, w)))
feat_l1 = self.feature_extraction(feat_l1)
# L2
feat_l2 = self.lrelu(self.conv_l2_1(feat_l1))
feat_l2 = self.lrelu(self.conv_l2_2(feat_l2))
# L3
feat_l3 = self.lrelu(self.conv_l3_1(feat_l2))
feat_l3 = self.lrelu(self.conv_l3_2(feat_l3))
feat_l1 = feat_l1.view(b, t, -1, h, w)
feat_l2 = feat_l2.view(b, t, -1, h // 2, w // 2)
feat_l3 = feat_l3.view(b, t, -1, h // 4, w // 4)
# PCD alignment
ref_feat_l = [ # reference feature list
feat_l1[:, self.center_frame_idx, :, :, :].clone(), feat_l2[:, self.center_frame_idx, :, :, :].clone(),
feat_l3[:, self.center_frame_idx, :, :, :].clone()
]
aligned_feat = []
for i in range(t):
nbr_feat_l = [ # neighboring feature list
feat_l1[:, i, :, :, :].clone(), feat_l2[:, i, :, :, :].clone(), feat_l3[:, i, :, :, :].clone()
]
aligned_feat.append(self.pcd_align(nbr_feat_l, ref_feat_l))
aligned_feat = torch.stack(aligned_feat, dim=1) # (b, t, c, h, w)
if not self.with_tsa:
aligned_feat = aligned_feat.view(b, -1, h, w)
feat = self.fusion(aligned_feat)
out = self.reconstruction(feat)
out = self.lrelu(self.pixel_shuffle(self.upconv1(out)))
out = self.lrelu(self.pixel_shuffle(self.upconv2(out)))
out = self.lrelu(self.conv_hr(out))
out = self.conv_last(out)
if self.hr_in:
base = x_center
else:
base = F.interpolate(x_center, scale_factor=4, mode='bilinear', align_corners=False)
out += base
return out123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307# Modified from https://github.com/mseitzer/pytorch-fid/blob/master/pytorch_fid/inception.py # noqa: E501
# For FID metric
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.model_zoo import load_url
from torchvision import models
# Inception weights ported to Pytorch from
# http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz
FID_WEIGHTS_URL = 'https://github.com/mseitzer/pytorch-fid/releases/download/fid_weights/pt_inception-2015-12-05-6726825d.pth' # noqa: E501
LOCAL_FID_WEIGHTS = 'experiments/pretrained_models/pt_inception-2015-12-05-6726825d.pth' # noqa: E501
class InceptionV3(nn.Module):
"""Pretrained InceptionV3 network returning feature maps"""
# Index of default block of inception to return,
# corresponds to output of final average pooling
DEFAULT_BLOCK_INDEX = 3
# Maps feature dimensionality to their output blocks indices
BLOCK_INDEX_BY_DIM = {
64: 0, # First max pooling features
192: 1, # Second max pooling features
768: 2, # Pre-aux classifier features
2048: 3 # Final average pooling features
}
def __init__(self,
output_blocks=(DEFAULT_BLOCK_INDEX),
resize_input=True,
normalize_input=True,
requires_grad=False,
use_fid_inception=True):
"""Build pretrained InceptionV3.
Args:
output_blocks (list[int]): Indices of blocks to return features of.
Possible values are:
- 0: corresponds to output of first max pooling
- 1: corresponds to output of second max pooling
- 2: corresponds to output which is fed to aux classifier
- 3: corresponds to output of final average pooling
resize_input (bool): If true, bilinearly resizes input to width and
height 299 before feeding input to model. As the network
without fully connected layers is fully convolutional, it
should be able to handle inputs of arbitrary size, so resizing
might not be strictly needed. Default: True.
normalize_input (bool): If true, scales the input from range (0, 1)
to the range the pretrained Inception network expects,
namely (-1, 1). Default: True.
requires_grad (bool): If true, parameters of the model require
gradients. Possibly useful for finetuning the network.
Default: False.
use_fid_inception (bool): If true, uses the pretrained Inception
model used in Tensorflow's FID implementation.
If false, uses the pretrained Inception model available in
torchvision. The FID Inception model has different weights
and a slightly different structure from torchvision's
Inception model. If you want to compute FID scores, you are
strongly advised to set this parameter to true to get
comparable results. Default: True.
"""
super(InceptionV3, self).__init__()
self.resize_input = resize_input
self.normalize_input = normalize_input
self.output_blocks = sorted(output_blocks)
self.last_needed_block = max(output_blocks)
assert self.last_needed_block <= 3, ('Last possible output block index is 3')
self.blocks = nn.ModuleList()
if use_fid_inception:
inception = fid_inception_v3()
else:
try:
inception = models.inception_v3(pretrained=True, init_weights=False)
except TypeError:
# pytorch < 1.5 does not have init_weights for inception_v3
inception = models.inception_v3(pretrained=True)
# Block 0: input to maxpool1
block0 = [
inception.Conv2d_1a_3x3, inception.Conv2d_2a_3x3, inception.Conv2d_2b_3x3,
nn.MaxPool2d(kernel_size=3, stride=2)
]
self.blocks.append(nn.Sequential(*block0))
# Block 1: maxpool1 to maxpool2
if self.last_needed_block >= 1:
block1 = [inception.Conv2d_3b_1x1, inception.Conv2d_4a_3x3, nn.MaxPool2d(kernel_size=3, stride=2)]
self.blocks.append(nn.Sequential(*block1))
# Block 2: maxpool2 to aux classifier
if self.last_needed_block >= 2:
block2 = [
inception.Mixed_5b,
inception.Mixed_5c,
inception.Mixed_5d,
inception.Mixed_6a,
inception.Mixed_6b,
inception.Mixed_6c,
inception.Mixed_6d,
inception.Mixed_6e,
]
self.blocks.append(nn.Sequential(*block2))
# Block 3: aux classifier to final avgpool
if self.last_needed_block >= 3:
block3 = [
inception.Mixed_7a, inception.Mixed_7b, inception.Mixed_7c,
nn.AdaptiveAvgPool2d(output_size=(1, 1))
]
self.blocks.append(nn.Sequential(*block3))
for param in self.parameters():
param.requires_grad = requires_grad
def forward(self, x):
"""Get Inception feature maps.
Args:
x (Tensor): Input tensor of shape (b, 3, h, w).
Values are expected to be in range (-1, 1). You can also input
(0, 1) with setting normalize_input = True.
Returns:
list[Tensor]: Corresponding to the selected output block, sorted
ascending by index.
"""
output = []
if self.resize_input:
x = F.interpolate(x, size=(299, 299), mode='bilinear', align_corners=False)
if self.normalize_input:
x = 2 * x - 1 # Scale from range (0, 1) to range (-1, 1)
for idx, block in enumerate(self.blocks):
x = block(x)
if idx in self.output_blocks:
output.append(x)
if idx == self.last_needed_block:
break
return output
def fid_inception_v3():
"""Build pretrained Inception model for FID computation.
The Inception model for FID computation uses a different set of weights
and has a slightly different structure than torchvision's Inception.
This method first constructs torchvision's Inception and then patches the
necessary parts that are different in the FID Inception model.
"""
try:
inception = models.inception_v3(num_classes=1008, aux_logits=False, pretrained=False, init_weights=False)
except TypeError:
# pytorch < 1.5 does not have init_weights for inception_v3
inception = models.inception_v3(num_classes=1008, aux_logits=False, pretrained=False)
inception.Mixed_5b = FIDInceptionA(192, pool_features=32)
inception.Mixed_5c = FIDInceptionA(256, pool_features=64)
inception.Mixed_5d = FIDInceptionA(288, pool_features=64)
inception.Mixed_6b = FIDInceptionC(768, channels_7x7=128)
inception.Mixed_6c = FIDInceptionC(768, channels_7x7=160)
inception.Mixed_6d = FIDInceptionC(768, channels_7x7=160)
inception.Mixed_6e = FIDInceptionC(768, channels_7x7=192)
inception.Mixed_7b = FIDInceptionE_1(1280)
inception.Mixed_7c = FIDInceptionE_2(2048)
if os.path.exists(LOCAL_FID_WEIGHTS):
state_dict = torch.load(LOCAL_FID_WEIGHTS, map_location=lambda storage, loc: storage)
else:
state_dict = load_url(FID_WEIGHTS_URL, progress=True)
inception.load_state_dict(state_dict)
return inception
class FIDInceptionA(models.inception.InceptionA):
"""InceptionA block patched for FID computation"""
def __init__(self, in_channels, pool_features):
super(FIDInceptionA, self).__init__(in_channels, pool_features)
def forward(self, x):
branch1x1 = self.branch1x1(x)
branch5x5 = self.branch5x5_1(x)
branch5x5 = self.branch5x5_2(branch5x5)
branch3x3dbl = self.branch3x3dbl_1(x)
branch3x3dbl = self.branch3x3dbl_2(branch3x3dbl)
branch3x3dbl = self.branch3x3dbl_3(branch3x3dbl)
# Patch: Tensorflow's average pool does not use the padded zero's in
# its average calculation
branch_pool = F.avg_pool2d(x, kernel_size=3, stride=1, padding=1, count_include_pad=False)
branch_pool = self.branch_pool(branch_pool)
outputs = [branch1x1, branch5x5, branch3x3dbl, branch_pool]
return torch.cat(outputs, 1)
class FIDInceptionC(models.inception.InceptionC):
"""InceptionC block patched for FID computation"""
def __init__(self, in_channels, channels_7x7):
super(FIDInceptionC, self).__init__(in_channels, channels_7x7)
def forward(self, x):
branch1x1 = self.branch1x1(x)
branch7x7 = self.branch7x7_1(x)
branch7x7 = self.branch7x7_2(branch7x7)
branch7x7 = self.branch7x7_3(branch7x7)
branch7x7dbl = self.branch7x7dbl_1(x)
branch7x7dbl = self.branch7x7dbl_2(branch7x7dbl)
branch7x7dbl = self.branch7x7dbl_3(branch7x7dbl)
branch7x7dbl = self.branch7x7dbl_4(branch7x7dbl)
branch7x7dbl = self.branch7x7dbl_5(branch7x7dbl)
# Patch: Tensorflow's average pool does not use the padded zero's in
# its average calculation
branch_pool = F.avg_pool2d(x, kernel_size=3, stride=1, padding=1, count_include_pad=False)
branch_pool = self.branch_pool(branch_pool)
outputs = [branch1x1, branch7x7, branch7x7dbl, branch_pool]
return torch.cat(outputs, 1)
class FIDInceptionE_1(models.inception.InceptionE):
"""First InceptionE block patched for FID computation"""
def __init__(self, in_channels):
super(FIDInceptionE_1, self).__init__(in_channels)
def forward(self, x):
branch1x1 = self.branch1x1(x)
branch3x3 = self.branch3x3_1(x)
branch3x3 = [
self.branch3x3_2a(branch3x3),
self.branch3x3_2b(branch3x3),
]
branch3x3 = torch.cat(branch3x3, 1)
branch3x3dbl = self.branch3x3dbl_1(x)
branch3x3dbl = self.branch3x3dbl_2(branch3x3dbl)
branch3x3dbl = [
self.branch3x3dbl_3a(branch3x3dbl),
self.branch3x3dbl_3b(branch3x3dbl),
]
branch3x3dbl = torch.cat(branch3x3dbl, 1)
# Patch: Tensorflow's average pool does not use the padded zero's in
# its average calculation
branch_pool = F.avg_pool2d(x, kernel_size=3, stride=1, padding=1, count_include_pad=False)
branch_pool = self.branch_pool(branch_pool)
outputs = [branch1x1, branch3x3, branch3x3dbl, branch_pool]
return torch.cat(outputs, 1)
class FIDInceptionE_2(models.inception.InceptionE):
"""Second InceptionE block patched for FID computation"""
def __init__(self, in_channels):
super(FIDInceptionE_2, self).__init__(in_channels)
def forward(self, x):
branch1x1 = self.branch1x1(x)
branch3x3 = self.branch3x3_1(x)
branch3x3 = [
self.branch3x3_2a(branch3x3),
self.branch3x3_2b(branch3x3),
]
branch3x3 = torch.cat(branch3x3, 1)
branch3x3dbl = self.branch3x3dbl_1(x)
branch3x3dbl = self.branch3x3dbl_2(branch3x3dbl)
branch3x3dbl = [
self.branch3x3dbl_3a(branch3x3dbl),
self.branch3x3dbl_3b(branch3x3dbl),
]
branch3x3dbl = torch.cat(branch3x3dbl, 1)
# Patch: The FID Inception model uses max pooling instead of average
# pooling. This is likely an error in this specific Inception
# implementation, as other Inception models use average pooling here
# (which matches the description in the paper).
branch_pool = F.max_pool2d(x, kernel_size=3, stride=1, padding=1)
branch_pool = self.branch_pool(branch_pool)
outputs = [branch1x1, branch3x3, branch3x3dbl, branch_pool]
return torch.cat(outputs, 1)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135import torch
from torch import nn as nn
from basicsr.utils.registry import ARCH_REGISTRY
from .arch_util import Upsample, make_layer
class ChannelAttention(nn.Module):
"""Channel attention used in RCAN.
Args:
num_feat (int): Channel number of intermediate features.
squeeze_factor (int): Channel squeeze factor. Default: 16.
"""
def __init__(self, num_feat, squeeze_factor=16):
super(ChannelAttention, self).__init__()
self.attention = nn.Sequential(
nn.AdaptiveAvgPool2d(1), nn.Conv2d(num_feat, num_feat // squeeze_factor, 1, padding=0),
nn.ReLU(inplace=True), nn.Conv2d(num_feat // squeeze_factor, num_feat, 1, padding=0), nn.Sigmoid())
def forward(self, x):
y = self.attention(x)
return x * y
class RCAB(nn.Module):
"""Residual Channel Attention Block (RCAB) used in RCAN.
Args:
num_feat (int): Channel number of intermediate features.
squeeze_factor (int): Channel squeeze factor. Default: 16.
res_scale (float): Scale the residual. Default: 1.
"""
def __init__(self, num_feat, squeeze_factor=16, res_scale=1):
super(RCAB, self).__init__()
self.res_scale = res_scale
self.rcab = nn.Sequential(
nn.Conv2d(num_feat, num_feat, 3, 1, 1), nn.ReLU(True), nn.Conv2d(num_feat, num_feat, 3, 1, 1),
ChannelAttention(num_feat, squeeze_factor))
def forward(self, x):
res = self.rcab(x) * self.res_scale
return res + x
class ResidualGroup(nn.Module):
"""Residual Group of RCAB.
Args:
num_feat (int): Channel number of intermediate features.
num_block (int): Block number in the body network.
squeeze_factor (int): Channel squeeze factor. Default: 16.
res_scale (float): Scale the residual. Default: 1.
"""
def __init__(self, num_feat, num_block, squeeze_factor=16, res_scale=1):
super(ResidualGroup, self).__init__()
self.residual_group = make_layer(
RCAB, num_block, num_feat=num_feat, squeeze_factor=squeeze_factor, res_scale=res_scale)
self.conv = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
def forward(self, x):
res = self.conv(self.residual_group(x))
return res + x
@ARCH_REGISTRY.register()
class RCAN(nn.Module):
"""Residual Channel Attention Networks.
Paper: Image Super-Resolution Using Very Deep Residual Channel Attention
Networks
Ref git repo: https://github.com/yulunzhang/RCAN.
Args:
num_in_ch (int): Channel number of inputs.
num_out_ch (int): Channel number of outputs.
num_feat (int): Channel number of intermediate features.
Default: 64.
num_group (int): Number of ResidualGroup. Default: 10.
num_block (int): Number of RCAB in ResidualGroup. Default: 16.
squeeze_factor (int): Channel squeeze factor. Default: 16.
upscale (int): Upsampling factor. Support 2^n and 3.
Default: 4.
res_scale (float): Used to scale the residual in residual block.
Default: 1.
img_range (float): Image range. Default: 255.
rgb_mean (tuple[float]): Image mean in RGB orders.
Default: (0.4488, 0.4371, 0.4040), calculated from DIV2K dataset.
"""
def __init__(self,
num_in_ch,
num_out_ch,
num_feat=64,
num_group=10,
num_block=16,
squeeze_factor=16,
upscale=4,
res_scale=1,
img_range=255.,
rgb_mean=(0.4488, 0.4371, 0.4040)):
super(RCAN, self).__init__()
self.img_range = img_range
self.mean = torch.Tensor(rgb_mean).view(1, 3, 1, 1)
self.conv_first = nn.Conv2d(num_in_ch, num_feat, 3, 1, 1)
self.body = make_layer(
ResidualGroup,
num_group,
num_feat=num_feat,
num_block=num_block,
squeeze_factor=squeeze_factor,
res_scale=res_scale)
self.conv_after_body = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
self.upsample = Upsample(upscale, num_feat)
self.conv_last = nn.Conv2d(num_feat, num_out_ch, 3, 1, 1)
def forward(self, x):
self.mean = self.mean.type_as(x)
x = (x - self.mean) * self.img_range
x = self.conv_first(x)
res = self.conv_after_body(self.body(x))
res += x
x = self.conv_last(self.upsample(res))
x = x / self.img_range + self.mean
return x123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184import torch
import torch.nn as nn
from basicsr.utils.registry import ARCH_REGISTRY
from .arch_util import ResidualBlockNoBN, make_layer
class MeanShift(nn.Conv2d):
""" Data normalization with mean and std.
Args:
rgb_range (int): Maximum value of RGB.
rgb_mean (list[float]): Mean for RGB channels.
rgb_std (list[float]): Std for RGB channels.
sign (int): For substraction, sign is -1, for addition, sign is 1.
Default: -1.
requires_grad (bool): Whether to update the self.weight and self.bias.
Default: True.
"""
def __init__(self, rgb_range, rgb_mean, rgb_std, sign=-1, requires_grad=True):
super(MeanShift, self).__init__(3, 3, kernel_size=1)
std = torch.Tensor(rgb_std)
self.weight.data = torch.eye(3).view(3, 3, 1, 1)
self.weight.data.div_(std.view(3, 1, 1, 1))
self.bias.data = sign * rgb_range * torch.Tensor(rgb_mean)
self.bias.data.div_(std)
self.requires_grad = requires_grad
class EResidualBlockNoBN(nn.Module):
"""Enhanced Residual block without BN.
There are three convolution layers in residual branch.
It has a style of:
---Conv-ReLU-Conv-ReLU-Conv-+-ReLU-
|__________________________|
"""
def __init__(self, in_channels, out_channels):
super(EResidualBlockNoBN, self).__init__()
self.body = nn.Sequential(
nn.Conv2d(in_channels, out_channels, 3, 1, 1),
nn.ReLU(inplace=True),
nn.Conv2d(out_channels, out_channels, 3, 1, 1),
nn.ReLU(inplace=True),
nn.Conv2d(out_channels, out_channels, 1, 1, 0),
)
self.relu = nn.ReLU(inplace=True)
def forward(self, x):
out = self.body(x)
out = self.relu(out + x)
return out
class MergeRun(nn.Module):
""" Merge-and-run unit.
This unit contains two branches with different dilated convolutions,
followed by a convolution to process the concatenated features.
Paper: Real Image Denoising with Feature Attention
Ref git repo: https://github.com/saeed-anwar/RIDNet
"""
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1):
super(MergeRun, self).__init__()
self.dilation1 = nn.Sequential(
nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding), nn.ReLU(inplace=True),
nn.Conv2d(out_channels, out_channels, kernel_size, stride, 2, 2), nn.ReLU(inplace=True))
self.dilation2 = nn.Sequential(
nn.Conv2d(in_channels, out_channels, kernel_size, stride, 3, 3), nn.ReLU(inplace=True),
nn.Conv2d(out_channels, out_channels, kernel_size, stride, 4, 4), nn.ReLU(inplace=True))
self.aggregation = nn.Sequential(
nn.Conv2d(out_channels * 2, out_channels, kernel_size, stride, padding), nn.ReLU(inplace=True))
def forward(self, x):
dilation1 = self.dilation1(x)
dilation2 = self.dilation2(x)
out = torch.cat([dilation1, dilation2], dim=1)
out = self.aggregation(out)
out = out + x
return out
class ChannelAttention(nn.Module):
"""Channel attention.
Args:
num_feat (int): Channel number of intermediate features.
squeeze_factor (int): Channel squeeze factor. Default:
"""
def __init__(self, mid_channels, squeeze_factor=16):
super(ChannelAttention, self).__init__()
self.attention = nn.Sequential(
nn.AdaptiveAvgPool2d(1), nn.Conv2d(mid_channels, mid_channels // squeeze_factor, 1, padding=0),
nn.ReLU(inplace=True), nn.Conv2d(mid_channels // squeeze_factor, mid_channels, 1, padding=0), nn.Sigmoid())
def forward(self, x):
y = self.attention(x)
return x * y
class EAM(nn.Module):
"""Enhancement attention modules (EAM) in RIDNet.
This module contains a merge-and-run unit, a residual block,
an enhanced residual block and a feature attention unit.
Attributes:
merge: The merge-and-run unit.
block1: The residual block.
block2: The enhanced residual block.
ca: The feature/channel attention unit.
"""
def __init__(self, in_channels, mid_channels, out_channels):
super(EAM, self).__init__()
self.merge = MergeRun(in_channels, mid_channels)
self.block1 = ResidualBlockNoBN(mid_channels)
self.block2 = EResidualBlockNoBN(mid_channels, out_channels)
self.ca = ChannelAttention(out_channels)
# The residual block in the paper contains a relu after addition.
self.relu = nn.ReLU(inplace=True)
def forward(self, x):
out = self.merge(x)
out = self.relu(self.block1(out))
out = self.block2(out)
out = self.ca(out)
return out
@ARCH_REGISTRY.register()
class RIDNet(nn.Module):
"""RIDNet: Real Image Denoising with Feature Attention.
Ref git repo: https://github.com/saeed-anwar/RIDNet
Args:
in_channels (int): Channel number of inputs.
mid_channels (int): Channel number of EAM modules.
Default: 64.
out_channels (int): Channel number of outputs.
num_block (int): Number of EAM. Default: 4.
img_range (float): Image range. Default: 255.
rgb_mean (tuple[float]): Image mean in RGB orders.
Default: (0.4488, 0.4371, 0.4040), calculated from DIV2K dataset.
"""
def __init__(self,
in_channels,
mid_channels,
out_channels,
num_block=4,
img_range=255.,
rgb_mean=(0.4488, 0.4371, 0.4040),
rgb_std=(1.0, 1.0, 1.0)):
super(RIDNet, self).__init__()
self.sub_mean = MeanShift(img_range, rgb_mean, rgb_std)
self.add_mean = MeanShift(img_range, rgb_mean, rgb_std, 1)
self.head = nn.Conv2d(in_channels, mid_channels, 3, 1, 1)
self.body = make_layer(
EAM, num_block, in_channels=mid_channels, mid_channels=mid_channels, out_channels=mid_channels)
self.tail = nn.Conv2d(mid_channels, out_channels, 3, 1, 1)
self.relu = nn.ReLU(inplace=True)
def forward(self, x):
res = self.sub_mean(x)
res = self.tail(self.body(self.relu(self.head(res))))
res = self.add_mean(res)
out = x + res
return out123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104import torch
from torch import nn as nn
from torch.nn import functional as F
from basicsr.utils.registry import ARCH_REGISTRY
from .arch_util import default_init_weights, make_layer
class ResidualDenseBlock(nn.Module):
"""Residual Dense Block.
Used in RRDB block in ESRGAN.
Args:
num_feat (int): Channel number of intermediate features.
num_grow_ch (int): Channels for each growth.
"""
def __init__(self, num_feat=64, num_grow_ch=32):
super(ResidualDenseBlock, self).__init__()
self.conv1 = nn.Conv2d(num_feat, num_grow_ch, 3, 1, 1)
self.conv2 = nn.Conv2d(num_feat + num_grow_ch, num_grow_ch, 3, 1, 1)
self.conv3 = nn.Conv2d(num_feat + 2 * num_grow_ch, num_grow_ch, 3, 1, 1)
self.conv4 = nn.Conv2d(num_feat + 3 * num_grow_ch, num_grow_ch, 3, 1, 1)
self.conv5 = nn.Conv2d(num_feat + 4 * num_grow_ch, num_feat, 3, 1, 1)
self.lrelu = nn.LeakyReLU(negative_slope=0.2, inplace=True)
# initialization
default_init_weights([self.conv1, self.conv2, self.conv3, self.conv4, self.conv5], 0.1)
def forward(self, x):
x1 = self.lrelu(self.conv1(x))
x2 = self.lrelu(self.conv2(torch.cat((x, x1), 1)))
x3 = self.lrelu(self.conv3(torch.cat((x, x1, x2), 1)))
x4 = self.lrelu(self.conv4(torch.cat((x, x1, x2, x3), 1)))
x5 = self.conv5(torch.cat((x, x1, x2, x3, x4), 1))
# Emperically, we use 0.2 to scale the residual for better performance
return x5 * 0.2 + x
class RRDB(nn.Module):
"""Residual in Residual Dense Block.
Used in RRDB-Net in ESRGAN.
Args:
num_feat (int): Channel number of intermediate features.
num_grow_ch (int): Channels for each growth.
"""
def __init__(self, num_feat, num_grow_ch=32):
super(RRDB, self).__init__()
self.rdb1 = ResidualDenseBlock(num_feat, num_grow_ch)
self.rdb2 = ResidualDenseBlock(num_feat, num_grow_ch)
self.rdb3 = ResidualDenseBlock(num_feat, num_grow_ch)
def forward(self, x):
out = self.rdb1(x)
out = self.rdb2(out)
out = self.rdb3(out)
# Emperically, we use 0.2 to scale the residual for better performance
return out * 0.2 + x
@ARCH_REGISTRY.register()
class RRDBNet(nn.Module):
"""Networks consisting of Residual in Residual Dense Block, which is used
in ESRGAN.
ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks.
Currently, it supports x4 upsampling scale factor.
Args:
num_in_ch (int): Channel number of inputs.
num_out_ch (int): Channel number of outputs.
num_feat (int): Channel number of intermediate features.
Default: 64
num_block (int): Block number in the trunk network. Defaults: 23
num_grow_ch (int): Channels for each growth. Default: 32.
"""
def __init__(self, num_in_ch, num_out_ch, num_feat=64, num_block=23, num_grow_ch=32):
super(RRDBNet, self).__init__()
self.conv_first = nn.Conv2d(num_in_ch, num_feat, 3, 1, 1)
self.body = make_layer(RRDB, num_block, num_feat=num_feat, num_grow_ch=num_grow_ch)
self.conv_body = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
# upsample
self.conv_up1 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
self.conv_up2 = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
self.conv_hr = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
self.conv_last = nn.Conv2d(num_feat, num_out_ch, 3, 1, 1)
self.lrelu = nn.LeakyReLU(negative_slope=0.2, inplace=True)
def forward(self, x):
feat = self.conv_first(x)
body_feat = self.conv_body(self.body(feat))
feat = feat + body_feat
# upsample
feat = self.lrelu(self.conv_up1(F.interpolate(feat, scale_factor=2, mode='nearest')))
feat = self.lrelu(self.conv_up2(F.interpolate(feat, scale_factor=2, mode='nearest')))
out = self.conv_last(self.lrelu(self.conv_hr(feat)))
return out123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596import math
import torch
from torch import nn as nn
from torch.nn import functional as F
from basicsr.utils.registry import ARCH_REGISTRY
from .arch_util import flow_warp
class BasicModule(nn.Module):
"""Basic Module for SpyNet.
"""
def __init__(self):
super(BasicModule, self).__init__()
self.basic_module = nn.Sequential(
nn.Conv2d(in_channels=8, out_channels=32, kernel_size=7, stride=1, padding=3), nn.ReLU(inplace=False),
nn.Conv2d(in_channels=32, out_channels=64, kernel_size=7, stride=1, padding=3), nn.ReLU(inplace=False),
nn.Conv2d(in_channels=64, out_channels=32, kernel_size=7, stride=1, padding=3), nn.ReLU(inplace=False),
nn.Conv2d(in_channels=32, out_channels=16, kernel_size=7, stride=1, padding=3), nn.ReLU(inplace=False),
nn.Conv2d(in_channels=16, out_channels=2, kernel_size=7, stride=1, padding=3))
def forward(self, tensor_input):
return self.basic_module(tensor_input)
@ARCH_REGISTRY.register()
class SpyNet(nn.Module):
"""SpyNet architecture.
Args:
load_path (str): path for pretrained SpyNet. Default: None.
"""
def __init__(self, load_path=None):
super(SpyNet, self).__init__()
self.basic_module = nn.ModuleList([BasicModule() for _ in range(6)])
if load_path:
self.load_state_dict(torch.load(load_path, map_location=lambda storage, loc: storage)['params'])
self.register_buffer('mean', torch.Tensor([0.485, 0.456, 0.406]).view(1, 3, 1, 1))
self.register_buffer('std', torch.Tensor([0.229, 0.224, 0.225]).view(1, 3, 1, 1))
def preprocess(self, tensor_input):
tensor_output = (tensor_input - self.mean) / self.std
return tensor_output
def process(self, ref, supp):
flow = []
ref = [self.preprocess(ref)]
supp = [self.preprocess(supp)]
for level in range(5):
ref.insert(0, F.avg_pool2d(input=ref[0], kernel_size=2, stride=2, count_include_pad=False))
supp.insert(0, F.avg_pool2d(input=supp[0], kernel_size=2, stride=2, count_include_pad=False))
flow = ref[0].new_zeros(
[ref[0].size(0), 2,
int(math.floor(ref[0].size(2) / 2.0)),
int(math.floor(ref[0].size(3) / 2.0))])
for level in range(len(ref)):
upsampled_flow = F.interpolate(input=flow, scale_factor=2, mode='bilinear', align_corners=True) * 2.0
if upsampled_flow.size(2) != ref[level].size(2):
upsampled_flow = F.pad(input=upsampled_flow, pad=[0, 0, 0, 1], mode='replicate')
if upsampled_flow.size(3) != ref[level].size(3):
upsampled_flow = F.pad(input=upsampled_flow, pad=[0, 1, 0, 0], mode='replicate')
flow = self.basic_module[level](torch.cat([
ref[level],
flow_warp(
supp[level], upsampled_flow.permute(0, 2, 3, 1), interp_mode='bilinear', padding_mode='border'),
upsampled_flow
], 1)) + upsampled_flow
return flow
def forward(self, ref, supp):
assert ref.size() == supp.size()
h, w = ref.size(2), ref.size(3)
w_floor = math.floor(math.ceil(w / 32.0) * 32.0)
h_floor = math.floor(math.ceil(h / 32.0) * 32.0)
ref = F.interpolate(input=ref, size=(h_floor, w_floor), mode='bilinear', align_corners=False)
supp = F.interpolate(input=supp, size=(h_floor, w_floor), mode='bilinear', align_corners=False)
flow = F.interpolate(input=self.process(ref, supp), size=(h, w), mode='bilinear', align_corners=False)
flow[:, 0, :, :] *= float(w) / float(w_floor)
flow[:, 1, :, :] *= float(h) / float(h_floor)
return flow1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768from torch import nn as nn
from torch.nn import functional as F
from basicsr.utils.registry import ARCH_REGISTRY
from .arch_util import ResidualBlockNoBN, default_init_weights, make_layer
@ARCH_REGISTRY.register()
class MSRResNet(nn.Module):
"""Modified SRResNet.
A compacted version modified from SRResNet in
"Photo-Realistic Single Image Super-Resolution Using a Generative
Adversarial Network"
It uses residual blocks without BN, similar to EDSR.
Currently, it supports x2, x3 and x4 upsampling scale factor.
Args:
num_in_ch (int): Channel number of inputs. Default: 3.
num_out_ch (int): Channel number of outputs. Default: 3.
num_feat (int): Channel number of intermediate features.
Default: 64.
num_block (int): Block number in the body network. Default: 16.
upscale (int): Upsampling factor. Support x2, x3 and x4.
Default: 4.
"""
def __init__(self, num_in_ch=3, num_out_ch=3, num_feat=64, num_block=16, upscale=4):
super(MSRResNet, self).__init__()
self.upscale = upscale
self.conv_first = nn.Conv2d(num_in_ch, num_feat, 3, 1, 1)
self.body = make_layer(ResidualBlockNoBN, num_block, num_feat=num_feat)
# upsampling
if self.upscale in [2, 3]:
self.upconv1 = nn.Conv2d(num_feat, num_feat * self.upscale * self.upscale, 3, 1, 1)
self.pixel_shuffle = nn.PixelShuffle(self.upscale)
elif self.upscale == 4:
self.upconv1 = nn.Conv2d(num_feat, num_feat * 4, 3, 1, 1)
self.upconv2 = nn.Conv2d(num_feat, num_feat * 4, 3, 1, 1)
self.pixel_shuffle = nn.PixelShuffle(2)
self.conv_hr = nn.Conv2d(num_feat, num_feat, 3, 1, 1)
self.conv_last = nn.Conv2d(num_feat, num_out_ch, 3, 1, 1)
# activation function
self.lrelu = nn.LeakyReLU(negative_slope=0.1, inplace=True)
# initialization
default_init_weights([self.conv_first, self.upconv1, self.conv_hr, self.conv_last], 0.1)
if self.upscale == 4:
default_init_weights(self.upconv2, 0.1)
def forward(self, x):
feat = self.lrelu(self.conv_first(x))
out = self.body(feat)
if self.upscale == 4:
out = self.lrelu(self.pixel_shuffle(self.upconv1(out)))
out = self.lrelu(self.pixel_shuffle(self.upconv2(out)))
elif self.upscale in [2, 3]:
out = self.lrelu(self.pixel_shuffle(self.upconv1(out)))
out = self.conv_last(self.lrelu(self.conv_hr(out)))
base = F.interpolate(x, scale_factor=self.upscale, mode='bilinear', align_corners=False)
out += base
return out123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799import math
import random
import torch
from torch import nn
from torch.nn import functional as F
from basicsr.ops.fused_act import FusedLeakyReLU, fused_leaky_relu
from basicsr.ops.upfirdn2d import upfirdn2d
from basicsr.utils.registry import ARCH_REGISTRY
class NormStyleCode(nn.Module):
def forward(self, x):
"""Normalize the style codes.
Args:
x (Tensor): Style codes with shape (b, c).
Returns:
Tensor: Normalized tensor.
"""
return x * torch.rsqrt(torch.mean(x**2, dim=1, keepdim=True) + 1e-8)
def make_resample_kernel(k):
"""Make resampling kernel for UpFirDn.
Args:
k (list[int]): A list indicating the 1D resample kernel magnitude.
Returns:
Tensor: 2D resampled kernel.
"""
k = torch.tensor(k, dtype=torch.float32)
if k.ndim == 1:
k = k[None, :] * k[:, None] # to 2D kernel, outer product
# normalize
k /= k.sum()
return k
class UpFirDnUpsample(nn.Module):
"""Upsample, FIR filter, and downsample (upsampole version).
References:
1. https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.upfirdn.html # noqa: E501
2. http://www.ece.northwestern.edu/local-apps/matlabhelp/toolbox/signal/upfirdn.html # noqa: E501
Args:
resample_kernel (list[int]): A list indicating the 1D resample kernel
magnitude.
factor (int): Upsampling scale factor. Default: 2.
"""
def __init__(self, resample_kernel, factor=2):
super(UpFirDnUpsample, self).__init__()
self.kernel = make_resample_kernel(resample_kernel) * (factor**2)
self.factor = factor
pad = self.kernel.shape[0] - factor
self.pad = ((pad + 1) // 2 + factor - 1, pad // 2)
def forward(self, x):
out = upfirdn2d(x, self.kernel.type_as(x), up=self.factor, down=1, pad=self.pad)
return out
def __repr__(self):
return (f'{self.__class__.__name__}(factor={self.factor})')
class UpFirDnDownsample(nn.Module):
"""Upsample, FIR filter, and downsample (downsampole version).
Args:
resample_kernel (list[int]): A list indicating the 1D resample kernel
magnitude.
factor (int): Downsampling scale factor. Default: 2.
"""
def __init__(self, resample_kernel, factor=2):
super(UpFirDnDownsample, self).__init__()
self.kernel = make_resample_kernel(resample_kernel)
self.factor = factor
pad = self.kernel.shape[0] - factor
self.pad = ((pad + 1) // 2, pad // 2)
def forward(self, x):
out = upfirdn2d(x, self.kernel.type_as(x), up=1, down=self.factor, pad=self.pad)
return out
def __repr__(self):
return (f'{self.__class__.__name__}(factor={self.factor})')
class UpFirDnSmooth(nn.Module):
"""Upsample, FIR filter, and downsample (smooth version).
Args:
resample_kernel (list[int]): A list indicating the 1D resample kernel
magnitude.
upsample_factor (int): Upsampling scale factor. Default: 1.
downsample_factor (int): Downsampling scale factor. Default: 1.
kernel_size (int): Kernel size: Deafult: 1.
"""
def __init__(self, resample_kernel, upsample_factor=1, downsample_factor=1, kernel_size=1):
super(UpFirDnSmooth, self).__init__()
self.upsample_factor = upsample_factor
self.downsample_factor = downsample_factor
self.kernel = make_resample_kernel(resample_kernel)
if upsample_factor > 1:
self.kernel = self.kernel * (upsample_factor**2)
if upsample_factor > 1:
pad = (self.kernel.shape[0] - upsample_factor) - (kernel_size - 1)
self.pad = ((pad + 1) // 2 + upsample_factor - 1, pad // 2 + 1)
elif downsample_factor > 1:
pad = (self.kernel.shape[0] - downsample_factor) + (kernel_size - 1)
self.pad = ((pad + 1) // 2, pad // 2)
else:
raise NotImplementedError
def forward(self, x):
out = upfirdn2d(x, self.kernel.type_as(x), up=1, down=1, pad=self.pad)
return out
def __repr__(self):
return (f'{self.__class__.__name__}(upsample_factor={self.upsample_factor}'
f', downsample_factor={self.downsample_factor})')
class EqualLinear(nn.Module):
"""Equalized Linear as StyleGAN2.
Args:
in_channels (int): Size of each sample.
out_channels (int): Size of each output sample.
bias (bool): If set to ``False``, the layer will not learn an additive
bias. Default: ``True``.
bias_init_val (float): Bias initialized value. Default: 0.
lr_mul (float): Learning rate multiplier. Default: 1.
activation (None | str): The activation after ``linear`` operation.
Supported: 'fused_lrelu', None. Default: None.
"""
def __init__(self, in_channels, out_channels, bias=True, bias_init_val=0, lr_mul=1, activation=None):
super(EqualLinear, self).__init__()
self.in_channels = in_channels
self.out_channels = out_channels
self.lr_mul = lr_mul
self.activation = activation
if self.activation not in ['fused_lrelu', None]:
raise ValueError(f'Wrong activation value in EqualLinear: {activation}'
"Supported ones are: ['fused_lrelu', None].")
self.scale = (1 / math.sqrt(in_channels)) * lr_mul
self.weight = nn.Parameter(torch.randn(out_channels, in_channels).div_(lr_mul))
if bias:
self.bias = nn.Parameter(torch.zeros(out_channels).fill_(bias_init_val))
else:
self.register_parameter('bias', None)
def forward(self, x):
if self.bias is None:
bias = None
else:
bias = self.bias * self.lr_mul
if self.activation == 'fused_lrelu':
out = F.linear(x, self.weight * self.scale)
out = fused_leaky_relu(out, bias)
else:
out = F.linear(x, self.weight * self.scale, bias=bias)
return out
def __repr__(self):
return (f'{self.__class__.__name__}(in_channels={self.in_channels}, '
f'out_channels={self.out_channels}, bias={self.bias is not None})')
class ModulatedConv2d(nn.Module):
"""Modulated Conv2d used in StyleGAN2.
There is no bias in ModulatedConv2d.
Args:
in_channels (int): Channel number of the input.
out_channels (int): Channel number of the output.
kernel_size (int): Size of the convolving kernel.
num_style_feat (int): Channel number of style features.
demodulate (bool): Whether to demodulate in the conv layer.
Default: True.
sample_mode (str | None): Indicating 'upsample', 'downsample' or None.
Default: None.
resample_kernel (list[int]): A list indicating the 1D resample kernel
magnitude. Default: (1, 3, 3, 1).
eps (float): A value added to the denominator for numerical stability.
Default: 1e-8.
"""
def __init__(self,
in_channels,
out_channels,
kernel_size,
num_style_feat,
demodulate=True,
sample_mode=None,
resample_kernel=(1, 3, 3, 1),
eps=1e-8):
super(ModulatedConv2d, self).__init__()
self.in_channels = in_channels
self.out_channels = out_channels
self.kernel_size = kernel_size
self.demodulate = demodulate
self.sample_mode = sample_mode
self.eps = eps
if self.sample_mode == 'upsample':
self.smooth = UpFirDnSmooth(
resample_kernel, upsample_factor=2, downsample_factor=1, kernel_size=kernel_size)
elif self.sample_mode == 'downsample':
self.smooth = UpFirDnSmooth(
resample_kernel, upsample_factor=1, downsample_factor=2, kernel_size=kernel_size)
elif self.sample_mode is None:
pass
else:
raise ValueError(f'Wrong sample mode {self.sample_mode}, '
"supported ones are ['upsample', 'downsample', None].")
self.scale = 1 / math.sqrt(in_channels * kernel_size**2)
# modulation inside each modulated conv
self.modulation = EqualLinear(
num_style_feat, in_channels, bias=True, bias_init_val=1, lr_mul=1, activation=None)
self.weight = nn.Parameter(torch.randn(1, out_channels, in_channels, kernel_size, kernel_size))
self.padding = kernel_size // 2
def forward(self, x, style):
"""Forward function.
Args:
x (Tensor): Tensor with shape (b, c, h, w).
style (Tensor): Tensor with shape (b, num_style_feat).
Returns:
Tensor: Modulated tensor after convolution.
"""
b, c, h, w = x.shape # c = c_in
# weight modulation
style = self.modulation(style).view(b, 1, c, 1, 1)
# self.weight: (1, c_out, c_in, k, k); style: (b, 1, c, 1, 1)
weight = self.scale * self.weight * style # (b, c_out, c_in, k, k)
if self.demodulate:
demod = torch.rsqrt(weight.pow(2).sum([2, 3, 4]) + self.eps)
weight = weight * demod.view(b, self.out_channels, 1, 1, 1)
weight = weight.view(b * self.out_channels, c, self.kernel_size, self.kernel_size)
if self.sample_mode == 'upsample':
x = x.view(1, b * c, h, w)
weight = weight.view(b, self.out_channels, c, self.kernel_size, self.kernel_size)
weight = weight.transpose(1, 2).reshape(b * c, self.out_channels, self.kernel_size, self.kernel_size)
out = F.conv_transpose2d(x, weight, padding=0, stride=2, groups=b)
out = out.view(b, self.out_channels, *out.shape[2:4])
out = self.smooth(out)
elif self.sample_mode == 'downsample':
x = self.smooth(x)
x = x.view(1, b * c, *x.shape[2:4])
out = F.conv2d(x, weight, padding=0, stride=2, groups=b)
out = out.view(b, self.out_channels, *out.shape[2:4])
else:
x = x.view(1, b * c, h, w)
# weight: (b*c_out, c_in, k, k), groups=b
out = F.conv2d(x, weight, padding=self.padding, groups=b)
out = out.view(b, self.out_channels, *out.shape[2:4])
return out
def __repr__(self):
return (f'{self.__class__.__name__}(in_channels={self.in_channels}, '
f'out_channels={self.out_channels}, '
f'kernel_size={self.kernel_size}, '
f'demodulate={self.demodulate}, sample_mode={self.sample_mode})')
class StyleConv(nn.Module):
"""Style conv.
Args:
in_channels (int): Channel number of the input.
out_channels (int): Channel number of the output.
kernel_size (int): Size of the convolving kernel.
num_style_feat (int): Channel number of style features.
demodulate (bool): Whether demodulate in the conv layer. Default: True.
sample_mode (str | None): Indicating 'upsample', 'downsample' or None.
Default: None.
resample_kernel (list[int]): A list indicating the 1D resample kernel
magnitude. Default: (1, 3, 3, 1).
"""
def __init__(self,
in_channels,
out_channels,
kernel_size,
num_style_feat,
demodulate=True,
sample_mode=None,
resample_kernel=(1, 3, 3, 1)):
super(StyleConv, self).__init__()
self.modulated_conv = ModulatedConv2d(
in_channels,
out_channels,
kernel_size,
num_style_feat,
demodulate=demodulate,
sample_mode=sample_mode,
resample_kernel=resample_kernel)
self.weight = nn.Parameter(torch.zeros(1)) # for noise injection
self.activate = FusedLeakyReLU(out_channels)
def forward(self, x, style, noise=None):
# modulate
out = self.modulated_conv(x, style)
# noise injection
if noise is None:
b, _, h, w = out.shape
noise = out.new_empty(b, 1, h, w).normal_()
out = out + self.weight * noise
# activation (with bias)
out = self.activate(out)
return out
class ToRGB(nn.Module):
"""To RGB from features.
Args:
in_channels (int): Channel number of input.
num_style_feat (int): Channel number of style features.
upsample (bool): Whether to upsample. Default: True.
resample_kernel (list[int]): A list indicating the 1D resample kernel
magnitude. Default: (1, 3, 3, 1).
"""
def __init__(self, in_channels, num_style_feat, upsample=True, resample_kernel=(1, 3, 3, 1)):
super(ToRGB, self).__init__()
if upsample:
self.upsample = UpFirDnUpsample(resample_kernel, factor=2)
else:
self.upsample = None
self.modulated_conv = ModulatedConv2d(
in_channels, 3, kernel_size=1, num_style_feat=num_style_feat, demodulate=False, sample_mode=None)
self.bias = nn.Parameter(torch.zeros(1, 3, 1, 1))
def forward(self, x, style, skip=None):
"""Forward function.
Args:
x (Tensor): Feature tensor with shape (b, c, h, w).
style (Tensor): Tensor with shape (b, num_style_feat).
skip (Tensor): Base/skip tensor. Default: None.
Returns:
Tensor: RGB images.
"""
out = self.modulated_conv(x, style)
out = out + self.bias
if skip is not None:
if self.upsample:
skip = self.upsample(skip)
out = out + skip
return out
class ConstantInput(nn.Module):
"""Constant input.
Args:
num_channel (int): Channel number of constant input.
size (int): Spatial size of constant input.
"""
def __init__(self, num_channel, size):
super(ConstantInput, self).__init__()
self.weight = nn.Parameter(torch.randn(1, num_channel, size, size))
def forward(self, batch):
out = self.weight.repeat(batch, 1, 1, 1)
return out
@ARCH_REGISTRY.register()
class StyleGAN2Generator(nn.Module):
"""StyleGAN2 Generator.
Args:
out_size (int): The spatial size of outputs.
num_style_feat (int): Channel number of style features. Default: 512.
num_mlp (int): Layer number of MLP style layers. Default: 8.
channel_multiplier (int): Channel multiplier for large networks of
StyleGAN2. Default: 2.
resample_kernel (list[int]): A list indicating the 1D resample kernel
magnitude. A cross production will be applied to extent 1D resample
kenrel to 2D resample kernel. Default: (1, 3, 3, 1).
lr_mlp (float): Learning rate multiplier for mlp layers. Default: 0.01.
narrow (float): Narrow ratio for channels. Default: 1.0.
"""
def __init__(self,
out_size,
num_style_feat=512,
num_mlp=8,
channel_multiplier=2,
resample_kernel=(1, 3, 3, 1),
lr_mlp=0.01,
narrow=1):
super(StyleGAN2Generator, self).__init__()
# Style MLP layers
self.num_style_feat = num_style_feat
style_mlp_layers = [NormStyleCode()]
for i in range(num_mlp):
style_mlp_layers.append(
EqualLinear(
num_style_feat, num_style_feat, bias=True, bias_init_val=0, lr_mul=lr_mlp,
activation='fused_lrelu'))
self.style_mlp = nn.Sequential(*style_mlp_layers)
channels = {
'4': int(512 * narrow),
'8': int(512 * narrow),
'16': int(512 * narrow),
'32': int(512 * narrow),
'64': int(256 * channel_multiplier * narrow),
'128': int(128 * channel_multiplier * narrow),
'256': int(64 * channel_multiplier * narrow),
'512': int(32 * channel_multiplier * narrow),
'1024': int(16 * channel_multiplier * narrow)
}
self.channels = channels
self.constant_input = ConstantInput(channels['4'], size=4)
self.style_conv1 = StyleConv(
channels['4'],
channels['4'],
kernel_size=3,
num_style_feat=num_style_feat,
demodulate=True,
sample_mode=None,
resample_kernel=resample_kernel)
self.to_rgb1 = ToRGB(channels['4'], num_style_feat, upsample=False, resample_kernel=resample_kernel)
self.log_size = int(math.log(out_size, 2))
self.num_layers = (self.log_size - 2) * 2 + 1
self.num_latent = self.log_size * 2 - 2
self.style_convs = nn.ModuleList()
self.to_rgbs = nn.ModuleList()
self.noises = nn.Module()
in_channels = channels['4']
# noise
for layer_idx in range(self.num_layers):
resolution = 2**((layer_idx + 5) // 2)
shape = [1, 1, resolution, resolution]
self.noises.register_buffer(f'noise{layer_idx}', torch.randn(*shape))
# style convs and to_rgbs
for i in range(3, self.log_size + 1):
out_channels = channels[f'{2**i}']
self.style_convs.append(
StyleConv(
in_channels,
out_channels,
kernel_size=3,
num_style_feat=num_style_feat,
demodulate=True,
sample_mode='upsample',
resample_kernel=resample_kernel,
))
self.style_convs.append(
StyleConv(
out_channels,
out_channels,
kernel_size=3,
num_style_feat=num_style_feat,
demodulate=True,
sample_mode=None,
resample_kernel=resample_kernel))
self.to_rgbs.append(ToRGB(out_channels, num_style_feat, upsample=True, resample_kernel=resample_kernel))
in_channels = out_channels
def make_noise(self):
"""Make noise for noise injection."""
device = self.constant_input.weight.device
noises = [torch.randn(1, 1, 4, 4, device=device)]
for i in range(3, self.log_size + 1):
for _ in range(2):
noises.append(torch.randn(1, 1, 2**i, 2**i, device=device))
return noises
def get_latent(self, x):
return self.style_mlp(x)
def mean_latent(self, num_latent):
latent_in = torch.randn(num_latent, self.num_style_feat, device=self.constant_input.weight.device)
latent = self.style_mlp(latent_in).mean(0, keepdim=True)
return latent
def forward(self,
styles,
input_is_latent=False,
noise=None,
randomize_noise=True,
truncation=1,
truncation_latent=None,
inject_index=None,
return_latents=False):
"""Forward function for StyleGAN2Generator.
Args:
styles (list[Tensor]): Sample codes of styles.
input_is_latent (bool): Whether input is latent style.
Default: False.
noise (Tensor | None): Input noise or None. Default: None.
randomize_noise (bool): Randomize noise, used when 'noise' is
False. Default: True.
truncation (float): TODO. Default: 1.
truncation_latent (Tensor | None): TODO. Default: None.
inject_index (int | None): The injection index for mixing noise.
Default: None.
return_latents (bool): Whether to return style latents.
Default: False.
"""
# style codes -> latents with Style MLP layer
if not input_is_latent:
styles = [self.style_mlp(s) for s in styles]
# noises
if noise is None:
if randomize_noise:
noise = [None] * self.num_layers # for each style conv layer
else: # use the stored noise
noise = [getattr(self.noises, f'noise{i}') for i in range(self.num_layers)]
# style truncation
if truncation < 1:
style_truncation = []
for style in styles:
style_truncation.append(truncation_latent + truncation * (style - truncation_latent))
styles = style_truncation
# get style latent with injection
if len(styles) == 1:
inject_index = self.num_latent
if styles[0].ndim < 3:
# repeat latent code for all the layers
latent = styles[0].unsqueeze(1).repeat(1, inject_index, 1)
else: # used for encoder with different latent code for each layer
latent = styles[0]
elif len(styles) == 2: # mixing noises
if inject_index is None:
inject_index = random.randint(1, self.num_latent - 1)
latent1 = styles[0].unsqueeze(1).repeat(1, inject_index, 1)
latent2 = styles[1].unsqueeze(1).repeat(1, self.num_latent - inject_index, 1)
latent = torch.cat([latent1, latent2], 1)
# main generation
out = self.constant_input(latent.shape[0])
out = self.style_conv1(out, latent[:, 0], noise=noise[0])
skip = self.to_rgb1(out, latent[:, 1])
i = 1
for conv1, conv2, noise1, noise2, to_rgb in zip(self.style_convs[::2], self.style_convs[1::2], noise[1::2],
noise[2::2], self.to_rgbs):
out = conv1(out, latent[:, i], noise=noise1)
out = conv2(out, latent[:, i + 1], noise=noise2)
skip = to_rgb(out, latent[:, i + 2], skip)
i += 2
image = skip
if return_latents:
return image, latent
else:
return image, None
class ScaledLeakyReLU(nn.Module):
"""Scaled LeakyReLU.
Args:
negative_slope (float): Negative slope. Default: 0.2.
"""
def __init__(self, negative_slope=0.2):
super(ScaledLeakyReLU, self).__init__()
self.negative_slope = negative_slope
def forward(self, x):
out = F.leaky_relu(x, negative_slope=self.negative_slope)
return out * math.sqrt(2)
class EqualConv2d(nn.Module):
"""Equalized Linear as StyleGAN2.
Args:
in_channels (int): Channel number of the input.
out_channels (int): Channel number of the output.
kernel_size (int): Size of the convolving kernel.
stride (int): Stride of the convolution. Default: 1
padding (int): Zero-padding added to both sides of the input.
Default: 0.
bias (bool): If ``True``, adds a learnable bias to the output.
Default: ``True``.
bias_init_val (float): Bias initialized value. Default: 0.
"""
def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, bias=True, bias_init_val=0):
super(EqualConv2d, self).__init__()
self.in_channels = in_channels
self.out_channels = out_channels
self.kernel_size = kernel_size
self.stride = stride
self.padding = padding
self.scale = 1 / math.sqrt(in_channels * kernel_size**2)
self.weight = nn.Parameter(torch.randn(out_channels, in_channels, kernel_size, kernel_size))
if bias:
self.bias = nn.Parameter(torch.zeros(out_channels).fill_(bias_init_val))
else:
self.register_parameter('bias', None)
def forward(self, x):
out = F.conv2d(
x,
self.weight * self.scale,
bias=self.bias,
stride=self.stride,
padding=self.padding,
)
return out
def __repr__(self):
return (f'{self.__class__.__name__}(in_channels={self.in_channels}, '
f'out_channels={self.out_channels}, '
f'kernel_size={self.kernel_size},'
f' stride={self.stride}, padding={self.padding}, '
f'bias={self.bias is not None})')
class ConvLayer(nn.Sequential):
"""Conv Layer used in StyleGAN2 Discriminator.
Args:
in_channels (int): Channel number of the input.
out_channels (int): Channel number of the output.
kernel_size (int): Kernel size.
downsample (bool): Whether downsample by a factor of 2.
Default: False.
resample_kernel (list[int]): A list indicating the 1D resample
kernel magnitude. A cross production will be applied to
extent 1D resample kenrel to 2D resample kernel.
Default: (1, 3, 3, 1).
bias (bool): Whether with bias. Default: True.
activate (bool): Whether use activateion. Default: True.
"""
def __init__(self,
in_channels,
out_channels,
kernel_size,
downsample=False,
resample_kernel=(1, 3, 3, 1),
bias=True,
activate=True):
layers = []
# downsample
if downsample:
layers.append(
UpFirDnSmooth(resample_kernel, upsample_factor=1, downsample_factor=2, kernel_size=kernel_size))
stride = 2
self.padding = 0
else:
stride = 1
self.padding = kernel_size // 2
# conv
layers.append(
EqualConv2d(
in_channels, out_channels, kernel_size, stride=stride, padding=self.padding, bias=bias
and not activate))
# activation
if activate:
if bias:
layers.append(FusedLeakyReLU(out_channels))
else:
layers.append(ScaledLeakyReLU(0.2))
super(ConvLayer, self).__init__(*layers)
class ResBlock(nn.Module):
"""Residual block used in StyleGAN2 Discriminator.
Args:
in_channels (int): Channel number of the input.
out_channels (int): Channel number of the output.
resample_kernel (list[int]): A list indicating the 1D resample
kernel magnitude. A cross production will be applied to
extent 1D resample kenrel to 2D resample kernel.
Default: (1, 3, 3, 1).
"""
def __init__(self, in_channels, out_channels, resample_kernel=(1, 3, 3, 1)):
super(ResBlock, self).__init__()
self.conv1 = ConvLayer(in_channels, in_channels, 3, bias=True, activate=True)
self.conv2 = ConvLayer(
in_channels, out_channels, 3, downsample=True, resample_kernel=resample_kernel, bias=True, activate=True)
self.skip = ConvLayer(
in_channels, out_channels, 1, downsample=True, resample_kernel=resample_kernel, bias=False, activate=False)
def forward(self, x):
out = self.conv1(x)
out = self.conv2(out)
skip = self.skip(x)
out = (out + skip) / math.sqrt(2)
return out
@ARCH_REGISTRY.register()
class StyleGAN2Discriminator(nn.Module):
"""StyleGAN2 Discriminator.
Args:
out_size (int): The spatial size of outputs.
channel_multiplier (int): Channel multiplier for large networks of
StyleGAN2. Default: 2.
resample_kernel (list[int]): A list indicating the 1D resample kernel
magnitude. A cross production will be applied to extent 1D resample
kenrel to 2D resample kernel. Default: (1, 3, 3, 1).
stddev_group (int): For group stddev statistics. Default: 4.
narrow (float): Narrow ratio for channels. Default: 1.0.
"""
def __init__(self, out_size, channel_multiplier=2, resample_kernel=(1, 3, 3, 1), stddev_group=4, narrow=1):
super(StyleGAN2Discriminator, self).__init__()
channels = {
'4': int(512 * narrow),
'8': int(512 * narrow),
'16': int(512 * narrow),
'32': int(512 * narrow),
'64': int(256 * channel_multiplier * narrow),
'128': int(128 * channel_multiplier * narrow),
'256': int(64 * channel_multiplier * narrow),
'512': int(32 * channel_multiplier * narrow),
'1024': int(16 * channel_multiplier * narrow)
}
log_size = int(math.log(out_size, 2))
conv_body = [ConvLayer(3, channels[f'{out_size}'], 1, bias=True, activate=True)]
in_channels = channels[f'{out_size}']
for i in range(log_size, 2, -1):
out_channels = channels[f'{2**(i - 1)}']
conv_body.append(ResBlock(in_channels, out_channels, resample_kernel))
in_channels = out_channels
self.conv_body = nn.Sequential(*conv_body)
self.final_conv = ConvLayer(in_channels + 1, channels['4'], 3, bias=True, activate=True)
self.final_linear = nn.Sequential(
EqualLinear(
channels['4'] * 4 * 4, channels['4'], bias=True, bias_init_val=0, lr_mul=1, activation='fused_lrelu'),
EqualLinear(channels['4'], 1, bias=True, bias_init_val=0, lr_mul=1, activation=None),
)
self.stddev_group = stddev_group
self.stddev_feat = 1
def forward(self, x):
out = self.conv_body(x)
b, c, h, w = out.shape
# concatenate a group stddev statistics to out
group = min(b, self.stddev_group) # Minibatch must be divisible by (or smaller than) group_size
stddev = out.view(group, -1, self.stddev_feat, c // self.stddev_feat, h, w)
stddev = torch.sqrt(stddev.var(0, unbiased=False) + 1e-8)
stddev = stddev.mean([2, 3, 4], keepdims=True).squeeze(2)
stddev = stddev.repeat(group, 1, h, w)
out = torch.cat([out, stddev], 1)
out = self.final_conv(out)
out = out.view(b, -1)
out = self.final_linear(out)
return out123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172import torch
from torch import nn as nn
from torch.nn import functional as F
from basicsr.utils.registry import ARCH_REGISTRY
from .arch_util import flow_warp
class BasicModule(nn.Module):
"""Basic module of SPyNet.
Note that unlike the architecture in spynet_arch.py, the basic module
here contains batch normalization.
"""
def __init__(self):
super(BasicModule, self).__init__()
self.basic_module = nn.Sequential(
nn.Conv2d(in_channels=8, out_channels=32, kernel_size=7, stride=1, padding=3, bias=False),
nn.BatchNorm2d(32), nn.ReLU(inplace=True),
nn.Conv2d(in_channels=32, out_channels=64, kernel_size=7, stride=1, padding=3, bias=False),
nn.BatchNorm2d(64), nn.ReLU(inplace=True),
nn.Conv2d(in_channels=64, out_channels=32, kernel_size=7, stride=1, padding=3, bias=False),
nn.BatchNorm2d(32), nn.ReLU(inplace=True),
nn.Conv2d(in_channels=32, out_channels=16, kernel_size=7, stride=1, padding=3, bias=False),
nn.BatchNorm2d(16), nn.ReLU(inplace=True),
nn.Conv2d(in_channels=16, out_channels=2, kernel_size=7, stride=1, padding=3))
def forward(self, tensor_input):
"""
Args:
tensor_input (Tensor): Input tensor with shape (b, 8, h, w).
8 channels contain:
[reference image (3), neighbor image (3), initial flow (2)].
Returns:
Tensor: Estimated flow with shape (b, 2, h, w)
"""
return self.basic_module(tensor_input)
class SPyNetTOF(nn.Module):
"""SPyNet architecture for TOF.
Note that this implementation is specifically for TOFlow. Please use
spynet_arch.py for general use. They differ in the following aspects:
1. The basic modules here contain BatchNorm.
2. Normalization and denormalization are not done here, as
they are done in TOFlow.
Paper:
Optical Flow Estimation using a Spatial Pyramid Network
Code reference:
https://github.com/Coldog2333/pytoflow
Args:
load_path (str): Path for pretrained SPyNet. Default: None.
"""
def __init__(self, load_path=None):
super(SPyNetTOF, self).__init__()
self.basic_module = nn.ModuleList([BasicModule() for _ in range(4)])
if load_path:
self.load_state_dict(torch.load(load_path, map_location=lambda storage, loc: storage)['params'])
def forward(self, ref, supp):
"""
Args:
ref (Tensor): Reference image with shape of (b, 3, h, w).
supp: The supporting image to be warped: (b, 3, h, w).
Returns:
Tensor: Estimated optical flow: (b, 2, h, w).
"""
num_batches, _, h, w = ref.size()
ref = [ref]
supp = [supp]
# generate downsampled frames
for _ in range(3):
ref.insert(0, F.avg_pool2d(input=ref[0], kernel_size=2, stride=2, count_include_pad=False))
supp.insert(0, F.avg_pool2d(input=supp[0], kernel_size=2, stride=2, count_include_pad=False))
# flow computation
flow = ref[0].new_zeros(num_batches, 2, h // 16, w // 16)
for i in range(4):
flow_up = F.interpolate(input=flow, scale_factor=2, mode='bilinear', align_corners=True) * 2.0
flow = flow_up + self.basic_module[i](
torch.cat([ref[i], flow_warp(supp[i], flow_up.permute(0, 2, 3, 1)), flow_up], 1))
return flow
@ARCH_REGISTRY.register()
class TOFlow(nn.Module):
"""PyTorch implementation of TOFlow.
In TOFlow, the LR frames are pre-upsampled and have the same size with
the GT frames.
Paper:
Xue et al., Video Enhancement with Task-Oriented Flow, IJCV 2018
Code reference:
1. https://github.com/anchen1011/toflow
2. https://github.com/Coldog2333/pytoflow
Args:
adapt_official_weights (bool): Whether to adapt the weights translated
from the official implementation. Set to false if you want to
train from scratch. Default: False
"""
def __init__(self, adapt_official_weights=False):
super(TOFlow, self).__init__()
self.adapt_official_weights = adapt_official_weights
self.ref_idx = 0 if adapt_official_weights else 3
self.register_buffer('mean', torch.Tensor([0.485, 0.456, 0.406]).view(1, 3, 1, 1))
self.register_buffer('std', torch.Tensor([0.229, 0.224, 0.225]).view(1, 3, 1, 1))
# flow estimation module
self.spynet = SPyNetTOF()
# reconstruction module
self.conv_1 = nn.Conv2d(3 * 7, 64, 9, 1, 4)
self.conv_2 = nn.Conv2d(64, 64, 9, 1, 4)
self.conv_3 = nn.Conv2d(64, 64, 1)
self.conv_4 = nn.Conv2d(64, 3, 1)
# activation function
self.relu = nn.ReLU(inplace=True)
def normalize(self, img):
return (img - self.mean) / self.std
def denormalize(self, img):
return img * self.std + self.mean
def forward(self, lrs):
"""
Args:
lrs: Input lr frames: (b, 7, 3, h, w).
Returns:
Tensor: SR frame: (b, 3, h, w).
"""
# In the official implementation, the 0-th frame is the reference frame
if self.adapt_official_weights:
lrs = lrs[:, [3, 0, 1, 2, 4, 5, 6], :, :, :]
num_batches, num_lrs, _, h, w = lrs.size()
lrs = self.normalize(lrs.view(-1, 3, h, w))
lrs = lrs.view(num_batches, num_lrs, 3, h, w)
lr_ref = lrs[:, self.ref_idx, :, :, :]
lr_aligned = []
for i in range(7): # 7 frames
if i == self.ref_idx:
lr_aligned.append(lr_ref)
else:
lr_supp = lrs[:, i, :, :, :]
flow = self.spynet(lr_ref, lr_supp)
lr_aligned.append(flow_warp(lr_supp, flow.permute(0, 2, 3, 1)))
# reconstruction
hr = torch.stack(lr_aligned, dim=1)
hr = hr.view(num_batches, -1, h, w)
hr = self.relu(self.conv_1(hr))
hr = self.relu(self.conv_2(hr))
hr = self.relu(self.conv_3(hr))
hr = self.conv_4(hr) + lr_ref
return self.denormalize(hr)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161import os
import torch
from collections import OrderedDict
from torch import nn as nn
from torchvision.models import vgg as vgg
from basicsr.utils.registry import ARCH_REGISTRY
VGG_PRETRAIN_PATH = 'experiments/pretrained_models/vgg19-dcbb9e9d.pth'
NAMES = {
'vgg11': [
'conv1_1', 'relu1_1', 'pool1', 'conv2_1', 'relu2_1', 'pool2', 'conv3_1', 'relu3_1', 'conv3_2', 'relu3_2',
'pool3', 'conv4_1', 'relu4_1', 'conv4_2', 'relu4_2', 'pool4', 'conv5_1', 'relu5_1', 'conv5_2', 'relu5_2',
'pool5'
],
'vgg13': [
'conv1_1', 'relu1_1', 'conv1_2', 'relu1_2', 'pool1', 'conv2_1', 'relu2_1', 'conv2_2', 'relu2_2', 'pool2',
'conv3_1', 'relu3_1', 'conv3_2', 'relu3_2', 'pool3', 'conv4_1', 'relu4_1', 'conv4_2', 'relu4_2', 'pool4',
'conv5_1', 'relu5_1', 'conv5_2', 'relu5_2', 'pool5'
],
'vgg16': [
'conv1_1', 'relu1_1', 'conv1_2', 'relu1_2', 'pool1', 'conv2_1', 'relu2_1', 'conv2_2', 'relu2_2', 'pool2',
'conv3_1', 'relu3_1', 'conv3_2', 'relu3_2', 'conv3_3', 'relu3_3', 'pool3', 'conv4_1', 'relu4_1', 'conv4_2',
'relu4_2', 'conv4_3', 'relu4_3', 'pool4', 'conv5_1', 'relu5_1', 'conv5_2', 'relu5_2', 'conv5_3', 'relu5_3',
'pool5'
],
'vgg19': [
'conv1_1', 'relu1_1', 'conv1_2', 'relu1_2', 'pool1', 'conv2_1', 'relu2_1', 'conv2_2', 'relu2_2', 'pool2',
'conv3_1', 'relu3_1', 'conv3_2', 'relu3_2', 'conv3_3', 'relu3_3', 'conv3_4', 'relu3_4', 'pool3', 'conv4_1',
'relu4_1', 'conv4_2', 'relu4_2', 'conv4_3', 'relu4_3', 'conv4_4', 'relu4_4', 'pool4', 'conv5_1', 'relu5_1',
'conv5_2', 'relu5_2', 'conv5_3', 'relu5_3', 'conv5_4', 'relu5_4', 'pool5'
]
}
def insert_bn(names):
"""Insert bn layer after each conv.
Args:
names (list): The list of layer names.
Returns:
list: The list of layer names with bn layers.
"""
names_bn = []
for name in names:
names_bn.append(name)
if 'conv' in name:
position = name.replace('conv', '')
names_bn.append('bn' + position)
return names_bn
@ARCH_REGISTRY.register()
class VGGFeatureExtractor(nn.Module):
"""VGG network for feature extraction.
In this implementation, we allow users to choose whether use normalization
in the input feature and the type of vgg network. Note that the pretrained
path must fit the vgg type.
Args:
layer_name_list (list[str]): Forward function returns the corresponding
features according to the layer_name_list.
Example: {'relu1_1', 'relu2_1', 'relu3_1'}.
vgg_type (str): Set the type of vgg network. Default: 'vgg19'.
use_input_norm (bool): If True, normalize the input image. Importantly,
the input feature must in the range [0, 1]. Default: True.
range_norm (bool): If True, norm images with range [-1, 1] to [0, 1].
Default: False.
requires_grad (bool): If true, the parameters of VGG network will be
optimized. Default: False.
remove_pooling (bool): If true, the max pooling operations in VGG net
will be removed. Default: False.
pooling_stride (int): The stride of max pooling operation. Default: 2.
"""
def __init__(self,
layer_name_list,
vgg_type='vgg19',
use_input_norm=True,
range_norm=False,
requires_grad=False,
remove_pooling=False,
pooling_stride=2):
super(VGGFeatureExtractor, self).__init__()
self.layer_name_list = layer_name_list
self.use_input_norm = use_input_norm
self.range_norm = range_norm
self.names = NAMES[vgg_type.replace('_bn', '')]
if 'bn' in vgg_type:
self.names = insert_bn(self.names)
# only borrow layers that will be used to avoid unused params
max_idx = 0
for v in layer_name_list:
idx = self.names.index(v)
if idx > max_idx:
max_idx = idx
if os.path.exists(VGG_PRETRAIN_PATH):
vgg_net = getattr(vgg, vgg_type)(pretrained=False)
state_dict = torch.load(VGG_PRETRAIN_PATH, map_location=lambda storage, loc: storage)
vgg_net.load_state_dict(state_dict)
else:
vgg_net = getattr(vgg, vgg_type)(pretrained=True)
features = vgg_net.features[:max_idx + 1]
modified_net = OrderedDict()
for k, v in zip(self.names, features):
if 'pool' in k:
# if remove_pooling is true, pooling operation will be removed
if remove_pooling:
continue
else:
# in some cases, we may want to change the default stride
modified_net[k] = nn.MaxPool2d(kernel_size=2, stride=pooling_stride)
else:
modified_net[k] = v
self.vgg_net = nn.Sequential(modified_net)
if not requires_grad:
self.vgg_net.eval()
for param in self.parameters():
param.requires_grad = False
else:
self.vgg_net.train()
for param in self.parameters():
param.requires_grad = True
if self.use_input_norm:
# the mean is for image with range [0, 1]
self.register_buffer('mean', torch.Tensor([0.485, 0.456, 0.406]).view(1, 3, 1, 1))
# the std is for image with range [0, 1]
self.register_buffer('std', torch.Tensor([0.229, 0.224, 0.225]).view(1, 3, 1, 1))
def forward(self, x):
"""Forward function.
Args:
x (Tensor): Input tensor with shape (n, c, h, w).
Returns:
Tensor: Forward results.
"""
if self.range_norm:
x = (x + 1) / 2
if self.use_input_norm:
x = (x - self.mean) / self.std
output = {}
for key, layer in self.vgg_net._modules.items():
x = layer(x)
if key in self.layer_name_list:
output[key] = x.clone()
return output123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100import importlib
import numpy as np
import random
import torch
import torch.utils.data
from copy import deepcopy
from functools import partial
from os import path as osp
from basicsr.data.prefetch_dataloader import PrefetchDataLoader
from basicsr.utils import get_root_logger, scandir
from basicsr.utils.dist_util import get_dist_info
from basicsr.utils.registry import DATASET_REGISTRY
__all__ = ['build_dataset', 'build_dataloader']
# automatically scan and import dataset modules for registry
# scan all the files under the data folder with '_dataset' in file names
data_folder = osp.dirname(osp.abspath(__file__))
dataset_filenames = [osp.splitext(osp.basename(v))[0] for v in scandir(data_folder) if v.endswith('_dataset.py')]
# import all the dataset modules
_dataset_modules = [importlib.import_module(f'basicsr.data.{file_name}') for file_name in dataset_filenames]
def build_dataset(dataset_opt):
"""Build dataset from options.
Args:
dataset_opt (dict): Configuration for dataset. It must constain:
name (str): Dataset name.
type (str): Dataset type.
"""
dataset_opt = deepcopy(dataset_opt)
dataset = DATASET_REGISTRY.get(dataset_opt['type'])(dataset_opt)
logger = get_root_logger()
logger.info(f'Dataset [{dataset.__class__.__name__}] - {dataset_opt["name"]} ' 'is built.')
return dataset
def build_dataloader(dataset, dataset_opt, num_gpu=1, dist=False, sampler=None, seed=None):
"""Build dataloader.
Args:
dataset (torch.utils.data.Dataset): Dataset.
dataset_opt (dict): Dataset options. It contains the following keys:
phase (str): 'train' or 'val'.
num_worker_per_gpu (int): Number of workers for each GPU.
batch_size_per_gpu (int): Training batch size for each GPU.
num_gpu (int): Number of GPUs. Used only in the train phase.
Default: 1.
dist (bool): Whether in distributed training. Used only in the train
phase. Default: False.
sampler (torch.utils.data.sampler): Data sampler. Default: None.
seed (int | None): Seed. Default: None
"""
phase = dataset_opt['phase']
rank, _ = get_dist_info()
if phase == 'train':
if dist: # distributed training
batch_size = dataset_opt['batch_size_per_gpu']
num_workers = dataset_opt['num_worker_per_gpu']
else: # non-distributed training
multiplier = 1 if num_gpu == 0 else num_gpu
batch_size = dataset_opt['batch_size_per_gpu'] * multiplier
num_workers = dataset_opt['num_worker_per_gpu'] * multiplier
dataloader_args = dict(
dataset=dataset,
batch_size=batch_size,
shuffle=False,
num_workers=num_workers,
sampler=sampler,
drop_last=True)
if sampler is None:
dataloader_args['shuffle'] = True
dataloader_args['worker_init_fn'] = partial(
worker_init_fn, num_workers=num_workers, rank=rank, seed=seed) if seed is not None else None
elif phase in ['val', 'test']: # validation
dataloader_args = dict(dataset=dataset, batch_size=1, shuffle=False, num_workers=0)
else:
raise ValueError(f'Wrong dataset phase: {phase}. ' "Supported ones are 'train', 'val' and 'test'.")
dataloader_args['pin_memory'] = dataset_opt.get('pin_memory', False)
prefetch_mode = dataset_opt.get('prefetch_mode')
if prefetch_mode == 'cpu': # CPUPrefetcher
num_prefetch_queue = dataset_opt.get('num_prefetch_queue', 1)
logger = get_root_logger()
logger.info(f'Use {prefetch_mode} prefetch dataloader: ' f'num_prefetch_queue = {num_prefetch_queue}')
return PrefetchDataLoader(num_prefetch_queue=num_prefetch_queue, **dataloader_args)
else:
# prefetch_mode=None: Normal dataloader
# prefetch_mode='cuda': dataloader for CUDAPrefetcher
return torch.utils.data.DataLoader(**dataloader_args)
def worker_init_fn(worker_id, num_workers, rank, seed):
# Set the worker seed to num_workers * rank + worker_id + seed
worker_seed = num_workers * rank + worker_id + seed
np.random.seed(worker_seed)
random.seed(worker_seed)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748import math
import torch
from torch.utils.data.sampler import Sampler
class EnlargedSampler(Sampler):
"""Sampler that restricts data loading to a subset of the dataset.
Modified from torch.utils.data.distributed.DistributedSampler
Support enlarging the dataset for iteration-based training, for saving
time when restart the dataloader after each epoch
Args:
dataset (torch.utils.data.Dataset): Dataset used for sampling.
num_replicas (int | None): Number of processes participating in
the training. It is usually the world_size.
rank (int | None): Rank of the current process within num_replicas.
ratio (int): Enlarging ratio. Default: 1.
"""
def __init__(self, dataset, num_replicas, rank, ratio=1):
self.dataset = dataset
self.num_replicas = num_replicas
self.rank = rank
self.epoch = 0
self.num_samples = math.ceil(len(self.dataset) * ratio / self.num_replicas)
self.total_size = self.num_samples * self.num_replicas
def __iter__(self):
# deterministically shuffle based on epoch
g = torch.Generator()
g.manual_seed(self.epoch)
indices = torch.randperm(self.total_size, generator=g).tolist()
dataset_size = len(self.dataset)
indices = [v % dataset_size for v in indices]
# subsample
indices = indices[self.rank:self.total_size:self.num_replicas]
assert len(indices) == self.num_samples
return iter(indices)
def __len__(self):
return self.num_samples
def set_epoch(self, epoch):
self.epoch = epoch123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305import cv2
import numpy as np
import torch
from os import path as osp
from torch.nn import functional as F
from basicsr.data.transforms import mod_crop
from basicsr.utils import img2tensor, scandir
def read_img_seq(path, require_mod_crop=False, scale=1):
"""Read a sequence of images from a given folder path.
Args:
path (list[str] | str): List of image paths or image folder path.
require_mod_crop (bool): Require mod crop for each image.
Default: False.
scale (int): Scale factor for mod_crop. Default: 1.
Returns:
Tensor: size (t, c, h, w), RGB, [0, 1].
"""
if isinstance(path, list):
img_paths = path
else:
img_paths = sorted(list(scandir(path, full_path=True)))
imgs = [cv2.imread(v).astype(np.float32) / 255. for v in img_paths]
if require_mod_crop:
imgs = [mod_crop(img, scale) for img in imgs]
imgs = img2tensor(imgs, bgr2rgb=True, float32=True)
imgs = torch.stack(imgs, dim=0)
return imgs
def generate_frame_indices(crt_idx, max_frame_num, num_frames, padding='reflection'):
"""Generate an index list for reading `num_frames` frames from a sequence
of images.
Args:
crt_idx (int): Current center index.
max_frame_num (int): Max number of the sequence of images (from 1).
num_frames (int): Reading num_frames frames.
padding (str): Padding mode, one of
'replicate' | 'reflection' | 'reflection_circle' | 'circle'
Examples: current_idx = 0, num_frames = 5
The generated frame indices under different padding mode:
replicate: [0, 0, 0, 1, 2]
reflection: [2, 1, 0, 1, 2]
reflection_circle: [4, 3, 0, 1, 2]
circle: [3, 4, 0, 1, 2]
Returns:
list[int]: A list of indices.
"""
assert num_frames % 2 == 1, 'num_frames should be an odd number.'
assert padding in ('replicate', 'reflection', 'reflection_circle', 'circle'), f'Wrong padding mode: {padding}.'
max_frame_num = max_frame_num - 1 # start from 0
num_pad = num_frames // 2
indices = []
for i in range(crt_idx - num_pad, crt_idx + num_pad + 1):
if i < 0:
if padding == 'replicate':
pad_idx = 0
elif padding == 'reflection':
pad_idx = -i
elif padding == 'reflection_circle':
pad_idx = crt_idx + num_pad - i
else:
pad_idx = num_frames + i
elif i > max_frame_num:
if padding == 'replicate':
pad_idx = max_frame_num
elif padding == 'reflection':
pad_idx = max_frame_num * 2 - i
elif padding == 'reflection_circle':
pad_idx = (crt_idx - num_pad) - (i - max_frame_num)
else:
pad_idx = i - num_frames
else:
pad_idx = i
indices.append(pad_idx)
return indices
def paired_paths_from_lmdb(folders, keys):
"""Generate paired paths from lmdb files.
Contents of lmdb. Taking the `lq.lmdb` for example, the file structure is:
lq.lmdb
├── data.mdb
├── lock.mdb
├── meta_info.txt
The data.mdb and lock.mdb are standard lmdb files and you can refer to
https://lmdb.readthedocs.io/en/release/ for more details.
The meta_info.txt is a specified txt file to record the meta information
of our datasets. It will be automatically created when preparing
datasets by our provided dataset tools.
Each line in the txt file records
1)image name (with extension),
2)image shape,
3)compression level, separated by a white space.
Example: `baboon.png (120,125,3) 1`
We use the image name without extension as the lmdb key.
Note that we use the same key for the corresponding lq and gt images.
Args:
folders (list[str]): A list of folder path. The order of list should
be [input_folder, gt_folder].
keys (list[str]): A list of keys identifying folders. The order should
be in consistent with folders, e.g., ['lq', 'gt'].
Note that this key is different from lmdb keys.
Returns:
list[str]: Returned path list.
"""
assert len(folders) == 2, ('The len of folders should be 2 with [input_folder, gt_folder]. '
f'But got {len(folders)}')
assert len(keys) == 2, ('The len of keys should be 2 with [input_key, gt_key]. ' f'But got {len(keys)}')
input_folder, gt_folder = folders
input_key, gt_key = keys
if not (input_folder.endswith('.lmdb') and gt_folder.endswith('.lmdb')):
raise ValueError(f'{input_key} folder and {gt_key} folder should both in lmdb '
f'formats. But received {input_key}: {input_folder}; '
f'{gt_key}: {gt_folder}')
# ensure that the two meta_info files are the same
with open(osp.join(input_folder, 'meta_info.txt')) as fin:
input_lmdb_keys = [line.split('.')[0] for line in fin]
with open(osp.join(gt_folder, 'meta_info.txt')) as fin:
gt_lmdb_keys = [line.split('.')[0] for line in fin]
if set(input_lmdb_keys) != set(gt_lmdb_keys):
raise ValueError(f'Keys in {input_key}_folder and {gt_key}_folder are different.')
else:
paths = []
for lmdb_key in sorted(input_lmdb_keys):
paths.append(dict([(f'{input_key}_path', lmdb_key), (f'{gt_key}_path', lmdb_key)]))
return paths
def paired_paths_from_meta_info_file(folders, keys, meta_info_file, filename_tmpl):
"""Generate paired paths from an meta information file.
Each line in the meta information file contains the image names and
image shape (usually for gt), separated by a white space.
Example of an meta information file:
```
0001_s001.png (480,480,3)
0001_s002.png (480,480,3)
```
Args:
folders (list[str]): A list of folder path. The order of list should
be [input_folder, gt_folder].
keys (list[str]): A list of keys identifying folders. The order should
be in consistent with folders, e.g., ['lq', 'gt'].
meta_info_file (str): Path to the meta information file.
filename_tmpl (str): Template for each filename. Note that the
template excludes the file extension. Usually the filename_tmpl is
for files in the input folder.
Returns:
list[str]: Returned path list.
"""
assert len(folders) == 2, ('The len of folders should be 2 with [input_folder, gt_folder]. '
f'But got {len(folders)}')
assert len(keys) == 2, ('The len of keys should be 2 with [input_key, gt_key]. ' f'But got {len(keys)}')
input_folder, gt_folder = folders
input_key, gt_key = keys
with open(meta_info_file, 'r') as fin:
gt_names = [line.split(' ')[0] for line in fin]
paths = []
for gt_name in gt_names:
basename, ext = osp.splitext(osp.basename(gt_name))
input_name = f'{filename_tmpl.format(basename)}{ext}'
input_path = osp.join(input_folder, input_name)
gt_path = osp.join(gt_folder, gt_name)
paths.append(dict([(f'{input_key}_path', input_path), (f'{gt_key}_path', gt_path)]))
return paths
def paired_paths_from_folder(folders, keys, filename_tmpl):
"""Generate paired paths from folders.
Args:
folders (list[str]): A list of folder path. The order of list should
be [input_folder, gt_folder].
keys (list[str]): A list of keys identifying folders. The order should
be in consistent with folders, e.g., ['lq', 'gt'].
filename_tmpl (str): Template for each filename. Note that the
template excludes the file extension. Usually the filename_tmpl is
for files in the input folder.
Returns:
list[str]: Returned path list.
"""
assert len(folders) == 2, ('The len of folders should be 2 with [input_folder, gt_folder]. '
f'But got {len(folders)}')
assert len(keys) == 2, ('The len of keys should be 2 with [input_key, gt_key]. ' f'But got {len(keys)}')
input_folder, gt_folder = folders
input_key, gt_key = keys
input_paths = list(scandir(input_folder))
gt_paths = list(scandir(gt_folder))
assert len(input_paths) == len(gt_paths), (f'{input_key} and {gt_key} datasets have different number of images: '
f'{len(input_paths)}, {len(gt_paths)}.')
paths = []
for gt_path in gt_paths:
basename, ext = osp.splitext(osp.basename(gt_path))
input_name = f'{filename_tmpl.format(basename)}{ext}'
input_path = osp.join(input_folder, input_name)
assert input_name in input_paths, (f'{input_name} is not in ' f'{input_key}_paths.')
gt_path = osp.join(gt_folder, gt_path)
paths.append(dict([(f'{input_key}_path', input_path), (f'{gt_key}_path', gt_path)]))
return paths
def paths_from_folder(folder):
"""Generate paths from folder.
Args:
folder (str): Folder path.
Returns:
list[str]: Returned path list.
"""
paths = list(scandir(folder))
paths = [osp.join(folder, path) for path in paths]
return paths
def paths_from_lmdb(folder):
"""Generate paths from lmdb.
Args:
folder (str): Folder path.
Returns:
list[str]: Returned path list.
"""
if not folder.endswith('.lmdb'):
raise ValueError(f'Folder {folder}folder should in lmdb format.')
with open(osp.join(folder, 'meta_info.txt')) as fin:
paths = [line.split('.')[0] for line in fin]
return paths
def generate_gaussian_kernel(kernel_size=13, sigma=1.6):
"""Generate Gaussian kernel used in `duf_downsample`.
Args:
kernel_size (int): Kernel size. Default: 13.
sigma (float): Sigma of the Gaussian kernel. Default: 1.6.
Returns:
np.array: The Gaussian kernel.
"""
from scipy.ndimage import filters as filters
kernel = np.zeros((kernel_size, kernel_size))
# set element at the middle to one, a dirac delta
kernel[kernel_size // 2, kernel_size // 2] = 1
# gaussian-smooth the dirac, resulting in a gaussian filter
return filters.gaussian_filter(kernel, sigma)
def duf_downsample(x, kernel_size=13, scale=4):
"""Downsamping with Gaussian kernel used in the DUF official code.
Args:
x (Tensor): Frames to be downsampled, with shape (b, t, c, h, w).
kernel_size (int): Kernel size. Default: 13.
scale (int): Downsampling factor. Supported scale: (2, 3, 4).
Default: 4.
Returns:
Tensor: DUF downsampled frames.
"""
assert scale in (2, 3, 4), f'Only support scale (2, 3, 4), but got {scale}.'
squeeze_flag = False
if x.ndim == 4:
squeeze_flag = True
x = x.unsqueeze(0)
b, t, c, h, w = x.size()
x = x.view(-1, 1, h, w)
pad_w, pad_h = kernel_size // 2 + scale * 2, kernel_size // 2 + scale * 2
x = F.pad(x, (pad_w, pad_w, pad_h, pad_h), 'reflect')
gaussian_filter = generate_gaussian_kernel(kernel_size, 0.4 * scale)
gaussian_filter = torch.from_numpy(gaussian_filter).type_as(x).unsqueeze(0).unsqueeze(0)
x = F.conv2d(x, gaussian_filter, stride=scale)
x = x[:, :, 2:-2, 2:-2]
x = x.view(b, t, c, x.size(2), x.size(3))
if squeeze_flag:
x = x.squeeze(0)
return x123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347import cv2
import math
import numpy as np
import random
# -------------------------------------------------------------------- #
# --------------------------- blur kernels --------------------------- #
# -------------------------------------------------------------------- #
def sigma_matrix2(sig_x, sig_y, theta):
"""Calculate the rotated sigma matrix (two dimensional matrix).
Args:
sig_x (float):
sig_y (float):
theta (float): Radian measurement.
Returns:
ndarray: Rotated sigma matrix.
"""
D = np.array([[sig_x**2, 0], [0, sig_y**2]])
U = np.array([[np.cos(theta), -np.sin(theta)], [np.sin(theta), np.cos(theta)]])
return np.dot(U, np.dot(D, U.T))
def mesh_grid(kernel_size):
"""Generate the mesh grid, centering at zero.
Args:
kernel_size (int):
Returns:
xy (ndarray): with the shape (kernel_size, kernel_size, 2)
xx (ndarray): with the shape (kernel_size, kernel_size)
yy (ndarray): with the shape (kernel_size, kernel_size)
"""
ax = np.arange(-kernel_size // 2 + 1., kernel_size // 2 + 1.)
xx, yy = np.meshgrid(ax, ax)
xy = np.hstack((xx.reshape((kernel_size * kernel_size, 1)), yy.reshape(kernel_size * kernel_size,
1))).reshape(kernel_size, kernel_size, 2)
return xy, xx, yy
def pdf2(sigma_matrix, grid):
"""Calculate PDF of the bivariate Gaussian distribution.
Args:
sigma_matrix (ndarray): with the shape (2, 2)
grid (ndarray): generated by :func:`mesh_grid`,
with the shape (K, K, 2), K is the kernel size.
Returns:
kernel (ndarrray): un-normalized kernel.
"""
inverse_sigma = np.linalg.inv(sigma_matrix)
kernel = np.exp(-0.5 * np.sum(np.dot(grid, inverse_sigma) * grid, 2))
return kernel
def mass_center_shift(kernel_size, kernel):
"""Calculate the shift of the mass center of a kenrel.
Args:
kernel_size (int):
kernel (ndarray): normalized kernel.
Returns:
delta_h (float):
delta_w (float):
"""
ax = np.arange(-kernel_size // 2 + 1., kernel_size // 2 + 1.)
col_sum, row_sum = np.sum(kernel, axis=0), np.sum(kernel, axis=1)
delta_h = np.dot(row_sum, ax)
delta_w = np.dot(col_sum, ax)
return delta_h, delta_w
def bivariate_anisotropic_Gaussian(kernel_size, sig_x, sig_y, theta, grid=None):
"""Generate a bivariate anisotropic Gaussian kernel.
Args:
kernel_size (int):
sig_x (float):
sig_y (float):
theta (float): Radian measurement.
grid (ndarray, optional): generated by :func:`mesh_grid`,
with the shape (K, K, 2), K is the kernel size. Default: None
Returns:
kernel (ndarray): normalized kernel.
"""
if grid is None:
grid, _, _ = mesh_grid(kernel_size)
sigma_matrix = sigma_matrix2(sig_x, sig_y, theta)
kernel = pdf2(sigma_matrix, grid)
kernel = kernel / np.sum(kernel)
return kernel
def bivariate_isotropic_Gaussian(kernel_size, sig, grid=None):
"""Generate a bivariate isotropic Gaussian kernel.
Args:
kernel_size (int):
sig (float):
grid (ndarray, optional): generated by :func:`mesh_grid`,
with the shape (K, K, 2), K is the kernel size. Default: None
Returns:
kernel (ndarray): normalized kernel.
"""
if grid is None:
grid, _, _ = mesh_grid(kernel_size)
sigma_matrix = np.array([[sig**2, 0], [0, sig**2]])
kernel = pdf2(sigma_matrix, grid)
kernel = kernel / np.sum(kernel)
return kernel
def random_bivariate_anisotropic_Gaussian(kernel_size,
sigma_x_range,
sigma_y_range,
rotation_range,
noise_range=None,
strict=False):
"""Randomly generate bivariate anisotropic Gaussian kernels.
Args:
kernel_size (int):
sigma_x_range (tuple): [0.6, 5]
sigma_y_range (tuple): [0.6, 5]
rotation range (tuple): [-math.pi, math.pi]
noise_range(tuple, optional): multiplicative kernel noise,
[0.75, 1.25]. Default: None
Returns:
kernel (ndarray):
"""
assert kernel_size % 2 == 1, 'Kernel size must be an odd number.'
assert sigma_x_range[0] < sigma_x_range[1], 'Wrong sigma_x_range.'
assert sigma_y_range[0] < sigma_y_range[1], 'Wrong sigma_y_range.'
assert rotation_range[0] < rotation_range[1], 'Wrong rotation_range.'
sigma_x = np.random.uniform(sigma_x_range[0], sigma_x_range[1])
sigma_y = np.random.uniform(sigma_y_range[0], sigma_y_range[1])
if strict:
sigma_max = np.max([sigma_x, sigma_y])
sigma_min = np.min([sigma_x, sigma_y])
sigma_x, sigma_y = sigma_max, sigma_min
rotation = np.random.uniform(rotation_range[0], rotation_range[1])
kernel = bivariate_anisotropic_Gaussian(kernel_size, sigma_x, sigma_y, rotation)
# add multiplicative noise
if noise_range is not None:
assert noise_range[0] < noise_range[1], 'Wrong noise range.'
noise = np.random.uniform(noise_range[0], noise_range[1], size=kernel.shape)
kernel = kernel * noise
kernel = kernel / np.sum(kernel)
if strict:
return kernel, sigma_x, sigma_y, rotation
else:
return kernel
def random_bivariate_isotropic_Gaussian(kernel_size, sigma_range, noise_range=None, strict=False):
"""Randomly generate bivariate isotropic Gaussian kernels.
Args:
kernel_size (int):
sigma_range (tuple): [0.6, 5]
noise_range(tuple, optional): multiplicative kernel noise,
[0.75, 1.25]. Default: None
Returns:
kernel (ndarray):
"""
assert kernel_size % 2 == 1, 'Kernel size must be an odd number.'
assert sigma_range[0] < sigma_range[1], 'Wrong sigma_x_range.'
sigma = np.random.uniform(sigma_range[0], sigma_range[1])
kernel = bivariate_isotropic_Gaussian(kernel_size, sigma)
# add multiplicative noise
if noise_range is not None:
assert noise_range[0] < noise_range[1], 'Wrong noise range.'
noise = np.random.uniform(noise_range[0], noise_range[1], size=kernel.shape)
kernel = kernel * noise
kernel = kernel / np.sum(kernel)
if strict:
return kernel, sigma
else:
return kernel
def random_mixed_kernels(kernel_list,
kernel_prob,
kernel_size=21,
sigma_x_range=[0.6, 5],
sigma_y_range=[0.6, 5],
rotation_range=[-math.pi, math.pi],
beta_range=[0.5, 8],
noise_range=None):
"""Randomly generate mixed kernels.
Args:
kernel_list (tuple): a list name of kenrel types,
support ['iso', 'aniso']
kernel_prob (tuple): corresponding kernel probability for each
kernel type
kernel_size (int):
sigma_x_range (tuple): [0.6, 5]
sigma_y_range (tuple): [0.6, 5]
rotation range (tuple): [-math.pi, math.pi]
beta_range (tuple): [0.5, 8]
noise_range(tuple, optional): multiplicative kernel noise,
[0.75, 1.25]. Default: None
Returns:
kernel (ndarray):
"""
kernel_type = random.choices(kernel_list, kernel_prob)[0]
if kernel_type == 'iso':
kernel = random_bivariate_isotropic_Gaussian(kernel_size, sigma_x_range, noise_range=noise_range)
elif kernel_type == 'aniso':
kernel = random_bivariate_anisotropic_Gaussian(
kernel_size, sigma_x_range, sigma_y_range, rotation_range, noise_range=noise_range)
# add multiplicative noise
if noise_range is not None:
assert noise_range[0] < noise_range[1], 'Wrong noise range.'
noise = np.random.uniform(noise_range[0], noise_range[1], size=kernel.shape)
kernel = kernel * noise
kernel = kernel / np.sum(kernel)
return kernel
# ------------------------------------------------------------- #
# --------------------------- noise --------------------------- #
# ------------------------------------------------------------- #
# ----------------------- Gaussian Noise ----------------------- #
def generate_gaussian_noise(img, sigma=10, gray_noise=False):
"""Generate Gaussian noise.
Args:
img (Numpy array): Input image, shape (h, w, c), range [0, 1], float32.
sigma (float): Noise scale (measured in range 255). Default: 10.
Returns:
(Numpy array): Returned noisy image, shape (h, w, c), range[0, 1],
float32.
"""
noise = np.float32(np.random.randn(*(img.shape))) * sigma / 255.
if gray_noise:
noise = np.float32(np.random.randn(*(img.shape[0:2]))) * sigma / 255.
noise = np.expand_dims(noise, axis=2).repeat(3, axis=2)
else:
noise = np.float32(np.random.randn(*(img.shape))) * sigma / 255.
return noise
def add_gaussian_noise(img, sigma=10, clip=True, rounds=False, gray_noise=False):
"""Add Gaussian noise.
Args:
img (Numpy array): Input image, shape (h, w, c), range [0, 1], float32.
sigma (float): Noise scale (measured in range 255). Default: 10.
Returns:
(Numpy array): Returned noisy image, shape (h, w, c), range[0, 1],
float32.
"""
noise = generate_gaussian_noise(img, sigma, gray_noise)
out = img + noise
if clip and rounds:
out = np.clip((out * 255.0).round(), 0, 255) / 255.
elif clip:
out = np.clip(out, 0, 1)
elif rounds:
out = (out * 255.0).round() / 255.
return out
# ----------------------- Random Gaussian Noise ----------------------- #
def random_generate_gaussian_noise(img, sigma_range=(0, 10), gray_prob=0):
sigma = np.random.uniform(sigma_range[0], sigma_range[1])
if np.random.uniform() < gray_prob:
gray_noise = True
else:
gray_noise = False
return generate_gaussian_noise(img, sigma, gray_noise)
def random_add_gaussian_noise(img, sigma_range=(0, 1.0), gray_prob=0, clip=True, rounds=False):
noise = random_generate_gaussian_noise(img, sigma_range, gray_prob)
out = img + noise
if clip and rounds:
out = np.clip((out * 255.0).round(), 0, 255) / 255.
elif clip:
out = np.clip(out, 0, 1)
elif rounds:
out = (out * 255.0).round() / 255.
return out
# ------------------------------------------------------------------------ #
# --------------------------- JPEG compression --------------------------- #
# ------------------------------------------------------------------------ #
def add_jpg_compression(img, quality=90):
"""Add JPG compression artifacts.
Args:
img (Numpy array): Input image, shape (h, w, c), range [0, 1], float32.
quality (float): JPG compression quality. 0 for lowest quality, 100 for
best quality. Default: 90.
Returns:
(Numpy array): Returned image after JPG, shape (h, w, c), range[0, 1],
float32.
"""
img = np.clip(img, 0, 1)
encode_param = [int(cv2.IMWRITE_JPEG_QUALITY), quality]
_, encimg = cv2.imencode('.jpg', img * 255., encode_param)
img = np.float32(cv2.imdecode(encimg, 1)) / 255.
return img
def random_add_jpg_compression(img, quality_range=(90, 100)):
"""Randomly add JPG compression artifacts.
Args:
img (Numpy array): Input image, shape (h, w, c), range [0, 1], float32.
quality_range (tuple[float] | list[float]): JPG compression quality
range. 0 for lowest quality, 100 for best quality.
Default: (90, 100).
Returns:
(Numpy array): Returned image after JPG, shape (h, w, c), range[0, 1],
float32.
"""
quality = np.random.uniform(quality_range[0], quality_range[1])
return add_jpg_compression(img, quality)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263from os import path as osp
from torch.utils import data as data
from torchvision.transforms.functional import normalize
from basicsr.data.transforms import augment
from basicsr.utils import FileClient, imfrombytes, img2tensor
from basicsr.utils.registry import DATASET_REGISTRY
@DATASET_REGISTRY.register()
class FFHQDataset(data.Dataset):
"""FFHQ dataset for StyleGAN.
Args:
opt (dict): Config for train datasets. It contains the following keys:
dataroot_gt (str): Data root path for gt.
io_backend (dict): IO backend type and other kwarg.
mean (list | tuple): Image mean.
std (list | tuple): Image std.
use_hflip (bool): Whether to horizontally flip.
"""
def __init__(self, opt):
super(FFHQDataset, self).__init__()
self.opt = opt
# file client (io backend)
self.file_client = None
self.io_backend_opt = opt['io_backend']
self.gt_folder = opt['dataroot_gt']
self.mean = opt['mean']
self.std = opt['std']
if self.io_backend_opt['type'] == 'lmdb':
self.io_backend_opt['db_paths'] = self.gt_folder
if not self.gt_folder.endswith('.lmdb'):
raise ValueError("'dataroot_gt' should end with '.lmdb', " f'but received {self.gt_folder}')
with open(osp.join(self.gt_folder, 'meta_info.txt')) as fin:
self.paths = [line.split('.')[0] for line in fin]
else:
# FFHQ has 70000 images in total
self.paths = [osp.join(self.gt_folder, f'{v:08d}.png') for v in range(70000)]
def __getitem__(self, index):
if self.file_client is None:
self.file_client = FileClient(self.io_backend_opt.pop('type'), **self.io_backend_opt)
# load gt image
gt_path = self.paths[index]
img_bytes = self.file_client.get(gt_path)
img_gt = imfrombytes(img_bytes, float32=True)
# random horizontal flip
img_gt = augment(img_gt, hflip=self.opt['use_hflip'], rotation=False)
# BGR to RGB, HWC to CHW, numpy to tensor
img_gt = img2tensor(img_gt, bgr2rgb=True, float32=True)
# normalize
normalize(img_gt, self.mean, self.std, inplace=True)
return {'gt': img_gt, 'gt_path': gt_path}
def __len__(self):
return len(self.paths)1234000 100 (720,1280,3)
011 100 (720,1280,3)
015 100 (720,1280,3)
020 100 (720,1280,3)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270000 100 (720,1280,3)
001 100 (720,1280,3)
002 100 (720,1280,3)
003 100 (720,1280,3)
004 100 (720,1280,3)
005 100 (720,1280,3)
006 100 (720,1280,3)
007 100 (720,1280,3)
008 100 (720,1280,3)
009 100 (720,1280,3)
010 100 (720,1280,3)
011 100 (720,1280,3)
012 100 (720,1280,3)
013 100 (720,1280,3)
014 100 (720,1280,3)
015 100 (720,1280,3)
016 100 (720,1280,3)
017 100 (720,1280,3)
018 100 (720,1280,3)
019 100 (720,1280,3)
020 100 (720,1280,3)
021 100 (720,1280,3)
022 100 (720,1280,3)
023 100 (720,1280,3)
024 100 (720,1280,3)
025 100 (720,1280,3)
026 100 (720,1280,3)
027 100 (720,1280,3)
028 100 (720,1280,3)
029 100 (720,1280,3)
030 100 (720,1280,3)
031 100 (720,1280,3)
032 100 (720,1280,3)
033 100 (720,1280,3)
034 100 (720,1280,3)
035 100 (720,1280,3)
036 100 (720,1280,3)
037 100 (720,1280,3)
038 100 (720,1280,3)
039 100 (720,1280,3)
040 100 (720,1280,3)
041 100 (720,1280,3)
042 100 (720,1280,3)
043 100 (720,1280,3)
044 100 (720,1280,3)
045 100 (720,1280,3)
046 100 (720,1280,3)
047 100 (720,1280,3)
048 100 (720,1280,3)
049 100 (720,1280,3)
050 100 (720,1280,3)
051 100 (720,1280,3)
052 100 (720,1280,3)
053 100 (720,1280,3)
054 100 (720,1280,3)
055 100 (720,1280,3)
056 100 (720,1280,3)
057 100 (720,1280,3)
058 100 (720,1280,3)
059 100 (720,1280,3)
060 100 (720,1280,3)
061 100 (720,1280,3)
062 100 (720,1280,3)
063 100 (720,1280,3)
064 100 (720,1280,3)
065 100 (720,1280,3)
066 100 (720,1280,3)
067 100 (720,1280,3)
068 100 (720,1280,3)
069 100 (720,1280,3)
070 100 (720,1280,3)
071 100 (720,1280,3)
072 100 (720,1280,3)
073 100 (720,1280,3)
074 100 (720,1280,3)
075 100 (720,1280,3)
076 100 (720,1280,3)
077 100 (720,1280,3)
078 100 (720,1280,3)
079 100 (720,1280,3)
080 100 (720,1280,3)
081 100 (720,1280,3)
082 100 (720,1280,3)
083 100 (720,1280,3)
084 100 (720,1280,3)
085 100 (720,1280,3)
086 100 (720,1280,3)
087 100 (720,1280,3)
088 100 (720,1280,3)
089 100 (720,1280,3)
090 100 (720,1280,3)
091 100 (720,1280,3)
092 100 (720,1280,3)
093 100 (720,1280,3)
094 100 (720,1280,3)
095 100 (720,1280,3)
096 100 (720,1280,3)
097 100 (720,1280,3)
098 100 (720,1280,3)
099 100 (720,1280,3)
100 100 (720,1280,3)
101 100 (720,1280,3)
102 100 (720,1280,3)
103 100 (720,1280,3)
104 100 (720,1280,3)
105 100 (720,1280,3)
106 100 (720,1280,3)
107 100 (720,1280,3)
108 100 (720,1280,3)
109 100 (720,1280,3)
110 100 (720,1280,3)
111 100 (720,1280,3)
112 100 (720,1280,3)
113 100 (720,1280,3)
114 100 (720,1280,3)
115 100 (720,1280,3)
116 100 (720,1280,3)
117 100 (720,1280,3)
118 100 (720,1280,3)
119 100 (720,1280,3)
120 100 (720,1280,3)
121 100 (720,1280,3)
122 100 (720,1280,3)
123 100 (720,1280,3)
124 100 (720,1280,3)
125 100 (720,1280,3)
126 100 (720,1280,3)
127 100 (720,1280,3)
128 100 (720,1280,3)
129 100 (720,1280,3)
130 100 (720,1280,3)
131 100 (720,1280,3)
132 100 (720,1280,3)
133 100 (720,1280,3)
134 100 (720,1280,3)
135 100 (720,1280,3)
136 100 (720,1280,3)
137 100 (720,1280,3)
138 100 (720,1280,3)
139 100 (720,1280,3)
140 100 (720,1280,3)
141 100 (720,1280,3)
142 100 (720,1280,3)
143 100 (720,1280,3)
144 100 (720,1280,3)
145 100 (720,1280,3)
146 100 (720,1280,3)
147 100 (720,1280,3)
148 100 (720,1280,3)
149 100 (720,1280,3)
150 100 (720,1280,3)
151 100 (720,1280,3)
152 100 (720,1280,3)
153 100 (720,1280,3)
154 100 (720,1280,3)
155 100 (720,1280,3)
156 100 (720,1280,3)
157 100 (720,1280,3)
158 100 (720,1280,3)
159 100 (720,1280,3)
160 100 (720,1280,3)
161 100 (720,1280,3)
162 100 (720,1280,3)
163 100 (720,1280,3)
164 100 (720,1280,3)
165 100 (720,1280,3)
166 100 (720,1280,3)
167 100 (720,1280,3)
168 100 (720,1280,3)
169 100 (720,1280,3)
170 100 (720,1280,3)
171 100 (720,1280,3)
172 100 (720,1280,3)
173 100 (720,1280,3)
174 100 (720,1280,3)
175 100 (720,1280,3)
176 100 (720,1280,3)
177 100 (720,1280,3)
178 100 (720,1280,3)
179 100 (720,1280,3)
180 100 (720,1280,3)
181 100 (720,1280,3)
182 100 (720,1280,3)
183 100 (720,1280,3)
184 100 (720,1280,3)
185 100 (720,1280,3)
186 100 (720,1280,3)
187 100 (720,1280,3)
188 100 (720,1280,3)
189 100 (720,1280,3)
190 100 (720,1280,3)
191 100 (720,1280,3)
192 100 (720,1280,3)
193 100 (720,1280,3)
194 100 (720,1280,3)
195 100 (720,1280,3)
196 100 (720,1280,3)
197 100 (720,1280,3)
198 100 (720,1280,3)
199 100 (720,1280,3)
200 100 (720,1280,3)
201 100 (720,1280,3)
202 100 (720,1280,3)
203 100 (720,1280,3)
204 100 (720,1280,3)
205 100 (720,1280,3)
206 100 (720,1280,3)
207 100 (720,1280,3)
208 100 (720,1280,3)
209 100 (720,1280,3)
210 100 (720,1280,3)
211 100 (720,1280,3)
212 100 (720,1280,3)
213 100 (720,1280,3)
214 100 (720,1280,3)
215 100 (720,1280,3)
216 100 (720,1280,3)
217 100 (720,1280,3)
218 100 (720,1280,3)
219 100 (720,1280,3)
220 100 (720,1280,3)
221 100 (720,1280,3)
222 100 (720,1280,3)
223 100 (720,1280,3)
224 100 (720,1280,3)
225 100 (720,1280,3)
226 100 (720,1280,3)
227 100 (720,1280,3)
228 100 (720,1280,3)
229 100 (720,1280,3)
230 100 (720,1280,3)
231 100 (720,1280,3)
232 100 (720,1280,3)
233 100 (720,1280,3)
234 100 (720,1280,3)
235 100 (720,1280,3)
236 100 (720,1280,3)
237 100 (720,1280,3)
238 100 (720,1280,3)
239 100 (720,1280,3)
240 100 (720,1280,3)
241 100 (720,1280,3)
242 100 (720,1280,3)
243 100 (720,1280,3)
244 100 (720,1280,3)
245 100 (720,1280,3)
246 100 (720,1280,3)
247 100 (720,1280,3)
248 100 (720,1280,3)
249 100 (720,1280,3)
250 100 (720,1280,3)
251 100 (720,1280,3)
252 100 (720,1280,3)
253 100 (720,1280,3)
254 100 (720,1280,3)
255 100 (720,1280,3)
256 100 (720,1280,3)
257 100 (720,1280,3)
258 100 (720,1280,3)
259 100 (720,1280,3)
260 100 (720,1280,3)
261 100 (720,1280,3)
262 100 (720,1280,3)
263 100 (720,1280,3)
264 100 (720,1280,3)
265 100 (720,1280,3)
266 100 (720,1280,3)
267 100 (720,1280,3)
268 100 (720,1280,3)
269 100 (720,1280,3)1234240 100 (720,1280,3)
241 100 (720,1280,3)
246 100 (720,1280,3)
257 100 (720,1280,3)123456789101112131415161718192021222324252627282930240 100 (720,1280,3)
241 100 (720,1280,3)
242 100 (720,1280,3)
243 100 (720,1280,3)
244 100 (720,1280,3)
245 100 (720,1280,3)
246 100 (720,1280,3)
247 100 (720,1280,3)
248 100 (720,1280,3)
249 100 (720,1280,3)
250 100 (720,1280,3)
251 100 (720,1280,3)
252 100 (720,1280,3)
253 100 (720,1280,3)
254 100 (720,1280,3)
255 100 (720,1280,3)
256 100 (720,1280,3)
257 100 (720,1280,3)
258 100 (720,1280,3)
259 100 (720,1280,3)
260 100 (720,1280,3)
261 100 (720,1280,3)
262 100 (720,1280,3)
263 100 (720,1280,3)
264 100 (720,1280,3)
265 100 (720,1280,3)
266 100 (720,1280,3)
267 100 (720,1280,3)
268 100 (720,1280,3)
269 100 (720,1280,3)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122500001/0625 7 (256,448,3)
00001/0632 7 (256,448,3)
00001/0807 7 (256,448,3)
00001/0832 7 (256,448,3)
00001/0834 7 (256,448,3)
00001/0836 7 (256,448,3)
00002/0004 7 (256,448,3)
00002/0112 7 (256,448,3)
00002/0116 7 (256,448,3)
00002/0123 7 (256,448,3)
00002/0455 7 (256,448,3)
00002/0602 7 (256,448,3)
00002/0976 7 (256,448,3)
00002/0980 7 (256,448,3)
00002/0983 7 (256,448,3)
00002/1000 7 (256,448,3)
00003/0022 7 (256,448,3)
00003/0031 7 (256,448,3)
00003/0035 7 (256,448,3)
00003/0041 7 (256,448,3)
00003/0073 7 (256,448,3)
00003/0107 7 (256,448,3)
00003/0111 7 (256,448,3)
00003/0114 7 (256,448,3)
00003/0117 7 (256,448,3)
00003/0121 7 (256,448,3)
00003/0499 7 (256,448,3)
00003/0501 7 (256,448,3)
00003/0507 7 (256,448,3)
00003/0510 7 (256,448,3)
00003/0517 7 (256,448,3)
00003/0522 7 (256,448,3)
00003/0531 7 (256,448,3)
00003/0533 7 (256,448,3)
00003/0534 7 (256,448,3)
00003/0682 7 (256,448,3)
00003/0687 7 (256,448,3)
00003/0715 7 (256,448,3)
00003/0742 7 (256,448,3)
00003/0751 7 (256,448,3)
00003/0984 7 (256,448,3)
00004/0042 7 (256,448,3)
00004/0165 7 (256,448,3)
00004/0321 7 (256,448,3)
00004/0569 7 (256,448,3)
00004/0572 7 (256,448,3)
00004/0619 7 (256,448,3)
00004/0776 7 (256,448,3)
00004/0780 7 (256,448,3)
00004/0825 7 (256,448,3)
00004/0832 7 (256,448,3)
00004/0853 7 (256,448,3)
00004/0876 7 (256,448,3)
00004/0888 7 (256,448,3)
00005/0015 7 (256,448,3)
00005/0021 7 (256,448,3)
00005/0022 7 (256,448,3)
00005/0024 7 (256,448,3)
00005/0026 7 (256,448,3)
00005/0394 7 (256,448,3)
00005/0403 7 (256,448,3)
00005/0531 7 (256,448,3)
00005/0546 7 (256,448,3)
00005/0554 7 (256,448,3)
00005/0694 7 (256,448,3)
00005/0700 7 (256,448,3)
00005/0740 7 (256,448,3)
00005/0826 7 (256,448,3)
00005/0832 7 (256,448,3)
00005/0834 7 (256,448,3)
00005/0943 7 (256,448,3)
00006/0184 7 (256,448,3)
00006/0205 7 (256,448,3)
00006/0206 7 (256,448,3)
00006/0211 7 (256,448,3)
00006/0271 7 (256,448,3)
00006/0273 7 (256,448,3)
00006/0277 7 (256,448,3)
00006/0283 7 (256,448,3)
00006/0287 7 (256,448,3)
00006/0298 7 (256,448,3)
00006/0310 7 (256,448,3)
00006/0356 7 (256,448,3)
00006/0357 7 (256,448,3)
00006/0544 7 (256,448,3)
00006/0565 7 (256,448,3)
00006/0569 7 (256,448,3)
00006/0573 7 (256,448,3)
00006/0592 7 (256,448,3)
00006/0613 7 (256,448,3)
00006/0633 7 (256,448,3)
00006/0637 7 (256,448,3)
00006/0646 7 (256,448,3)
00006/0649 7 (256,448,3)
00006/0655 7 (256,448,3)
00006/0658 7 (256,448,3)
00006/0662 7 (256,448,3)
00006/0666 7 (256,448,3)
00006/0673 7 (256,448,3)
00007/0248 7 (256,448,3)
00007/0253 7 (256,448,3)
00007/0430 7 (256,448,3)
00007/0434 7 (256,448,3)
00007/0436 7 (256,448,3)
00007/0452 7 (256,448,3)
00007/0464 7 (256,448,3)
00007/0470 7 (256,448,3)
00007/0472 7 (256,448,3)
00007/0483 7 (256,448,3)
00007/0484 7 (256,448,3)
00007/0493 7 (256,448,3)
00007/0508 7 (256,448,3)
00007/0514 7 (256,448,3)
00007/0697 7 (256,448,3)
00007/0698 7 (256,448,3)
00007/0744 7 (256,448,3)
00007/0775 7 (256,448,3)
00007/0786 7 (256,448,3)
00007/0790 7 (256,448,3)
00007/0800 7 (256,448,3)
00007/0833 7 (256,448,3)
00007/0867 7 (256,448,3)
00007/0879 7 (256,448,3)
00007/0899 7 (256,448,3)
00008/0251 7 (256,448,3)
00008/0322 7 (256,448,3)
00008/0971 7 (256,448,3)
00008/0976 7 (256,448,3)
00009/0016 7 (256,448,3)
00009/0036 7 (256,448,3)
00009/0037 7 (256,448,3)
00009/0609 7 (256,448,3)
00009/0812 7 (256,448,3)
00009/0821 7 (256,448,3)
00009/0947 7 (256,448,3)
00009/0952 7 (256,448,3)
00009/0955 7 (256,448,3)
00009/0970 7 (256,448,3)
00010/0072 7 (256,448,3)
00010/0074 7 (256,448,3)
00010/0079 7 (256,448,3)
00010/0085 7 (256,448,3)
00010/0139 7 (256,448,3)
00010/0140 7 (256,448,3)
00010/0183 7 (256,448,3)
00010/0200 7 (256,448,3)
00010/0223 7 (256,448,3)
00010/0305 7 (256,448,3)
00010/0323 7 (256,448,3)
00010/0338 7 (256,448,3)
00010/0342 7 (256,448,3)
00010/0350 7 (256,448,3)
00010/0356 7 (256,448,3)
00010/0362 7 (256,448,3)
00010/0366 7 (256,448,3)
00010/0375 7 (256,448,3)
00010/0404 7 (256,448,3)
00010/0407 7 (256,448,3)
00010/0414 7 (256,448,3)
00010/0418 7 (256,448,3)
00010/0429 7 (256,448,3)
00010/0557 7 (256,448,3)
00010/0564 7 (256,448,3)
00010/0733 7 (256,448,3)
00010/0935 7 (256,448,3)
00010/0939 7 (256,448,3)
00010/0943 7 (256,448,3)
00011/0242 7 (256,448,3)
00011/0259 7 (256,448,3)
00011/0263 7 (256,448,3)
00011/0266 7 (256,448,3)
00011/0278 7 (256,448,3)
00011/0890 7 (256,448,3)
00011/0894 7 (256,448,3)
00011/0903 7 (256,448,3)
00011/0906 7 (256,448,3)
00011/0913 7 (256,448,3)
00012/0011 7 (256,448,3)
00012/0014 7 (256,448,3)
00012/0126 7 (256,448,3)
00012/0127 7 (256,448,3)
00012/0526 7 (256,448,3)
00012/0551 7 (256,448,3)
00012/0896 7 (256,448,3)
00012/0910 7 (256,448,3)
00012/0915 7 (256,448,3)
00013/0167 7 (256,448,3)
00013/0794 7 (256,448,3)
00013/0807 7 (256,448,3)
00013/0846 7 (256,448,3)
00013/0882 7 (256,448,3)
00013/0889 7 (256,448,3)
00013/0910 7 (256,448,3)
00013/0913 7 (256,448,3)
00013/0924 7 (256,448,3)
00013/0931 7 (256,448,3)
00013/0944 7 (256,448,3)
00013/0955 7 (256,448,3)
00013/0962 7 (256,448,3)
00013/0969 7 (256,448,3)
00014/0012 7 (256,448,3)
00014/0025 7 (256,448,3)
00014/0473 7 (256,448,3)
00014/0499 7 (256,448,3)
00014/0524 7 (256,448,3)
00014/0739 7 (256,448,3)
00014/0753 7 (256,448,3)
00014/0771 7 (256,448,3)
00014/0832 7 (256,448,3)
00014/0836 7 (256,448,3)
00014/0838 7 (256,448,3)
00014/0839 7 (256,448,3)
00014/0843 7 (256,448,3)
00014/0846 7 (256,448,3)
00014/0849 7 (256,448,3)
00014/0859 7 (256,448,3)
00014/0880 7 (256,448,3)
00014/0906 7 (256,448,3)
00015/0030 7 (256,448,3)
00015/0067 7 (256,448,3)
00015/0084 7 (256,448,3)
00015/0190 7 (256,448,3)
00015/0575 7 (256,448,3)
00015/0784 7 (256,448,3)
00015/0855 7 (256,448,3)
00015/0904 7 (256,448,3)
00015/0914 7 (256,448,3)
00015/0936 7 (256,448,3)
00015/0939 7 (256,448,3)
00015/0943 7 (256,448,3)
00015/0957 7 (256,448,3)
00016/0131 7 (256,448,3)
00016/0173 7 (256,448,3)
00016/0320 7 (256,448,3)
00016/0328 7 (256,448,3)
00016/0334 7 (256,448,3)
00016/0338 7 (256,448,3)
00016/0339 7 (256,448,3)
00016/0345 7 (256,448,3)
00016/0365 7 (256,448,3)
00016/0584 7 (256,448,3)
00016/0634 7 (256,448,3)
00017/0342 7 (256,448,3)
00017/0346 7 (256,448,3)
00017/0350 7 (256,448,3)
00017/0766 7 (256,448,3)
00017/0786 7 (256,448,3)
00017/0911 7 (256,448,3)
00017/0914 7 (256,448,3)
00018/0217 7 (256,448,3)
00018/0258 7 (256,448,3)
00018/0307 7 (256,448,3)
00018/0480 7 (256,448,3)
00018/0491 7 (256,448,3)
00018/0994 7 (256,448,3)
00018/0995 7 (256,448,3)
00018/0997 7 (256,448,3)
00018/1000 7 (256,448,3)
00019/0007 7 (256,448,3)
00019/0016 7 (256,448,3)
00019/0026 7 (256,448,3)
00019/0030 7 (256,448,3)
00019/0086 7 (256,448,3)
00019/0089 7 (256,448,3)
00019/0111 7 (256,448,3)
00019/0285 7 (256,448,3)
00019/0415 7 (256,448,3)
00019/0434 7 (256,448,3)
00019/0437 7 (256,448,3)
00019/0568 7 (256,448,3)
00019/0570 7 (256,448,3)
00019/0591 7 (256,448,3)
00019/0596 7 (256,448,3)
00019/0603 7 (256,448,3)
00019/0607 7 (256,448,3)
00019/0637 7 (256,448,3)
00019/0644 7 (256,448,3)
00019/0647 7 (256,448,3)
00019/0787 7 (256,448,3)
00019/0993 7 (256,448,3)
00019/0998 7 (256,448,3)
00021/0232 7 (256,448,3)
00021/0255 7 (256,448,3)
00021/0646 7 (256,448,3)
00021/0653 7 (256,448,3)
00021/0657 7 (256,448,3)
00021/0668 7 (256,448,3)
00021/0672 7 (256,448,3)
00021/0725 7 (256,448,3)
00021/0750 7 (256,448,3)
00021/0764 7 (256,448,3)
00021/0821 7 (256,448,3)
00022/0192 7 (256,448,3)
00022/0391 7 (256,448,3)
00022/0514 7 (256,448,3)
00022/0567 7 (256,448,3)
00022/0674 7 (256,448,3)
00022/0686 7 (256,448,3)
00022/0700 7 (256,448,3)
00023/0020 7 (256,448,3)
00023/0024 7 (256,448,3)
00023/0025 7 (256,448,3)
00023/0042 7 (256,448,3)
00023/0050 7 (256,448,3)
00023/0094 7 (256,448,3)
00023/0107 7 (256,448,3)
00023/0635 7 (256,448,3)
00023/0698 7 (256,448,3)
00023/0774 7 (256,448,3)
00023/0795 7 (256,448,3)
00023/0821 7 (256,448,3)
00023/0839 7 (256,448,3)
00023/0846 7 (256,448,3)
00023/0869 7 (256,448,3)
00023/0879 7 (256,448,3)
00023/0887 7 (256,448,3)
00023/0899 7 (256,448,3)
00023/0910 7 (256,448,3)
00023/0920 7 (256,448,3)
00023/0929 7 (256,448,3)
00023/0941 7 (256,448,3)
00023/0942 7 (256,448,3)
00023/0952 7 (256,448,3)
00024/0066 7 (256,448,3)
00024/0072 7 (256,448,3)
00024/0080 7 (256,448,3)
00024/0093 7 (256,448,3)
00024/0107 7 (256,448,3)
00024/0262 7 (256,448,3)
00024/0283 7 (256,448,3)
00024/0294 7 (256,448,3)
00024/0296 7 (256,448,3)
00024/0304 7 (256,448,3)
00024/0315 7 (256,448,3)
00024/0322 7 (256,448,3)
00024/0648 7 (256,448,3)
00024/0738 7 (256,448,3)
00024/0743 7 (256,448,3)
00025/0542 7 (256,448,3)
00025/0769 7 (256,448,3)
00025/0984 7 (256,448,3)
00025/0985 7 (256,448,3)
00025/0989 7 (256,448,3)
00025/0991 7 (256,448,3)
00026/0009 7 (256,448,3)
00026/0013 7 (256,448,3)
00026/0020 7 (256,448,3)
00026/0021 7 (256,448,3)
00026/0025 7 (256,448,3)
00026/0135 7 (256,448,3)
00026/0200 7 (256,448,3)
00026/0297 7 (256,448,3)
00026/0306 7 (256,448,3)
00026/0444 7 (256,448,3)
00026/0450 7 (256,448,3)
00026/0453 7 (256,448,3)
00026/0464 7 (256,448,3)
00026/0486 7 (256,448,3)
00026/0773 7 (256,448,3)
00026/0785 7 (256,448,3)
00026/0836 7 (256,448,3)
00026/0838 7 (256,448,3)
00026/0848 7 (256,448,3)
00026/0885 7 (256,448,3)
00026/0893 7 (256,448,3)
00026/0939 7 (256,448,3)
00026/0942 7 (256,448,3)
00027/0092 7 (256,448,3)
00027/0112 7 (256,448,3)
00027/0115 7 (256,448,3)
00027/0143 7 (256,448,3)
00027/0175 7 (256,448,3)
00027/0179 7 (256,448,3)
00027/0183 7 (256,448,3)
00027/0197 7 (256,448,3)
00027/0199 7 (256,448,3)
00027/0300 7 (256,448,3)
00028/0015 7 (256,448,3)
00028/0032 7 (256,448,3)
00028/0048 7 (256,448,3)
00028/0068 7 (256,448,3)
00028/0219 7 (256,448,3)
00028/0606 7 (256,448,3)
00028/0626 7 (256,448,3)
00028/0748 7 (256,448,3)
00028/0764 7 (256,448,3)
00028/0772 7 (256,448,3)
00028/0780 7 (256,448,3)
00028/0926 7 (256,448,3)
00028/0947 7 (256,448,3)
00028/0962 7 (256,448,3)
00029/0085 7 (256,448,3)
00029/0281 7 (256,448,3)
00029/0284 7 (256,448,3)
00029/0288 7 (256,448,3)
00029/0294 7 (256,448,3)
00029/0364 7 (256,448,3)
00029/0369 7 (256,448,3)
00029/0421 7 (256,448,3)
00029/0425 7 (256,448,3)
00029/0550 7 (256,448,3)
00030/0014 7 (256,448,3)
00030/0101 7 (256,448,3)
00030/0143 7 (256,448,3)
00030/0351 7 (256,448,3)
00030/0356 7 (256,448,3)
00030/0371 7 (256,448,3)
00030/0484 7 (256,448,3)
00030/0492 7 (256,448,3)
00030/0503 7 (256,448,3)
00030/0682 7 (256,448,3)
00030/0696 7 (256,448,3)
00030/0735 7 (256,448,3)
00030/0737 7 (256,448,3)
00030/0868 7 (256,448,3)
00031/0161 7 (256,448,3)
00031/0180 7 (256,448,3)
00031/0194 7 (256,448,3)
00031/0253 7 (256,448,3)
00031/0293 7 (256,448,3)
00031/0466 7 (256,448,3)
00031/0477 7 (256,448,3)
00031/0549 7 (256,448,3)
00031/0600 7 (256,448,3)
00031/0617 7 (256,448,3)
00031/0649 7 (256,448,3)
00032/0015 7 (256,448,3)
00032/0020 7 (256,448,3)
00032/0023 7 (256,448,3)
00032/0048 7 (256,448,3)
00032/0056 7 (256,448,3)
00032/0872 7 (256,448,3)
00033/0069 7 (256,448,3)
00033/0073 7 (256,448,3)
00033/0078 7 (256,448,3)
00033/0079 7 (256,448,3)
00033/0086 7 (256,448,3)
00033/0088 7 (256,448,3)
00033/0091 7 (256,448,3)
00033/0096 7 (256,448,3)
00033/0607 7 (256,448,3)
00033/0613 7 (256,448,3)
00033/0616 7 (256,448,3)
00033/0619 7 (256,448,3)
00033/0626 7 (256,448,3)
00033/0628 7 (256,448,3)
00033/0637 7 (256,448,3)
00033/0686 7 (256,448,3)
00033/0842 7 (256,448,3)
00034/0261 7 (256,448,3)
00034/0265 7 (256,448,3)
00034/0269 7 (256,448,3)
00034/0275 7 (256,448,3)
00034/0286 7 (256,448,3)
00034/0294 7 (256,448,3)
00034/0431 7 (256,448,3)
00034/0577 7 (256,448,3)
00034/0685 7 (256,448,3)
00034/0687 7 (256,448,3)
00034/0703 7 (256,448,3)
00034/0715 7 (256,448,3)
00034/0935 7 (256,448,3)
00034/0943 7 (256,448,3)
00034/0963 7 (256,448,3)
00034/0979 7 (256,448,3)
00034/0990 7 (256,448,3)
00035/0129 7 (256,448,3)
00035/0153 7 (256,448,3)
00035/0156 7 (256,448,3)
00035/0474 7 (256,448,3)
00035/0507 7 (256,448,3)
00035/0532 7 (256,448,3)
00035/0560 7 (256,448,3)
00035/0572 7 (256,448,3)
00035/0587 7 (256,448,3)
00035/0588 7 (256,448,3)
00035/0640 7 (256,448,3)
00035/0654 7 (256,448,3)
00035/0655 7 (256,448,3)
00035/0737 7 (256,448,3)
00035/0843 7 (256,448,3)
00035/0932 7 (256,448,3)
00035/0957 7 (256,448,3)
00036/0029 7 (256,448,3)
00036/0266 7 (256,448,3)
00036/0276 7 (256,448,3)
00036/0310 7 (256,448,3)
00036/0314 7 (256,448,3)
00036/0320 7 (256,448,3)
00036/0333 7 (256,448,3)
00036/0348 7 (256,448,3)
00036/0357 7 (256,448,3)
00036/0360 7 (256,448,3)
00036/0368 7 (256,448,3)
00036/0371 7 (256,448,3)
00036/0378 7 (256,448,3)
00036/0391 7 (256,448,3)
00036/0440 7 (256,448,3)
00036/0731 7 (256,448,3)
00036/0733 7 (256,448,3)
00036/0741 7 (256,448,3)
00036/0743 7 (256,448,3)
00036/0927 7 (256,448,3)
00036/0931 7 (256,448,3)
00036/0933 7 (256,448,3)
00036/0938 7 (256,448,3)
00036/0944 7 (256,448,3)
00036/0946 7 (256,448,3)
00036/0951 7 (256,448,3)
00036/0953 7 (256,448,3)
00036/0963 7 (256,448,3)
00036/0964 7 (256,448,3)
00036/0981 7 (256,448,3)
00036/0991 7 (256,448,3)
00037/0072 7 (256,448,3)
00037/0079 7 (256,448,3)
00037/0132 7 (256,448,3)
00037/0135 7 (256,448,3)
00037/0137 7 (256,448,3)
00037/0141 7 (256,448,3)
00037/0229 7 (256,448,3)
00037/0234 7 (256,448,3)
00037/0239 7 (256,448,3)
00037/0242 7 (256,448,3)
00037/0254 7 (256,448,3)
00037/0269 7 (256,448,3)
00037/0276 7 (256,448,3)
00037/0279 7 (256,448,3)
00037/0286 7 (256,448,3)
00037/0345 7 (256,448,3)
00037/0449 7 (256,448,3)
00037/0450 7 (256,448,3)
00037/0820 7 (256,448,3)
00037/0824 7 (256,448,3)
00037/0859 7 (256,448,3)
00037/0899 7 (256,448,3)
00037/0906 7 (256,448,3)
00038/0535 7 (256,448,3)
00038/0572 7 (256,448,3)
00038/0675 7 (256,448,3)
00038/0731 7 (256,448,3)
00038/0732 7 (256,448,3)
00038/0744 7 (256,448,3)
00038/0755 7 (256,448,3)
00039/0002 7 (256,448,3)
00039/0013 7 (256,448,3)
00039/0247 7 (256,448,3)
00039/0489 7 (256,448,3)
00039/0504 7 (256,448,3)
00039/0558 7 (256,448,3)
00039/0686 7 (256,448,3)
00039/0727 7 (256,448,3)
00039/0769 7 (256,448,3)
00040/0081 7 (256,448,3)
00040/0082 7 (256,448,3)
00040/0402 7 (256,448,3)
00040/0407 7 (256,448,3)
00040/0408 7 (256,448,3)
00040/0410 7 (256,448,3)
00040/0411 7 (256,448,3)
00040/0412 7 (256,448,3)
00040/0413 7 (256,448,3)
00040/0415 7 (256,448,3)
00040/0421 7 (256,448,3)
00040/0422 7 (256,448,3)
00040/0426 7 (256,448,3)
00040/0438 7 (256,448,3)
00040/0439 7 (256,448,3)
00040/0440 7 (256,448,3)
00040/0443 7 (256,448,3)
00040/0457 7 (256,448,3)
00040/0459 7 (256,448,3)
00040/0725 7 (256,448,3)
00040/0727 7 (256,448,3)
00040/0936 7 (256,448,3)
00040/0959 7 (256,448,3)
00040/0964 7 (256,448,3)
00040/0968 7 (256,448,3)
00040/0974 7 (256,448,3)
00040/0978 7 (256,448,3)
00040/0979 7 (256,448,3)
00040/0989 7 (256,448,3)
00040/0993 7 (256,448,3)
00040/0994 7 (256,448,3)
00040/0997 7 (256,448,3)
00041/0001 7 (256,448,3)
00041/0007 7 (256,448,3)
00041/0019 7 (256,448,3)
00041/0040 7 (256,448,3)
00041/0350 7 (256,448,3)
00041/0357 7 (256,448,3)
00041/0393 7 (256,448,3)
00041/0890 7 (256,448,3)
00041/0909 7 (256,448,3)
00041/0915 7 (256,448,3)
00041/0933 7 (256,448,3)
00042/0017 7 (256,448,3)
00042/0332 7 (256,448,3)
00042/0346 7 (256,448,3)
00042/0350 7 (256,448,3)
00042/0356 7 (256,448,3)
00042/0382 7 (256,448,3)
00042/0389 7 (256,448,3)
00042/0539 7 (256,448,3)
00042/0546 7 (256,448,3)
00042/0550 7 (256,448,3)
00042/0553 7 (256,448,3)
00042/0555 7 (256,448,3)
00042/0560 7 (256,448,3)
00042/0570 7 (256,448,3)
00043/0119 7 (256,448,3)
00043/0122 7 (256,448,3)
00043/0168 7 (256,448,3)
00043/0274 7 (256,448,3)
00043/0304 7 (256,448,3)
00043/0731 7 (256,448,3)
00043/0735 7 (256,448,3)
00043/0739 7 (256,448,3)
00043/0740 7 (256,448,3)
00044/0212 7 (256,448,3)
00044/0432 7 (256,448,3)
00044/0934 7 (256,448,3)
00044/0940 7 (256,448,3)
00044/0987 7 (256,448,3)
00045/0004 7 (256,448,3)
00045/0009 7 (256,448,3)
00045/0011 7 (256,448,3)
00045/0019 7 (256,448,3)
00045/0023 7 (256,448,3)
00045/0289 7 (256,448,3)
00045/0760 7 (256,448,3)
00045/0779 7 (256,448,3)
00045/0816 7 (256,448,3)
00045/0820 7 (256,448,3)
00046/0132 7 (256,448,3)
00046/0350 7 (256,448,3)
00046/0356 7 (256,448,3)
00046/0357 7 (256,448,3)
00046/0379 7 (256,448,3)
00046/0410 7 (256,448,3)
00046/0412 7 (256,448,3)
00046/0481 7 (256,448,3)
00046/0497 7 (256,448,3)
00046/0510 7 (256,448,3)
00046/0515 7 (256,448,3)
00046/0529 7 (256,448,3)
00046/0544 7 (256,448,3)
00046/0545 7 (256,448,3)
00046/0552 7 (256,448,3)
00046/0559 7 (256,448,3)
00046/0589 7 (256,448,3)
00046/0642 7 (256,448,3)
00046/0724 7 (256,448,3)
00046/0758 7 (256,448,3)
00046/0930 7 (256,448,3)
00046/0953 7 (256,448,3)
00047/0013 7 (256,448,3)
00047/0014 7 (256,448,3)
00047/0017 7 (256,448,3)
00047/0076 7 (256,448,3)
00047/0151 7 (256,448,3)
00047/0797 7 (256,448,3)
00048/0014 7 (256,448,3)
00048/0021 7 (256,448,3)
00048/0026 7 (256,448,3)
00048/0030 7 (256,448,3)
00048/0039 7 (256,448,3)
00048/0045 7 (256,448,3)
00048/0049 7 (256,448,3)
00048/0145 7 (256,448,3)
00048/0188 7 (256,448,3)
00048/0302 7 (256,448,3)
00048/0361 7 (256,448,3)
00048/0664 7 (256,448,3)
00048/0672 7 (256,448,3)
00048/0681 7 (256,448,3)
00048/0689 7 (256,448,3)
00048/0690 7 (256,448,3)
00048/0691 7 (256,448,3)
00048/0711 7 (256,448,3)
00049/0085 7 (256,448,3)
00049/0810 7 (256,448,3)
00049/0858 7 (256,448,3)
00049/0865 7 (256,448,3)
00049/0871 7 (256,448,3)
00049/0903 7 (256,448,3)
00049/0928 7 (256,448,3)
00050/0092 7 (256,448,3)
00050/0101 7 (256,448,3)
00050/0108 7 (256,448,3)
00050/0112 7 (256,448,3)
00050/0120 7 (256,448,3)
00050/0128 7 (256,448,3)
00050/0383 7 (256,448,3)
00050/0395 7 (256,448,3)
00050/0405 7 (256,448,3)
00050/0632 7 (256,448,3)
00050/0648 7 (256,448,3)
00050/0649 7 (256,448,3)
00050/0659 7 (256,448,3)
00050/0699 7 (256,448,3)
00050/0708 7 (256,448,3)
00050/0716 7 (256,448,3)
00050/0758 7 (256,448,3)
00050/0761 7 (256,448,3)
00051/0572 7 (256,448,3)
00052/0163 7 (256,448,3)
00052/0242 7 (256,448,3)
00052/0260 7 (256,448,3)
00052/0322 7 (256,448,3)
00052/0333 7 (256,448,3)
00052/0806 7 (256,448,3)
00052/0813 7 (256,448,3)
00052/0821 7 (256,448,3)
00052/0830 7 (256,448,3)
00052/0914 7 (256,448,3)
00052/0923 7 (256,448,3)
00052/0959 7 (256,448,3)
00053/0288 7 (256,448,3)
00053/0290 7 (256,448,3)
00053/0323 7 (256,448,3)
00053/0337 7 (256,448,3)
00053/0340 7 (256,448,3)
00053/0437 7 (256,448,3)
00053/0595 7 (256,448,3)
00053/0739 7 (256,448,3)
00053/0761 7 (256,448,3)
00054/0014 7 (256,448,3)
00054/0017 7 (256,448,3)
00054/0178 7 (256,448,3)
00054/0183 7 (256,448,3)
00054/0196 7 (256,448,3)
00054/0205 7 (256,448,3)
00054/0214 7 (256,448,3)
00054/0289 7 (256,448,3)
00054/0453 7 (256,448,3)
00054/0498 7 (256,448,3)
00054/0502 7 (256,448,3)
00054/0514 7 (256,448,3)
00054/0773 7 (256,448,3)
00055/0001 7 (256,448,3)
00055/0115 7 (256,448,3)
00055/0118 7 (256,448,3)
00055/0171 7 (256,448,3)
00055/0214 7 (256,448,3)
00055/0354 7 (256,448,3)
00055/0449 7 (256,448,3)
00055/0473 7 (256,448,3)
00055/0649 7 (256,448,3)
00055/0800 7 (256,448,3)
00055/0803 7 (256,448,3)
00055/0990 7 (256,448,3)
00056/0041 7 (256,448,3)
00056/0120 7 (256,448,3)
00056/0293 7 (256,448,3)
00056/0357 7 (256,448,3)
00056/0506 7 (256,448,3)
00056/0561 7 (256,448,3)
00056/0567 7 (256,448,3)
00056/0575 7 (256,448,3)
00057/0175 7 (256,448,3)
00057/0495 7 (256,448,3)
00057/0498 7 (256,448,3)
00057/0506 7 (256,448,3)
00057/0612 7 (256,448,3)
00057/0620 7 (256,448,3)
00057/0623 7 (256,448,3)
00057/0635 7 (256,448,3)
00057/0773 7 (256,448,3)
00057/0778 7 (256,448,3)
00057/0867 7 (256,448,3)
00057/0976 7 (256,448,3)
00057/0980 7 (256,448,3)
00057/0985 7 (256,448,3)
00057/0992 7 (256,448,3)
00058/0009 7 (256,448,3)
00058/0076 7 (256,448,3)
00058/0078 7 (256,448,3)
00058/0279 7 (256,448,3)
00058/0283 7 (256,448,3)
00058/0286 7 (256,448,3)
00058/0350 7 (256,448,3)
00058/0380 7 (256,448,3)
00061/0132 7 (256,448,3)
00061/0141 7 (256,448,3)
00061/0156 7 (256,448,3)
00061/0159 7 (256,448,3)
00061/0168 7 (256,448,3)
00061/0170 7 (256,448,3)
00061/0186 7 (256,448,3)
00061/0219 7 (256,448,3)
00061/0227 7 (256,448,3)
00061/0238 7 (256,448,3)
00061/0256 7 (256,448,3)
00061/0303 7 (256,448,3)
00061/0312 7 (256,448,3)
00061/0313 7 (256,448,3)
00061/0325 7 (256,448,3)
00061/0367 7 (256,448,3)
00061/0369 7 (256,448,3)
00061/0387 7 (256,448,3)
00061/0396 7 (256,448,3)
00061/0486 7 (256,448,3)
00061/0895 7 (256,448,3)
00061/0897 7 (256,448,3)
00062/0846 7 (256,448,3)
00063/0156 7 (256,448,3)
00063/0184 7 (256,448,3)
00063/0191 7 (256,448,3)
00063/0334 7 (256,448,3)
00063/0350 7 (256,448,3)
00063/0499 7 (256,448,3)
00063/0878 7 (256,448,3)
00064/0004 7 (256,448,3)
00064/0264 7 (256,448,3)
00064/0735 7 (256,448,3)
00064/0738 7 (256,448,3)
00065/0105 7 (256,448,3)
00065/0169 7 (256,448,3)
00065/0305 7 (256,448,3)
00065/0324 7 (256,448,3)
00065/0353 7 (256,448,3)
00065/0520 7 (256,448,3)
00065/0533 7 (256,448,3)
00065/0545 7 (256,448,3)
00065/0551 7 (256,448,3)
00065/0568 7 (256,448,3)
00065/0603 7 (256,448,3)
00065/0884 7 (256,448,3)
00065/0988 7 (256,448,3)
00066/0002 7 (256,448,3)
00066/0011 7 (256,448,3)
00066/0031 7 (256,448,3)
00066/0037 7 (256,448,3)
00066/0136 7 (256,448,3)
00066/0137 7 (256,448,3)
00066/0150 7 (256,448,3)
00066/0166 7 (256,448,3)
00066/0178 7 (256,448,3)
00066/0357 7 (256,448,3)
00066/0428 7 (256,448,3)
00066/0483 7 (256,448,3)
00066/0600 7 (256,448,3)
00066/0863 7 (256,448,3)
00066/0873 7 (256,448,3)
00066/0875 7 (256,448,3)
00066/0899 7 (256,448,3)
00067/0020 7 (256,448,3)
00067/0025 7 (256,448,3)
00067/0132 7 (256,448,3)
00067/0492 7 (256,448,3)
00067/0726 7 (256,448,3)
00067/0734 7 (256,448,3)
00067/0744 7 (256,448,3)
00067/0754 7 (256,448,3)
00067/0779 7 (256,448,3)
00068/0078 7 (256,448,3)
00068/0083 7 (256,448,3)
00068/0113 7 (256,448,3)
00068/0117 7 (256,448,3)
00068/0121 7 (256,448,3)
00068/0206 7 (256,448,3)
00068/0261 7 (256,448,3)
00068/0321 7 (256,448,3)
00068/0354 7 (256,448,3)
00068/0380 7 (256,448,3)
00068/0419 7 (256,448,3)
00068/0547 7 (256,448,3)
00068/0561 7 (256,448,3)
00068/0565 7 (256,448,3)
00068/0583 7 (256,448,3)
00068/0599 7 (256,448,3)
00068/0739 7 (256,448,3)
00068/0743 7 (256,448,3)
00068/0754 7 (256,448,3)
00068/0812 7 (256,448,3)
00069/0178 7 (256,448,3)
00070/0025 7 (256,448,3)
00070/0030 7 (256,448,3)
00070/0036 7 (256,448,3)
00070/0042 7 (256,448,3)
00070/0078 7 (256,448,3)
00070/0079 7 (256,448,3)
00070/0362 7 (256,448,3)
00071/0195 7 (256,448,3)
00071/0210 7 (256,448,3)
00071/0211 7 (256,448,3)
00071/0221 7 (256,448,3)
00071/0352 7 (256,448,3)
00071/0354 7 (256,448,3)
00071/0366 7 (256,448,3)
00071/0454 7 (256,448,3)
00071/0464 7 (256,448,3)
00071/0487 7 (256,448,3)
00071/0502 7 (256,448,3)
00071/0561 7 (256,448,3)
00071/0676 7 (256,448,3)
00071/0808 7 (256,448,3)
00071/0813 7 (256,448,3)
00071/0836 7 (256,448,3)
00072/0286 7 (256,448,3)
00072/0290 7 (256,448,3)
00072/0298 7 (256,448,3)
00072/0302 7 (256,448,3)
00072/0333 7 (256,448,3)
00072/0590 7 (256,448,3)
00072/0793 7 (256,448,3)
00072/0803 7 (256,448,3)
00072/0833 7 (256,448,3)
00073/0049 7 (256,448,3)
00073/0050 7 (256,448,3)
00073/0388 7 (256,448,3)
00073/0480 7 (256,448,3)
00073/0485 7 (256,448,3)
00073/0611 7 (256,448,3)
00073/0616 7 (256,448,3)
00073/0714 7 (256,448,3)
00073/0724 7 (256,448,3)
00073/0730 7 (256,448,3)
00074/0034 7 (256,448,3)
00074/0228 7 (256,448,3)
00074/0239 7 (256,448,3)
00074/0275 7 (256,448,3)
00074/0527 7 (256,448,3)
00074/0620 7 (256,448,3)
00074/0764 7 (256,448,3)
00074/0849 7 (256,448,3)
00074/0893 7 (256,448,3)
00075/0333 7 (256,448,3)
00075/0339 7 (256,448,3)
00075/0347 7 (256,448,3)
00075/0399 7 (256,448,3)
00075/0478 7 (256,448,3)
00075/0494 7 (256,448,3)
00075/0678 7 (256,448,3)
00075/0688 7 (256,448,3)
00075/0706 7 (256,448,3)
00075/0709 7 (256,448,3)
00075/0748 7 (256,448,3)
00075/0769 7 (256,448,3)
00075/0777 7 (256,448,3)
00075/0781 7 (256,448,3)
00076/0151 7 (256,448,3)
00076/0159 7 (256,448,3)
00076/0164 7 (256,448,3)
00076/0265 7 (256,448,3)
00076/0269 7 (256,448,3)
00076/0433 7 (256,448,3)
00076/0813 7 (256,448,3)
00076/0817 7 (256,448,3)
00076/0818 7 (256,448,3)
00076/0827 7 (256,448,3)
00076/0874 7 (256,448,3)
00076/0880 7 (256,448,3)
00076/0891 7 (256,448,3)
00076/0894 7 (256,448,3)
00076/0909 7 (256,448,3)
00076/0913 7 (256,448,3)
00076/0926 7 (256,448,3)
00076/0962 7 (256,448,3)
00076/0973 7 (256,448,3)
00076/0986 7 (256,448,3)
00077/0617 7 (256,448,3)
00077/0623 7 (256,448,3)
00077/0628 7 (256,448,3)
00077/0629 7 (256,448,3)
00077/0631 7 (256,448,3)
00077/0639 7 (256,448,3)
00077/0982 7 (256,448,3)
00077/0984 7 (256,448,3)
00077/0995 7 (256,448,3)
00077/0998 7 (256,448,3)
00078/0001 7 (256,448,3)
00078/0015 7 (256,448,3)
00078/0157 7 (256,448,3)
00078/0161 7 (256,448,3)
00078/0175 7 (256,448,3)
00078/0178 7 (256,448,3)
00078/0189 7 (256,448,3)
00078/0192 7 (256,448,3)
00078/0229 7 (256,448,3)
00078/0237 7 (256,448,3)
00078/0241 7 (256,448,3)
00078/0249 7 (256,448,3)
00078/0251 7 (256,448,3)
00078/0254 7 (256,448,3)
00078/0258 7 (256,448,3)
00078/0311 7 (256,448,3)
00078/0603 7 (256,448,3)
00078/0607 7 (256,448,3)
00078/0824 7 (256,448,3)
00079/0045 7 (256,448,3)
00079/0048 7 (256,448,3)
00079/0054 7 (256,448,3)
00080/0050 7 (256,448,3)
00080/0488 7 (256,448,3)
00080/0494 7 (256,448,3)
00080/0496 7 (256,448,3)
00080/0499 7 (256,448,3)
00080/0502 7 (256,448,3)
00080/0510 7 (256,448,3)
00080/0534 7 (256,448,3)
00080/0558 7 (256,448,3)
00080/0571 7 (256,448,3)
00080/0709 7 (256,448,3)
00080/0882 7 (256,448,3)
00081/0322 7 (256,448,3)
00081/0428 7 (256,448,3)
00081/0700 7 (256,448,3)
00081/0706 7 (256,448,3)
00081/0707 7 (256,448,3)
00081/0937 7 (256,448,3)
00082/0021 7 (256,448,3)
00082/0424 7 (256,448,3)
00082/0794 7 (256,448,3)
00082/0807 7 (256,448,3)
00082/0810 7 (256,448,3)
00082/0824 7 (256,448,3)
00083/0129 7 (256,448,3)
00083/0131 7 (256,448,3)
00083/0249 7 (256,448,3)
00083/0250 7 (256,448,3)
00083/0656 7 (256,448,3)
00083/0812 7 (256,448,3)
00083/0819 7 (256,448,3)
00083/0824 7 (256,448,3)
00083/0827 7 (256,448,3)
00083/0841 7 (256,448,3)
00083/0963 7 (256,448,3)
00084/0047 7 (256,448,3)
00084/0319 7 (256,448,3)
00084/0334 7 (256,448,3)
00084/0363 7 (256,448,3)
00084/0493 7 (256,448,3)
00084/0655 7 (256,448,3)
00084/0752 7 (256,448,3)
00084/0813 7 (256,448,3)
00084/0886 7 (256,448,3)
00084/0948 7 (256,448,3)
00084/0976 7 (256,448,3)
00085/0512 7 (256,448,3)
00085/0641 7 (256,448,3)
00085/0653 7 (256,448,3)
00085/0655 7 (256,448,3)
00085/0697 7 (256,448,3)
00085/0698 7 (256,448,3)
00085/0700 7 (256,448,3)
00085/0703 7 (256,448,3)
00085/0705 7 (256,448,3)
00085/0709 7 (256,448,3)
00085/0713 7 (256,448,3)
00085/0739 7 (256,448,3)
00085/0750 7 (256,448,3)
00085/0763 7 (256,448,3)
00085/0765 7 (256,448,3)
00085/0769 7 (256,448,3)
00085/0863 7 (256,448,3)
00085/0868 7 (256,448,3)
00085/0927 7 (256,448,3)
00085/0936 7 (256,448,3)
00085/0965 7 (256,448,3)
00085/0969 7 (256,448,3)
00085/0974 7 (256,448,3)
00085/0981 7 (256,448,3)
00085/0982 7 (256,448,3)
00085/1000 7 (256,448,3)
00086/0003 7 (256,448,3)
00086/0009 7 (256,448,3)
00086/0011 7 (256,448,3)
00086/0028 7 (256,448,3)
00086/0032 7 (256,448,3)
00086/0034 7 (256,448,3)
00086/0035 7 (256,448,3)
00086/0042 7 (256,448,3)
00086/0064 7 (256,448,3)
00086/0066 7 (256,448,3)
00086/0095 7 (256,448,3)
00086/0099 7 (256,448,3)
00086/0101 7 (256,448,3)
00086/0104 7 (256,448,3)
00086/0115 7 (256,448,3)
00086/0116 7 (256,448,3)
00086/0284 7 (256,448,3)
00086/0291 7 (256,448,3)
00086/0295 7 (256,448,3)
00086/0302 7 (256,448,3)
00086/0318 7 (256,448,3)
00086/0666 7 (256,448,3)
00086/0797 7 (256,448,3)
00086/0851 7 (256,448,3)
00086/0855 7 (256,448,3)
00086/0874 7 (256,448,3)
00086/0878 7 (256,448,3)
00086/0881 7 (256,448,3)
00086/0883 7 (256,448,3)
00086/0896 7 (256,448,3)
00086/0899 7 (256,448,3)
00086/0903 7 (256,448,3)
00086/0989 7 (256,448,3)
00087/0008 7 (256,448,3)
00087/0429 7 (256,448,3)
00087/0511 7 (256,448,3)
00088/0241 7 (256,448,3)
00088/0319 7 (256,448,3)
00088/0323 7 (256,448,3)
00088/0411 7 (256,448,3)
00088/0427 7 (256,448,3)
00088/0452 7 (256,448,3)
00088/0463 7 (256,448,3)
00088/0476 7 (256,448,3)
00088/0496 7 (256,448,3)
00088/0559 7 (256,448,3)
00089/0058 7 (256,448,3)
00089/0061 7 (256,448,3)
00089/0069 7 (256,448,3)
00089/0077 7 (256,448,3)
00089/0096 7 (256,448,3)
00089/0099 7 (256,448,3)
00089/0100 7 (256,448,3)
00089/0211 7 (256,448,3)
00089/0380 7 (256,448,3)
00089/0381 7 (256,448,3)
00089/0384 7 (256,448,3)
00089/0390 7 (256,448,3)
00089/0393 7 (256,448,3)
00089/0394 7 (256,448,3)
00089/0395 7 (256,448,3)
00089/0406 7 (256,448,3)
00089/0410 7 (256,448,3)
00089/0412 7 (256,448,3)
00089/0703 7 (256,448,3)
00089/0729 7 (256,448,3)
00089/0930 7 (256,448,3)
00089/0952 7 (256,448,3)
00090/0062 7 (256,448,3)
00090/0101 7 (256,448,3)
00090/0213 7 (256,448,3)
00090/0216 7 (256,448,3)
00090/0268 7 (256,448,3)
00090/0406 7 (256,448,3)
00090/0411 7 (256,448,3)
00090/0442 7 (256,448,3)
00090/0535 7 (256,448,3)
00090/0542 7 (256,448,3)
00090/0571 7 (256,448,3)
00090/0934 7 (256,448,3)
00090/0938 7 (256,448,3)
00090/0947 7 (256,448,3)
00091/0066 7 (256,448,3)
00091/0448 7 (256,448,3)
00091/0451 7 (256,448,3)
00091/0454 7 (256,448,3)
00091/0457 7 (256,448,3)
00091/0467 7 (256,448,3)
00091/0470 7 (256,448,3)
00091/0477 7 (256,448,3)
00091/0583 7 (256,448,3)
00091/0981 7 (256,448,3)
00091/0994 7 (256,448,3)
00092/0112 7 (256,448,3)
00092/0119 7 (256,448,3)
00092/0129 7 (256,448,3)
00092/0146 7 (256,448,3)
00092/0149 7 (256,448,3)
00092/0608 7 (256,448,3)
00092/0643 7 (256,448,3)
00092/0646 7 (256,448,3)
00092/0766 7 (256,448,3)
00092/0768 7 (256,448,3)
00092/0779 7 (256,448,3)
00093/0081 7 (256,448,3)
00093/0085 7 (256,448,3)
00093/0135 7 (256,448,3)
00093/0241 7 (256,448,3)
00093/0277 7 (256,448,3)
00093/0283 7 (256,448,3)
00093/0320 7 (256,448,3)
00093/0598 7 (256,448,3)
00094/0159 7 (256,448,3)
00094/0253 7 (256,448,3)
00094/0265 7 (256,448,3)
00094/0267 7 (256,448,3)
00094/0269 7 (256,448,3)
00094/0281 7 (256,448,3)
00094/0293 7 (256,448,3)
00094/0404 7 (256,448,3)
00094/0593 7 (256,448,3)
00094/0612 7 (256,448,3)
00094/0638 7 (256,448,3)
00094/0656 7 (256,448,3)
00094/0668 7 (256,448,3)
00094/0786 7 (256,448,3)
00094/0870 7 (256,448,3)
00094/0897 7 (256,448,3)
00094/0900 7 (256,448,3)
00094/0944 7 (256,448,3)
00094/0946 7 (256,448,3)
00094/0952 7 (256,448,3)
00094/0969 7 (256,448,3)
00094/0973 7 (256,448,3)
00094/0981 7 (256,448,3)
00095/0088 7 (256,448,3)
00095/0125 7 (256,448,3)
00095/0130 7 (256,448,3)
00095/0142 7 (256,448,3)
00095/0151 7 (256,448,3)
00095/0180 7 (256,448,3)
00095/0192 7 (256,448,3)
00095/0194 7 (256,448,3)
00095/0195 7 (256,448,3)
00095/0204 7 (256,448,3)
00095/0245 7 (256,448,3)
00095/0315 7 (256,448,3)
00095/0321 7 (256,448,3)
00095/0324 7 (256,448,3)
00095/0327 7 (256,448,3)
00095/0730 7 (256,448,3)
00095/0731 7 (256,448,3)
00095/0741 7 (256,448,3)
00095/0948 7 (256,448,3)
00096/0407 7 (256,448,3)
00096/0420 7 (256,448,3)
00096/0435 7 (256,448,3)
00096/0682 7 (256,448,3)
00096/0865 7 (256,448,3)1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161300001/0266 7 (256,448,3)
00001/0268 7 (256,448,3)
00001/0275 7 (256,448,3)
00001/0278 7 (256,448,3)
00001/0287 7 (256,448,3)
00001/0291 7 (256,448,3)
00001/0627 7 (256,448,3)
00001/0636 7 (256,448,3)
00001/0804 7 (256,448,3)
00001/0837 7 (256,448,3)
00001/0849 7 (256,448,3)
00001/0851 7 (256,448,3)
00001/0852 7 (256,448,3)
00001/0986 7 (256,448,3)
00001/0991 7 (256,448,3)
00002/0007 7 (256,448,3)
00002/0008 7 (256,448,3)
00002/0016 7 (256,448,3)
00002/0036 7 (256,448,3)
00002/0091 7 (256,448,3)
00002/0093 7 (256,448,3)
00002/0209 7 (256,448,3)
00002/0235 7 (256,448,3)
00002/0236 7 (256,448,3)
00002/0241 7 (256,448,3)
00002/0466 7 (256,448,3)
00002/0504 7 (256,448,3)
00002/0960 7 (256,448,3)
00002/0961 7 (256,448,3)
00002/0964 7 (256,448,3)
00003/0007 7 (256,448,3)
00003/0069 7 (256,448,3)
00003/0345 7 (256,448,3)
00003/0347 7 (256,448,3)
00003/0372 7 (256,448,3)
00003/0525 7 (256,448,3)
00003/0652 7 (256,448,3)
00003/0667 7 (256,448,3)
00003/0669 7 (256,448,3)
00003/0706 7 (256,448,3)
00003/0713 7 (256,448,3)
00003/0721 7 (256,448,3)
00003/0747 7 (256,448,3)
00003/0829 7 (256,448,3)
00003/0916 7 (256,448,3)
00003/0918 7 (256,448,3)
00003/0924 7 (256,448,3)
00003/0926 7 (256,448,3)
00003/0927 7 (256,448,3)
00004/0288 7 (256,448,3)
00004/0303 7 (256,448,3)
00004/0307 7 (256,448,3)
00004/0628 7 (256,448,3)
00004/0713 7 (256,448,3)
00004/0715 7 (256,448,3)
00004/0719 7 (256,448,3)
00004/0727 7 (256,448,3)
00004/0821 7 (256,448,3)
00005/0006 7 (256,448,3)
00005/0007 7 (256,448,3)
00005/0012 7 (256,448,3)
00005/0013 7 (256,448,3)
00005/0040 7 (256,448,3)
00005/0055 7 (256,448,3)
00005/0119 7 (256,448,3)
00005/0130 7 (256,448,3)
00005/0185 7 (256,448,3)
00005/0198 7 (256,448,3)
00005/0270 7 (256,448,3)
00005/0541 7 (256,448,3)
00005/0560 7 (256,448,3)
00005/0660 7 (256,448,3)
00005/0682 7 (256,448,3)
00005/0683 7 (256,448,3)
00005/0688 7 (256,448,3)
00005/0706 7 (256,448,3)
00005/0728 7 (256,448,3)
00005/0732 7 (256,448,3)
00005/0739 7 (256,448,3)
00005/0804 7 (256,448,3)
00005/0805 7 (256,448,3)
00005/0827 7 (256,448,3)
00005/0828 7 (256,448,3)
00005/0857 7 (256,448,3)
00005/0861 7 (256,448,3)
00005/0862 7 (256,448,3)
00005/0868 7 (256,448,3)
00005/0872 7 (256,448,3)
00005/0933 7 (256,448,3)
00005/0958 7 (256,448,3)
00005/0960 7 (256,448,3)
00006/0087 7 (256,448,3)
00006/0090 7 (256,448,3)
00006/0351 7 (256,448,3)
00006/0353 7 (256,448,3)
00006/0558 7 (256,448,3)
00006/0588 7 (256,448,3)
00006/0619 7 (256,448,3)
00006/0621 7 (256,448,3)
00006/0748 7 (256,448,3)
00006/0796 7 (256,448,3)
00006/0805 7 (256,448,3)
00006/0807 7 (256,448,3)
00007/0236 7 (256,448,3)
00007/0240 7 (256,448,3)
00007/0243 7 (256,448,3)
00007/0246 7 (256,448,3)
00007/0247 7 (256,448,3)
00007/0252 7 (256,448,3)
00007/0322 7 (256,448,3)
00007/0458 7 (256,448,3)
00007/0492 7 (256,448,3)
00007/0658 7 (256,448,3)
00007/0717 7 (256,448,3)
00007/0722 7 (256,448,3)
00007/0725 7 (256,448,3)
00007/0740 7 (256,448,3)
00007/0748 7 (256,448,3)
00007/0749 7 (256,448,3)
00007/0759 7 (256,448,3)
00007/0772 7 (256,448,3)
00007/0783 7 (256,448,3)
00007/0787 7 (256,448,3)
00007/0883 7 (256,448,3)
00008/0033 7 (256,448,3)
00008/0035 7 (256,448,3)
00008/0091 7 (256,448,3)
00008/0154 7 (256,448,3)
00008/0966 7 (256,448,3)
00008/0987 7 (256,448,3)
00009/0108 7 (256,448,3)
00009/0607 7 (256,448,3)
00009/0668 7 (256,448,3)
00009/0683 7 (256,448,3)
00009/0941 7 (256,448,3)
00009/0949 7 (256,448,3)
00009/0962 7 (256,448,3)
00009/0972 7 (256,448,3)
00009/0974 7 (256,448,3)
00010/0014 7 (256,448,3)
00010/0018 7 (256,448,3)
00010/0043 7 (256,448,3)
00010/0099 7 (256,448,3)
00010/0252 7 (256,448,3)
00010/0296 7 (256,448,3)
00010/0413 7 (256,448,3)
00010/0422 7 (256,448,3)
00010/0516 7 (256,448,3)
00010/0525 7 (256,448,3)
00010/0556 7 (256,448,3)
00010/0701 7 (256,448,3)
00010/0740 7 (256,448,3)
00010/0772 7 (256,448,3)
00010/0831 7 (256,448,3)
00010/0925 7 (256,448,3)
00011/0013 7 (256,448,3)
00011/0016 7 (256,448,3)
00011/0017 7 (256,448,3)
00011/0249 7 (256,448,3)
00011/0826 7 (256,448,3)
00011/0827 7 (256,448,3)
00011/0831 7 (256,448,3)
00011/0833 7 (256,448,3)
00011/0835 7 (256,448,3)
00011/0998 7 (256,448,3)
00012/0023 7 (256,448,3)
00012/0024 7 (256,448,3)
00012/0027 7 (256,448,3)
00012/0037 7 (256,448,3)
00012/0444 7 (256,448,3)
00012/0445 7 (256,448,3)
00012/0451 7 (256,448,3)
00012/0461 7 (256,448,3)
00012/0521 7 (256,448,3)
00012/0758 7 (256,448,3)
00012/0760 7 (256,448,3)
00012/0771 7 (256,448,3)
00012/0903 7 (256,448,3)
00012/0909 7 (256,448,3)
00013/0581 7 (256,448,3)
00013/0786 7 (256,448,3)
00013/0789 7 (256,448,3)
00013/0791 7 (256,448,3)
00013/0798 7 (256,448,3)
00013/0802 7 (256,448,3)
00013/0820 7 (256,448,3)
00013/0850 7 (256,448,3)
00013/0854 7 (256,448,3)
00013/0894 7 (256,448,3)
00013/0919 7 (256,448,3)
00013/0999 7 (256,448,3)
00014/0001 7 (256,448,3)
00014/0014 7 (256,448,3)
00014/0018 7 (256,448,3)
00014/0244 7 (256,448,3)
00014/0475 7 (256,448,3)
00014/0483 7 (256,448,3)
00014/0680 7 (256,448,3)
00014/0700 7 (256,448,3)
00014/0701 7 (256,448,3)
00014/0706 7 (256,448,3)
00014/0712 7 (256,448,3)
00014/0713 7 (256,448,3)
00014/0717 7 (256,448,3)
00014/0719 7 (256,448,3)
00014/0728 7 (256,448,3)
00014/0734 7 (256,448,3)
00014/0736 7 (256,448,3)
00014/0738 7 (256,448,3)
00014/0742 7 (256,448,3)
00014/0745 7 (256,448,3)
00014/0746 7 (256,448,3)
00014/0750 7 (256,448,3)
00014/0769 7 (256,448,3)
00014/0774 7 (256,448,3)
00014/0781 7 (256,448,3)
00014/0782 7 (256,448,3)
00014/0852 7 (256,448,3)
00014/0853 7 (256,448,3)
00014/0855 7 (256,448,3)
00014/0867 7 (256,448,3)
00014/0876 7 (256,448,3)
00014/0881 7 (256,448,3)
00014/0890 7 (256,448,3)
00014/0914 7 (256,448,3)
00015/0033 7 (256,448,3)
00015/0113 7 (256,448,3)
00015/0125 7 (256,448,3)
00015/0185 7 (256,448,3)
00015/0194 7 (256,448,3)
00015/0202 7 (256,448,3)
00015/0312 7 (256,448,3)
00015/0688 7 (256,448,3)
00015/0698 7 (256,448,3)
00015/0788 7 (256,448,3)
00015/0854 7 (256,448,3)
00015/0863 7 (256,448,3)
00015/0864 7 (256,448,3)
00015/0918 7 (256,448,3)
00015/0931 7 (256,448,3)
00016/0276 7 (256,448,3)
00016/0301 7 (256,448,3)
00016/0306 7 (256,448,3)
00016/0324 7 (256,448,3)
00016/0362 7 (256,448,3)
00016/0364 7 (256,448,3)
00016/0370 7 (256,448,3)
00016/0378 7 (256,448,3)
00016/0379 7 (256,448,3)
00016/0402 7 (256,448,3)
00016/0405 7 (256,448,3)
00016/0418 7 (256,448,3)
00016/0419 7 (256,448,3)
00016/0435 7 (256,448,3)
00016/0501 7 (256,448,3)
00016/0561 7 (256,448,3)
00016/0562 7 (256,448,3)
00016/0569 7 (256,448,3)
00016/0591 7 (256,448,3)
00016/0599 7 (256,448,3)
00016/0711 7 (256,448,3)
00016/0713 7 (256,448,3)
00016/0813 7 (256,448,3)
00016/0953 7 (256,448,3)
00016/0960 7 (256,448,3)
00016/0961 7 (256,448,3)
00017/0519 7 (256,448,3)
00017/0523 7 (256,448,3)
00017/0588 7 (256,448,3)
00017/0608 7 (256,448,3)
00017/0609 7 (256,448,3)
00017/0719 7 (256,448,3)
00017/0721 7 (256,448,3)
00017/0727 7 (256,448,3)
00017/0728 7 (256,448,3)
00017/0769 7 (256,448,3)
00017/0775 7 (256,448,3)
00017/0787 7 (256,448,3)
00017/0797 7 (256,448,3)
00018/0043 7 (256,448,3)
00018/0206 7 (256,448,3)
00018/0209 7 (256,448,3)
00018/0211 7 (256,448,3)
00018/0216 7 (256,448,3)
00018/0220 7 (256,448,3)
00018/0221 7 (256,448,3)
00018/0252 7 (256,448,3)
00018/0260 7 (256,448,3)
00018/0331 7 (256,448,3)
00018/0333 7 (256,448,3)
00018/0447 7 (256,448,3)
00018/0523 7 (256,448,3)
00019/0014 7 (256,448,3)
00019/0015 7 (256,448,3)
00019/0019 7 (256,448,3)
00019/0049 7 (256,448,3)
00019/0109 7 (256,448,3)
00019/0114 7 (256,448,3)
00019/0125 7 (256,448,3)
00019/0137 7 (256,448,3)
00019/0140 7 (256,448,3)
00019/0148 7 (256,448,3)
00019/0153 7 (256,448,3)
00019/0155 7 (256,448,3)
00019/0158 7 (256,448,3)
00019/0159 7 (256,448,3)
00019/0160 7 (256,448,3)
00019/0162 7 (256,448,3)
00019/0279 7 (256,448,3)
00019/0282 7 (256,448,3)
00019/0409 7 (256,448,3)
00019/0427 7 (256,448,3)
00019/0430 7 (256,448,3)
00019/0545 7 (256,448,3)
00019/0555 7 (256,448,3)
00019/0558 7 (256,448,3)
00019/0650 7 (256,448,3)
00019/0681 7 (256,448,3)
00019/0747 7 (256,448,3)
00019/0748 7 (256,448,3)
00019/0749 7 (256,448,3)
00019/0752 7 (256,448,3)
00019/0768 7 (256,448,3)
00019/0772 7 (256,448,3)
00019/0773 7 (256,448,3)
00019/0777 7 (256,448,3)
00019/0795 7 (256,448,3)
00019/0806 7 (256,448,3)
00019/0815 7 (256,448,3)
00019/0840 7 (256,448,3)
00019/0844 7 (256,448,3)
00019/0848 7 (256,448,3)
00019/0853 7 (256,448,3)
00019/0863 7 (256,448,3)
00019/0888 7 (256,448,3)
00019/0894 7 (256,448,3)
00019/0901 7 (256,448,3)
00019/0995 7 (256,448,3)
00021/0030 7 (256,448,3)
00021/0035 7 (256,448,3)
00021/0039 7 (256,448,3)
00021/0041 7 (256,448,3)
00021/0044 7 (256,448,3)
00021/0045 7 (256,448,3)
00021/0264 7 (256,448,3)
00021/0330 7 (256,448,3)
00021/0332 7 (256,448,3)
00021/0333 7 (256,448,3)
00021/0336 7 (256,448,3)
00021/0337 7 (256,448,3)
00021/0338 7 (256,448,3)
00021/0343 7 (256,448,3)
00021/0472 7 (256,448,3)
00021/0667 7 (256,448,3)
00021/0731 7 (256,448,3)
00021/0779 7 (256,448,3)
00021/0805 7 (256,448,3)
00021/0814 7 (256,448,3)
00021/0818 7 (256,448,3)
00021/0874 7 (256,448,3)
00022/0008 7 (256,448,3)
00022/0010 7 (256,448,3)
00022/0231 7 (256,448,3)
00022/0323 7 (256,448,3)
00022/0337 7 (256,448,3)
00022/0359 7 (256,448,3)
00022/0377 7 (256,448,3)
00022/0378 7 (256,448,3)
00022/0385 7 (256,448,3)
00022/0393 7 (256,448,3)
00022/0424 7 (256,448,3)
00022/0582 7 (256,448,3)
00022/0583 7 (256,448,3)
00022/0605 7 (256,448,3)
00022/0632 7 (256,448,3)
00022/0633 7 (256,448,3)
00022/0666 7 (256,448,3)
00022/0671 7 (256,448,3)
00022/0673 7 (256,448,3)
00022/0702 7 (256,448,3)
00022/0852 7 (256,448,3)
00022/0853 7 (256,448,3)
00022/0971 7 (256,448,3)
00023/0037 7 (256,448,3)
00023/0224 7 (256,448,3)
00023/0308 7 (256,448,3)
00023/0393 7 (256,448,3)
00023/0633 7 (256,448,3)
00023/0637 7 (256,448,3)
00023/0638 7 (256,448,3)
00023/0770 7 (256,448,3)
00023/0786 7 (256,448,3)
00023/0898 7 (256,448,3)
00024/0247 7 (256,448,3)
00024/0251 7 (256,448,3)
00024/0267 7 (256,448,3)
00024/0288 7 (256,448,3)
00024/0530 7 (256,448,3)
00024/0569 7 (256,448,3)
00024/0587 7 (256,448,3)
00024/0730 7 (256,448,3)
00024/0736 7 (256,448,3)
00024/0742 7 (256,448,3)
00024/0832 7 (256,448,3)
00024/0936 7 (256,448,3)
00025/0044 7 (256,448,3)
00025/0047 7 (256,448,3)
00025/0540 7 (256,448,3)
00025/0552 7 (256,448,3)
00025/0554 7 (256,448,3)
00025/0559 7 (256,448,3)
00025/0572 7 (256,448,3)
00025/0576 7 (256,448,3)
00025/0699 7 (256,448,3)
00025/0709 7 (256,448,3)
00025/0743 7 (256,448,3)
00025/0767 7 (256,448,3)
00025/0780 7 (256,448,3)
00025/0782 7 (256,448,3)
00025/0784 7 (256,448,3)
00025/0791 7 (256,448,3)
00025/0889 7 (256,448,3)
00025/0890 7 (256,448,3)
00025/0894 7 (256,448,3)
00025/0896 7 (256,448,3)
00025/0898 7 (256,448,3)
00025/0905 7 (256,448,3)
00025/0999 7 (256,448,3)
00026/0003 7 (256,448,3)
00026/0005 7 (256,448,3)
00026/0011 7 (256,448,3)
00026/0017 7 (256,448,3)
00026/0036 7 (256,448,3)
00026/0129 7 (256,448,3)
00026/0131 7 (256,448,3)
00026/0161 7 (256,448,3)
00026/0177 7 (256,448,3)
00026/0178 7 (256,448,3)
00026/0180 7 (256,448,3)
00026/0298 7 (256,448,3)
00026/0307 7 (256,448,3)
00026/0308 7 (256,448,3)
00026/0312 7 (256,448,3)
00026/0352 7 (256,448,3)
00026/0440 7 (256,448,3)
00026/0706 7 (256,448,3)
00026/0708 7 (256,448,3)
00026/0715 7 (256,448,3)
00026/0769 7 (256,448,3)
00026/0777 7 (256,448,3)
00026/0779 7 (256,448,3)
00026/0789 7 (256,448,3)
00026/0924 7 (256,448,3)
00026/0928 7 (256,448,3)
00026/0932 7 (256,448,3)
00026/0935 7 (256,448,3)
00027/0118 7 (256,448,3)
00027/0121 7 (256,448,3)
00027/0155 7 (256,448,3)
00027/0168 7 (256,448,3)
00027/0196 7 (256,448,3)
00027/0289 7 (256,448,3)
00027/0294 7 (256,448,3)
00027/0803 7 (256,448,3)
00028/0016 7 (256,448,3)
00028/0045 7 (256,448,3)
00028/0063 7 (256,448,3)
00028/0601 7 (256,448,3)
00028/0638 7 (256,448,3)
00028/0733 7 (256,448,3)
00028/0736 7 (256,448,3)
00028/0741 7 (256,448,3)
00028/0753 7 (256,448,3)
00028/0770 7 (256,448,3)
00028/0771 7 (256,448,3)
00028/0777 7 (256,448,3)
00028/0950 7 (256,448,3)
00028/0951 7 (256,448,3)
00029/0048 7 (256,448,3)
00029/0060 7 (256,448,3)
00029/0362 7 (256,448,3)
00029/0399 7 (256,448,3)
00029/0404 7 (256,448,3)
00029/0412 7 (256,448,3)
00029/0416 7 (256,448,3)
00029/0418 7 (256,448,3)
00029/0428 7 (256,448,3)
00030/0131 7 (256,448,3)
00030/0135 7 (256,448,3)
00030/0150 7 (256,448,3)
00030/0245 7 (256,448,3)
00030/0339 7 (256,448,3)
00030/0472 7 (256,448,3)
00030/0482 7 (256,448,3)
00030/0500 7 (256,448,3)
00030/0501 7 (256,448,3)
00030/0697 7 (256,448,3)
00030/0707 7 (256,448,3)
00030/0733 7 (256,448,3)
00030/0743 7 (256,448,3)
00030/0747 7 (256,448,3)
00030/0754 7 (256,448,3)
00030/0755 7 (256,448,3)
00030/0759 7 (256,448,3)
00030/0762 7 (256,448,3)
00030/0764 7 (256,448,3)
00030/0767 7 (256,448,3)
00030/0794 7 (256,448,3)
00030/0796 7 (256,448,3)
00030/0799 7 (256,448,3)
00030/0814 7 (256,448,3)
00030/0823 7 (256,448,3)
00030/0829 7 (256,448,3)
00030/0833 7 (256,448,3)
00030/0848 7 (256,448,3)
00030/0853 7 (256,448,3)
00030/0861 7 (256,448,3)
00031/0182 7 (256,448,3)
00031/0275 7 (256,448,3)
00031/0279 7 (256,448,3)
00031/0555 7 (256,448,3)
00031/0648 7 (256,448,3)
00031/0663 7 (256,448,3)
00031/0680 7 (256,448,3)
00031/0880 7 (256,448,3)
00031/0922 7 (256,448,3)
00031/0925 7 (256,448,3)
00031/0928 7 (256,448,3)
00032/0025 7 (256,448,3)
00032/0377 7 (256,448,3)
00032/0378 7 (256,448,3)
00032/0382 7 (256,448,3)
00032/0384 7 (256,448,3)
00032/0386 7 (256,448,3)
00032/0389 7 (256,448,3)
00032/0391 7 (256,448,3)
00032/0393 7 (256,448,3)
00032/0492 7 (256,448,3)
00032/0497 7 (256,448,3)
00032/0505 7 (256,448,3)
00032/0523 7 (256,448,3)
00032/0542 7 (256,448,3)
00032/0544 7 (256,448,3)
00032/0712 7 (256,448,3)
00032/0847 7 (256,448,3)
00032/0850 7 (256,448,3)
00032/0875 7 (256,448,3)
00033/0062 7 (256,448,3)
00033/0063 7 (256,448,3)
00033/0098 7 (256,448,3)
00033/0101 7 (256,448,3)
00033/0105 7 (256,448,3)
00033/0114 7 (256,448,3)
00033/0432 7 (256,448,3)
00033/0441 7 (256,448,3)
00033/0606 7 (256,448,3)
00033/0611 7 (256,448,3)
00033/0634 7 (256,448,3)
00033/0787 7 (256,448,3)
00033/0792 7 (256,448,3)
00033/0802 7 (256,448,3)
00033/0825 7 (256,448,3)
00033/0835 7 (256,448,3)
00034/0249 7 (256,448,3)
00034/0253 7 (256,448,3)
00034/0254 7 (256,448,3)
00034/0282 7 (256,448,3)
00034/0318 7 (256,448,3)
00034/0319 7 (256,448,3)
00034/0323 7 (256,448,3)
00034/0336 7 (256,448,3)
00034/0348 7 (256,448,3)
00034/0356 7 (256,448,3)
00034/0379 7 (256,448,3)
00034/0387 7 (256,448,3)
00034/0575 7 (256,448,3)
00034/0608 7 (256,448,3)
00034/0663 7 (256,448,3)
00034/0811 7 (256,448,3)
00034/0812 7 (256,448,3)
00034/0946 7 (256,448,3)
00034/0948 7 (256,448,3)
00034/0950 7 (256,448,3)
00035/0204 7 (256,448,3)
00035/0243 7 (256,448,3)
00035/0308 7 (256,448,3)
00035/0465 7 (256,448,3)
00035/0478 7 (256,448,3)
00035/0523 7 (256,448,3)
00035/0540 7 (256,448,3)
00035/0544 7 (256,448,3)
00035/0556 7 (256,448,3)
00035/0568 7 (256,448,3)
00035/0570 7 (256,448,3)
00035/0609 7 (256,448,3)
00035/0643 7 (256,448,3)
00035/0644 7 (256,448,3)
00035/0645 7 (256,448,3)
00035/0646 7 (256,448,3)
00035/0650 7 (256,448,3)
00035/0661 7 (256,448,3)
00035/0724 7 (256,448,3)
00035/0725 7 (256,448,3)
00035/0850 7 (256,448,3)
00035/0863 7 (256,448,3)
00035/0870 7 (256,448,3)
00035/0951 7 (256,448,3)
00036/0038 7 (256,448,3)
00036/0062 7 (256,448,3)
00036/0423 7 (256,448,3)
00036/0737 7 (256,448,3)
00036/0750 7 (256,448,3)
00036/0751 7 (256,448,3)
00036/0754 7 (256,448,3)
00036/0929 7 (256,448,3)
00037/0085 7 (256,448,3)
00037/0113 7 (256,448,3)
00037/0130 7 (256,448,3)
00037/0153 7 (256,448,3)
00037/0169 7 (256,448,3)
00037/0263 7 (256,448,3)
00037/0272 7 (256,448,3)
00037/0273 7 (256,448,3)
00037/0275 7 (256,448,3)
00037/0280 7 (256,448,3)
00037/0399 7 (256,448,3)
00037/0456 7 (256,448,3)
00037/0853 7 (256,448,3)
00037/0855 7 (256,448,3)
00037/0856 7 (256,448,3)
00037/0857 7 (256,448,3)
00037/0925 7 (256,448,3)
00037/0947 7 (256,448,3)
00038/0148 7 (256,448,3)
00038/0533 7 (256,448,3)
00038/0534 7 (256,448,3)
00038/0560 7 (256,448,3)
00038/0562 7 (256,448,3)
00038/0566 7 (256,448,3)
00038/0578 7 (256,448,3)
00038/0652 7 (256,448,3)
00038/0674 7 (256,448,3)
00038/0685 7 (256,448,3)
00038/0686 7 (256,448,3)
00038/0692 7 (256,448,3)
00038/0736 7 (256,448,3)
00039/0035 7 (256,448,3)
00039/0105 7 (256,448,3)
00039/0109 7 (256,448,3)
00039/0121 7 (256,448,3)
00039/0128 7 (256,448,3)
00039/0129 7 (256,448,3)
00039/0132 7 (256,448,3)
00039/0137 7 (256,448,3)
00039/0157 7 (256,448,3)
00039/0496 7 (256,448,3)
00039/0502 7 (256,448,3)
00039/0526 7 (256,448,3)
00039/0529 7 (256,448,3)
00039/0682 7 (256,448,3)
00039/0690 7 (256,448,3)
00039/0693 7 (256,448,3)
00039/0703 7 (256,448,3)
00039/0725 7 (256,448,3)
00039/0734 7 (256,448,3)
00040/0518 7 (256,448,3)
00040/0728 7 (256,448,3)
00040/0774 7 (256,448,3)
00040/0812 7 (256,448,3)
00040/0818 7 (256,448,3)
00040/0827 7 (256,448,3)
00040/0914 7 (256,448,3)
00040/0917 7 (256,448,3)
00040/0918 7 (256,448,3)
00040/0924 7 (256,448,3)
00040/0925 7 (256,448,3)
00041/0004 7 (256,448,3)
00041/0006 7 (256,448,3)
00041/0013 7 (256,448,3)
00041/0059 7 (256,448,3)
00041/0110 7 (256,448,3)
00041/0291 7 (256,448,3)
00041/0366 7 (256,448,3)
00041/0388 7 (256,448,3)
00041/0434 7 (256,448,3)
00041/0436 7 (256,448,3)
00041/0450 7 (256,448,3)
00041/0457 7 (256,448,3)
00041/0460 7 (256,448,3)
00041/0468 7 (256,448,3)
00041/0471 7 (256,448,3)
00041/0474 7 (256,448,3)
00041/0809 7 (256,448,3)
00041/0844 7 (256,448,3)
00041/0858 7 (256,448,3)
00041/0874 7 (256,448,3)
00041/0876 7 (256,448,3)
00042/0020 7 (256,448,3)
00042/0205 7 (256,448,3)
00042/0206 7 (256,448,3)
00042/0432 7 (256,448,3)
00042/0563 7 (256,448,3)
00042/0569 7 (256,448,3)
00042/0575 7 (256,448,3)
00042/0576 7 (256,448,3)
00042/0888 7 (256,448,3)
00042/0892 7 (256,448,3)
00042/0943 7 (256,448,3)
00042/0944 7 (256,448,3)
00043/0126 7 (256,448,3)
00043/0130 7 (256,448,3)
00043/0136 7 (256,448,3)
00043/0233 7 (256,448,3)
00043/0235 7 (256,448,3)
00043/0237 7 (256,448,3)
00043/0277 7 (256,448,3)
00043/0301 7 (256,448,3)
00043/0302 7 (256,448,3)
00043/0303 7 (256,448,3)
00043/0308 7 (256,448,3)
00043/0309 7 (256,448,3)
00043/0314 7 (256,448,3)
00043/0713 7 (256,448,3)
00043/0715 7 (256,448,3)
00043/0923 7 (256,448,3)
00044/0095 7 (256,448,3)
00044/0255 7 (256,448,3)
00044/0864 7 (256,448,3)
00044/0892 7 (256,448,3)
00044/0898 7 (256,448,3)
00044/0993 7 (256,448,3)
00044/0995 7 (256,448,3)
00044/0997 7 (256,448,3)
00045/0001 7 (256,448,3)
00045/0006 7 (256,448,3)
00045/0269 7 (256,448,3)
00045/0276 7 (256,448,3)
00045/0280 7 (256,448,3)
00045/0281 7 (256,448,3)
00045/0282 7 (256,448,3)
00045/0284 7 (256,448,3)
00045/0550 7 (256,448,3)
00045/0571 7 (256,448,3)
00045/0629 7 (256,448,3)
00045/0631 7 (256,448,3)
00045/0659 7 (256,448,3)
00045/0693 7 (256,448,3)
00045/0807 7 (256,448,3)
00045/0810 7 (256,448,3)
00045/0826 7 (256,448,3)
00045/0849 7 (256,448,3)
00045/0946 7 (256,448,3)
00045/0987 7 (256,448,3)
00045/0990 7 (256,448,3)
00046/0104 7 (256,448,3)
00046/0477 7 (256,448,3)
00046/0490 7 (256,448,3)
00046/0491 7 (256,448,3)
00046/0509 7 (256,448,3)
00046/0513 7 (256,448,3)
00046/0603 7 (256,448,3)
00046/0723 7 (256,448,3)
00046/0744 7 (256,448,3)
00046/0746 7 (256,448,3)
00046/0750 7 (256,448,3)
00046/0852 7 (256,448,3)
00046/0927 7 (256,448,3)
00046/0928 7 (256,448,3)
00046/0929 7 (256,448,3)
00046/0931 7 (256,448,3)
00046/0936 7 (256,448,3)
00046/0939 7 (256,448,3)
00046/0947 7 (256,448,3)
00046/0948 7 (256,448,3)
00046/0950 7 (256,448,3)
00046/0955 7 (256,448,3)
00046/0961 7 (256,448,3)
00047/0023 7 (256,448,3)
00047/0029 7 (256,448,3)
00047/0035 7 (256,448,3)
00047/0058 7 (256,448,3)
00047/0061 7 (256,448,3)
00047/0065 7 (256,448,3)
00047/0068 7 (256,448,3)
00047/0072 7 (256,448,3)
00047/0074 7 (256,448,3)
00047/0148 7 (256,448,3)
00047/0594 7 (256,448,3)
00047/0782 7 (256,448,3)
00047/0787 7 (256,448,3)
00047/0860 7 (256,448,3)
00047/0889 7 (256,448,3)
00047/0893 7 (256,448,3)
00047/0894 7 (256,448,3)
00047/0902 7 (256,448,3)
00047/0975 7 (256,448,3)
00047/0995 7 (256,448,3)
00048/0033 7 (256,448,3)
00048/0113 7 (256,448,3)
00048/0115 7 (256,448,3)
00048/0120 7 (256,448,3)
00048/0129 7 (256,448,3)
00048/0136 7 (256,448,3)
00048/0327 7 (256,448,3)
00048/0329 7 (256,448,3)
00048/0341 7 (256,448,3)
00048/0343 7 (256,448,3)
00048/0345 7 (256,448,3)
00048/0346 7 (256,448,3)
00048/0355 7 (256,448,3)
00048/0359 7 (256,448,3)
00048/0363 7 (256,448,3)
00048/0378 7 (256,448,3)
00048/0386 7 (256,448,3)
00048/0387 7 (256,448,3)
00048/0388 7 (256,448,3)
00048/0428 7 (256,448,3)
00048/0439 7 (256,448,3)
00048/0507 7 (256,448,3)
00048/0510 7 (256,448,3)
00048/0512 7 (256,448,3)
00048/0514 7 (256,448,3)
00048/0539 7 (256,448,3)
00048/0542 7 (256,448,3)
00048/0544 7 (256,448,3)
00048/0631 7 (256,448,3)
00048/0632 7 (256,448,3)
00048/0636 7 (256,448,3)
00048/0640 7 (256,448,3)
00048/0644 7 (256,448,3)
00048/0653 7 (256,448,3)
00048/0655 7 (256,448,3)
00048/0658 7 (256,448,3)
00048/0667 7 (256,448,3)
00048/0688 7 (256,448,3)
00048/0708 7 (256,448,3)
00049/0005 7 (256,448,3)
00049/0074 7 (256,448,3)
00049/0077 7 (256,448,3)
00049/0084 7 (256,448,3)
00049/0516 7 (256,448,3)
00049/0800 7 (256,448,3)
00049/0900 7 (256,448,3)
00050/0607 7 (256,448,3)
00050/0661 7 (256,448,3)
00050/0665 7 (256,448,3)
00050/0685 7 (256,448,3)
00050/0711 7 (256,448,3)
00051/0068 7 (256,448,3)
00051/0069 7 (256,448,3)
00051/0076 7 (256,448,3)
00051/0569 7 (256,448,3)
00051/0801 7 (256,448,3)
00051/0927 7 (256,448,3)
00051/0945 7 (256,448,3)
00051/0952 7 (256,448,3)
00051/0976 7 (256,448,3)
00051/0985 7 (256,448,3)
00052/0012 7 (256,448,3)
00052/0015 7 (256,448,3)
00052/0052 7 (256,448,3)
00052/0056 7 (256,448,3)
00052/0060 7 (256,448,3)
00052/0157 7 (256,448,3)
00052/0265 7 (256,448,3)
00052/0788 7 (256,448,3)
00052/0790 7 (256,448,3)
00052/0793 7 (256,448,3)
00052/0816 7 (256,448,3)
00052/0824 7 (256,448,3)
00052/0918 7 (256,448,3)
00052/0933 7 (256,448,3)
00052/0947 7 (256,448,3)
00053/0232 7 (256,448,3)
00053/0277 7 (256,448,3)
00053/0362 7 (256,448,3)
00053/0577 7 (256,448,3)
00053/0609 7 (256,448,3)
00053/0612 7 (256,448,3)
00053/0628 7 (256,448,3)
00053/0629 7 (256,448,3)
00053/0633 7 (256,448,3)
00053/0659 7 (256,448,3)
00053/0667 7 (256,448,3)
00053/0671 7 (256,448,3)
00053/0797 7 (256,448,3)
00053/0804 7 (256,448,3)
00053/0807 7 (256,448,3)
00053/0952 7 (256,448,3)
00053/0970 7 (256,448,3)
00053/0981 7 (256,448,3)
00053/0999 7 (256,448,3)
00054/0003 7 (256,448,3)
00054/0013 7 (256,448,3)
00054/0020 7 (256,448,3)
00054/0022 7 (256,448,3)
00054/0023 7 (256,448,3)
00054/0044 7 (256,448,3)
00054/0051 7 (256,448,3)
00054/0063 7 (256,448,3)
00054/0065 7 (256,448,3)
00054/0145 7 (256,448,3)
00054/0153 7 (256,448,3)
00054/0203 7 (256,448,3)
00054/0325 7 (256,448,3)
00054/0445 7 (256,448,3)
00054/0448 7 (256,448,3)
00054/0456 7 (256,448,3)
00054/0457 7 (256,448,3)
00054/0519 7 (256,448,3)
00054/0524 7 (256,448,3)
00054/0530 7 (256,448,3)
00054/0532 7 (256,448,3)
00054/0535 7 (256,448,3)
00054/0574 7 (256,448,3)
00054/0760 7 (256,448,3)
00054/0767 7 (256,448,3)
00054/0837 7 (256,448,3)
00055/0011 7 (256,448,3)
00055/0109 7 (256,448,3)
00055/0111 7 (256,448,3)
00055/0117 7 (256,448,3)
00055/0119 7 (256,448,3)
00055/0182 7 (256,448,3)
00055/0192 7 (256,448,3)
00055/0193 7 (256,448,3)
00055/0200 7 (256,448,3)
00055/0204 7 (256,448,3)
00055/0207 7 (256,448,3)
00055/0212 7 (256,448,3)
00055/0213 7 (256,448,3)
00055/0348 7 (256,448,3)
00055/0423 7 (256,448,3)
00055/0427 7 (256,448,3)
00055/0456 7 (256,448,3)
00055/0489 7 (256,448,3)
00055/0689 7 (256,448,3)
00055/0753 7 (256,448,3)
00055/0802 7 (256,448,3)
00055/0844 7 (256,448,3)
00055/0850 7 (256,448,3)
00055/0982 7 (256,448,3)
00055/0993 7 (256,448,3)
00056/0113 7 (256,448,3)
00056/0148 7 (256,448,3)
00056/0151 7 (256,448,3)
00056/0316 7 (256,448,3)
00056/0379 7 (256,448,3)
00056/0380 7 (256,448,3)
00056/0385 7 (256,448,3)
00056/0505 7 (256,448,3)
00056/0579 7 (256,448,3)
00057/0254 7 (256,448,3)
00057/0264 7 (256,448,3)
00057/0272 7 (256,448,3)
00057/0403 7 (256,448,3)
00057/0501 7 (256,448,3)
00057/0503 7 (256,448,3)
00057/0884 7 (256,448,3)
00058/0026 7 (256,448,3)
00058/0029 7 (256,448,3)
00058/0104 7 (256,448,3)
00058/0124 7 (256,448,3)
00058/0162 7 (256,448,3)
00058/0288 7 (256,448,3)
00058/0289 7 (256,448,3)
00058/0323 7 (256,448,3)
00058/0328 7 (256,448,3)
00058/0329 7 (256,448,3)
00058/0337 7 (256,448,3)
00058/0367 7 (256,448,3)
00058/0383 7 (256,448,3)
00058/0395 7 (256,448,3)
00060/0178 7 (256,448,3)
00060/0182 7 (256,448,3)
00061/0001 7 (256,448,3)
00061/0003 7 (256,448,3)
00061/0006 7 (256,448,3)
00061/0443 7 (256,448,3)
00061/0586 7 (256,448,3)
00061/0587 7 (256,448,3)
00061/0774 7 (256,448,3)
00061/0789 7 (256,448,3)
00061/0815 7 (256,448,3)
00061/0817 7 (256,448,3)
00061/0826 7 (256,448,3)
00061/0829 7 (256,448,3)
00061/0830 7 (256,448,3)
00061/0832 7 (256,448,3)
00061/0833 7 (256,448,3)
00061/0836 7 (256,448,3)
00061/0837 7 (256,448,3)
00061/0839 7 (256,448,3)
00061/0843 7 (256,448,3)
00061/0849 7 (256,448,3)
00061/0859 7 (256,448,3)
00061/0861 7 (256,448,3)
00061/0868 7 (256,448,3)
00061/0877 7 (256,448,3)
00061/0889 7 (256,448,3)
00061/0905 7 (256,448,3)
00062/0115 7 (256,448,3)
00062/0118 7 (256,448,3)
00062/0125 7 (256,448,3)
00062/0134 7 (256,448,3)
00062/0142 7 (256,448,3)
00062/0400 7 (256,448,3)
00062/0457 7 (256,448,3)
00062/0459 7 (256,448,3)
00062/0560 7 (256,448,3)
00062/0650 7 (256,448,3)
00062/0655 7 (256,448,3)
00062/0715 7 (256,448,3)
00062/0847 7 (256,448,3)
00062/0905 7 (256,448,3)
00062/0981 7 (256,448,3)
00063/0177 7 (256,448,3)
00063/0230 7 (256,448,3)
00063/0253 7 (256,448,3)
00063/0257 7 (256,448,3)
00063/0326 7 (256,448,3)
00063/0530 7 (256,448,3)
00063/0677 7 (256,448,3)
00063/0759 7 (256,448,3)
00063/0761 7 (256,448,3)
00063/0777 7 (256,448,3)
00063/0842 7 (256,448,3)
00063/0900 7 (256,448,3)
00064/0014 7 (256,448,3)
00064/0028 7 (256,448,3)
00064/0029 7 (256,448,3)
00064/0030 7 (256,448,3)
00064/0037 7 (256,448,3)
00064/0044 7 (256,448,3)
00064/0280 7 (256,448,3)
00064/0285 7 (256,448,3)
00064/0286 7 (256,448,3)
00064/0291 7 (256,448,3)
00064/0300 7 (256,448,3)
00064/0303 7 (256,448,3)
00064/0308 7 (256,448,3)
00064/0314 7 (256,448,3)
00064/0316 7 (256,448,3)
00064/0317 7 (256,448,3)
00064/0323 7 (256,448,3)
00064/0435 7 (256,448,3)
00064/0733 7 (256,448,3)
00064/0848 7 (256,448,3)
00064/0868 7 (256,448,3)
00064/0888 7 (256,448,3)
00064/0898 7 (256,448,3)
00065/0116 7 (256,448,3)
00065/0121 7 (256,448,3)
00065/0122 7 (256,448,3)
00065/0124 7 (256,448,3)
00065/0125 7 (256,448,3)
00065/0126 7 (256,448,3)
00065/0136 7 (256,448,3)
00065/0146 7 (256,448,3)
00065/0147 7 (256,448,3)
00065/0163 7 (256,448,3)
00065/0170 7 (256,448,3)
00065/0175 7 (256,448,3)
00065/0176 7 (256,448,3)
00065/0180 7 (256,448,3)
00065/0184 7 (256,448,3)
00065/0186 7 (256,448,3)
00065/0332 7 (256,448,3)
00065/0343 7 (256,448,3)
00065/0365 7 (256,448,3)
00065/0393 7 (256,448,3)
00065/0394 7 (256,448,3)
00065/0442 7 (256,448,3)
00065/0459 7 (256,448,3)
00065/0462 7 (256,448,3)
00065/0476 7 (256,448,3)
00065/0483 7 (256,448,3)
00065/0590 7 (256,448,3)
00065/0593 7 (256,448,3)
00065/0595 7 (256,448,3)
00065/0774 7 (256,448,3)
00065/0947 7 (256,448,3)
00065/0985 7 (256,448,3)
00065/0986 7 (256,448,3)
00066/0015 7 (256,448,3)
00066/0043 7 (256,448,3)
00066/0131 7 (256,448,3)
00066/0157 7 (256,448,3)
00066/0169 7 (256,448,3)
00066/0374 7 (256,448,3)
00066/0382 7 (256,448,3)
00066/0481 7 (256,448,3)
00066/0482 7 (256,448,3)
00066/0491 7 (256,448,3)
00066/0493 7 (256,448,3)
00066/0494 7 (256,448,3)
00066/0496 7 (256,448,3)
00066/0680 7 (256,448,3)
00066/0700 7 (256,448,3)
00066/0887 7 (256,448,3)
00066/0910 7 (256,448,3)
00066/0918 7 (256,448,3)
00067/0024 7 (256,448,3)
00067/0059 7 (256,448,3)
00067/0408 7 (256,448,3)
00067/0414 7 (256,448,3)
00067/0417 7 (256,448,3)
00067/0419 7 (256,448,3)
00067/0423 7 (256,448,3)
00067/0441 7 (256,448,3)
00067/0467 7 (256,448,3)
00067/0471 7 (256,448,3)
00067/0487 7 (256,448,3)
00067/0494 7 (256,448,3)
00067/0497 7 (256,448,3)
00067/0513 7 (256,448,3)
00067/0521 7 (256,448,3)
00068/0111 7 (256,448,3)
00068/0123 7 (256,448,3)
00068/0126 7 (256,448,3)
00068/0129 7 (256,448,3)
00068/0270 7 (256,448,3)
00068/0330 7 (256,448,3)
00068/0407 7 (256,448,3)
00068/0428 7 (256,448,3)
00068/0544 7 (256,448,3)
00068/0635 7 (256,448,3)
00068/0637 7 (256,448,3)
00068/0736 7 (256,448,3)
00068/0738 7 (256,448,3)
00068/0747 7 (256,448,3)
00068/0748 7 (256,448,3)
00068/0749 7 (256,448,3)
00068/0762 7 (256,448,3)
00068/0815 7 (256,448,3)
00068/0981 7 (256,448,3)
00068/0982 7 (256,448,3)
00069/0187 7 (256,448,3)
00069/0191 7 (256,448,3)
00070/0001 7 (256,448,3)
00070/0003 7 (256,448,3)
00070/0340 7 (256,448,3)
00070/0341 7 (256,448,3)
00070/0342 7 (256,448,3)
00070/0347 7 (256,448,3)
00070/0372 7 (256,448,3)
00070/0383 7 (256,448,3)
00070/0389 7 (256,448,3)
00070/0728 7 (256,448,3)
00070/0813 7 (256,448,3)
00070/0814 7 (256,448,3)
00070/0823 7 (256,448,3)
00070/0840 7 (256,448,3)
00070/0843 7 (256,448,3)
00070/0861 7 (256,448,3)
00071/0111 7 (256,448,3)
00071/0138 7 (256,448,3)
00071/0143 7 (256,448,3)
00071/0150 7 (256,448,3)
00071/0508 7 (256,448,3)
00071/0514 7 (256,448,3)
00071/0550 7 (256,448,3)
00071/0556 7 (256,448,3)
00071/0600 7 (256,448,3)
00071/0665 7 (256,448,3)
00071/0670 7 (256,448,3)
00071/0672 7 (256,448,3)
00071/0673 7 (256,448,3)
00071/0705 7 (256,448,3)
00071/0706 7 (256,448,3)
00071/0707 7 (256,448,3)
00071/0774 7 (256,448,3)
00071/0799 7 (256,448,3)
00071/0814 7 (256,448,3)
00071/0816 7 (256,448,3)
00071/0819 7 (256,448,3)
00071/0823 7 (256,448,3)
00071/0828 7 (256,448,3)
00071/0830 7 (256,448,3)
00071/0839 7 (256,448,3)
00071/0841 7 (256,448,3)
00072/0192 7 (256,448,3)
00072/0194 7 (256,448,3)
00072/0197 7 (256,448,3)
00072/0199 7 (256,448,3)
00072/0285 7 (256,448,3)
00072/0586 7 (256,448,3)
00072/0795 7 (256,448,3)
00072/0811 7 (256,448,3)
00072/0812 7 (256,448,3)
00072/0824 7 (256,448,3)
00072/0831 7 (256,448,3)
00072/0835 7 (256,448,3)
00072/0837 7 (256,448,3)
00072/0841 7 (256,448,3)
00072/0962 7 (256,448,3)
00073/0296 7 (256,448,3)
00073/0299 7 (256,448,3)
00073/0300 7 (256,448,3)
00073/0301 7 (256,448,3)
00073/0427 7 (256,448,3)
00073/0428 7 (256,448,3)
00073/0494 7 (256,448,3)
00073/0615 7 (256,448,3)
00073/0620 7 (256,448,3)
00073/0624 7 (256,448,3)
00073/0979 7 (256,448,3)
00074/0226 7 (256,448,3)
00074/0250 7 (256,448,3)
00074/0284 7 (256,448,3)
00074/0503 7 (256,448,3)
00074/0614 7 (256,448,3)
00074/0629 7 (256,448,3)
00074/0762 7 (256,448,3)
00074/0765 7 (256,448,3)
00074/0900 7 (256,448,3)
00074/0908 7 (256,448,3)
00075/0352 7 (256,448,3)
00075/0360 7 (256,448,3)
00075/0361 7 (256,448,3)
00075/0365 7 (256,448,3)
00075/0383 7 (256,448,3)
00075/0384 7 (256,448,3)
00075/0386 7 (256,448,3)
00075/0407 7 (256,448,3)
00075/0410 7 (256,448,3)
00075/0412 7 (256,448,3)
00075/0413 7 (256,448,3)
00075/0459 7 (256,448,3)
00075/0504 7 (256,448,3)
00075/0515 7 (256,448,3)
00075/0518 7 (256,448,3)
00075/0567 7 (256,448,3)
00075/0681 7 (256,448,3)
00075/0693 7 (256,448,3)
00075/0728 7 (256,448,3)
00075/0731 7 (256,448,3)
00075/0804 7 (256,448,3)
00075/0974 7 (256,448,3)
00075/0975 7 (256,448,3)
00075/0983 7 (256,448,3)
00075/0997 7 (256,448,3)
00076/0006 7 (256,448,3)
00076/0007 7 (256,448,3)
00076/0011 7 (256,448,3)
00076/0013 7 (256,448,3)
00076/0014 7 (256,448,3)
00076/0027 7 (256,448,3)
00076/0029 7 (256,448,3)
00076/0037 7 (256,448,3)
00076/0041 7 (256,448,3)
00076/0055 7 (256,448,3)
00076/0071 7 (256,448,3)
00076/0172 7 (256,448,3)
00076/0275 7 (256,448,3)
00076/0286 7 (256,448,3)
00076/0467 7 (256,448,3)
00076/0481 7 (256,448,3)
00076/0527 7 (256,448,3)
00076/0895 7 (256,448,3)
00076/0896 7 (256,448,3)
00076/0906 7 (256,448,3)
00076/0924 7 (256,448,3)
00076/0964 7 (256,448,3)
00076/0984 7 (256,448,3)
00077/0317 7 (256,448,3)
00077/0322 7 (256,448,3)
00077/0333 7 (256,448,3)
00077/0334 7 (256,448,3)
00077/0480 7 (256,448,3)
00077/0488 7 (256,448,3)
00077/0490 7 (256,448,3)
00077/0582 7 (256,448,3)
00077/0586 7 (256,448,3)
00077/0969 7 (256,448,3)
00078/0007 7 (256,448,3)
00078/0011 7 (256,448,3)
00078/0153 7 (256,448,3)
00078/0289 7 (256,448,3)
00078/0312 7 (256,448,3)
00078/0492 7 (256,448,3)
00078/0580 7 (256,448,3)
00078/0595 7 (256,448,3)
00078/0814 7 (256,448,3)
00078/0950 7 (256,448,3)
00078/0955 7 (256,448,3)
00079/0060 7 (256,448,3)
00079/0067 7 (256,448,3)
00080/0216 7 (256,448,3)
00080/0308 7 (256,448,3)
00080/0504 7 (256,448,3)
00080/0552 7 (256,448,3)
00080/0576 7 (256,448,3)
00080/0583 7 (256,448,3)
00080/0837 7 (256,448,3)
00080/0839 7 (256,448,3)
00080/0871 7 (256,448,3)
00080/0877 7 (256,448,3)
00080/0880 7 (256,448,3)
00080/0969 7 (256,448,3)
00080/0973 7 (256,448,3)
00080/0980 7 (256,448,3)
00081/0202 7 (256,448,3)
00081/0203 7 (256,448,3)
00081/0210 7 (256,448,3)
00081/0268 7 (256,448,3)
00081/0281 7 (256,448,3)
00081/0283 7 (256,448,3)
00081/0317 7 (256,448,3)
00081/0327 7 (256,448,3)
00082/0018 7 (256,448,3)
00082/0025 7 (256,448,3)
00082/0089 7 (256,448,3)
00082/0140 7 (256,448,3)
00082/0442 7 (256,448,3)
00082/0465 7 (256,448,3)
00082/0473 7 (256,448,3)
00082/0481 7 (256,448,3)
00082/0492 7 (256,448,3)
00082/0495 7 (256,448,3)
00082/0497 7 (256,448,3)
00082/0502 7 (256,448,3)
00082/0504 7 (256,448,3)
00082/0506 7 (256,448,3)
00082/0507 7 (256,448,3)
00082/0510 7 (256,448,3)
00082/0519 7 (256,448,3)
00082/0523 7 (256,448,3)
00082/0588 7 (256,448,3)
00082/0597 7 (256,448,3)
00082/0632 7 (256,448,3)
00082/0751 7 (256,448,3)
00082/0767 7 (256,448,3)
00082/0771 7 (256,448,3)
00082/0790 7 (256,448,3)
00082/0804 7 (256,448,3)
00082/0823 7 (256,448,3)
00083/0052 7 (256,448,3)
00083/0056 7 (256,448,3)
00083/0113 7 (256,448,3)
00083/0114 7 (256,448,3)
00083/0122 7 (256,448,3)
00083/0137 7 (256,448,3)
00083/0270 7 (256,448,3)
00083/0295 7 (256,448,3)
00083/0303 7 (256,448,3)
00083/0308 7 (256,448,3)
00083/0586 7 (256,448,3)
00083/0592 7 (256,448,3)
00083/0640 7 (256,448,3)
00083/0648 7 (256,448,3)
00083/0654 7 (256,448,3)
00083/0662 7 (256,448,3)
00083/0666 7 (256,448,3)
00083/0668 7 (256,448,3)
00083/0669 7 (256,448,3)
00083/0675 7 (256,448,3)
00083/0679 7 (256,448,3)
00083/0681 7 (256,448,3)
00083/0682 7 (256,448,3)
00083/0694 7 (256,448,3)
00083/0695 7 (256,448,3)
00083/0697 7 (256,448,3)
00083/0704 7 (256,448,3)
00083/0713 7 (256,448,3)
00083/0721 7 (256,448,3)
00083/0855 7 (256,448,3)
00084/0109 7 (256,448,3)
00084/0113 7 (256,448,3)
00084/0306 7 (256,448,3)
00084/0442 7 (256,448,3)
00084/0669 7 (256,448,3)
00084/0679 7 (256,448,3)
00084/0685 7 (256,448,3)
00084/0691 7 (256,448,3)
00084/0768 7 (256,448,3)
00084/0817 7 (256,448,3)
00085/0027 7 (256,448,3)
00085/0035 7 (256,448,3)
00085/0038 7 (256,448,3)
00085/0223 7 (256,448,3)
00085/0233 7 (256,448,3)
00085/0281 7 (256,448,3)
00085/0287 7 (256,448,3)
00085/0313 7 (256,448,3)
00085/0521 7 (256,448,3)
00085/0848 7 (256,448,3)
00085/0855 7 (256,448,3)
00085/0865 7 (256,448,3)
00085/0952 7 (256,448,3)
00085/0964 7 (256,448,3)
00085/0973 7 (256,448,3)
00085/0986 7 (256,448,3)
00085/0993 7 (256,448,3)
00086/0070 7 (256,448,3)
00086/0075 7 (256,448,3)
00086/0094 7 (256,448,3)
00086/0103 7 (256,448,3)
00086/0112 7 (256,448,3)
00086/0288 7 (256,448,3)
00086/0576 7 (256,448,3)
00086/0580 7 (256,448,3)
00086/0584 7 (256,448,3)
00086/0599 7 (256,448,3)
00086/0600 7 (256,448,3)
00086/0602 7 (256,448,3)
00086/0612 7 (256,448,3)
00086/0629 7 (256,448,3)
00086/0655 7 (256,448,3)
00086/0679 7 (256,448,3)
00086/0694 7 (256,448,3)
00086/0695 7 (256,448,3)
00086/0701 7 (256,448,3)
00086/0760 7 (256,448,3)
00086/0786 7 (256,448,3)
00086/0845 7 (256,448,3)
00086/0868 7 (256,448,3)
00086/0889 7 (256,448,3)
00086/0891 7 (256,448,3)
00086/0927 7 (256,448,3)
00086/0938 7 (256,448,3)
00086/0946 7 (256,448,3)
00086/0963 7 (256,448,3)
00086/0969 7 (256,448,3)
00087/0023 7 (256,448,3)
00087/0029 7 (256,448,3)
00087/0144 7 (256,448,3)
00087/0148 7 (256,448,3)
00087/0159 7 (256,448,3)
00087/0174 7 (256,448,3)
00087/0283 7 (256,448,3)
00087/0284 7 (256,448,3)
00087/0294 7 (256,448,3)
00087/0296 7 (256,448,3)
00087/0498 7 (256,448,3)
00087/0502 7 (256,448,3)
00087/0532 7 (256,448,3)
00087/0557 7 (256,448,3)
00087/0559 7 (256,448,3)
00087/0574 7 (256,448,3)
00087/0577 7 (256,448,3)
00088/0006 7 (256,448,3)
00088/0268 7 (256,448,3)
00088/0320 7 (256,448,3)
00088/0412 7 (256,448,3)
00088/0431 7 (256,448,3)
00088/0432 7 (256,448,3)
00088/0465 7 (256,448,3)
00088/0507 7 (256,448,3)
00088/0565 7 (256,448,3)
00088/0629 7 (256,448,3)
00088/0831 7 (256,448,3)
00088/0836 7 (256,448,3)
00088/0972 7 (256,448,3)
00088/0974 7 (256,448,3)
00088/0980 7 (256,448,3)
00089/0067 7 (256,448,3)
00089/0244 7 (256,448,3)
00089/0404 7 (256,448,3)
00089/0416 7 (256,448,3)
00089/0419 7 (256,448,3)
00089/0428 7 (256,448,3)
00089/0712 7 (256,448,3)
00089/0713 7 (256,448,3)
00089/0723 7 (256,448,3)
00089/0727 7 (256,448,3)
00089/0770 7 (256,448,3)
00089/0809 7 (256,448,3)
00089/0811 7 (256,448,3)
00089/0888 7 (256,448,3)
00089/0898 7 (256,448,3)
00089/0903 7 (256,448,3)
00089/0907 7 (256,448,3)
00089/0911 7 (256,448,3)
00089/0915 7 (256,448,3)
00089/0926 7 (256,448,3)
00089/0955 7 (256,448,3)
00090/0027 7 (256,448,3)
00090/0028 7 (256,448,3)
00090/0032 7 (256,448,3)
00090/0038 7 (256,448,3)
00090/0076 7 (256,448,3)
00090/0081 7 (256,448,3)
00090/0086 7 (256,448,3)
00090/0119 7 (256,448,3)
00090/0258 7 (256,448,3)
00090/0261 7 (256,448,3)
00090/0447 7 (256,448,3)
00090/0498 7 (256,448,3)
00090/0514 7 (256,448,3)
00090/0523 7 (256,448,3)
00090/0530 7 (256,448,3)
00090/0540 7 (256,448,3)
00090/0548 7 (256,448,3)
00090/0565 7 (256,448,3)
00090/0578 7 (256,448,3)
00090/0580 7 (256,448,3)
00090/0581 7 (256,448,3)
00090/0780 7 (256,448,3)
00090/0940 7 (256,448,3)
00090/0984 7 (256,448,3)
00091/0023 7 (256,448,3)
00091/0051 7 (256,448,3)
00091/0317 7 (256,448,3)
00091/0320 7 (256,448,3)
00091/0582 7 (256,448,3)
00091/0585 7 (256,448,3)
00091/0588 7 (256,448,3)
00091/0601 7 (256,448,3)
00091/0602 7 (256,448,3)
00091/0603 7 (256,448,3)
00091/0634 7 (256,448,3)
00091/0693 7 (256,448,3)
00091/0741 7 (256,448,3)
00091/0966 7 (256,448,3)
00091/0973 7 (256,448,3)
00091/0985 7 (256,448,3)
00092/0007 7 (256,448,3)
00092/0132 7 (256,448,3)
00092/0270 7 (256,448,3)
00092/0296 7 (256,448,3)
00092/0611 7 (256,448,3)
00092/0625 7 (256,448,3)
00092/0627 7 (256,448,3)
00092/0651 7 (256,448,3)
00092/0652 7 (256,448,3)
00092/0910 7 (256,448,3)
00093/0075 7 (256,448,3)
00093/0078 7 (256,448,3)
00093/0100 7 (256,448,3)
00093/0132 7 (256,448,3)
00093/0133 7 (256,448,3)
00093/0176 7 (256,448,3)
00093/0177 7 (256,448,3)
00093/0178 7 (256,448,3)
00093/0181 7 (256,448,3)
00093/0183 7 (256,448,3)
00093/0184 7 (256,448,3)
00093/0286 7 (256,448,3)
00093/0304 7 (256,448,3)
00093/0305 7 (256,448,3)
00093/0319 7 (256,448,3)
00093/0324 7 (256,448,3)
00093/0325 7 (256,448,3)
00093/0327 7 (256,448,3)
00093/0331 7 (256,448,3)
00093/0444 7 (256,448,3)
00093/0450 7 (256,448,3)
00093/0593 7 (256,448,3)
00094/0032 7 (256,448,3)
00094/0057 7 (256,448,3)
00094/0139 7 (256,448,3)
00094/0206 7 (256,448,3)
00094/0211 7 (256,448,3)
00094/0215 7 (256,448,3)
00094/0218 7 (256,448,3)
00094/0257 7 (256,448,3)
00094/0329 7 (256,448,3)
00094/0331 7 (256,448,3)
00094/0332 7 (256,448,3)
00094/0369 7 (256,448,3)
00094/0370 7 (256,448,3)
00094/0383 7 (256,448,3)
00094/0385 7 (256,448,3)
00094/0387 7 (256,448,3)
00094/0399 7 (256,448,3)
00094/0605 7 (256,448,3)
00094/0648 7 (256,448,3)
00094/0649 7 (256,448,3)
00094/0759 7 (256,448,3)
00094/0800 7 (256,448,3)
00094/0894 7 (256,448,3)
00094/0896 7 (256,448,3)
00095/0089 7 (256,448,3)
00095/0108 7 (256,448,3)
00095/0109 7 (256,448,3)
00095/0114 7 (256,448,3)
00095/0128 7 (256,448,3)
00095/0133 7 (256,448,3)
00095/0150 7 (256,448,3)
00095/0153 7 (256,448,3)
00095/0154 7 (256,448,3)
00095/0196 7 (256,448,3)
00095/0209 7 (256,448,3)
00095/0228 7 (256,448,3)
00095/0230 7 (256,448,3)
00095/0231 7 (256,448,3)
00095/0242 7 (256,448,3)
00095/0243 7 (256,448,3)
00095/0253 7 (256,448,3)
00095/0280 7 (256,448,3)
00095/0281 7 (256,448,3)
00095/0283 7 (256,448,3)
00095/0314 7 (256,448,3)
00095/0868 7 (256,448,3)
00095/0894 7 (256,448,3)
00096/0062 7 (256,448,3)
00096/0347 7 (256,448,3)
00096/0348 7 (256,448,3)
00096/0359 7 (256,448,3)
00096/0363 7 (256,448,3)
00096/0373 7 (256,448,3)
00096/0378 7 (256,448,3)
00096/0387 7 (256,448,3)
00096/0395 7 (256,448,3)
00096/0396 7 (256,448,3)
00096/0404 7 (256,448,3)
00096/0653 7 (256,448,3)
00096/0668 7 (256,448,3)
00096/0679 7 (256,448,3)
00096/0729 7 (256,448,3)
00096/0736 7 (256,448,3)
00096/0823 7 (256,448,3)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101from torch.utils import data as data
from torchvision.transforms.functional import normalize
from basicsr.data.data_util import paired_paths_from_folder, paired_paths_from_lmdb, paired_paths_from_meta_info_file
from basicsr.data.transforms import augment, paired_random_crop
from basicsr.utils import FileClient, imfrombytes, img2tensor
from basicsr.utils.registry import DATASET_REGISTRY
@DATASET_REGISTRY.register()
class PairedImageDataset(data.Dataset):
"""Paired image dataset for image restoration.
Read LQ (Low Quality, e.g. LR (Low Resolution), blurry, noisy, etc) and
GT image pairs.
There are three modes:
1. 'lmdb': Use lmdb files.
If opt['io_backend'] == lmdb.
2. 'meta_info_file': Use meta information file to generate paths.
If opt['io_backend'] != lmdb and opt['meta_info_file'] is not None.
3. 'folder': Scan folders to generate paths.
The rest.
Args:
opt (dict): Config for train datasets. It contains the following keys:
dataroot_gt (str): Data root path for gt.
dataroot_lq (str): Data root path for lq.
meta_info_file (str): Path for meta information file.
io_backend (dict): IO backend type and other kwarg.
filename_tmpl (str): Template for each filename. Note that the
template excludes the file extension. Default: '{}'.
gt_size (int): Cropped patched size for gt patches.
use_flip (bool): Use horizontal flips.
use_rot (bool): Use rotation (use vertical flip and transposing h
and w for implementation).
scale (bool): Scale, which will be added automatically.
phase (str): 'train' or 'val'.
"""
def __init__(self, opt):
super(PairedImageDataset, self).__init__()
self.opt = opt
# file client (io backend)
self.file_client = None
self.io_backend_opt = opt['io_backend']
self.mean = opt['mean'] if 'mean' in opt else None
self.std = opt['std'] if 'std' in opt else None
self.gt_folder, self.lq_folder = opt['dataroot_gt'], opt['dataroot_lq']
if 'filename_tmpl' in opt:
self.filename_tmpl = opt['filename_tmpl']
else:
self.filename_tmpl = '{}'
if self.io_backend_opt['type'] == 'lmdb':
self.io_backend_opt['db_paths'] = [self.lq_folder, self.gt_folder]
self.io_backend_opt['client_keys'] = ['lq', 'gt']
self.paths = paired_paths_from_lmdb([self.lq_folder, self.gt_folder], ['lq', 'gt'])
elif 'meta_info_file' in self.opt and self.opt['meta_info_file'] is not None:
self.paths = paired_paths_from_meta_info_file([self.lq_folder, self.gt_folder], ['lq', 'gt'],
self.opt['meta_info_file'], self.filename_tmpl)
else:
self.paths = paired_paths_from_folder([self.lq_folder, self.gt_folder], ['lq', 'gt'], self.filename_tmpl)
def __getitem__(self, index):
if self.file_client is None:
self.file_client = FileClient(self.io_backend_opt.pop('type'), **self.io_backend_opt)
scale = self.opt['scale']
# Load gt and lq images. Dimension order: HWC; channel order: BGR;
# image range: [0, 1], float32.
gt_path = self.paths[index]['gt_path']
img_bytes = self.file_client.get(gt_path, 'gt')
img_gt = imfrombytes(img_bytes, float32=True)
lq_path = self.paths[index]['lq_path']
img_bytes = self.file_client.get(lq_path, 'lq')
img_lq = imfrombytes(img_bytes, float32=True)
# augmentation for training
if self.opt['phase'] == 'train':
gt_size = self.opt['gt_size']
# random crop
img_gt, img_lq = paired_random_crop(img_gt, img_lq, gt_size, scale, gt_path)
# flip, rotation
img_gt, img_lq = augment([img_gt, img_lq], self.opt['use_flip'], self.opt['use_rot'])
# TODO: color space transform
# BGR to RGB, HWC to CHW, numpy to tensor
img_gt, img_lq = img2tensor([img_gt, img_lq], bgr2rgb=True, float32=True)
# normalize
if self.mean is not None or self.std is not None:
normalize(img_lq, self.mean, self.std, inplace=True)
normalize(img_gt, self.mean, self.std, inplace=True)
return {'lq': img_lq, 'gt': img_gt, 'lq_path': lq_path, 'gt_path': gt_path}
def __len__(self):
return len(self.paths)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125import queue as Queue
import threading
import torch
from torch.utils.data import DataLoader
class PrefetchGenerator(threading.Thread):
"""A general prefetch generator.
Ref:
https://stackoverflow.com/questions/7323664/python-generator-pre-fetch
Args:
generator: Python generator.
num_prefetch_queue (int): Number of prefetch queue.
"""
def __init__(self, generator, num_prefetch_queue):
threading.Thread.__init__(self)
self.queue = Queue.Queue(num_prefetch_queue)
self.generator = generator
self.daemon = True
self.start()
def run(self):
for item in self.generator:
self.queue.put(item)
self.queue.put(None)
def __next__(self):
next_item = self.queue.get()
if next_item is None:
raise StopIteration
return next_item
def __iter__(self):
return self
class PrefetchDataLoader(DataLoader):
"""Prefetch version of dataloader.
Ref:
https://github.com/IgorSusmelj/pytorch-styleguide/issues/5#
TODO:
Need to test on single gpu and ddp (multi-gpu). There is a known issue in
ddp.
Args:
num_prefetch_queue (int): Number of prefetch queue.
kwargs (dict): Other arguments for dataloader.
"""
def __init__(self, num_prefetch_queue, **kwargs):
self.num_prefetch_queue = num_prefetch_queue
super(PrefetchDataLoader, self).__init__(**kwargs)
def __iter__(self):
return PrefetchGenerator(super().__iter__(), self.num_prefetch_queue)
class CPUPrefetcher():
"""CPU prefetcher.
Args:
loader: Dataloader.
"""
def __init__(self, loader):
self.ori_loader = loader
self.loader = iter(loader)
def next(self):
try:
return next(self.loader)
except StopIteration:
return None
def reset(self):
self.loader = iter(self.ori_loader)
class CUDAPrefetcher():
"""CUDA prefetcher.
Ref:
https://github.com/NVIDIA/apex/issues/304#
It may consums more GPU memory.
Args:
loader: Dataloader.
opt (dict): Options.
"""
def __init__(self, loader, opt):
self.ori_loader = loader
self.loader = iter(loader)
self.opt = opt
self.stream = torch.cuda.Stream()
self.device = torch.device('cuda' if opt['num_gpu'] != 0 else 'cpu')
self.preload()
def preload(self):
try:
self.batch = next(self.loader) # self.batch is a dict
except StopIteration:
self.batch = None
return None
# put tensors to gpu
with torch.cuda.stream(self.stream):
for k, v in self.batch.items():
if torch.is_tensor(v):
self.batch[k] = self.batch[k].to(device=self.device, non_blocking=True)
def next(self):
torch.cuda.current_stream().wait_stream(self.stream)
batch = self.batch
self.preload()
return batch
def reset(self):
self.loader = iter(self.ori_loader)
self.preload()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209import numpy as np
import random
import torch
from pathlib import Path
from torch.utils import data as data
from basicsr.data.transforms import augment, paired_random_crop
from basicsr.utils import FileClient, get_root_logger, imfrombytes, img2tensor
from basicsr.utils.flow_util import dequantize_flow
from basicsr.utils.registry import DATASET_REGISTRY
@DATASET_REGISTRY.register()
class REDSDataset(data.Dataset):
"""REDS dataset for training.
The keys are generated from a meta info txt file.
basicsr/data/meta_info/meta_info_REDS_GT.txt
Each line contains:
1. subfolder (clip) name; 2. frame number; 3. image shape, seperated by
a white space.
Examples:
000 100 (720,1280,3)
001 100 (720,1280,3)
...
Key examples: "000/00000000"
GT (gt): Ground-Truth;
LQ (lq): Low-Quality, e.g., low-resolution/blurry/noisy/compressed frames.
Args:
opt (dict): Config for train dataset. It contains the following keys:
dataroot_gt (str): Data root path for gt.
dataroot_lq (str): Data root path for lq.
dataroot_flow (str, optional): Data root path for flow.
meta_info_file (str): Path for meta information file.
val_partition (str): Validation partition types. 'REDS4' or
'official'.
io_backend (dict): IO backend type and other kwarg.
num_frame (int): Window size for input frames.
gt_size (int): Cropped patched size for gt patches.
interval_list (list): Interval list for temporal augmentation.
random_reverse (bool): Random reverse input frames.
use_flip (bool): Use horizontal flips.
use_rot (bool): Use rotation (use vertical flip and transposing h
and w for implementation).
scale (bool): Scale, which will be added automatically.
"""
def __init__(self, opt):
super(REDSDataset, self).__init__()
self.opt = opt
self.gt_root, self.lq_root = Path(opt['dataroot_gt']), Path(opt['dataroot_lq'])
self.flow_root = Path(opt['dataroot_flow']) if opt['dataroot_flow'] is not None else None
assert opt['num_frame'] % 2 == 1, (f'num_frame should be odd number, but got {opt["num_frame"]}')
self.num_frame = opt['num_frame']
self.num_half_frames = opt['num_frame'] // 2
self.keys = []
with open(opt['meta_info_file'], 'r') as fin:
for line in fin:
folder, frame_num, _ = line.split(' ')
self.keys.extend([f'{folder}/{i:08d}' for i in range(int(frame_num))])
# remove the video clips used in validation
if opt['val_partition'] == 'REDS4':
val_partition = ['000', '011', '015', '020']
elif opt['val_partition'] == 'official':
val_partition = [f'{v:03d}' for v in range(240, 270)]
else:
raise ValueError(f'Wrong validation partition {opt["val_partition"]}.'
f"Supported ones are ['official', 'REDS4'].")
self.keys = [v for v in self.keys if v.split('/')[0] not in val_partition]
# file client (io backend)
self.file_client = None
self.io_backend_opt = opt['io_backend']
self.is_lmdb = False
if self.io_backend_opt['type'] == 'lmdb':
self.is_lmdb = True
if self.flow_root is not None:
self.io_backend_opt['db_paths'] = [self.lq_root, self.gt_root, self.flow_root]
self.io_backend_opt['client_keys'] = ['lq', 'gt', 'flow']
else:
self.io_backend_opt['db_paths'] = [self.lq_root, self.gt_root]
self.io_backend_opt['client_keys'] = ['lq', 'gt']
# temporal augmentation configs
self.interval_list = opt['interval_list']
self.random_reverse = opt['random_reverse']
interval_str = ','.join(str(x) for x in opt['interval_list'])
logger = get_root_logger()
logger.info(f'Temporal augmentation interval list: [{interval_str}]; '
f'random reverse is {self.random_reverse}.')
def __getitem__(self, index):
if self.file_client is None:
self.file_client = FileClient(self.io_backend_opt.pop('type'), **self.io_backend_opt)
scale = self.opt['scale']
gt_size = self.opt['gt_size']
key = self.keys[index]
clip_name, frame_name = key.split('/') # key example: 000/00000000
center_frame_idx = int(frame_name)
# determine the neighboring frames
interval = random.choice(self.interval_list)
# ensure not exceeding the borders
start_frame_idx = center_frame_idx - self.num_half_frames * interval
end_frame_idx = center_frame_idx + self.num_half_frames * interval
# each clip has 100 frames starting from 0 to 99
while (start_frame_idx < 0) or (end_frame_idx > 99):
center_frame_idx = random.randint(0, 99)
start_frame_idx = (center_frame_idx - self.num_half_frames * interval)
end_frame_idx = center_frame_idx + self.num_half_frames * interval
frame_name = f'{center_frame_idx:08d}'
neighbor_list = list(range(start_frame_idx, end_frame_idx + 1, interval))
# random reverse
if self.random_reverse and random.random() < 0.5:
neighbor_list.reverse()
assert len(neighbor_list) == self.num_frame, (f'Wrong length of neighbor list: {len(neighbor_list)}')
# get the GT frame (as the center frame)
if self.is_lmdb:
img_gt_path = f'{clip_name}/{frame_name}'
else:
img_gt_path = self.gt_root / clip_name / f'{frame_name}.png'
img_bytes = self.file_client.get(img_gt_path, 'gt')
img_gt = imfrombytes(img_bytes, float32=True)
# get the neighboring LQ frames
img_lqs = []
for neighbor in neighbor_list:
if self.is_lmdb:
img_lq_path = f'{clip_name}/{neighbor:08d}'
else:
img_lq_path = self.lq_root / clip_name / f'{neighbor:08d}.png'
img_bytes = self.file_client.get(img_lq_path, 'lq')
img_lq = imfrombytes(img_bytes, float32=True)
img_lqs.append(img_lq)
# get flows
if self.flow_root is not None:
img_flows = []
# read previous flows
for i in range(self.num_half_frames, 0, -1):
if self.is_lmdb:
flow_path = f'{clip_name}/{frame_name}_p{i}'
else:
flow_path = (self.flow_root / clip_name / f'{frame_name}_p{i}.png')
img_bytes = self.file_client.get(flow_path, 'flow')
cat_flow = imfrombytes(img_bytes, flag='grayscale', float32=False) # uint8, [0, 255]
dx, dy = np.split(cat_flow, 2, axis=0)
flow = dequantize_flow(dx, dy, max_val=20, denorm=False) # we use max_val 20 here.
img_flows.append(flow)
# read next flows
for i in range(1, self.num_half_frames + 1):
if self.is_lmdb:
flow_path = f'{clip_name}/{frame_name}_n{i}'
else:
flow_path = (self.flow_root / clip_name / f'{frame_name}_n{i}.png')
img_bytes = self.file_client.get(flow_path, 'flow')
cat_flow = imfrombytes(img_bytes, flag='grayscale', float32=False) # uint8, [0, 255]
dx, dy = np.split(cat_flow, 2, axis=0)
flow = dequantize_flow(dx, dy, max_val=20, denorm=False) # we use max_val 20 here.
img_flows.append(flow)
# for random crop, here, img_flows and img_lqs have the same
# spatial size
img_lqs.extend(img_flows)
# randomly crop
img_gt, img_lqs = paired_random_crop(img_gt, img_lqs, gt_size, scale, img_gt_path)
if self.flow_root is not None:
img_lqs, img_flows = img_lqs[:self.num_frame], img_lqs[self.num_frame:]
# augmentation - flip, rotate
img_lqs.append(img_gt)
if self.flow_root is not None:
img_results, img_flows = augment(img_lqs, self.opt['use_flip'], self.opt['use_rot'], img_flows)
else:
img_results = augment(img_lqs, self.opt['use_flip'], self.opt['use_rot'])
img_results = img2tensor(img_results)
img_lqs = torch.stack(img_results[0:-1], dim=0)
img_gt = img_results[-1]
if self.flow_root is not None:
img_flows = img2tensor(img_flows)
# add the zero center flow
img_flows.insert(self.num_half_frames, torch.zeros_like(img_flows[0]))
img_flows = torch.stack(img_flows, dim=0)
# img_lqs: (t, c, h, w)
# img_flows: (t, 2, h, w)
# img_gt: (c, h, w)
# key: str
if self.flow_root is not None:
return {'lq': img_lqs, 'flow': img_flows, 'gt': img_gt, 'key': key}
else:
return {'lq': img_lqs, 'gt': img_gt, 'key': key}
def __len__(self):
return len(self.keys)1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465from os import path as osp
from torch.utils import data as data
from torchvision.transforms.functional import normalize
from basicsr.data.data_util import paths_from_lmdb
from basicsr.utils import FileClient, imfrombytes, img2tensor, scandir
from basicsr.utils.registry import DATASET_REGISTRY
@DATASET_REGISTRY.register()
class SingleImageDataset(data.Dataset):
"""Read only lq images in the test phase.
Read LQ (Low Quality, e.g. LR (Low Resolution), blurry, noisy, etc).
There are two modes:
1. 'meta_info_file': Use meta information file to generate paths.
2. 'folder': Scan folders to generate paths.
Args:
opt (dict): Config for train datasets. It contains the following keys:
dataroot_lq (str): Data root path for lq.
meta_info_file (str): Path for meta information file.
io_backend (dict): IO backend type and other kwarg.
"""
def __init__(self, opt):
super(SingleImageDataset, self).__init__()
self.opt = opt
# file client (io backend)
self.file_client = None
self.io_backend_opt = opt['io_backend']
self.mean = opt['mean'] if 'mean' in opt else None
self.std = opt['std'] if 'std' in opt else None
self.lq_folder = opt['dataroot_lq']
if self.io_backend_opt['type'] == 'lmdb':
self.io_backend_opt['db_paths'] = [self.lq_folder]
self.io_backend_opt['client_keys'] = ['lq']
self.paths = paths_from_lmdb(self.lq_folder)
elif 'meta_info_file' in self.opt:
with open(self.opt['meta_info_file'], 'r') as fin:
self.paths = [osp.join(self.lq_folder, line.split(' ')[0]) for line in fin]
else:
self.paths = sorted(list(scandir(self.lq_folder, full_path=True)))
def __getitem__(self, index):
if self.file_client is None:
self.file_client = FileClient(self.io_backend_opt.pop('type'), **self.io_backend_opt)
# load lq image
lq_path = self.paths[index]
img_bytes = self.file_client.get(lq_path, 'lq')
img_lq = imfrombytes(img_bytes, float32=True)
# TODO: color space transform
# BGR to RGB, HWC to CHW, numpy to tensor
img_lq = img2tensor(img_lq, bgr2rgb=True, float32=True)
# normalize
if self.mean is not None or self.std is not None:
normalize(img_lq, self.mean, self.std, inplace=True)
return {'lq': img_lq, 'lq_path': lq_path}
def __len__(self):
return len(self.paths)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165import cv2
import random
def mod_crop(img, scale):
"""Mod crop images, used during testing.
Args:
img (ndarray): Input image.
scale (int): Scale factor.
Returns:
ndarray: Result image.
"""
img = img.copy()
if img.ndim in (2, 3):
h, w = img.shape[0], img.shape[1]
h_remainder, w_remainder = h % scale, w % scale
img = img[:h - h_remainder, :w - w_remainder, ...]
else:
raise ValueError(f'Wrong img ndim: {img.ndim}.')
return img
def paired_random_crop(img_gts, img_lqs, gt_patch_size, scale, gt_path):
"""Paired random crop.
It crops lists of lq and gt images with corresponding locations.
Args:
img_gts (list[ndarray] | ndarray): GT images. Note that all images
should have the same shape. If the input is an ndarray, it will
be transformed to a list containing itself.
img_lqs (list[ndarray] | ndarray): LQ images. Note that all images
should have the same shape. If the input is an ndarray, it will
be transformed to a list containing itself.
gt_patch_size (int): GT patch size.
scale (int): Scale factor.
gt_path (str): Path to ground-truth.
Returns:
list[ndarray] | ndarray: GT images and LQ images. If returned results
only have one element, just return ndarray.
"""
if not isinstance(img_gts, list):
img_gts = [img_gts]
if not isinstance(img_lqs, list):
img_lqs = [img_lqs]
h_lq, w_lq, _ = img_lqs[0].shape
h_gt, w_gt, _ = img_gts[0].shape
lq_patch_size = gt_patch_size // scale
if h_gt != h_lq * scale or w_gt != w_lq * scale:
raise ValueError(f'Scale mismatches. GT ({h_gt}, {w_gt}) is not {scale}x ',
f'multiplication of LQ ({h_lq}, {w_lq}).')
if h_lq < lq_patch_size or w_lq < lq_patch_size:
raise ValueError(f'LQ ({h_lq}, {w_lq}) is smaller than patch size '
f'({lq_patch_size}, {lq_patch_size}). '
f'Please remove {gt_path}.')
# randomly choose top and left coordinates for lq patch
top = random.randint(0, h_lq - lq_patch_size)
left = random.randint(0, w_lq - lq_patch_size)
# crop lq patch
img_lqs = [v[top:top + lq_patch_size, left:left + lq_patch_size, ...] for v in img_lqs]
# crop corresponding gt patch
top_gt, left_gt = int(top * scale), int(left * scale)
img_gts = [v[top_gt:top_gt + gt_patch_size, left_gt:left_gt + gt_patch_size, ...] for v in img_gts]
if len(img_gts) == 1:
img_gts = img_gts[0]
if len(img_lqs) == 1:
img_lqs = img_lqs[0]
return img_gts, img_lqs
def augment(imgs, hflip=True, rotation=True, flows=None, return_status=False):
"""Augment: horizontal flips OR rotate (0, 90, 180, 270 degrees).
We use vertical flip and transpose for rotation implementation.
All the images in the list use the same augmentation.
Args:
imgs (list[ndarray] | ndarray): Images to be augmented. If the input
is an ndarray, it will be transformed to a list.
hflip (bool): Horizontal flip. Default: True.
rotation (bool): Ratotation. Default: True.
flows (list[ndarray]: Flows to be augmented. If the input is an
ndarray, it will be transformed to a list.
Dimension is (h, w, 2). Default: None.
return_status (bool): Return the status of flip and rotation.
Default: False.
Returns:
list[ndarray] | ndarray: Augmented images and flows. If returned
results only have one element, just return ndarray.
"""
hflip = hflip and random.random() < 0.5
vflip = rotation and random.random() < 0.5
rot90 = rotation and random.random() < 0.5
def _augment(img):
if hflip: # horizontal
cv2.flip(img, 1, img)
if vflip: # vertical
cv2.flip(img, 0, img)
if rot90:
img = img.transpose(1, 0, 2)
return img
def _augment_flow(flow):
if hflip: # horizontal
cv2.flip(flow, 1, flow)
flow[:, :, 0] *= -1
if vflip: # vertical
cv2.flip(flow, 0, flow)
flow[:, :, 1] *= -1
if rot90:
flow = flow.transpose(1, 0, 2)
flow = flow[:, :, [1, 0]]
return flow
if not isinstance(imgs, list):
imgs = [imgs]
imgs = [_augment(img) for img in imgs]
if len(imgs) == 1:
imgs = imgs[0]
if flows is not None:
if not isinstance(flows, list):
flows = [flows]
flows = [_augment_flow(flow) for flow in flows]
if len(flows) == 1:
flows = flows[0]
return imgs, flows
else:
if return_status:
return imgs, (hflip, vflip, rot90)
else:
return imgs
def img_rotate(img, angle, center=None, scale=1.0):
"""Rotate image.
Args:
img (ndarray): Image to be rotated.
angle (float): Rotation angle in degrees. Positive values mean
counter-clockwise rotation.
center (tuple[int]): Rotation center. If the center is None,
initialize it as the center of the image. Default: None.
scale (float): Isotropic scale factor. Default: 1.0.
"""
(h, w) = img.shape[:2]
if center is None:
center = (w // 2, h // 2)
matrix = cv2.getRotationMatrix2D(center, angle, scale)
rotated_img = cv2.warpAffine(img, matrix, (w, h))
return rotated_img123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287import glob
import torch
from os import path as osp
from torch.utils import data as data
from basicsr.data.data_util import duf_downsample, generate_frame_indices, read_img_seq
from basicsr.utils import get_root_logger, scandir
from basicsr.utils.registry import DATASET_REGISTRY
@DATASET_REGISTRY.register()
class VideoTestDataset(data.Dataset):
"""Video test dataset.
Supported datasets: Vid4, REDS4, REDSofficial.
More generally, it supports testing dataset with following structures:
dataroot
├── subfolder1
├── frame000
├── frame001
├── ...
├── subfolder1
├── frame000
├── frame001
├── ...
├── ...
For testing datasets, there is no need to prepare LMDB files.
Args:
opt (dict): Config for train dataset. It contains the following keys:
dataroot_gt (str): Data root path for gt.
dataroot_lq (str): Data root path for lq.
io_backend (dict): IO backend type and other kwarg.
cache_data (bool): Whether to cache testing datasets.
name (str): Dataset name.
meta_info_file (str): The path to the file storing the list of test
folders. If not provided, all the folders in the dataroot will
be used.
num_frame (int): Window size for input frames.
padding (str): Padding mode.
"""
def __init__(self, opt):
super(VideoTestDataset, self).__init__()
self.opt = opt
self.cache_data = opt['cache_data']
self.gt_root, self.lq_root = opt['dataroot_gt'], opt['dataroot_lq']
self.data_info = {'lq_path': [], 'gt_path': [], 'folder': [], 'idx': [], 'border': []}
# file client (io backend)
self.file_client = None
self.io_backend_opt = opt['io_backend']
assert self.io_backend_opt['type'] != 'lmdb', 'No need to use lmdb during validation/test.'
logger = get_root_logger()
logger.info(f'Generate data info for VideoTestDataset - {opt["name"]}')
self.imgs_lq, self.imgs_gt = {}, {}
if 'meta_info_file' in opt:
with open(opt['meta_info_file'], 'r') as fin:
subfolders = [line.split(' ')[0] for line in fin]
subfolders_lq = [osp.join(self.lq_root, key) for key in subfolders]
subfolders_gt = [osp.join(self.gt_root, key) for key in subfolders]
else:
subfolders_lq = sorted(glob.glob(osp.join(self.lq_root, '*')))
subfolders_gt = sorted(glob.glob(osp.join(self.gt_root, '*')))
if opt['name'].lower() in ['vid4', 'reds4', 'redsofficial']:
for subfolder_lq, subfolder_gt in zip(subfolders_lq, subfolders_gt):
# get frame list for lq and gt
subfolder_name = osp.basename(subfolder_lq)
img_paths_lq = sorted(list(scandir(subfolder_lq, full_path=True)))
img_paths_gt = sorted(list(scandir(subfolder_gt, full_path=True)))
max_idx = len(img_paths_lq)
assert max_idx == len(img_paths_gt), (f'Different number of images in lq ({max_idx})'
f' and gt folders ({len(img_paths_gt)})')
self.data_info['lq_path'].extend(img_paths_lq)
self.data_info['gt_path'].extend(img_paths_gt)
self.data_info['folder'].extend([subfolder_name] * max_idx)
for i in range(max_idx):
self.data_info['idx'].append(f'{i}/{max_idx}')
border_l = [0] * max_idx
for i in range(self.opt['num_frame'] // 2):
border_l[i] = 1
border_l[max_idx - i - 1] = 1
self.data_info['border'].extend(border_l)
# cache data or save the frame list
if self.cache_data:
logger.info(f'Cache {subfolder_name} for VideoTestDataset...')
self.imgs_lq[subfolder_name] = read_img_seq(img_paths_lq)
self.imgs_gt[subfolder_name] = read_img_seq(img_paths_gt)
else:
self.imgs_lq[subfolder_name] = img_paths_lq
self.imgs_gt[subfolder_name] = img_paths_gt
else:
raise ValueError(f'Non-supported video test dataset: {type(opt["name"])}')
def __getitem__(self, index):
folder = self.data_info['folder'][index]
idx, max_idx = self.data_info['idx'][index].split('/')
idx, max_idx = int(idx), int(max_idx)
border = self.data_info['border'][index]
lq_path = self.data_info['lq_path'][index]
select_idx = generate_frame_indices(idx, max_idx, self.opt['num_frame'], padding=self.opt['padding'])
if self.cache_data:
imgs_lq = self.imgs_lq[folder].index_select(0, torch.LongTensor(select_idx))
img_gt = self.imgs_gt[folder][idx]
else:
img_paths_lq = [self.imgs_lq[folder][i] for i in select_idx]
imgs_lq = read_img_seq(img_paths_lq)
img_gt = read_img_seq([self.imgs_gt[folder][idx]])
img_gt.squeeze_(0)
return {
'lq': imgs_lq, # (t, c, h, w)
'gt': img_gt, # (c, h, w)
'folder': folder, # folder name
'idx': self.data_info['idx'][index], # e.g., 0/99
'border': border, # 1 for border, 0 for non-border
'lq_path': lq_path # center frame
}
def __len__(self):
return len(self.data_info['gt_path'])
@DATASET_REGISTRY.register()
class VideoTestVimeo90KDataset(data.Dataset):
"""Video test dataset for Vimeo90k-Test dataset.
It only keeps the center frame for testing.
For testing datasets, there is no need to prepare LMDB files.
Args:
opt (dict): Config for train dataset. It contains the following keys:
dataroot_gt (str): Data root path for gt.
dataroot_lq (str): Data root path for lq.
io_backend (dict): IO backend type and other kwarg.
cache_data (bool): Whether to cache testing datasets.
name (str): Dataset name.
meta_info_file (str): The path to the file storing the list of test
folders. If not provided, all the folders in the dataroot will
be used.
num_frame (int): Window size for input frames.
padding (str): Padding mode.
"""
def __init__(self, opt):
super(VideoTestVimeo90KDataset, self).__init__()
self.opt = opt
self.cache_data = opt['cache_data']
if self.cache_data:
raise NotImplementedError('cache_data in Vimeo90K-Test dataset is not implemented.')
self.gt_root, self.lq_root = opt['dataroot_gt'], opt['dataroot_lq']
self.data_info = {'lq_path': [], 'gt_path': [], 'folder': [], 'idx': [], 'border': []}
neighbor_list = [i + (9 - opt['num_frame']) // 2 for i in range(opt['num_frame'])]
# file client (io backend)
self.file_client = None
self.io_backend_opt = opt['io_backend']
assert self.io_backend_opt['type'] != 'lmdb', 'No need to use lmdb during validation/test.'
logger = get_root_logger()
logger.info(f'Generate data info for VideoTestDataset - {opt["name"]}')
with open(opt['meta_info_file'], 'r') as fin:
subfolders = [line.split(' ')[0] for line in fin]
for idx, subfolder in enumerate(subfolders):
gt_path = osp.join(self.gt_root, subfolder, 'im4.png')
self.data_info['gt_path'].append(gt_path)
lq_paths = [osp.join(self.lq_root, subfolder, f'im{i}.png') for i in neighbor_list]
self.data_info['lq_path'].append(lq_paths)
self.data_info['folder'].append('vimeo90k')
self.data_info['idx'].append(f'{idx}/{len(subfolders)}')
self.data_info['border'].append(0)
def __getitem__(self, index):
lq_path = self.data_info['lq_path'][index]
gt_path = self.data_info['gt_path'][index]
imgs_lq = read_img_seq(lq_path)
img_gt = read_img_seq([gt_path])
img_gt.squeeze_(0)
return {
'lq': imgs_lq, # (t, c, h, w)
'gt': img_gt, # (c, h, w)
'folder': self.data_info['folder'][index], # folder name
'idx': self.data_info['idx'][index], # e.g., 0/843
'border': self.data_info['border'][index], # 0 for non-border
'lq_path': lq_path[self.opt['num_frame'] // 2] # center frame
}
def __len__(self):
return len(self.data_info['gt_path'])
@DATASET_REGISTRY.register()
class VideoTestDUFDataset(VideoTestDataset):
""" Video test dataset for DUF dataset.
Args:
opt (dict): Config for train dataset.
Most of keys are the same as VideoTestDataset.
It has the follwing extra keys:
use_duf_downsampling (bool): Whether to use duf downsampling to
generate low-resolution frames.
scale (bool): Scale, which will be added automatically.
"""
def __getitem__(self, index):
folder = self.data_info['folder'][index]
idx, max_idx = self.data_info['idx'][index].split('/')
idx, max_idx = int(idx), int(max_idx)
border = self.data_info['border'][index]
lq_path = self.data_info['lq_path'][index]
select_idx = generate_frame_indices(idx, max_idx, self.opt['num_frame'], padding=self.opt['padding'])
if self.cache_data:
if self.opt['use_duf_downsampling']:
# read imgs_gt to generate low-resolution frames
imgs_lq = self.imgs_gt[folder].index_select(0, torch.LongTensor(select_idx))
imgs_lq = duf_downsample(imgs_lq, kernel_size=13, scale=self.opt['scale'])
else:
imgs_lq = self.imgs_lq[folder].index_select(0, torch.LongTensor(select_idx))
img_gt = self.imgs_gt[folder][idx]
else:
if self.opt['use_duf_downsampling']:
img_paths_lq = [self.imgs_gt[folder][i] for i in select_idx]
# read imgs_gt to generate low-resolution frames
imgs_lq = read_img_seq(img_paths_lq, require_mod_crop=True, scale=self.opt['scale'])
imgs_lq = duf_downsample(imgs_lq, kernel_size=13, scale=self.opt['scale'])
else:
img_paths_lq = [self.imgs_lq[folder][i] for i in select_idx]
imgs_lq = read_img_seq(img_paths_lq)
img_gt = read_img_seq([self.imgs_gt[folder][idx]], require_mod_crop=True, scale=self.opt['scale'])
img_gt.squeeze_(0)
return {
'lq': imgs_lq, # (t, c, h, w)
'gt': img_gt, # (c, h, w)
'folder': folder, # folder name
'idx': self.data_info['idx'][index], # e.g., 0/99
'border': border, # 1 for border, 0 for non-border
'lq_path': lq_path # center frame
}
@DATASET_REGISTRY.register()
class VideoRecurrentTestDataset(VideoTestDataset):
"""Video test dataset for recurrent architectures, which takes LR video
frames as input and output corresponding HR video frames.
Args:
Same as VideoTestDataset.
Unused opt:
padding (str): Padding mode.
"""
def __init__(self, opt):
super(VideoRecurrentTestDataset, self).__init__(opt)
# Find unique folder strings
self.folders = sorted(list(set(self.data_info['folder'])))
def __getitem__(self, index):
folder = self.folders[index]
if self.cache_data:
imgs_lq = self.imgs_lq[folder]
imgs_gt = self.imgs_gt[folder]
else:
raise NotImplementedError('Without cache_data is not implemented.')
return {
'lq': imgs_lq,
'gt': imgs_gt,
'folder': folder,
}
def __len__(self):
return len(self.folders)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126import random
import torch
from pathlib import Path
from torch.utils import data as data
from basicsr.data.transforms import augment, paired_random_crop
from basicsr.utils import FileClient, get_root_logger, imfrombytes, img2tensor
from basicsr.utils.registry import DATASET_REGISTRY
@DATASET_REGISTRY.register()
class Vimeo90KDataset(data.Dataset):
"""Vimeo90K dataset for training.
The keys are generated from a meta info txt file.
basicsr/data/meta_info/meta_info_Vimeo90K_train_GT.txt
Each line contains:
1. clip name; 2. frame number; 3. image shape, seperated by a white space.
Examples:
00001/0001 7 (256,448,3)
00001/0002 7 (256,448,3)
Key examples: "00001/0001"
GT (gt): Ground-Truth;
LQ (lq): Low-Quality, e.g., low-resolution/blurry/noisy/compressed frames.
The neighboring frame list for different num_frame:
num_frame | frame list
1 | 4
3 | 3,4,5
5 | 2,3,4,5,6
7 | 1,2,3,4,5,6,7
Args:
opt (dict): Config for train dataset. It contains the following keys:
dataroot_gt (str): Data root path for gt.
dataroot_lq (str): Data root path for lq.
meta_info_file (str): Path for meta information file.
io_backend (dict): IO backend type and other kwarg.
num_frame (int): Window size for input frames.
gt_size (int): Cropped patched size for gt patches.
random_reverse (bool): Random reverse input frames.
use_flip (bool): Use horizontal flips.
use_rot (bool): Use rotation (use vertical flip and transposing h
and w for implementation).
scale (bool): Scale, which will be added automatically.
"""
def __init__(self, opt):
super(Vimeo90KDataset, self).__init__()
self.opt = opt
self.gt_root, self.lq_root = Path(opt['dataroot_gt']), Path(opt['dataroot_lq'])
with open(opt['meta_info_file'], 'r') as fin:
self.keys = [line.split(' ')[0] for line in fin]
# file client (io backend)
self.file_client = None
self.io_backend_opt = opt['io_backend']
self.is_lmdb = False
if self.io_backend_opt['type'] == 'lmdb':
self.is_lmdb = True
self.io_backend_opt['db_paths'] = [self.lq_root, self.gt_root]
self.io_backend_opt['client_keys'] = ['lq', 'gt']
# indices of input images
self.neighbor_list = [i + (9 - opt['num_frame']) // 2 for i in range(opt['num_frame'])]
# temporal augmentation configs
self.random_reverse = opt['random_reverse']
logger = get_root_logger()
logger.info(f'Random reverse is {self.random_reverse}.')
def __getitem__(self, index):
if self.file_client is None:
self.file_client = FileClient(self.io_backend_opt.pop('type'), **self.io_backend_opt)
# random reverse
if self.random_reverse and random.random() < 0.5:
self.neighbor_list.reverse()
scale = self.opt['scale']
gt_size = self.opt['gt_size']
key = self.keys[index]
clip, seq = key.split('/') # key example: 00001/0001
# get the GT frame (im4.png)
if self.is_lmdb:
img_gt_path = f'{key}/im4'
else:
img_gt_path = self.gt_root / clip / seq / 'im4.png'
img_bytes = self.file_client.get(img_gt_path, 'gt')
img_gt = imfrombytes(img_bytes, float32=True)
# get the neighboring LQ frames
img_lqs = []
for neighbor in self.neighbor_list:
if self.is_lmdb:
img_lq_path = f'{clip}/{seq}/im{neighbor}'
else:
img_lq_path = self.lq_root / clip / seq / f'im{neighbor}.png'
img_bytes = self.file_client.get(img_lq_path, 'lq')
img_lq = imfrombytes(img_bytes, float32=True)
img_lqs.append(img_lq)
# randomly crop
img_gt, img_lqs = paired_random_crop(img_gt, img_lqs, gt_size, scale, img_gt_path)
# augmentation - flip, rotate
img_lqs.append(img_gt)
img_results = augment(img_lqs, self.opt['use_flip'], self.opt['use_rot'])
img_results = img2tensor(img_results)
img_lqs = torch.stack(img_results[0:-1], dim=0)
img_gt = img_results[-1]
# img_lqs: (t, c, h, w)
# img_gt: (c, h, w)
# key: str
return {'lq': img_lqs, 'gt': img_gt, 'key': key}
def __len__(self):
return len(self.keys)1234567891011121314151617181920212223242526from copy import deepcopy
from basicsr.utils import get_root_logger
from basicsr.utils.registry import LOSS_REGISTRY
from .losses import (CharbonnierLoss, GANLoss, L1Loss, MSELoss, PerceptualLoss, WeightedTVLoss, g_path_regularize,
gradient_penalty_loss, r1_penalty)
__all__ = [
'L1Loss', 'MSELoss', 'CharbonnierLoss', 'WeightedTVLoss', 'PerceptualLoss', 'GANLoss', 'gradient_penalty_loss',
'r1_penalty', 'g_path_regularize'
]
def build_loss(opt):
"""Build loss from options.
Args:
opt (dict): Configuration. It must constain:
type (str): Model type.
"""
opt = deepcopy(opt)
loss_type = opt.pop('type')
loss = LOSS_REGISTRY.get(loss_type)(**opt)
logger = get_root_logger()
logger.info(f'Loss [{loss.__class__.__name__}] is created.')
return loss1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495import functools
from torch.nn import 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: Reduced loss tensor.
"""
reduction_enum = F._Reduction.get_enum(reduction)
# none: 0, elementwise_mean:1, sum: 2
if reduction_enum == 0:
return loss
elif reduction_enum == 1:
return loss.mean()
else:
return loss.sum()
def weight_reduce_loss(loss, weight=None, reduction='mean'):
"""Apply element-wise weight and reduce loss.
Args:
loss (Tensor): Element-wise loss.
weight (Tensor): Element-wise weights. Default: None.
reduction (str): Same as built-in losses of PyTorch. Options are
'none', 'mean' and 'sum'. Default: 'mean'.
Returns:
Tensor: Loss values.
"""
# if weight is specified, apply element-wise weight
if weight is not None:
assert weight.dim() == loss.dim()
assert weight.size(1) == 1 or weight.size(1) == loss.size(1)
loss = loss * weight
# if weight is not specified or reduction is sum, just reduce the loss
if weight is None or reduction == 'sum':
loss = reduce_loss(loss, reduction)
# if reduction is mean, then compute mean over weight region
elif reduction == 'mean':
if weight.size(1) > 1:
weight = weight.sum()
else:
weight = weight.sum() * loss.size(1)
loss = loss.sum() / weight
return loss
def weighted_loss(loss_func):
"""Create a weighted version of a given loss function.
To use this decorator, the loss function must have the signature like
`loss_func(pred, target, **kwargs)`. The function only needs to compute
element-wise loss without any reduction. This decorator will add weight
and reduction arguments to the function. The decorated function will have
the signature like `loss_func(pred, target, weight=None, reduction='mean',
**kwargs)`.
:Example:
>>> import torch
>>> @weighted_loss
>>> def l1_loss(pred, target):
>>> return (pred - target).abs()
>>> pred = torch.Tensor([0, 2, 3])
>>> target = torch.Tensor([1, 1, 1])
>>> weight = torch.Tensor([1, 0, 1])
>>> l1_loss(pred, target)
tensor(1.3333)
>>> l1_loss(pred, target, weight)
tensor(1.5000)
>>> l1_loss(pred, target, reduction='none')
tensor([1., 1., 2.])
>>> l1_loss(pred, target, weight, reduction='sum')
tensor(3.)
"""
@functools.wraps(loss_func)
def wrapper(pred, target, weight=None, reduction='mean', **kwargs):
# get element-wise loss
loss = loss_func(pred, target, **kwargs)
loss = weight_reduce_loss(loss, weight, reduction)
return loss
return wrapper123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423import math
import torch
from torch import autograd as autograd
from torch import nn as nn
from torch.nn import functional as F
from basicsr.archs.vgg_arch import VGGFeatureExtractor
from basicsr.utils.registry import LOSS_REGISTRY
from .loss_util import weighted_loss
_reduction_modes = ['none', 'mean', 'sum']
@weighted_loss
def l1_loss(pred, target):
return F.l1_loss(pred, target, reduction='none')
@weighted_loss
def mse_loss(pred, target):
return F.mse_loss(pred, target, reduction='none')
@weighted_loss
def charbonnier_loss(pred, target, eps=1e-12):
return torch.sqrt((pred - target)**2 + eps)
@LOSS_REGISTRY.register()
class L1Loss(nn.Module):
"""L1 (mean absolute error, MAE) loss.
Args:
loss_weight (float): Loss weight for L1 loss. Default: 1.0.
reduction (str): Specifies the reduction to apply to the output.
Supported choices are 'none' | 'mean' | 'sum'. Default: 'mean'.
"""
def __init__(self, loss_weight=1.0, reduction='mean'):
super(L1Loss, self).__init__()
if reduction not in ['none', 'mean', 'sum']:
raise ValueError(f'Unsupported reduction mode: {reduction}. ' f'Supported ones are: {_reduction_modes}')
self.loss_weight = loss_weight
self.reduction = reduction
def forward(self, pred, target, weight=None, **kwargs):
"""
Args:
pred (Tensor): of shape (N, C, H, W). Predicted tensor.
target (Tensor): of shape (N, C, H, W). Ground truth tensor.
weight (Tensor, optional): of shape (N, C, H, W). Element-wise
weights. Default: None.
"""
return self.loss_weight * l1_loss(pred, target, weight, reduction=self.reduction)
@LOSS_REGISTRY.register()
class MSELoss(nn.Module):
"""MSE (L2) loss.
Args:
loss_weight (float): Loss weight for MSE loss. Default: 1.0.
reduction (str): Specifies the reduction to apply to the output.
Supported choices are 'none' | 'mean' | 'sum'. Default: 'mean'.
"""
def __init__(self, loss_weight=1.0, reduction='mean'):
super(MSELoss, self).__init__()
if reduction not in ['none', 'mean', 'sum']:
raise ValueError(f'Unsupported reduction mode: {reduction}. ' f'Supported ones are: {_reduction_modes}')
self.loss_weight = loss_weight
self.reduction = reduction
def forward(self, pred, target, weight=None, **kwargs):
"""
Args:
pred (Tensor): of shape (N, C, H, W). Predicted tensor.
target (Tensor): of shape (N, C, H, W). Ground truth tensor.
weight (Tensor, optional): of shape (N, C, H, W). Element-wise
weights. Default: None.
"""
return self.loss_weight * mse_loss(pred, target, weight, reduction=self.reduction)
@LOSS_REGISTRY.register()
class CharbonnierLoss(nn.Module):
"""Charbonnier loss (one variant of Robust L1Loss, a differentiable
variant of L1Loss).
Described in "Deep Laplacian Pyramid Networks for Fast and Accurate
Super-Resolution".
Args:
loss_weight (float): Loss weight for L1 loss. Default: 1.0.
reduction (str): Specifies the reduction to apply to the output.
Supported choices are 'none' | 'mean' | 'sum'. Default: 'mean'.
eps (float): A value used to control the curvature near zero.
Default: 1e-12.
"""
def __init__(self, loss_weight=1.0, reduction='mean', eps=1e-12):
super(CharbonnierLoss, self).__init__()
if reduction not in ['none', 'mean', 'sum']:
raise ValueError(f'Unsupported reduction mode: {reduction}. ' f'Supported ones are: {_reduction_modes}')
self.loss_weight = loss_weight
self.reduction = reduction
self.eps = eps
def forward(self, pred, target, weight=None, **kwargs):
"""
Args:
pred (Tensor): of shape (N, C, H, W). Predicted tensor.
target (Tensor): of shape (N, C, H, W). Ground truth tensor.
weight (Tensor, optional): of shape (N, C, H, W). Element-wise
weights. Default: None.
"""
return self.loss_weight * charbonnier_loss(pred, target, weight, eps=self.eps, reduction=self.reduction)
@LOSS_REGISTRY.register()
class WeightedTVLoss(L1Loss):
"""Weighted TV loss.
Args:
loss_weight (float): Loss weight. Default: 1.0.
"""
def __init__(self, loss_weight=1.0):
super(WeightedTVLoss, self).__init__(loss_weight=loss_weight)
def forward(self, pred, weight=None):
y_diff = super(WeightedTVLoss, self).forward(pred[:, :, :-1, :], pred[:, :, 1:, :], weight=weight[:, :, :-1, :])
x_diff = super(WeightedTVLoss, self).forward(pred[:, :, :, :-1], pred[:, :, :, 1:], weight=weight[:, :, :, :-1])
loss = x_diff + y_diff
return loss
@LOSS_REGISTRY.register()
class PerceptualLoss(nn.Module):
"""Perceptual loss with commonly used style loss.
Args:
layer_weights (dict): The weight for each layer of vgg feature.
Here is an example: {'conv5_4': 1.}, which means the conv5_4
feature layer (before relu5_4) will be extracted with weight
1.0 in calculting losses.
vgg_type (str): The type of vgg network used as feature extractor.
Default: 'vgg19'.
use_input_norm (bool): If True, normalize the input image in vgg.
Default: True.
range_norm (bool): If True, norm images with range [-1, 1] to [0, 1].
Default: False.
perceptual_weight (float): If `perceptual_weight > 0`, the perceptual
loss will be calculated and the loss will multiplied by the
weight. Default: 1.0.
style_weight (float): If `style_weight > 0`, the style loss will be
calculated and the loss will multiplied by the weight.
Default: 0.
criterion (str): Criterion used for perceptual loss. Default: 'l1'.
"""
def __init__(self,
layer_weights,
vgg_type='vgg19',
use_input_norm=True,
range_norm=False,
perceptual_weight=1.0,
style_weight=0.,
criterion='l1'):
super(PerceptualLoss, self).__init__()
self.perceptual_weight = perceptual_weight
self.style_weight = style_weight
self.layer_weights = layer_weights
self.vgg = VGGFeatureExtractor(
layer_name_list=list(layer_weights.keys()),
vgg_type=vgg_type,
use_input_norm=use_input_norm,
range_norm=range_norm)
self.criterion_type = criterion
if self.criterion_type == 'l1':
self.criterion = torch.nn.L1Loss()
elif self.criterion_type == 'l2':
self.criterion = torch.nn.L2loss()
elif self.criterion_type == 'fro':
self.criterion = None
else:
raise NotImplementedError(f'{criterion} criterion has not been supported.')
def forward(self, x, gt):
"""Forward function.
Args:
x (Tensor): Input tensor with shape (n, c, h, w).
gt (Tensor): Ground-truth tensor with shape (n, c, h, w).
Returns:
Tensor: Forward results.
"""
# extract vgg features
x_features = self.vgg(x)
gt_features = self.vgg(gt.detach())
# calculate perceptual loss
if self.perceptual_weight > 0:
percep_loss = 0
for k in x_features.keys():
if self.criterion_type == 'fro':
percep_loss += torch.norm(x_features[k] - gt_features[k], p='fro') * self.layer_weights[k]
else:
percep_loss += self.criterion(x_features[k], gt_features[k]) * self.layer_weights[k]
percep_loss *= self.perceptual_weight
else:
percep_loss = None
# calculate style loss
if self.style_weight > 0:
style_loss = 0
for k in x_features.keys():
if self.criterion_type == 'fro':
style_loss += torch.norm(
self._gram_mat(x_features[k]) - self._gram_mat(gt_features[k]), p='fro') * self.layer_weights[k]
else:
style_loss += self.criterion(self._gram_mat(x_features[k]), self._gram_mat(
gt_features[k])) * self.layer_weights[k]
style_loss *= self.style_weight
else:
style_loss = None
return percep_loss, style_loss
def _gram_mat(self, x):
"""Calculate Gram matrix.
Args:
x (torch.Tensor): Tensor with shape of (n, c, h, w).
Returns:
torch.Tensor: Gram matrix.
"""
n, c, h, w = x.size()
features = x.view(n, c, w * h)
features_t = features.transpose(1, 2)
gram = features.bmm(features_t) / (c * h * w)
return gram
@LOSS_REGISTRY.register()
class GANLoss(nn.Module):
"""Define GAN loss.
Args:
gan_type (str): Support 'vanilla', 'lsgan', 'wgan', 'hinge'.
real_label_val (float): The value for real label. Default: 1.0.
fake_label_val (float): The value for fake label. Default: 0.0.
loss_weight (float): Loss weight. Default: 1.0.
Note that loss_weight is only for generators; and it is always 1.0
for discriminators.
"""
def __init__(self, gan_type, real_label_val=1.0, fake_label_val=0.0, loss_weight=1.0):
super(GANLoss, self).__init__()
self.gan_type = gan_type
self.loss_weight = loss_weight
self.real_label_val = real_label_val
self.fake_label_val = fake_label_val
if self.gan_type == 'vanilla':
self.loss = nn.BCEWithLogitsLoss()
elif self.gan_type == 'lsgan':
self.loss = nn.MSELoss()
elif self.gan_type == 'wgan':
self.loss = self._wgan_loss
elif self.gan_type == 'wgan_softplus':
self.loss = self._wgan_softplus_loss
elif self.gan_type == 'hinge':
self.loss = nn.ReLU()
else:
raise NotImplementedError(f'GAN type {self.gan_type} is not implemented.')
def _wgan_loss(self, input, target):
"""wgan loss.
Args:
input (Tensor): Input tensor.
target (bool): Target label.
Returns:
Tensor: wgan loss.
"""
return -input.mean() if target else input.mean()
def _wgan_softplus_loss(self, input, target):
"""wgan loss with soft plus. softplus is a smooth approximation to the
ReLU function.
In StyleGAN2, it is called:
Logistic loss for discriminator;
Non-saturating loss for generator.
Args:
input (Tensor): Input tensor.
target (bool): Target label.
Returns:
Tensor: wgan loss.
"""
return F.softplus(-input).mean() if target else F.softplus(input).mean()
def get_target_label(self, input, target_is_real):
"""Get target label.
Args:
input (Tensor): Input tensor.
target_is_real (bool): Whether the target is real or fake.
Returns:
(bool | Tensor): Target tensor. Return bool for wgan, otherwise,
return Tensor.
"""
if self.gan_type in ['wgan', 'wgan_softplus']:
return target_is_real
target_val = (self.real_label_val if target_is_real else self.fake_label_val)
return input.new_ones(input.size()) * target_val
def forward(self, input, target_is_real, is_disc=False):
"""
Args:
input (Tensor): The input for the loss module, i.e., the network
prediction.
target_is_real (bool): Whether the targe is real or fake.
is_disc (bool): Whether the loss for discriminators or not.
Default: False.
Returns:
Tensor: GAN loss value.
"""
target_label = self.get_target_label(input, target_is_real)
if self.gan_type == 'hinge':
if is_disc: # for discriminators in hinge-gan
input = -input if target_is_real else input
loss = self.loss(1 + input).mean()
else: # for generators in hinge-gan
loss = -input.mean()
else: # other gan types
loss = self.loss(input, target_label)
# loss_weight is always 1.0 for discriminators
return loss if is_disc else loss * self.loss_weight
def r1_penalty(real_pred, real_img):
"""R1 regularization for discriminator. The core idea is to
penalize the gradient on real data alone: when the
generator distribution produces the true data distribution
and the discriminator is equal to 0 on the data manifold, the
gradient penalty ensures that the discriminator cannot create
a non-zero gradient orthogonal to the data manifold without
suffering a loss in the GAN game.
Ref:
Eq. 9 in Which training methods for GANs do actually converge.
"""
grad_real = autograd.grad(outputs=real_pred.sum(), inputs=real_img, create_graph=True)[0]
grad_penalty = grad_real.pow(2).view(grad_real.shape[0], -1).sum(1).mean()
return grad_penalty
def g_path_regularize(fake_img, latents, mean_path_length, decay=0.01):
noise = torch.randn_like(fake_img) / math.sqrt(fake_img.shape[2] * fake_img.shape[3])
grad = autograd.grad(outputs=(fake_img * noise).sum(), inputs=latents, create_graph=True)[0]
path_lengths = torch.sqrt(grad.pow(2).sum(2).mean(1))
path_mean = mean_path_length + decay * (path_lengths.mean() - mean_path_length)
path_penalty = (path_lengths - path_mean).pow(2).mean()
return path_penalty, path_lengths.detach().mean(), path_mean.detach()
def gradient_penalty_loss(discriminator, real_data, fake_data, weight=None):
"""Calculate gradient penalty for wgan-gp.
Args:
discriminator (nn.Module): Network for the discriminator.
real_data (Tensor): Real input data.
fake_data (Tensor): Fake input data.
weight (Tensor): Weight tensor. Default: None.
Returns:
Tensor: A tensor for gradient penalty.
"""
batch_size = real_data.size(0)
alpha = real_data.new_tensor(torch.rand(batch_size, 1, 1, 1))
# interpolate between real_data and fake_data
interpolates = alpha * real_data + (1. - alpha) * fake_data
interpolates = autograd.Variable(interpolates, requires_grad=True)
disc_interpolates = discriminator(interpolates)
gradients = autograd.grad(
outputs=disc_interpolates,
inputs=interpolates,
grad_outputs=torch.ones_like(disc_interpolates),
create_graph=True,
retain_graph=True,
only_inputs=True)[0]
if weight is not None:
gradients = gradients * weight
gradients_penalty = ((gradients.norm(2, dim=1) - 1)**2).mean()
if weight is not None:
gradients_penalty /= torch.mean(weight)
return gradients_penalty1234567891011121314151617181920from copy import deepcopy
from basicsr.utils.registry import METRIC_REGISTRY
from .niqe import calculate_niqe
from .psnr_ssim import calculate_psnr, calculate_ssim
__all__ = ['calculate_psnr', 'calculate_ssim', 'calculate_niqe']
def calculate_metric(data, opt):
"""Calculate metric from data and options.
Args:
opt (dict): Configuration. It must constain:
type (str): Model type.
"""
opt = deepcopy(opt)
metric_type = opt.pop('type')
metric = METRIC_REGISTRY.get(metric_type)(**data, **opt)
return metric123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293import numpy as np
import torch
import torch.nn as nn
from scipy import linalg
from tqdm import tqdm
from basicsr.archs.inception import InceptionV3
def load_patched_inception_v3(device='cuda', resize_input=True, normalize_input=False):
# we may not resize the input, but in [rosinality/stylegan2-pytorch] it
# does resize the input.
inception = InceptionV3([3], resize_input=resize_input, normalize_input=normalize_input)
inception = nn.DataParallel(inception).eval().to(device)
return inception
@torch.no_grad()
def extract_inception_features(data_generator, inception, len_generator=None, device='cuda'):
"""Extract inception features.
Args:
data_generator (generator): A data generator.
inception (nn.Module): Inception model.
len_generator (int): Length of the data_generator to show the
progressbar. Default: None.
device (str): Device. Default: cuda.
Returns:
Tensor: Extracted features.
"""
if len_generator is not None:
pbar = tqdm(total=len_generator, unit='batch', desc='Extract')
else:
pbar = None
features = []
for data in data_generator:
if pbar:
pbar.update(1)
data = data.to(device)
feature = inception(data)[0].view(data.shape[0], -1)
features.append(feature.to('cpu'))
if pbar:
pbar.close()
features = torch.cat(features, 0)
return features
def calculate_fid(mu1, sigma1, mu2, sigma2, eps=1e-6):
"""Numpy implementation of the Frechet Distance.
The Frechet distance between two multivariate Gaussians X_1 ~ N(mu_1, C_1)
and X_2 ~ N(mu_2, C_2) is
d^2 = ||mu_1 - mu_2||^2 + Tr(C_1 + C_2 - 2*sqrt(C_1*C_2)).
Stable version by Dougal J. Sutherland.
Args:
mu1 (np.array): The sample mean over activations.
sigma1 (np.array): The covariance matrix over activations for
generated samples.
mu2 (np.array): The sample mean over activations, precalculated on an
representative data set.
sigma2 (np.array): The covariance matrix over activations,
precalculated on an representative data set.
Returns:
float: The Frechet Distance.
"""
assert mu1.shape == mu2.shape, 'Two mean vectors have different lengths'
assert sigma1.shape == sigma2.shape, ('Two covariances have different dimensions')
cov_sqrt, _ = linalg.sqrtm(sigma1 @ sigma2, disp=False)
# Product might be almost singular
if not np.isfinite(cov_sqrt).all():
print('Product of cov matrices is singular. Adding {eps} to diagonal ' 'of cov estimates')
offset = np.eye(sigma1.shape[0]) * eps
cov_sqrt = linalg.sqrtm((sigma1 + offset) @ (sigma2 + offset))
# Numerical error might give slight imaginary component
if np.iscomplexobj(cov_sqrt):
if not np.allclose(np.diagonal(cov_sqrt).imag, 0, atol=1e-3):
m = np.max(np.abs(cov_sqrt.imag))
raise ValueError(f'Imaginary component {m}')
cov_sqrt = cov_sqrt.real
mean_diff = mu1 - mu2
mean_norm = mean_diff @ mean_diff
trace = np.trace(sigma1) + np.trace(sigma2) - 2 * np.trace(cov_sqrt)
fid = mean_norm + trace
return fid123456789101112131415161718192021222324252627282930313233343536373839404142434445import numpy as np
from basicsr.utils.matlab_functions import bgr2ycbcr
def reorder_image(img, input_order='HWC'):
"""Reorder images to 'HWC' order.
If the input_order is (h, w), return (h, w, 1);
If the input_order is (c, h, w), return (h, w, c);
If the input_order is (h, w, c), return as it is.
Args:
img (ndarray): Input image.
input_order (str): Whether the input order is 'HWC' or 'CHW'.
If the input image shape is (h, w), input_order will not have
effects. Default: 'HWC'.
Returns:
ndarray: reordered image.
"""
if input_order not in ['HWC', 'CHW']:
raise ValueError(f'Wrong input_order {input_order}. Supported input_orders are ' "'HWC' and 'CHW'")
if len(img.shape) == 2:
img = img[..., None]
if input_order == 'CHW':
img = img.transpose(1, 2, 0)
return img
def to_y_channel(img):
"""Change to Y channel of YCbCr.
Args:
img (ndarray): Images with range [0, 255].
Returns:
(ndarray): Images with range [0, 255] (float type) without round.
"""
img = img.astype(np.float32) / 255.
if img.ndim == 3 and img.shape[2] == 3:
img = bgr2ycbcr(img, y_only=True)
img = img[..., None]
return img * 255..gitattributes+4
Wav2Lip-HD/audio.pyAdded+139
Wav2Lip-HD/basicsr/README.mdAdded+1
Wav2Lip-HD/basicsr/__init__.pyAdded+12
Wav2Lip-HD/basicsr/apply_sr.pyAdded+25
Wav2Lip-HD/basicsr/archs/__init__.pyAdded+25
Wav2Lip-HD/basicsr/archs/arch_util.pyAdded+227
Wav2Lip-HD/basicsr/archs/dfdnet_arch.pyAdded+158
Wav2Lip-HD/basicsr/archs/dfdnet_util.pyAdded+162
Wav2Lip-HD/basicsr/archs/discriminator_arch.pyAdded+73
Wav2Lip-HD/basicsr/archs/duf_arch.pyAdded+283
Wav2Lip-HD/basicsr/archs/edsr_arch.pyAdded+61
Wav2Lip-HD/basicsr/archs/edvr_arch.pyAdded+383
Wav2Lip-HD/basicsr/archs/inception.pyAdded+307
Wav2Lip-HD/basicsr/archs/rcan_arch.pyAdded+135
Wav2Lip-HD/basicsr/archs/ridnet_arch.pyAdded+184
Wav2Lip-HD/basicsr/archs/rrdbnet_arch.pyAdded+104
Wav2Lip-HD/basicsr/archs/spynet_arch.pyAdded+96
Wav2Lip-HD/basicsr/archs/srresnet_arch.pyAdded+68
Wav2Lip-HD/basicsr/archs/stylegan2_arch.pyAdded+799
Wav2Lip-HD/basicsr/archs/tof_arch.pyAdded+172
Wav2Lip-HD/basicsr/archs/vgg_arch.pyAdded+161
Wav2Lip-HD/basicsr/data/__init__.pyAdded+100
Wav2Lip-HD/basicsr/data/data_sampler.pyAdded+48
Wav2Lip-HD/basicsr/data/data_util.pyAdded+305
Wav2Lip-HD/basicsr/data/degradations.pyAdded+347
Wav2Lip-HD/basicsr/data/ffhq_dataset.pyAdded+63
Wav2Lip-HD/basicsr/data/meta_info/meta_info_DIV2K800sub_GT.txtAdded
Wav2Lip-HD/basicsr/data/meta_info/meta_info_REDS4_test_GT.txtAdded+4
Wav2Lip-HD/basicsr/data/meta_info/meta_info_REDS_GT.txtAdded+270
Wav2Lip-HD/basicsr/data/meta_info/meta_info_REDSofficial4_test_GT.txtAdded+4
Wav2Lip-HD/basicsr/data/meta_info/meta_info_REDSval_official_test_GT.txtAdded+30
Wav2Lip-HD/basicsr/data/meta_info/meta_info_Vimeo90K_test_GT.txtAdded
Wav2Lip-HD/basicsr/data/meta_info/meta_info_Vimeo90K_test_fast_GT.txtAdded+1225
Wav2Lip-HD/basicsr/data/meta_info/meta_info_Vimeo90K_test_medium_GT.txtAdded
Wav2Lip-HD/basicsr/data/meta_info/meta_info_Vimeo90K_test_slow_GT.txtAdded+1613
Wav2Lip-HD/basicsr/data/meta_info/meta_info_Vimeo90K_train_GT.txtAdded
Wav2Lip-HD/basicsr/data/paired_image_dataset.pyAdded+101
Wav2Lip-HD/basicsr/data/prefetch_dataloader.pyAdded+125
Wav2Lip-HD/basicsr/data/reds_dataset.pyAdded+209
Wav2Lip-HD/basicsr/data/single_image_dataset.pyAdded+65
Wav2Lip-HD/basicsr/data/transforms.pyAdded+165
Wav2Lip-HD/basicsr/data/video_test_dataset.pyAdded+287
Wav2Lip-HD/basicsr/data/vimeo90k_dataset.pyAdded+126
Wav2Lip-HD/basicsr/losses/__init__.pyAdded+26
Wav2Lip-HD/basicsr/losses/loss_util.pyAdded+95
Wav2Lip-HD/basicsr/losses/losses.pyAdded+423
Wav2Lip-HD/basicsr/metrics/__init__.pyAdded+20
Wav2Lip-HD/basicsr/metrics/fid.pyAdded+93
Wav2Lip-HD/basicsr/metrics/metric_util.pyAdded+45