Skip to content

Create deepedit tutorial #661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
May 9, 2022

Conversation

diazandr3s
Copy link
Contributor

Signed-off-by: Andres Diaz-Pinto [email protected]

Description

Add tutorial to run deepedit model on MONAI Core

Status

Ready

Signed-off-by: Andres Diaz-Pinto <[email protected]>
@diazandr3s diazandr3s requested a review from wyli April 18, 2022 19:22
@diazandr3s diazandr3s self-assigned this Apr 18, 2022
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@Nic-Ma
Copy link
Contributor

Nic-Ma commented Apr 19, 2022

Hi @diazandr3s ,

Thanks very much for the tutorial!
As we are going to release MONAI bundle soon, would you like to also contribute a bundle for this deepedit model?
The get_started tutorial and reference example are at: https://github.com/Project-MONAI/tutorials/tree/master/modules/bundles.
And related documentation: https://docs.monai.io/en/latest/bundle_intro.html.

What do you think?
CC @ericspod @wyli

Thanks in advance.

@ericspod
Copy link
Member

Thanks for the tutorial!

It's great to have a tutorial introducing DeepEdit but I think it needs more explanation about what's going on and what the moving parts are. The notebook doesn't make clear what the specific elements of DeepEdit are and how they're used, in the first part there is a sequence of transforms which appears to add a landmark into the data dictionary, but the parts which do this aren't explained and the use for this isn't made clear. In the second part a pretrained model is used to segment but how that relates to the first part isn't clear. I understand what the moving pieces are in DeepEdit from other presentations but this needs to be motivated here.

There's a number of functions in the notebook for plotting, you might want to put these into a PR in core to be kept here if they're generic enough. A general routine for overlaying landmarks would be useful in general.

There's also a lot of code in the custom_*.py files, for a tutorial this makes it hard to follow and there seems to be duplication here with what's in MONAILabel itself, could this be reduced or is the point to avoid importing MONAILabel? The notebook imports a number of classes from here that aren't used, it would be clearer if there were no unnecessary imports.

If would be great if this model were packaged into a bundle with an added inference.json file at least, a training.json file would be great as well that replicated what's in the training script. It would be easier to take the model into other contexts such as deployment.

@diazandr3s
Copy link
Contributor Author

Many thanks for your comments and suggestions, @Nic-Ma @ericspod. They are helpful! :)

I'll create a couple of PRs to MONAI core to include custom transforms, custom interaction, and common plotting functions ... All this to simplify the tutorial. I'll also make the steps/content clearer

I really like the idea of creating a bundle for DeepEdit. I'll work on this once we have the latest version of the tutorial.

Will keep you posted!

@daguangxu
Copy link

Many thanks for your comments and suggestions, @Nic-Ma @ericspod. They are helpful! :)

I'll create a couple of PRs to MONAI core to include custom transforms, custom interaction, and common plotting functions ... All this to simplify the tutorial. I'll also make the steps/content clearer

I really like the idea of creating a bundle for DeepEdit. I'll work on this once we have the latest version of the tutorial.

Will keep you posted!

@diazandr3s, we plan to release MONAI 0.9 in mid-June. Can you try to finish this DeepEdit bundle before end of May? Thanks.

@diazandr3s
Copy link
Contributor Author

Many thanks for your comments and suggestions, @Nic-Ma @ericspod. They are helpful! :)
I'll create a couple of PRs to MONAI core to include custom transforms, custom interaction, and common plotting functions ... All this to simplify the tutorial. I'll also make the steps/content clearer
I really like the idea of creating a bundle for DeepEdit. I'll work on this once we have the latest version of the tutorial.
Will keep you posted!

@diazandr3s, we plan to release MONAI 0.9 in mid-June. Can you try to finish this DeepEdit bundle before end of May? Thanks.

Yes, I'll be working on this next week.

@diazandr3s
Copy link
Contributor Author

Quick update on this:

Once I have the MONAI release candidate or MONAI weekly version, I'll update the files

@diazandr3s diazandr3s requested a review from Nic-Ma April 26, 2022 18:14
@diazandr3s diazandr3s added the good first issue Good for newcomers label Apr 26, 2022
Copy link
Contributor

@Nic-Ma Nic-Ma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested both the DynUNet and UNETR? May I know the difference in the result?

Thanks.

@review-notebook-app
Copy link

review-notebook-app bot commented May 9, 2022

View / edit / reply to this conversation on ReviewNB

Nic-Ma commented on 2022-05-09T09:55:05Z
----------------------------------------------------------------

Please add these optional imports in above cell directly.

Refer to other tutorial:

https://github.com/Project-MONAI/tutorials/blob/master/3d_segmentation/spleen_segmentation_3d_lightning.ipynb

Thanks.


@review-notebook-app
Copy link

View / edit / reply to this conversation on ReviewNB

Nic-Ma commented on 2022-05-09T09:55:06Z
----------------------------------------------------------------

Line #35.        print("Final PLOT:: {} => image shape: {}, pred shape: {}; min: {}, max: {}, sum: {}".format(

I think here it plot too many charts, could you please help reduce them? Maybe less than 10 charts?

Thanks.


@diazandr3s
Copy link
Contributor Author

Have you tested both the DynUNet and UNETR? May I know the difference in the result?

Thanks.

Yes! It works better than the DynUNET. But I wanted to keep the DynUNET as default as it takes less time training

@diazandr3s
Copy link
Contributor Author

View / edit / reply to this conversation on ReviewNB

Nic-Ma commented on 2022-05-09T09:55:06Z ----------------------------------------------------------------

Line #35. print("Final PLOT:: {} => image shape: {}, pred shape: {}; min: {}, max: {}, sum: {}".format(

I think here it plot too many charts, could you please help reduce them? Maybe less than 10 charts?

Thanks.

Agree!

@diazandr3s
Copy link
Contributor Author

View / edit / reply to this conversation on ReviewNB

Nic-Ma commented on 2022-05-09T09:55:05Z ----------------------------------------------------------------

Please add these optional imports in above cell directly.

Refer to other tutorial:

https://github.com/Project-MONAI/tutorials/blob/master/3d_segmentation/spleen_segmentation_3d_lightning.ipynb

Thanks.

Agree. Just changed it

diazandr3s added 5 commits May 9, 2022 12:03
Signed-off-by: Andres Diaz-Pinto <[email protected]>
Signed-off-by: Andres Diaz-Pinto <[email protected]>
Signed-off-by: Andres Diaz-Pinto <[email protected]>
Signed-off-by: Andres Diaz-Pinto <[email protected]>
@Nic-Ma
Copy link
Contributor

Nic-Ma commented May 9, 2022

View / edit / reply to this conversation on ReviewNB
Nic-Ma commented on 2022-05-09T09:55:06Z ----------------------------------------------------------------
Line #35. print("Final PLOT:: {} => image shape: {}, pred shape: {}; min: {}, max: {}, sum: {}".format(
I think here it plot too many charts, could you please help reduce them? Maybe less than 10 charts?
Thanks.

Agree!

I think you don't need to add another variable num_slides, just for i in range(10) or for i in range(0, 100, 10)?

image

Thanks.

@diazandr3s
Copy link
Contributor Author

View / edit / reply to this conversation on ReviewNB
Nic-Ma commented on 2022-05-09T09:55:06Z ----------------------------------------------------------------
Line #35. print("Final PLOT:: {} => image shape: {}, pred shape: {}; min: {}, max: {}, sum: {}".format(
I think here it plot too many charts, could you please help reduce them? Maybe less than 10 charts?
Thanks.

Agree!

I think you don't need to add another variable num_slides, just for i in range(10) or for i in range(0, 100, 10)?

image

Thanks.

agree!

@diazandr3s diazandr3s requested a review from Nic-Ma May 9, 2022 12:37
Copy link
Contributor

@wyli wyli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it looks good to me.

@diazandr3s diazandr3s merged commit f6a1eed into Project-MONAI:master May 9, 2022
Copy link
Contributor

@Nic-Ma Nic-Ma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Thanks.

boneseva pushed a commit to boneseva/MONAI-tutorials that referenced this pull request Apr 21, 2024
* Create deepedit tutorial

Signed-off-by: Andres Diaz-Pinto <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update train file

Signed-off-by: Andres Diaz-Pinto <[email protected]>

* Move custom transforms and interaction to MONAI core

Signed-off-by: Andres Diaz-Pinto <[email protected]>

* Update imports from MONAI

Signed-off-by: Andres Diaz-Pinto <[email protected]>

* Update Notebook and Readme

Signed-off-by: Andres Diaz-Pinto <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix static errors in Notebook

Signed-off-by: Andres Diaz-Pinto <[email protected]>

* Fix spaces autofix

Signed-off-by: Andres Diaz-Pinto <[email protected]>

* Update DeepEdit transform names

Signed-off-by: Andres Diaz-Pinto <[email protected]>

* Update Readme

Signed-off-by: Andres Diaz-Pinto <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Address first round of comments

Signed-off-by: Andres Diaz-Pinto <[email protected]>

* Fix static issues

Signed-off-by: Andres Diaz-Pinto <[email protected]>

* Fix static

Signed-off-by: Andres Diaz-Pinto <[email protected]>

* Fix static erros

Signed-off-by: Andres Diaz-Pinto <[email protected]>

* Address second round of comments

Signed-off-by: Andres Diaz-Pinto <[email protected]>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants