Ground truth different shape from input #6992
Unanswered
jonathanquantumalpha
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Hi @jonathanquantumalpha, from the error message, the mismatch is in batch dim which has nothing to do with transforms. Could you please check the shape of your input data and where will change the batch dim? Hope it helps, thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @KumoLiu , Below is my code until the error in Colab:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I've been getting the error when training my dataset midway:
epoch 1/100
1.0/3, Train_loss: 0.5414
Train_dice: 0.4586
2.0/3, Train_loss: 0.5474
Train_dice: 0.4526
3.0/3, Train_loss: 0.5476
Train_dice: 0.4524
4.0/3, Train_loss: 0.5494
Train_dice: 0.4506
5.0/3, Train_loss: 0.5548
Train_dice: 0.4452
6.0/3, Train_loss: 0.5496
Train_dice: 0.4504
7.0/3, Train_loss: 0.5552
Train_dice: 0.4448
Epoch_loss: 0.5493
Epoch_metric: 0.4507
AssertionError Traceback (most recent call last)
in <cell line: 16>()
36
37 if name == 'main':
---> 38 train(model, data_in, loss_function, optimizer, 100, model_dir)
2 frames
/usr/local/lib/python3.10/dist-packages/monai/losses/dice.py in forward(self, input, target)
158
159 if target.shape != input.shape:
--> 160 raise AssertionError(f"ground truth has different shape ({target.shape}) from input ({input.shape})")
161
162 # reducing only spatial dimensions (not batch nor channels)
AssertionError: ground truth has different shape (torch.Size([2, 2, 128, 128, 64])) from input (torch.Size([1, 2, 128, 128, 64]))
I'm training it on MSD Liver dataset and below are my transforms:
Why is this the case? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions