Skip to content

An error occurs when running ChangeFormerV2 #114

Description

@Hank-user

G_pred shape: torch.Size([8, 2, 256, 256])
G_pred[-1] shape: torch.Size([2, 256, 256])
gt shape: torch.Size([8, 1, 256, 256])
0%| | 0/890 [00:01<?, ?it/s]
Traceback (most recent call last):
File "F:\ChangeDetection\ChangeFormer\main_cd.py", line 84, in
train(args)
File "F:\ChangeDetection\ChangeFormer\main_cd.py", line 15, in train
model.train_models()
File "F:\ChangeDetection\ChangeFormer\models\trainer.py", line 341, in train_models
self._backward_G()
File "F:\ChangeDetection\ChangeFormer\models\trainer.py", line 317, in _backward_G
self.G_loss = self._pxl_loss(self.G_pred[-1], gt)
File "F:\ChangeDetection\ChangeFormer\models\losses.py", line 20, in cross_entropy
return F.cross_entropy(input=input, target=target, weight=weight,
File "D:\Major app\anaconda3\envs\pytorch\lib\site-packages\torch\nn\functional.py", line 3059, in cross_entropy
return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)
ValueError: Expected input batch_size (2) to match target batch_size (8).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions