Skip to content

Fixes for Nuclick Transform#5563

Merged
wyli merged 13 commits intoProject-MONAI:devfrom
SachidanandAlle:nuclick
Nov 24, 2022
Merged

Fixes for Nuclick Transform#5563
wyli merged 13 commits intoProject-MONAI:devfrom
SachidanandAlle:nuclick

Conversation

@SachidanandAlle
Copy link
Copy Markdown
Contributor

@SachidanandAlle SachidanandAlle commented Nov 22, 2022

Fixes # .

Description

  • Make the current nuclick transform tensor enabled.
  • Add option to use Gaussian Filter over user clicks.
  • Option to choose initial seed point based on distance transform instead of random
  • Optimize patch/boundary box creation logic for nuclei cells
  • The same transform should be useful to create an interactive nuclick classification model

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

Signed-off-by: Sachidanand Alle <[email protected]>
Signed-off-by: Sachidanand Alle <[email protected]>
Signed-off-by: Sachidanand Alle <[email protected]>
@SachidanandAlle SachidanandAlle marked this pull request as draft November 22, 2022 19:15
@SachidanandAlle
Copy link
Copy Markdown
Contributor Author

Verified against existing NuClick Tutorial (for both train and infer notebooks)

Signed-off-by: Sachidanand Alle <[email protected]>
@wyli wyli marked this pull request as ready for review November 23, 2022 07:07
@wyli
Copy link
Copy Markdown
Contributor

wyli commented Nov 23, 2022

/build

@wyli wyli enabled auto-merge (squash) November 23, 2022 07:07
@wyli
Copy link
Copy Markdown
Contributor

wyli commented Nov 23, 2022

some errors from pytorch 1.8.2:

[2022-11-23T07:41:33.686Z] ======================================================================
[2022-11-23T07:41:33.686Z] ERROR: test_correct_shape_0 (tests.test_nuclick_transforms.TestGuidanceSignal)
[2022-11-23T07:41:33.686Z] ----------------------------------------------------------------------
[2022-11-23T07:41:33.686Z] Traceback (most recent call last):
[2022-11-23T07:41:33.686Z]   File "/usr/local/lib/python3.7/dist-packages/parameterized/parameterized.py", line 533, in standalone_func
[2022-11-23T07:41:33.686Z]     return func(*(a + p.args), **p.kwargs)
[2022-11-23T07:41:33.686Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/tests/test_nuclick_transforms.py", line 215, in test_correct_shape
[2022-11-23T07:41:33.686Z]     result = AddPointGuidanceSignald(**arguments)(input_data)
[2022-11-23T07:41:33.686Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/apps/nuclick/transforms.py", line 312, in __call__
[2022-11-23T07:41:33.686Z]     inc_sig = self.inclusion_map(mask[0], dtype=image.dtype)
[2022-11-23T07:41:33.686Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/apps/nuclick/transforms.py", line 350, in inclusion_map
[2022-11-23T07:41:33.686Z]     indices = torch.argwhere(mask > 0)
[2022-11-23T07:41:33.686Z] AttributeError: module 'torch' has no attribute 'argwhere'
[2022-11-23T07:41:33.686Z] 
[2022-11-23T07:41:33.686Z] ======================================================================
[2022-11-23T07:41:33.686Z] ERROR: test_correct_shape_1 (tests.test_nuclick_transforms.TestGuidanceSignal)
[2022-11-23T07:41:33.686Z] ----------------------------------------------------------------------
[2022-11-23T07:41:33.686Z] Traceback (most recent call last):
[2022-11-23T07:41:33.686Z]   File "/usr/local/lib/python3.7/dist-packages/parameterized/parameterized.py", line 533, in standalone_func
[2022-11-23T07:41:33.686Z]     return func(*(a + p.args), **p.kwargs)
[2022-11-23T07:41:33.686Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/tests/test_nuclick_transforms.py", line 215, in test_correct_shape
[2022-11-23T07:41:33.686Z]     result = AddPointGuidanceSignald(**arguments)(input_data)
[2022-11-23T07:41:33.686Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/apps/nuclick/transforms.py", line 312, in __call__
[2022-11-23T07:41:33.686Z]     inc_sig = self.inclusion_map(mask[0], dtype=image.dtype)
[2022-11-23T07:41:33.686Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/apps/nuclick/transforms.py", line 350, in inclusion_map
[2022-11-23T07:41:33.686Z]     indices = torch.argwhere(mask > 0)
[2022-11-23T07:41:33.686Z] AttributeError: module 'torch' has no attribute 'argwhere'
[2022-11-23T07:41:33.686Z] 
[2022-11-23T07:41:33.686Z] ======================================================================
[2022-11-23T07:41:33.686Z] ERROR: test_correct_results_0 (tests.test_nuclick_transforms.TestSplitLabelsd)
[2022-11-23T07:41:33.686Z] ----------------------------------------------------------------------
[2022-11-23T07:41:33.686Z] Traceback (most recent call last):
[2022-11-23T07:41:33.686Z]   File "/usr/local/lib/python3.7/dist-packages/parameterized/parameterized.py", line 533, in standalone_func
[2022-11-23T07:41:33.686Z]     return func(*(a + p.args), **p.kwargs)
[2022-11-23T07:41:33.686Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/tests/test_nuclick_transforms.py", line 208, in test_correct_results
[2022-11-23T07:41:33.686Z]     result = SplitLabeld(**arguments)(input_data)
[2022-11-23T07:41:33.686Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/apps/nuclick/transforms.py", line 177, in __call__
[2022-11-23T07:41:33.686Z]     others = torch.where(label == mask_value, 0, label)
[2022-11-23T07:41:33.686Z] RuntimeError: expected scalar type long int but found unsigned char
[2022-11-23T07:41:33.686Z] 
[2022-11-23T07:41:33.686Z] ======================================================================
[2022-11-23T07:41:33.686Z] ERROR: test_correct_results_1 (tests.test_nuclick_transforms.TestSplitLabelsd)
[2022-11-23T07:41:33.687Z] ----------------------------------------------------------------------
[2022-11-23T07:41:33.687Z] Traceback (most recent call last):
[2022-11-23T07:41:33.687Z]   File "/usr/local/lib/python3.7/dist-packages/parameterized/parameterized.py", line 533, in standalone_func
[2022-11-23T07:41:33.687Z]     return func(*(a + p.args), **p.kwargs)
[2022-11-23T07:41:33.687Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/tests/test_nuclick_transforms.py", line 208, in test_correct_results
[2022-11-23T07:41:33.687Z]     result = SplitLabeld(**arguments)(input_data)
[2022-11-23T07:41:33.687Z]   File "/home/jenkins/agent/workspace/MONAI-premerge/monai/monai/apps/nuclick/transforms.py", line 177, in __call__
[2022-11-23T07:41:33.687Z]     others = torch.where(label == mask_value, 0, label)
[2022-11-23T07:41:33.687Z] RuntimeError: expected scalar type long int but found unsigned char
[2022-11-23T07:41:33.687Z] 
[2022-11-23T07:41:33.687Z] ----------------------------------------------------------------------

@wyli wyli disabled auto-merge November 23, 2022 08:11
@SachidanandAlle
Copy link
Copy Markdown
Contributor Author

Will look into pytorch compatibility. I am also verifying using them e2e for both train and infer in monailabel with new possible version of nuclick and classification model. Until then, this shall continue as draft PR

@wyli wyli marked this pull request as draft November 23, 2022 08:22
@wyli
Copy link
Copy Markdown
Contributor

wyli commented Nov 23, 2022

Will look into pytorch compatibility. I am also verifying using them e2e for both train and infer in monailabel with new possible version of nuclick and classification model. Until then, this shall continue as draft PR

ok thanks, sorry I thought it was ready for merging. let me know if you want to trigger the tests

@SachidanandAlle SachidanandAlle marked this pull request as ready for review November 24, 2022 20:45
@SachidanandAlle
Copy link
Copy Markdown
Contributor Author

@wyli this version looks good to merge. also tested workflows on pytorch 1.8

@wyli
Copy link
Copy Markdown
Contributor

wyli commented Nov 24, 2022

/build

@wyli wyli enabled auto-merge (squash) November 24, 2022 21:08
@wyli wyli merged commit 94dbc3c into Project-MONAI:dev Nov 24, 2022
@SachidanandAlle SachidanandAlle deleted the nuclick branch November 24, 2022 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 💯 Complete

Development

Successfully merging this pull request may close these issues.

2 participants