AAnoosheh / ToDayGAN

http://arxiv.org/abs/1809.09767
BSD 2-Clause "Simplified" License
172 stars 32 forks source link

ValueError: Sample larger than population #2

Closed SummerHuiZhang closed 5 years ago

SummerHuiZhang commented 5 years ago

create web directory ./checkpoints/summer2winter_yosemite/web... Traceback (most recent call last): File "train.py", line 22, in for i, data in enumerate(dataset): File "/home/timing/Git_Repos_Summer/ToDayGAN/data/data_loader.py", line 21, in iter for i, data in enumerate(self.dataloader): File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 286, in next return self._process_next_batch(batch) File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 307, in _process_next_batch raise batch.exc_type(batch.exc_msg) ValueError: Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 57, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 57, in samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/timing/Git_Repos_Summer/ToDayGAN/data/unaligned_dataset.py", line 39, in getitem DA, DB = random.sample(range(len(self.dirs)), 2) File "/usr/lib/python3.5/random.py", line 315, in sample raise ValueError("Sample larger than population") ValueError: Sample larger than population

AAnoosheh commented 5 years ago

DA, DB = random.sample(range(len(self.dirs)), 2)

An error at that line means you have less than two directories to choose from. Please ensure you have at minimum two image directories starting with the prefix "train" i.e. trainA & trainB, or train0 & train1