strange error on training
I am trying to run the sample training, as per provided notebbok. I use a dataset of 3361 training images (both lr and hr) and 40 validation images (900x900, 3 band RGB) I declared the trainer as follows:
trainer = Trainer(
generator=rrdn,
discriminator=discr,
feature_extractor=f_ext,
lr_train_dir='../lr-images',
hr_train_dir='../hr-images',
lr_valid_dir='../lr-val-images',
hr_valid_dir='../hr-val-images',
loss_weights=loss_weights,
learning_rate=learning_rate,
flatness=flatness,
dataname='spacenet',
log_dirs=log_dirs,
weights_generator=None,
weights_discriminator=None,
n_validation=40
)
When I run the sample code I get the following error:
File "C:\pix2pix\p2p\lib\site-packages\ISR\utils\datahandler.py", line 44, in _make_img_list
range(len(self.img_list['hr'])), self.n_validation_samples, replace=False
File "mtrand.pyx", line 900, in numpy.random.mtrand.RandomState.choice
ValueError: 'a' cannot be empty unless no samples are taken
The list of images seems empty, are you pointing to the right directory?
First check whether or not you are pointing the right directory and try not to have any non english letters or spaces on the directory like ü.ı etc etc.
Another and most likely reason is that you have non admissible image type, what I mean by that https://github.com/idealo/image-super-resolution/blob/master/ISR/utils/datahandler.py
If you check the link above line 23 you'll see only acceptable data types are jpeg/ png/jpg try convert you images to one of these then try again, it should work.
P.S: Before converting keep in mind that if your data is either tis tiff or geotiff files and their sizes are big (4000x7000 for example) you'll be losing a lot of information when converting.