Skip to content

SlidingWindowInferer: option to adaptively stitch in cpu memory for large images#5297

Merged
Nic-Ma merged 9 commits into
Project-MONAI:devfrom
myron:sliding
Oct 13, 2022
Merged

SlidingWindowInferer: option to adaptively stitch in cpu memory for large images#5297
Nic-Ma merged 9 commits into
Project-MONAI:devfrom
myron:sliding

Conversation

@myron

@myron myron commented Oct 8, 2022

Copy link
Copy Markdown
Collaborator

SlidingWindowInferer: option to adaptively stitch in cpu memory for large images.

This adds an option to provide maximum input image volume (number of elements) to dynamically change stitching to cpu memory (to avoid gpu memory crashes). For example with cpu_thresh=400*400*400, all input images with large volume will be stitched on cpu.

At the moment, a user must decide beforehand, to stitch ALL images on cpu or gpu (by specifying the 'device' parameter). But in many datasets, only a few large images require device==cpu, and running inference on cpu for ALL will be unnecessary slow.

It's related to
#4625
#4495
#3497
#4726
#4588

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: myron <amyronenko@nvidia.com>
@myron myron added the enhancement New feature or request label Oct 8, 2022
@myron myron added this to the Auto3D Seg framework [P0 v1.0] milestone Oct 8, 2022
Comment thread monai/inferers/inferer.py Outdated
myron and others added 4 commits October 9, 2022 16:05
Comment thread monai/inferers/inferer.py Outdated
myron added 3 commits October 13, 2022 10:09
Signed-off-by: myron <amyronenko@nvidia.com>
Signed-off-by: myron <amyronenko@nvidia.com>
@Nic-Ma

Nic-Ma commented Oct 13, 2022

Copy link
Copy Markdown
Contributor

/black

@Nic-Ma

Nic-Ma commented Oct 13, 2022

Copy link
Copy Markdown
Contributor

/build

@Nic-Ma Nic-Ma enabled auto-merge (squash) October 13, 2022 17:28
@wyli

wyli commented Oct 13, 2022

Copy link
Copy Markdown
Contributor

/build

@Nic-Ma Nic-Ma merged commit dae09ff into Project-MONAI:dev Oct 13, 2022
wyli added a commit to wyli/MONAI that referenced this pull request Oct 15, 2022
…arge images (Project-MONAI#5297)

SlidingWindowInferer: option to adaptively stitch in cpu memory for
large images.

This adds an option to provide maximum input image volume (number of
elements) to dynamically change stitching to cpu memory (to avoid gpu
memory crashes). For example with `cpu_thresh=400*400*400`, all input
images with large volume will be stitched on cpu.

At the moment, a user must decide beforehand, to stitch ALL images on
cpu or gpu (by specifying the 'device' parameter). But in many datasets,
only a few large images require device==cpu, and running inference on
cpu for ALL will be unnecessary slow.

It's related to 
Project-MONAI#4625
Project-MONAI#4495
Project-MONAI#3497
Project-MONAI#4726
Project-MONAI#4588 


### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] 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: myron <amyronenko@nvidia.com>
Co-authored-by: Wenqi Li <831580+wyli@users.noreply.github.com>
bhashemian pushed a commit to JHancox/MONAI that referenced this pull request Oct 20, 2022
…arge images (Project-MONAI#5297)

SlidingWindowInferer: option to adaptively stitch in cpu memory for
large images.

This adds an option to provide maximum input image volume (number of
elements) to dynamically change stitching to cpu memory (to avoid gpu
memory crashes). For example with `cpu_thresh=400*400*400`, all input
images with large volume will be stitched on cpu.

At the moment, a user must decide beforehand, to stitch ALL images on
cpu or gpu (by specifying the 'device' parameter). But in many datasets,
only a few large images require device==cpu, and running inference on
cpu for ALL will be unnecessary slow.

It's related to 
Project-MONAI#4625
Project-MONAI#4495
Project-MONAI#3497
Project-MONAI#4726
Project-MONAI#4588 


### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] 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: myron <amyronenko@nvidia.com>
Co-authored-by: Wenqi Li <831580+wyli@users.noreply.github.com>
Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com>
@myron myron deleted the sliding branch October 22, 2022 18:50
KumoLiu pushed a commit that referenced this pull request Nov 2, 2022
…arge images (#5297)

SlidingWindowInferer: option to adaptively stitch in cpu memory for
large images.

This adds an option to provide maximum input image volume (number of
elements) to dynamically change stitching to cpu memory (to avoid gpu
memory crashes). For example with `cpu_thresh=400*400*400`, all input
images with large volume will be stitched on cpu.

At the moment, a user must decide beforehand, to stitch ALL images on
cpu or gpu (by specifying the 'device' parameter). But in many datasets,
only a few large images require device==cpu, and running inference on
cpu for ALL will be unnecessary slow.

It's related to 
#4625
#4495
#3497
#4726
#4588 


### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] 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: myron <amyronenko@nvidia.com>
Co-authored-by: Wenqi Li <831580+wyli@users.noreply.github.com>
Signed-off-by: KumoLiu <yunl@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants