Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This problem occurs when training deraining dataset. Why is that? #89

Closed
lonely6628 opened this issue Oct 28, 2021 · 6 comments
Closed

Comments

@lonely6628
Copy link

Hello,I'm sorry to bother you. I encountered a problem when training the deraining dataset. My friends didn't encountered this case, so I'd like to ask you to help me see the reason for this error. I only changed the values of BATCH_SIZE and TRAIN_PS in the train. yml file, it occurred during the training of epochs 9, 22, 31 and 60. The error code is as follows:

Traceback (most recent call last):
  File "train.py", line 109, in <module>
    for i, data in enumerate(tqdm(train_loader), 0):
  File "/home/min1/anaconda3/envs/bwq/lib/python3.7/site-packages/tqdm/std.py", line 1185, in __iter__
    for obj in iterable:
  File "/home/min1/anaconda3/envs/bwq/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 582, in __next__
    return self._process_next_batch(batch)
  File "/home/min1/anaconda3/envs/bwq/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch
    raise batch.exc_type(batch.exc_msg)
RuntimeError: Traceback (most recent call last):
  File "/home/min1/anaconda3/envs/bwq/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/home/min1/anaconda3/envs/bwq/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 68, in default_collate
    return [default_collate(samples) for samples in transposed]
  File "/home/min1/anaconda3/envs/bwq/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 68, in <listcomp>
    return [default_collate(samples) for samples in transposed]
  File "/home/min1/anaconda3/envs/bwq/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 43, in default_collate
    return torch.stack(batch, 0, out=out)
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 128 and 126 in dimension 3 at /opt/conda/conda-bld/pytorch_1556653114079/work/aten/src/TH/generic/THTensor.cpp:711
@adityac8
Copy link
Collaborator

Hi,

Which TRAIN_PS are you using. Also, are you using the MPRNet model.

Thanks

@lonely6628
Copy link
Author

Hello,thank you very much for your reply!
Yes, I use the MPRNet Model.
I changed the value of TRAIN_PS to 128 and the value of BATCH_SIZE to 2. Nothing else has changed.

@adityac8
Copy link
Collaborator

adityac8 commented Nov 1, 2021

Hi

Make sure you do not turn off reflection padding in dataset_RGB.py

There are certain images whose height and width are smaller than 128. For those particular cases, we reflect pad it to TRAIN_PS.

Thanks

@lonely6628
Copy link
Author

lonely6628 commented Nov 2, 2021

Hi,I didn't modify the code in dataset_RGB.py, the code of reflection padding should be effective.

Thanks for your reply!

@lonely6628
Copy link
Author

Hi, I really appreciate your guidance!
I have solved this problem. This is because there is a different size of the input picture and the target picture in the dataset.

@adityac8
Copy link
Collaborator

Hi @lonely6628

I am glad that your issue is solved.
I checked the dataset we uploaded and there does not seem to be such problem with the data.

Thanks

@swz30 swz30 closed this as completed Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants