当前位置: 首页>>代码示例>>Python>>正文


Python common.get_patch方法代码示例

本文整理汇总了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 
开发者ID:HolmesShuan,项目名称:OISR-PyTorch,代码行数:18,代码来源:srdata.py

示例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 
开发者ID:ofsoundof,项目名称:3D_Appearance_SR,代码行数:18,代码来源:srdata.py

示例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 
开发者ID:ChaofWang,项目名称:AWSRN,代码行数:20,代码来源:srdata.py

示例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 
开发者ID:yyknight,项目名称:NTIRE2019_EDRN,代码行数:19,代码来源:srdata.py

示例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 
开发者ID:HolmesShuan,项目名称:OISR-PyTorch,代码行数:9,代码来源:srdata.py

示例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 
开发者ID:Paper99,项目名称:SRFBN_CVPR19,代码行数:12,代码来源:LRHR_dataset.py

示例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 
开发者ID:ChaofWang,项目名称:AWSRN,代码行数:12,代码来源:srdata.py

示例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 
开发者ID:MIVRC,项目名称:MSRN-PyTorch,代码行数:17,代码来源:srdata.py

示例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 
开发者ID:MIVRC,项目名称:MSRN-PyTorch,代码行数:11,代码来源:srdata.py


注:本文中的data.common.get_patch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。