本文整理汇总了Python中data.common.get_patch方法的典型用法代码示例。如果您正苦于以下问题:Python common.get_patch方法的具体用法?Python common.get_patch怎么用?Python common.get_patch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data.common
的用法示例。
在下文中一共展示了common.get_patch方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_patch
# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import get_patch [as 别名]
def get_patch(self, lr, hr):
scale = self.scale[self.idx_scale]
if self.train:
lr, hr = common.get_patch(
lr, hr,
patch_size=self.args.patch_size,
scale=scale,
multi=(len(self.scale) > 1),
input_large=self.input_large
)
if not self.args.no_augment: lr, hr = common.augment(lr, hr)
else:
ih, iw = lr.shape[:2]
hr = hr[0:ih * scale, 0:iw * scale]
return lr, hr
示例2: _get_patch
# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import get_patch [as 别名]
def _get_patch(self, lr, hr):
patch_size = self.args.patch_size
scale = self.scale[self.idx_scale]
multi_scale = len(self.scale) > 1
if self.train:
#from IPython import embed; embed(); exit()
lr, hr = common.get_patch(
lr, hr, patch_size, scale, multi_scale=multi_scale
)
lr, hr = common.augment([lr, hr])
lr = common.add_noise(lr, self.args.noise)
else:
ih, iw = lr.shape[0:2]
hr = hr[0:ih * scale, 0:iw * scale]
return lr, hr
示例3: get_patch
# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import get_patch [as 别名]
def get_patch(self, lr, hr):
scale = self.scale[self.idx_scale]
multi_scale = len(self.scale) > 1
if self.train:
lr, hr = common.get_patch(
lr,
hr,
patch_size=self.args.patch_size,
scale=scale,
multi_scale=multi_scale
)
if not self.args.no_augment:
lr, hr = common.augment(lr, hr)
else:
ih, iw = lr.shape[:2]
hr = hr[0:ih * scale, 0:iw * scale]
return lr, hr
示例4: __getitem__
# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import get_patch [as 别名]
def __getitem__(self, idx):
if self.train:
lr, hr, filename = self._load_file(idx)
lr, hr= self.get_patch(*[lr, hr])
lr, hr = common.set_channel(lr, hr, n_channels=self.args.n_colors)
lr_tensor, hr_tensor = common.np2Tensor(
lr, hr, rgb_range=self.args.rgb_range
)
return lr_tensor, hr_tensor,filename
else:
lr, hr, filename = self._load_file(idx)
lr, hr= self.get_patch(*[lr, hr])
lr, hr = common.set_channel(lr, hr, n_channels=self.args.n_colors)
lr_tensor, hr_tensor = common.np2Tensor(
lr, hr, rgb_range=self.args.rgb_range
)
return lr_tensor, hr_tensor,filename
示例5: __getitem__
# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import get_patch [as 别名]
def __getitem__(self, idx):
lr, hr, filename = self._load_file(idx)
pair = self.get_patch(lr, hr)
pair = common.set_channel(*pair, n_channels=self.args.n_colors)
pair_t = common.np2Tensor(*pair, rgb_range=self.args.rgb_range)
return pair_t[0], pair_t[1], filename
示例6: _get_patch
# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import get_patch [as 别名]
def _get_patch(self, lr, hr):
LR_size = self.opt['LR_size']
# random crop and augment
lr, hr = common.get_patch(
lr, hr, LR_size, self.scale)
lr, hr = common.augment([lr, hr])
lr = common.add_noise(lr, self.opt['noise'])
return lr, hr
示例7: __getitem__
# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import get_patch [as 别名]
def __getitem__(self, idx):
lr, hr, filename = self._load_file(idx)
lr, hr = self.get_patch(lr, hr)
lr, hr = common.set_channel(lr, hr, n_channels=self.args.n_colors)
lr_tensor, hr_tensor = common.np2Tensor(
lr, hr, rgb_range=self.args.rgb_range
)
return lr_tensor, hr_tensor, filename
示例8: _get_patch
# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import get_patch [as 别名]
def _get_patch(self, lr, hr):
patch_size = self.args.patch_size
scale = self.scale[self.idx_scale]
multi_scale = len(self.scale) > 1
if self.train:
lr, hr = common.get_patch(
lr, hr, patch_size, scale, multi_scale=multi_scale
)
lr, hr = common.augment([lr, hr])
lr = common.add_noise(lr, self.args.noise)
else:
ih, iw = lr.shape[0:2]
hr = hr[0:ih * scale, 0:iw * scale]
return lr, hr
示例9: __getitem__
# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import get_patch [as 别名]
def __getitem__(self, idx):
lr, hr, filename = self._load_file(idx)
lr, hr = self.get_patch(lr, hr)
lr, hr = common.set_channel(lr, hr, n_channels=self.args.n_colors)
lr_tensor, hr_tensor = common.np2Tensor(
lr, hr, rgb_range=self.args.rgb_range
)
return lr_tensor, hr_tensor, filename