diptamath / Nonhomogeneous_Image_Dehazing

Fast Deep Multi-patch Hierarchical Network for Nonhomogeneous Image Dehazing
MIT License
34 stars 7 forks source link

Problem : iteration over a 0-d tensor #5

Closed AMBBe closed 3 years ago

AMBBe commented 3 years ago

After I run DMSHN_train.py, this error shown:

init data folders Training... Epoch: 100 /usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3613: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details. "See the documentation of nn.Upsample for details.".format(mode) /usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3658: UserWarning: The default behavior for interpolate/upsample with float scale_factor changed in 1.6.0 to align with other frameworks/libraries, and now uses scale_factor directly, instead of relying on the computed output size. If you wish to restore the old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details. "The default behavior for interpolate/upsample with float scale_factor changed " /usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at /pytorch/c10/core/TensorImpl.h:1156.) return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode) Traceback (most recent call last): File "DMSHN_train.py", line 232, in main() File "DMSHN_train.py", line 185, in main loss_lv1, loss_recn, loss_perc, loss_tv = custom_loss_fn(dehazed_image,gt) File "/usr/local/lib/python3.7/dist-packages/torch/_tensor.py", line 607, in iter raise TypeError('iteration over a 0-d tensor') TypeError: iteration over a 0-d tensor

Please help me

saikatdutta commented 3 years ago

Go to loss.py. In Line #28, change it so that the function returns 4 values. After that try training.

AMBBe commented 3 years ago

Thanks. It's OK