No Post-processing Without Decollate!
See original GitHub issueDescribe the bug https://github.com/Project-MONAI/MONAI/blob/3edff7449984f87c371ac87c99244e6b00e97a92/monai/engines/workflow.py#L167-L171
Not all the metrics accepting decollated tensors, for instance ignite.metrics.Accuracy
expects individual tensors, so disabling the entire post-processing transformation when decollate=False
is limiting and in fact it has broken the pathology pipeline.
Expected behavior
The post-processing being applied regardless of decollate
status.
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
MONAI/workflow.py at dev
tips: if `decollate=False` and `postprocessing` is MONAI transforms, it may not work well. # because all the MONAI transforms expect `channel-first` data.
Read more >Control-D: MSGCLASS (joblog) decollation (also known as ...
This can cause serious increasing elapsed time - if a Generic decollation does not have post-processing activity, the next one can begin ...
Read more >Source code for monai.engines.workflow
_register_decollate() if postprocessing is not None: # tips: if `decollate=False` and `postprocessing` is MONAI transforms, it may not work well # because ...
Read more >Post In conditions to ControlM from INTRDR/JCL
n.b: I did not design this workflow and I am only supporting the system. ... D element) for report decollation and sending to...
Read more >Scheduling Non-CPU Tasks
Not all of the tasks in your data center are computer jobs. ... Tasks performed after a job is run on the CPU...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @wyli ,
Thanks for your suggestions and comments, makes sense to me. Actually, I think we have discussed this topic several times before, and at that time our data shape is not flexible and also need to consider the
TransformInverter
andMetrics
a lot, but now we don’t have those restrictions anymore. So I made an enhancement proposal based on our current implementation and your suggestions:_run_postprocessing
always executes no matterdecollate=True / False
._run_postprocessing
to runengine_apply_transform
directly if not bothbatch
andoutput
are lists, so it can also support other postprocessing methods instead of MONAI transforms.DecollateBatch
handler, so users can setdecollate=False
in the trainer and do some other logic then decollate the data in handlers, just a similar idea as thePostprocessing
handler.I can implement this proposal ASAP, what do you think?
Thanks.
Thanks for the reply @Nic-Ma let’s track pathology pipeline bugs in a separate ticket if there’s any…
For the main topic here, the postprocessing’s type is a generic
Optional[Callable]
(instead ofmonai.transforms.Transform
) https://github.com/Project-MONAI/MONAI/blob/3edff7449984f87c371ac87c99244e6b00e97a92/monai/engines/workflow.py#L98 we should keep this flexibility throughout the base workflow implementation. The decollate can be viewed as a slightly special postprocessing step at this workflow level.For the workflow flexibility, I have another two comments, (1) for
on(IterationEvents.MODEL_COMPLETED)
of the monai engine, the user should be able to set a sequence of event handlers in an arbitrary order, for example: “MyEventHandler1 -> Decollate -> MyEventHandler2 -> MyEventHandler3”, in this way the workflow allows for some customised event handling before the decollate. But by default, we could provideDecollate -> monai.handlers.Postprocessing -> any user specified handlers
. Might be good to have aDecollate
handler?(2) I think the postprocessing logic is also too restrictive: https://github.com/Project-MONAI/MONAI/blob/3edff7449984f87c371ac87c99244e6b00e97a92/monai/engines/workflow.py#L196-L201 https://github.com/Project-MONAI/MONAI/blob/3edff7449984f87c371ac87c99244e6b00e97a92/monai/handlers/postprocessing.py#L54-L58
both case should be changed to something like: