Skip to content

561 497 Provide metrics base APIs#2291

Merged
Nic-Ma merged 32 commits into
Project-MONAI:feature/561-metrics-apifrom
Nic-Ma:561-provide-metrics-base
Jun 6, 2021
Merged

561 497 Provide metrics base APIs#2291
Nic-Ma merged 32 commits into
Project-MONAI:feature/561-metrics-apifrom
Nic-Ma:561-provide-metrics-base

Conversation

@Nic-Ma

@Nic-Ma Nic-Ma commented Jun 1, 2021

Copy link
Copy Markdown
Contributor

Description

This PR added base class for the metrics.
And add support for list of channel-first Tensor.
It's a non-breaking change.

Status

Ready

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.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

@Nic-Ma

Nic-Ma commented Jun 2, 2021

Copy link
Copy Markdown
Contributor Author

/black

@Nic-Ma Nic-Ma marked this pull request as ready for review June 2, 2021 11:31
@Nic-Ma Nic-Ma changed the title [WIP] 561 497 Provide metrics base APIs 561 497 Provide metrics base APIs Jun 2, 2021
Signed-off-by: monai-bot <monai.miccai2019@gmail.com>
@Nic-Ma

Nic-Ma commented Jun 2, 2021

Copy link
Copy Markdown
Contributor Author

Hi @vfdev-5 ,

This PR added the metric base class and support a list of tensors. Tried to align with your new metric API design.

Thanks.

Comment thread monai/config/type_definitions.py Outdated
Comment thread monai/metrics/metric.py
Nic-Ma added 4 commits June 2, 2021 21:00
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma

Nic-Ma commented Jun 2, 2021

Copy link
Copy Markdown
Contributor Author

/black

Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma Nic-Ma force-pushed the 561-provide-metrics-base branch from 9f3945f to 1372133 Compare June 2, 2021 15:59
Nic-Ma added 2 commits June 3, 2021 00:35
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma

Nic-Ma commented Jun 2, 2021

Copy link
Copy Markdown
Contributor Author

/black

@Nic-Ma

Nic-Ma commented Jun 2, 2021

Copy link
Copy Markdown
Contributor Author

/integration-test

@Nic-Ma

Nic-Ma commented Jun 2, 2021

Copy link
Copy Markdown
Contributor Author

Hi @wyli @rijobro @ericspod ,

This PR is ready for review now.

Thanks.

Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma

Nic-Ma commented Jun 2, 2021

Copy link
Copy Markdown
Contributor Author

/black

Comment thread monai/metrics/hausdorff_distance.py Outdated
Comment thread monai/metrics/hausdorff_distance.py Outdated
Comment thread monai/metrics/meandice.py Outdated
Comment thread monai/metrics/metric.py
Comment thread monai/metrics/regression.py Outdated

@yiheng-wang-nv yiheng-wang-nv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the changes, I left some comments above.

Comment thread tests/test_handler_rocauc.py

@wyli wyli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks, I put some initial comments, the metric base classes may need more work, let me check the evaluation working group discussions and think about this

Comment thread monai/metrics/confusion_matrix.py Outdated
Comment thread monai/handlers/iteration_metric.py
Comment thread monai/metrics/metric.py Outdated
Comment thread monai/metrics/metric.py Outdated
Nic-Ma added 5 commits June 3, 2021 22:07
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma

Nic-Ma commented Jun 3, 2021

Copy link
Copy Markdown
Contributor Author

/black

Nic-Ma added 2 commits June 3, 2021 23:12
Signed-off-by: Nic Ma <nma@nvidia.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma

Nic-Ma commented Jun 3, 2021

Copy link
Copy Markdown
Contributor Author

/black

@Nic-Ma Nic-Ma changed the base branch from dev to feature/561-metrics-api June 6, 2021 00:22
@Nic-Ma

Nic-Ma commented Jun 6, 2021

Copy link
Copy Markdown
Contributor Author

As this is a very big feature update, I created a new branch: feature/561-metrics-api in the Project-MONAI repo.
I will merge this PR into that branch and create a new PR to dev branch.

Thanks.

@Nic-Ma Nic-Ma merged commit 6dfafdc into Project-MONAI:feature/561-metrics-api Jun 6, 2021
Nic-Ma added a commit that referenced this pull request Jun 11, 2021
* 561 497 Provide metrics base APIs (#2291)

* [DLMED] add metric base class

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update meandice and auc

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] extract reduce API

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update regression metrics

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update all the other metrics and enhance unit tests

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add doc-strings and update unit tests

Signed-off-by: Nic Ma <nma@nvidia.com>

* [MONAI] python code formatting

Signed-off-by: monai-bot <monai.miccai2019@gmail.com>

* [DLMED] fix flake8 issue

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix pytype issue

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix all the mypy issues

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix integration test

Signed-off-by: Nic Ma <nma@nvidia.com>

* [MONAI] python code formatting

Signed-off-by: monai-bot <monai.miccai2019@gmail.com>

* [DLMED] fix flake8 issue

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix pytype issue

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add more sanity check

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to Yiheng's comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to Wenqi's comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] change to "_compute()" and "aggregate()"

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add compute_list()

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix flake8 issue

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] fix flake8 issue

Signed-off-by: Nic Ma <nma@nvidia.com>

Co-authored-by: monai-bot <monai.miccai2019@gmail.com>
Co-authored-by: Yiheng Wang <68361391+yiheng-wang-nv@users.noreply.github.com>

* [DLMED] update according to comments

1. re-define base classes in 3 levels to make it more clear and flexible to extend
2. added self-contained variables in metrics to provide easier API
3. added reset() and sync() logic
4. added distributed data parallel logic for all the metrics

Signed-off-by: Nic Ma <nma@nvidia.com>

* [MONAI] python code formatting

Signed-off-by: monai-bot <monai.miccai2019@gmail.com>

* [DLMED] fix flake8 issue

Signed-off-by: Nic Ma <nma@nvidia.com>

* [MONAI] python code formatting

Signed-off-by: monai-bot <monai.miccai2019@gmail.com>

* [DLMED] optimize base classes

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] simplify integration tests to use new APIs

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update based on comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] add synced=False in add()

Signed-off-by: Nic Ma <nma@nvidia.com>

* [DLMED] update according to comments

Signed-off-by: Nic Ma <nma@nvidia.com>

* full ci/cd for feature branches

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* [DLMED] update aggregate()

Signed-off-by: Nic Ma <nma@nvidia.com>

Co-authored-by: monai-bot <monai.miccai2019@gmail.com>
Co-authored-by: Yiheng Wang <68361391+yiheng-wang-nv@users.noreply.github.com>
Co-authored-by: Wenqi Li <wenqil@nvidia.com>
@Nic-Ma Nic-Ma deleted the 561-provide-metrics-base branch July 2, 2021 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Additional Metric Interface to compute quantities over dataset

6 participants