Skip to content

Shape mismatch in _SegmentationLoss #207

@ATATC

Description

@ATATC
  File "/venv/main/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1787, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/app/MIPCandy/mipcandy/common/optim/loss.py", line 60, in forward
    metrics["dice"] = dice_similarity_coefficient_with_logits(outputs, labels).item()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/app/MIPCandy/mipcandy/metrics.py", line 72, in dice_similarity_coefficient_with_logits
    _args_check(outputs, labels, dtype=torch.float)
  File "/workspace/app/MIPCandy/mipcandy/metrics.py", line 11, in _args_check
    raise ValueError(f"Outputs ({outputs.shape}) and labels ({labels.shape}) must have the same shape")
ValueError: Outputs (torch.Size([1, 5, 80, 160, 160])) and labels (torch.Size([1, 1, 80, 160, 160])) must have the same shape

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtodoNew task or assignment

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions