Issue with ComputeAverageDice Metric in SDK 3.1

config_train.json (4.0 KB)
segResNetCPU.py (6.2 KB)

Hi,

Upon trying the training model with channel last, getting following error in metric computation

Traceback (most recent call last):
File “workflows/fitters/supervised_fitter.py”, line 245, in fit
File “workflows/fitters/supervised_fitter.py”, line 672, in _do_fit
File “workflows/fitters/supervised_fitter.py”, line 962, in do_validation
File “components/metrics/metric.py”, line 71, in update
File “libs/metrics/avg_from_array.py”, line 27, in update
File “libs/metrics/avg_from_array_dice.py”, line 38, in reduction_fn
File “libs/metrics/np_ops.py”, line 105, in acc_dice_np_batch
File “libs/metrics/np_ops.py”, line 41, in acc_dice_np
File “libs/metrics/np_ops.py”, line 7, in dice_np
AssertionError: shape of labels (128, 128, 128) and prediction (128, 128, 10) are inconsistent

The issue seems to be due to that fact that ComputeAverageDice is defined for channel_first only.
class ComputeAverageDice ( name , field , label_field=‘label’ , is_2d=False , remove_bg=True , logit_thresh=0.5 , is_one_hot_targets=False , report_path=None , do_summary=True , do_print=True , is_key_metric=False )

Please let me know how to resolve the upper issue.
I have uploaded my config_train.json and custom segResNet network file here.

Thanks,
Archit

Hi
Thanks for your interest in Clara Train SDK.
There are multiple issues here.
1 we don’t support running on a CPU
2 we always recommend using channel first
3- If this is a 3d problem then your sizes should be 128,128,128,numOfClasses (10)

Hope this helps

Please note we have recently release clara train V4.0 based on MONAI which uses PyTorch. Please check out the notebooks to get you started clara-train-examples/PyTorch/NoteBooks at master · NVIDIA/clara-train-examples · GitHub

  1. Is channel first recommended or is it mandatory.
    The above worked fine for channel first, but in case of channel last it showed the above error.
    The above worked as 3D in case of channel first.

We are working on Clara 3.1, and its difficult to move to a new version.
Is clara 3.1 still supported by nvidia?