Skip to content

fix bugs for dataset initialization. #436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions basicsr/data/ffhq_blind_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ def __init__(self, opt):
else:
self.crop_components = False

if self.latent_gt_path is not None:
self.load_latent_gt = True
self.latent_gt_dict = torch.load(self.latent_gt_path)
else:
self.load_latent_gt = False
self.latent_gt_dict = None

if self.io_backend_opt['type'] == 'lmdb':
self.io_backend_opt['db_paths'] = self.gt_folder
Expand Down Expand Up @@ -177,6 +173,14 @@ def get_component_locations(self, name, status):


def __getitem__(self, index):

if self.latent_gt_path is not None:
self.load_latent_gt = True
if self.latent_gt_dict is None:
self.latent_gt_dict = torch.load(self.latent_gt_path)
else:
self.load_latent_gt = False

if self.file_client is None:
self.file_client = FileClient(self.io_backend_opt.pop('type'), **self.io_backend_opt)

Expand Down
14 changes: 9 additions & 5 deletions basicsr/data/ffhq_blind_joint_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ def __init__(self, opt):
else:
self.crop_components = False

if self.latent_gt_path is not None:
self.load_latent_gt = True
self.latent_gt_dict = torch.load(self.latent_gt_path)
else:
self.load_latent_gt = False
self.latent_gt_dict = None

if self.io_backend_opt['type'] == 'lmdb':
self.io_backend_opt['db_paths'] = self.gt_folder
Expand Down Expand Up @@ -169,6 +165,14 @@ def get_component_locations(self, name, status):


def __getitem__(self, index):

if self.latent_gt_path is not None:
self.load_latent_gt = True
if self.latent_gt_dict is None:
self.latent_gt_dict = torch.load(self.latent_gt_path)
else:
self.load_latent_gt = False

if self.file_client is None:
self.file_client = FileClient(self.io_backend_opt.pop('type'), **self.io_backend_opt)

Expand Down