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


Python common.np2Tensor方法代码示例

本文整理汇总了Python中data.common.np2Tensor方法的典型用法代码示例。如果您正苦于以下问题:Python common.np2Tensor方法的具体用法?Python common.np2Tensor怎么用?Python common.np2Tensor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在data.common的用法示例。


在下文中一共展示了common.np2Tensor方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __getitem__

# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import np2Tensor [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

示例2: __getitem__

# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import np2Tensor [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

示例3: __getitem__

# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import np2Tensor [as 别名]
def __getitem__(self, idx):
        filename = os.path.splitext(os.path.basename(self.filelist[idx]))[0]
        lr = imageio.imread(self.filelist[idx])
        lr, = common.set_channel(lr, n_channels=self.args.n_colors)
        lr_t, = common.np2Tensor(lr, rgb_range=self.args.rgb_range)

        return lr_t, -1, filename 
开发者ID:HolmesShuan,项目名称:OISR-PyTorch,代码行数:9,代码来源:demo.py

示例4: __getitem__

# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import np2Tensor [as 别名]
def __getitem__(self, idx):
        success, lr = self.vidcap.read()
        if success:
            self.n_frames += 1
            lr, = common.set_channel(lr, n_channels=self.args.n_colors)
            lr_t, = common.np2Tensor(lr, rgb_range=self.args.rgb_range)

            return lr_t, -1, '{}_{:0>5}'.format(self.filename, self.n_frames)
        else:
            vidcap.release()
            return None 
开发者ID:HolmesShuan,项目名称:OISR-PyTorch,代码行数:13,代码来源:video.py

示例5: __getitem__

# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import np2Tensor [as 别名]
def __getitem__(self, idx):
        # get LR image
        lr, lr_path = self._load_file(idx)
        lr_tensor = common.np2Tensor([lr], self.opt['rgb_range'])[0]
        return {'LR': lr_tensor, 'LR_path': lr_path} 
开发者ID:Paper99,项目名称:SRFBN_CVPR19,代码行数:7,代码来源:LR_dataset.py

示例6: __getitem__

# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import np2Tensor [as 别名]
def __getitem__(self, idx):
        lr, hr, lr_path, hr_path = self._load_file(idx)
        if self.train:
            lr, hr = self._get_patch(lr, hr)
        lr_tensor, hr_tensor = common.np2Tensor([lr, hr], self.opt['rgb_range'])
        return {'LR': lr_tensor, 'HR': hr_tensor, 'LR_path': lr_path, 'HR_path': hr_path} 
开发者ID:Paper99,项目名称:SRFBN_CVPR19,代码行数:8,代码来源:LRHR_dataset.py

示例7: __getitem__

# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import np2Tensor [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], self.args.n_colors)
        lr_tensor, hr_tensor = common.np2Tensor([lr, hr], self.args.rgb_range)
        return lr_tensor, hr_tensor, filename 
开发者ID:ofsoundof,项目名称:3D_Appearance_SR,代码行数:8,代码来源:srdata.py

示例8: __getitem__

# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import np2Tensor [as 别名]
def __getitem__(self, idx):
        lr, nl, mk, hr, filename = self._load_file(idx)
        lr, nl, mk, hr = self._get_patch(lr, nl, mk, hr)
        lr, hr = common.set_channel([lr, hr], self.args.n_colors)
        #print('The size of lr, hr images are {}, {}'.format(lr.shape, hr.shape))
        lr_tensor, nl_tensor, mk_tensor, hr_tensor = common.np2Tensor([lr, nl, mk, hr], self.args.rgb_range)
        # if self.model_flag.lower() == 'finetune':
        return lr_tensor, nl_tensor, mk_tensor, hr_tensor, filename
        # else:
        #     return lr_tensor, hr_tensor, filename 
开发者ID:ofsoundof,项目名称:3D_Appearance_SR,代码行数:12,代码来源:srtexture.py

示例9: __getitem__

# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import np2Tensor [as 别名]
def __getitem__(self, idx):
        filename = os.path.split(self.filelist[idx])[-1]
        filename, _ = os.path.splitext(filename)
        lr = misc.imread(self.filelist[idx])
        lr = common.set_channel([lr], self.args.n_colors)[0]

        return common.np2Tensor([lr], self.args.rgb_range)[0], -1, filename 
开发者ID:ofsoundof,项目名称:3D_Appearance_SR,代码行数:9,代码来源:demo.py

示例10: __getitem__

# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import np2Tensor [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

示例11: __getitem__

# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import np2Tensor [as 别名]
def __getitem__(self, idx):
        filename = os.path.split(self.filelist[idx])[-1]
        filename, _ = os.path.splitext(filename)
        lr = imageio.imread(self.filelist[idx])
        lr, = common.set_channel(lr, n_channels=self.args.n_colors)
        lr_t, = common.np2Tensor(lr, rgb_range=self.args.rgb_range)

        return lr_t, -1, filename 
开发者ID:ChaofWang,项目名称:AWSRN,代码行数:10,代码来源:demo.py

示例12: __getitem__

# 需要导入模块: from data import common [as 别名]
# 或者: from data.common import np2Tensor [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.np2Tensor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。