costapt / adversarial_retinal_synthesis

22 stars 10 forks source link

ValueError: output of generator should be a tuple (x, y, sample_weight) or (x, y). Found: None #11

Closed AliSaeed86 closed 2 years ago

AliSaeed86 commented 2 years ago

Hi, please, i need help with the following error : ValueError: output of generator should be a tuple (x, y, sample_weight) or (x, y). Found: None

I fed up trying to solve it and i couldn't find the cause.

note these are my params (you may need to check them): {'a_ch': 1, 'alpha': 100, 'b_ch': 3, 'base_dir': '/content/drive/MyDrive/dataset_2nd_obj/DRIVE', 'batch_size': 20, 'beta': 100, 'beta_1': 0.5, 'continue_train': False, 'epochs': 100, 'expt_name': 'training_ali', 'height_shift_range': 0.0, 'horizontal_flip': False, 'is_a_binary': True, 'is_a_grayscale': True, 'is_b_binary': False, 'is_b_grayscale': False, 'latent_dim': 16, 'load_to_memory': True, 'log_dir': 'log', 'lr': 0.0002, 'nfatoa': 32, 'nfatob': 32, 'nfd': 32, 'pix2pix': False, 'rotation_range': 0.0, 'save_every': 2, 'target_size': 256, 'train_dir': 'train_dir', 'train_samples': -1, 'val_dir': 'val_dir', 'val_samples': -1, 'vertical_flip': False, 'width_shift_range': 0.0, 'zoom_range': 0.0}

and the error msgs are as follow : ----> train(models, it_train, it_val, params)

in train(models, it_train, it_val, params)
    349         # Evaluate how the models is doing on the validation set.
    350 
--> 351         evaluate(models, generators, losses, val_samples=val_samples)
in evaluate(models, generators, losses, val_samples, verbose)
    139     p2p2p = models.p2p2p
    140 
--> 141     d_loss = d.evaluate_generator(d_gen, val_samples)
in evaluate_generator(self, generator, val_samples, max_q_size, nb_worker, pickle_safe)
   1664                     raise ValueError('output of generator should be a tuple '
   1665                                      '(x, y, sample_weight) '
-> 1666                                      'or (x, y). Found: ' + str(generator_output))

ValueError: output of generator should be a tuple (x, y, sample_weight) or (x, y). Found: None`

NOTE : i guess the problem is that the images don't fetched during exeuction. coz It shows that the number of training_samples/val_samples = 0, Although there are 16 images in train_dir and 4 images in val_dir.

Please any idea why is this problem happening, or why it is showing training_samples and val_samples are 0 not the actual number of images in the train_dir and val_dir?

AliSaeed86 commented 2 years ago

for those who faced the same issue. Kindly, you need to rename the images in A and B directories to be the same. taking DRIVE dataset as an example, if an image in A directory has the name "25_training" then the ground truth in B directory must renamed to have the same name which is "25_training", and so on for other images.

thanks for the authors once again for the code.. Cheers.