forked from mrq/DL-Art-School
Update LQ_dataset to support inference on split image videos
This commit is contained in:
parent
74bb0fad33
commit
90073fc761
|
@ -33,14 +33,15 @@ class LQDataset(data.Dataset):
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
if self.data_type == 'lmdb' and self.LQ_env is None:
|
if self.data_type == 'lmdb' and self.LQ_env is None:
|
||||||
self._init_lmdb()
|
self._init_lmdb()
|
||||||
actual_index = int(index / 2)
|
actual_index = index # int(index / 2)
|
||||||
is_left = (index % 2) == 0
|
is_left = (index % 2) == 0
|
||||||
|
|
||||||
# get LQ image
|
# get LQ image
|
||||||
LQ_path = self.paths_LQ[actual_index]
|
LQ_path = self.paths_LQ[actual_index]
|
||||||
img_LQ = Image.open(LQ_path)
|
img_LQ = Image.open(LQ_path)
|
||||||
left = 0 if is_left else 2000
|
left = 0 if is_left else 1920
|
||||||
img_LQ = F.crop(img_LQ, 74, left + 74, 1900, 1900)
|
# crop input if needed.
|
||||||
|
#img_LQ = F.crop(img_LQ, 5, left + 5, 1900, 1900)
|
||||||
img_LQ = F.to_tensor(img_LQ)
|
img_LQ = F.to_tensor(img_LQ)
|
||||||
|
|
||||||
img_name = osp.splitext(osp.basename(LQ_path))[0]
|
img_name = osp.splitext(osp.basename(LQ_path))[0]
|
||||||
|
@ -49,4 +50,4 @@ class LQDataset(data.Dataset):
|
||||||
return {'LQ': img_LQ, 'LQ_path': LQ_path}
|
return {'LQ': img_LQ, 'LQ_path': LQ_path}
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self.paths_LQ) * 2
|
return len(self.paths_LQ) # * 2
|
||||||
|
|
Loading…
Reference in New Issue
Block a user