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

Error while training CANNET #14

Open
MagazzuGaetano opened this issue Jul 5, 2020 · 1 comment
Open

Error while training CANNET #14

MagazzuGaetano opened this issue Jul 5, 2020 · 1 comment

Comments

@MagazzuGaetano
Copy link

[NWPU DATASET]: 3109 training images.
[NWPU DATASET]: 500 validation images.
dataset preparation finished!
training has started!
/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py:2973: 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.6/dist-packages/torch/nn/functional.py:1569: UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.
warnings.warn("nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.")
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/loss.py:432: UserWarning: Using a target size (torch.Size([4, 576, 768])) that is different to the input size (torch.Size([4, 72, 96])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size.
return F.mse_loss(input, target, reduction=self.reduction)
Traceback (most recent call last):
File "train.py", line 34, in
cc_trainer.forward()
File "/content/drive/My Drive/Stage Crowd Counting/NPWU-CROWD/trainer.py", line 66, in forward
self.train()
File "/content/drive/My Drive/Stage Crowd Counting/NPWU-CROWD/trainer.py", line 102, in train
pred_map, _ = self.net(img, gt_map)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "/content/drive/My Drive/Stage Crowd Counting/NPWU-CROWD/models/CC.py", line 35, in forward
self.loss_mse= self.build_loss(density_map.squeeze(), gt_map.squeeze())
File "/content/drive/My Drive/Stage Crowd Counting/NPWU-CROWD/models/CC.py", line 39, in build_loss
loss_mse = self.loss_mse_fn(density_map, gt_data)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/loss.py", line 432, in forward
return F.mse_loss(input, target, reduction=self.reduction)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py", line 2542, in mse_loss
expanded_input, expanded_target = torch.broadcast_tensors(input, target)
File "/usr/local/lib/python3.6/dist-packages/torch/functional.py", line 62, in broadcast_tensors
return _VF.broadcast_tensors(tensors)
RuntimeError: The size of tensor a (96) must match the size of tensor b (768) at non-singleton dimension 2

@msn199959
Copy link

I have the same question, how to solve it?

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

2 participants