Tencent/Real-SR

train with custom dataset

jstak0804 opened this issue · 0 comments

Hello I'm trying to train model with my custom datasets
but, it shows error below.

TypeError: Caught TypeError in DataLoader worker process 0.

TypeError: object of type 'module' has no len()
I saw past's Issue so I edit data_loader as

self.noise_imgs = [os.path.join(root, name)
for root, dirs, files in os.walk(base)
for name in files
if name.endswith(('png'))]

I think It shows problem in noise part
espacially here

    if self.opt['phase'] == 'train':
        print(self.opt)
        # add noise to LR during train
        if self.opt['aug'] and 'noise' in self.opt['aug']:
            print(len(self.noises))
            noise = self.noises[np.random.randint(0, len(self.noises))]

            img_LQ = torch.clamp(img_LQ + noise, 0, 1)

and this is my yml file that relates with train

name: Corrupted_noise
use_tb_logger: true
model: srgan
distortion: sr
scale: 4
gpu_ids: [4]

datasets

datasets:
train:
name: train
mode: LQGT
aug: noise
scale: 4
noise_data: /media/soft/20EE2B81EE2B4DFA/Tak/Real-SR/codes/open/train/Corrupted_noise
dataroot_GT: /media/soft/20EE2B81EE2B4DFA/Tak/Real-SR/codes/open/train/generated/tdsr/HR
dataroot_LQ: /media/soft/20EE2B81EE2B4DFA/Tak/Real-SR/codes/open/train/generated/tdsr/LR
use_shuffle: true
n_workers: 6 # per GPU
batch_size: 16
GT_size: 128
use_flip: true
use_rot: true
color: RGB

I need your help...!