JCruan519 / VM-UNet

(ARXIV24) This is the official code repository for "VM-UNet: Vision Mamba UNet for Medical Image Segmentation".
Apache License 2.0
513 stars 24 forks source link

ceDiceloss #83

Open xiaogege1210 opened 3 weeks ago

xiaogege1210 commented 3 weeks ago

Why do I get an error when using ceDice as the loss function during training: ../aten/src/ATen/native/cuda/NLLLoss2d.cu:104: nll_loss2d_forward_kernel: block: [0,0,0], thread: [278,0,0] Assertion 't >= 0 && t < n_classes' failed., but when I switch to nDiceLoss, it runs normally? Why is that?

JCruan519 commented 3 weeks ago

The error may be caused by the class labels in your datasets. The #label in your predictions are more than that in your datasets.

---- Replied Message ---- | From | @.> | | Date | 10/22/2024 17:17 | | To | @.> | | Cc | @.***> | | Subject | [JCruan519/VM-UNet] ceDiceloss (Issue #83) |

Why do I get an error when using ceDice as the loss function during training: ../aten/src/ATen/native/cuda/NLLLoss2d.cu:104: nll_loss2d_forward_kernel: block: [0,0,0], thread: [278,0,0] Assertion 't >= 0 && t < n_classes' failed., but when I switch to nDiceLoss, it runs normally? Why is that?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

xiaogege1210 commented 3 weeks ago

I am using the Synapse dataset you provided, with num_classes=9, and the model outputs logits with a shape of (B, 9, 224, 224). Do you know what might be causing the error?

JCruan519 commented 3 weeks ago

You can first check whether the conda environment is configured according to the contents of the requirements. As for this particular error, the cause is that the number of predicted categories is more than the number of labels.

xiaogege1210 commented 3 weeks ago

Sure, thank you very much for your help.