本文整理汇总了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
示例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
示例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
示例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
示例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}
示例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}
示例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
示例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
示例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
示例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
示例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
示例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