Skip to content

v0.5 to v0.6 migration guide

Wenqi Li edited this page Jul 9, 2021 · 13 revisions

Migrating your v0.5 code to v0.6

In MONAI v0.6, we enhanced the design of metrics and postprocessing transforms to provide more flexible and advanced features, which, in the meantime, brought some slightly breaking changes.

Check What's new in 0.6 for more details of the new features.

To help users smoothly migrate the existing code from MONAI v0.5 to v0.6, this document shows the detailed steps with example code.

Decollate batch-first Tensor to list of channel-first Tensors

  1. After model forward and loss backward, to independently apply postprocessing transforms for every single data in a batch, need to execute decollate_batch to convert the batch Tensor to a list of Tensors.
  2. Currently, all the MONAI postprocessing transforms are updated to handle channel-first Tensor instead of batch-first Tensor. So both the preprocessing transforms and postprocessing transforms handle the same data shape. Just execute postprocessing transform for every items of the list.
  3. As all the postprocessing transforms expect Tensor type input, in order to ensure the data after decollate_batch is Tensor, suggest to add ToTensor or ToTensord transform.
  4. Use from_engine() utility to extract expected data from the decollated list, set first=True for scalar values. {placeholder}

Adjust the new metrics APIs to automatically support data parallel

  1. Support list of channel-first Tensors as input.
  2. Support data parallel in multi-GPUs or multi-nodes cases. {placeholder}

Update the batch_transform or output_transform of several event handlers

{placeholder}

Update all the post transform to postprocessing

{placeholder}

The from_engine utility function

{placeholder}

DynUNet

In v0.6, DynUNet has been updated, the previous version is still made available:

from monai.networks.nets.dynunet_v1 import DynUNetV1 as DynUNet

dynunet_v1 will be removed in the future release.

Clone this wiki locally