lhjthp / HNCT

18 stars 8 forks source link

复现错误 #8

Open kekiii opened 9 months ago

kekiii commented 9 months ago

372,848 total parameters.372,848 training parammeters Evaluation:0it [00:02,?it/s] Traceback (most recent cal1 last):File“main.py”,line 48,in mainoFile main.py",line 41, in mainwhile not t.terminate.:File“/root/HNCT-main/src/trainer.py”,line 195,in terminateself.test.File“/root/HNCT-main/src/trainer.py”,line 132,in testPSNR values.append(eval acc / len(d)) ZeroDivisionError: division by zero 您好,我尝试用给出的模型测试自己的数据集,但是出现如上错误,数据集路径应该没有问题,请问有什么其他可能的原因吗,谢谢

luodi789567890 commented 9 months ago

朋友你遇到三倍数的时候的错误吗public/home/zq_luodi/.local/lib/python3.8/site-packages/torch/nn/modules/loss.py:101: UserWarning: Using a target size (torch.Size([16, 3, 256, 256])) that is different to the input size (torch.Size([16, 3, 255, 255])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size. return F.l1_loss(input, target, reduction=self.reduction) Traceback (most recent call last): File "main.py", line 39, in main() File "main.py", line 33, in main t.train() File "/public/home/zq_luodi/perl5/3w/HNCT-main/src/trainer.py", line 55, in train loss = self.loss(sr, hr) File "/public/home/zq_luodi/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, *kwargs) File "/public/home/zq_luodi/perl5/3w/HNCT-main/src/loss/init.py", line 73, in forward loss = l['function'](sr, hr) File "/public/home/zq_luodi/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(args, **kwargs) File "/public/home/zq_luodi/.local/lib/python3.8/site-packages/torch/nn/modules/loss.py", line 101, in forward return F.l1_loss(input, target, reduction=self.reduction) File "/public/home/zq_luodi/.local/lib/python3.8/site-packages/torch/nn/functional.py", line 3263, in l1_loss expanded_input, expanded_target = torch.broadcast_tensors(input, target) File "/public/home/zq_luodi/.local/lib/python3.8/site-packages/torch/functional.py", line 74, in broadcast_tensors return _VF.broadcast_tensors(tensors) # type: ignore[attr-defined] RuntimeError: The size of tensor a (255) must match the size of tensor b (256) at non-singleton dimension 3

kekiii commented 8 months ago

我没遇到这个问题,根据你给出的错误信息,可能是输入数据的尺寸不对导致的,我在测试自己的数据时,好像读取不到数据,不清楚是不是路径写错了,请问你是怎么更改数据集路径的?

Shiqi72 commented 8 months ago

你好,1.1.0复现时from torch.utils.data.dataloader import _DataLoaderIter报错,要怎么修改

Shiqi72 commented 7 months ago

总共 372,848 个参数。372,848 个训练参数 评估:0it [00:02,?it/s] 回溯(最近一次 cal1 last):File“main.py”,第 48 行,in mainoFile main.py“,第 41 行,in mainwhile not t.terminate.:File”/root/HNCT-main/src/trainer.py“,line 195,in terminateself.test.File”/root/HNCT-main/src/trainer.py“,line 132,in testPSNR values.append(eval acc / len(d)) ZeroDivisionError:除以零您好,我尝试用给出的模型测试自己的数据集,但是出现如上错误,数据集路径应该没有问题,请问有什么其他可能的原因吗,谢谢

你好,我也遇到了这个问题,想问一下你解决了吗

Shiqi72 commented 5 months ago

朋友你遇到三倍数的时候的错误吗public/home/zq_luodi/.local/lib/python3.8/site-packages/torch/nn/modules/loss.py:101: UserWarning: Using a target size (torch.Size([16, 3, 256, 256])) that is different to the input size (torch.Size([16, 3, 255, 255])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size. return F.l1_loss(input, target, reduction=self.reduction) Traceback (most recent call last): File "main.py", line 39, in main() File "main.py", line 33, in main t.train() File "/public/home/zq_luodi/perl5/3w/HNCT-main/src/trainer.py", line 55, in train loss = self.loss(sr, hr) File "/public/home/zq_luodi/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, kwargs) File "/public/home/zq_luodi/perl5/3w/HNCT-main/src/loss/init*.py", line 73, in forward loss = l['function'](sr, hr) File "/public/home/zq_luodi/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(args, **kwargs) File "/public/home/zq_luodi/.local/lib/python3.8/site-packages/torch/nn/modules/loss.py", line 101, in forward return F.l1_loss(input, target, reduction=self.reduction) File "/public/home/zq_luodi/.local/lib/python3.8/site-packages/torch/nn/functional.py", line 3263, in l1_loss expanded_input, expanded_target = torch.broadcast_tensors(input, target) File "/public/home/zq_luodi/.local/lib/python3.8/site-packages/torch/functional.py", line 74, in broadcast_tensors return _VF.broadcast_tensors(tensors) # type: ignore[attr-defined] RuntimeError: The size of tensor a (255) must match the size of tensor b (256) at non-singleton dimension 3

你好,请问解决了吗

Bobodesu commented 5 months ago

这个问题我也遇到了,似乎是因为256/3除不尽,得到85.3333后自动舍入成85了,再上采样3倍后就是255,我也不知道该如何修改。顺带一提有人尝试用这个模型跑其他数据集吗,为什么我一换数据集就run不起来呢(realsr数据集)