lhjthp / HNCT

18 stars 8 forks source link

怎么训练3倍数的模型 #9

Open luodi789567890 opened 9 months ago

luodi789567890 commented 9 months ago

我训练3倍数的时候出现错误:public/home/zq_luodi/.local/lib/python3.8/site-packages/torch/utils/data/dataloader.py:560: UserWarning: This DataLoader will create 6 worker processes in total. Our suggested max number of worker in current system is 3, which is smaller than what this DataLoader is going to create. Please be aware that excessive worker creation might get DataLoader running slow or even freeze, lower the worker number to avoid potential slowness/freeze if necessary. warnings.warn(_create_warning_msg( /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/bb/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/bb/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

Shiqi72 commented 8 months ago

你好,请问解决了吗