DiceMetric to compute separate organs dice score #1800
Unanswered
FerseinChris
asked this question in
Q&A
Replies: 4 comments 2 replies
-
Hi @FerseinChris, you can get separate dice for each channel by setting the reduction to
For how to process your output, you can refer to this tutorial: https://github.com/Project-MONAI/tutorials/blob/main/3d_segmentation/swin_unetr_btcv_segmentation_3d.ipynb |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks dear for the fast reply!
Based on the example code provided through the link, I wish to know how to
get the values for each dice of each organ to segment?
|
Beta Was this translation helpful? Give feedback.
1 reply
-
I've tried this way you provided and I've encountered an error. I think it
should be better you provided a code using mean_batch as reduction. Because
the code on the link rather use mean.
…On Mon, Aug 26, 2024 at 2:20 PM Jorvialom Tshivetta ***@***.***> wrote:
Thanks dear for the fast reply!
Based on the example code provided through the link, I wish to know how to
get the values for each dice of each organ to segment?
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Thanks a lot.
…On Mon, Aug 26, 2024 at 2:33 PM YunLiu ***@***.***> wrote:
Hi @FerseinChris <https://github.com/FerseinChris>,
You can refer to these tutorials, they all use mean_batch as reduction.
https://github.com/Project-MONAI/tutorials/blob/main/3d_segmentation/swin_unetr_brats21_segmentation_3d.ipynb
https://github.com/Project-MONAI/tutorials/blob/main/competitions/MICCAI/surgtoolloc/classification_files/train.py
https://github.com/Project-MONAI/tutorials/blob/main/acceleration/distributed_training/brats_training_ddp.py
—
Reply to this email directly, view it on GitHub
<#1800 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQHEBDKYIPOXJQ6UGU5MHLTZTLD3JAVCNFSM6AAAAABNDDDXA6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANBUG43TAMI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to use Monai and obtain the dice of each organ in my volume (case of BTCV dataset)? Below is the code used to compute dice.
def validation(epoch_iterator_val): model.eval() with torch.no_grad(): for batch in epoch_iterator_val: val_inputs, val_labels = (batch["image"].cuda(), batch["label"].cuda()) val_outputs = sliding_window_inference(val_inputs, (96, 96, 96), 4, model) val_labels_list = decollate_batch(val_labels) val_labels_convert = [post_label(val_label_tensor) for val_label_tensor in val_labels_list] val_outputs_list = decollate_batch(val_outputs) val_output_convert = [post_pred(val_pred_tensor) for val_pred_tensor in val_outputs_list] dice_metric(y_pred=val_output_convert, y=val_labels_convert) epoch_iterator_val.set_description("Validate (%d / %d Steps)" % (global_step, 10.0)) # noqa: B038 mean_dice_val = dice_metric.aggregate().item() dice_metric.reset() return mean_dice_val
Beta Was this translation helpful? Give feedback.
All reactions