-
Notifications
You must be signed in to change notification settings - Fork 1.1k
v0.5 to v0.6 migration guide
Wenqi Li edited this page Jul 9, 2021
·
13 revisions
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.
- 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. - Currently, all the MONAI postprocessing transforms are updated to handle
channel-first
Tensor instead ofbatch-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. - As all the postprocessing transforms expect Tensor type input, in order to ensure the data after
decollate_batch
is Tensor, suggest to addToTensor
orToTensord
transform. - Use
from_engine()
utility to extract expected data from the decollated list, setfirst=True
for scalar values. {placeholder}
- Support list of
channel-first
Tensors as input. - Support data parallel in multi-GPUs or multi-nodes cases. {placeholder}
{placeholder}
{placeholder}
{placeholder}
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.