junyanz / pytorch-CycleGAN-and-pix2pix

Image-to-Image Translation in PyTorch
Other
22.8k stars 6.29k forks source link

PIL.Image.DecompressionBombError: Caught DecompressionBombError in DataLoader worker process 1. #1592

Open hhy-joseph opened 1 year ago

hhy-joseph commented 1 year ago

!python train.py --dataroot ./data/image/AB --name sat2map --model pix2pix --gpu_ids 0 --direction BtoA --display_id -1 --batch_size 2

I'm running the code above and return the error: create web directory ./checkpoints/sat2map/web... /usr/local/lib/python3.10/dist-packages/torch/optim/lr_scheduler.py:139: UserWarning: Detected call of lr_scheduler.step() before optimizer.step(). In PyTorch 1.1.0 and later, you should call them in the opposite order: optimizer.step() before lr_scheduler.step(). Failure to do this will result in PyTorch skipping the first value of the learning rate schedule. See more details at https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate warnings.warn("Detected call of lr_scheduler.step() before optimizer.step(). " learning rate 0.0002000 -> 0.0002000 Traceback (most recent call last): File "/content/pytorch-CycleGAN-and-pix2pix/train.py", line 44, in for i, data in enumerate(dataset): # inner loop within one epoch File "/content/pytorch-CycleGAN-and-pix2pix/data/init.py", line 90, in iter for i, data in enumerate(self.dataloader): File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py", line 633, in next data = self._next_data() File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py", line 1325, in _next_data return self._process_data(data) File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py", line 1371, in _process_data data.reraise() File "/usr/local/lib/python3.10/dist-packages/torch/_utils.py", line 644, in reraise raise exception PIL.Image.DecompressionBombError: Caught DecompressionBombError in DataLoader worker process 1. Original Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop data = fetcher.fetch(index) File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py", line 51, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/content/pytorch-CycleGAN-and-pix2pix/data/aligned_dataset.py", line 41, in getitem AB = Image.open(AB_path).convert('RGB') File "/usr/local/lib/python3.10/dist-packages/PIL/Image.py", line 3268, in open im = _open_core(fp, filename, prefix, formats) File "/usr/local/lib/python3.10/dist-packages/PIL/Image.py", line 3255, in _open_core _decompression_bomb_check(im.size) File "/usr/local/lib/python3.10/dist-packages/PIL/Image.py", line 3164, in _decompression_bomb_check raise DecompressionBombError(msg) PIL.Image.DecompressionBombError: Image size (201840000 pixels) exceeds limit of 178956970 pixels, could be decompression bomb DOS attack.