junyanz / pytorch-CycleGAN-and-pix2pix

Image-to-Image Translation in PyTorch
Other
23.09k stars 6.32k forks source link

Rectangular image training failed,HELP! HELP! #1668

Open HolicAnn opened 3 months ago

HolicAnn commented 3 months ago

*My image is 860688 rectangular image, I use the following command when training:**

python train.py --dataroot ./datasets/white --name white --model pix2pix --direction AtoB --preprocess crop --crop_size 688

But when training errors, as follows /home/alan/miniforge3/envs/torch/lib/python3.11/site-packages/torch/optim/lr_scheduler.py:136: 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 "/mnt/c/Users/Alan/Desktop/pytorch-CycleGAN-and-pix2pix-master/train.py", line 56, in model.optimize_parameters() # calculate loss functions, get gradients, update network weights ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/mnt/c/Users/Alan/Desktop/pytorch-CycleGAN-and-pix2pix-master/models/pix2pix_model.py", line 117, in optimize_parameters self.forward() # compute fake images: G(A) ^^^^^^^^^^^^^^ File "/mnt/c/Users/Alan/Desktop/pytorch-CycleGAN-and-pix2pix-master/models/pix2pix_model.py", line 88, in forward self.fake_B = self.netG(self.real_A) # G(A) ^^^^^^^^^^^^^^^^^^^^^^ File "/home/alan/miniforge3/envs/torch/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alan/miniforge3/envs/torch/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alan/miniforge3/envs/torch/lib/python3.11/site-packages/torch/nn/parallel/data_parallel.py", line 183, in forward return self.module(inputs[0], module_kwargs[0]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alan/miniforge3/envs/torch/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alan/miniforge3/envs/torch/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/mnt/c/Users/Alan/Desktop/pytorch-CycleGAN-and-pix2pix-master/models/networks.py", line 466, in forward return self.model(input) ^^^^^^^^^^^^^^^^^ File "/home/alan/miniforge3/envs/torch/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alan/miniforge3/envs/torch/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/mnt/c/Users/Alan/Desktop/pytorch-CycleGAN-and-pix2pix-master/models/networks.py", line 543, in forward model_output = self.model(x) ^^^^^^^^^^^^^ File "/home/alan/miniforge3/envs/torch/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alan/miniforge3/envs/torch/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alan/miniforge3/envs/torch/lib/python3.11/site-packages/torch/nn/modules/container.py", line 215, in forward input = module(input) ^^^^^^^^^^^^^ File "/home/alan/miniforge3/envs/torch/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alan/miniforge3/envs/torch/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/mnt/c/Users/Alan/Desktop/pytorch-CycleGAN-and-pix2pix-master/models/networks.py", line 543, in forward model_output = self.model(x) ^^^^^^^^^^^^^ File "/home/alan/miniforge3/envs/torch/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alan/miniforge3/envs/torch/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alan/miniforge3/envs/tor