forked from Project-MONAI/MONAI
-
Notifications
You must be signed in to change notification settings - Fork 1
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
merge master #466
Merged
Merged
merge master #466
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- update citation.cff - update weekly-preview version number - closes #5626 Signed-off-by: Wenqi Li <[email protected]>
Fixes #5776 ### 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: Wenqi Li <[email protected]>
Fixes #5793 . ### Description This PR provides a workaround for the incompatible sphinx 6.0.0 ### 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: Yiheng Wang <[email protected]> Signed-off-by: Wenqi Li <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Wenqi Li <[email protected]>
VarAutoEncoder.__init__() got an unexpected keyword argument 'dimensions' because now it is called spatial_dims.
Signed-off-by: Yiheng Wang <[email protected]> Fixes #5775 . ### Description This PR fixes the issue of `_get_latest_bundle_version` on Windows (`os.path.join` will produce backslash which will create a wrong url) Thanks @SachidanandAlle for finding this issue. ### 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: Yiheng Wang <[email protected]>
<!--pre-commit.ci start--> updates: - [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.4.0](pre-commit/pre-commit-hooks@v4.3.0...v4.4.0) - [github.com/asottile/pyupgrade: v2.38.2 → v3.3.1](asottile/pyupgrade@v2.38.2...v3.3.1) - [github.com/hadialqattan/pycln: v2.1.1 → v2.1.2](hadialqattan/pycln@v2.1.1...v2.1.2) <!--pre-commit.ci end--> fixes #5805 Signed-off-by: Wenqi Li <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: kbressem <[email protected]> Fixes #3178 ### Description As discussed in #3178, this PR adds a more general interface to apply simple convolutions to images. This PR (re-)implements 2D and 3D versions for mean filtering, edge detection, outline detection, mask dilatation and image sharpening. ### Detailed description The main transform is `ImageFilter`. It comes with some preset filters that can be initialized using a string. Available presets are `["mean", "laplace", "elliptical", "sobel", "sharpen", "median", "gauss", "savitzky_golay"]`. For example, a transformation for mean filtering can be created with: ```python mean_filter = ImageFilter("mean", 3) ``` `ImageFilter` automatically detects whether the input is 2D or 3D and creates the appropriate filter on the first call. This filter will then be used in future calls of the transformation, so switching between 2D and 3D images is not supported. The initialization form string is only a convenience function. All preset filters are also available in `monai.networks.layers.simplelayers` as `nn.Module` subclasses. ImageFilter` can also be created directly from an `nn.Module`. For example, to create a transformation for mean filtering, the following is also possible: ```python filter_3d = MeanFilter(spatial_dims=3, size=3) mean_filter = ImageFilter(filter_3d) ``` In this example, however, the filter size is predefined and is not automatically derived from the input. In addition, it is also possible to use custom filters with `ImageFilter` using a `torch.Tensor` or `numpy.ndarray`. For example: ```python filter_3d = torch.ones(3,3,3) mean_filter = ImageFilter(filter_3d) ``` `RandImageFilter` is a randomizable variant of `ImageFilter` that executes with probability `p` on each call. Both `ImageFilter` and `RandImageFilter` also have dictionary versions. ### 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). - [x] New tests added to cover the changes. - [x] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [x] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: kbressem <[email protected]>
Fixes #5653. ### Description A new utility decorator that enables us to warn users of a changing default argument. Current implementation does the following: - If version < since no warning will be printed. - If the default argument is explicitly set by the caller no warning will be printed. - If since <= version < replaced a warning like this will be printed: "Default of argument `{name}` has been deprecated since version `{since}` from `{old_default}` to `{new_default}`. It will be changed in version `{replaced}`." - If replaced <= version a warning like this will be printed: "Default of argument `{name}` was changed in version `{changed}` from `{old_default}` to `{new_default}`." - It doesn't validate the `old_default`, so you can even use this in scenarios where the default is actually `None` but set later in the function. This also enables us to set `old_default` to any string if the default is e.g. not printable. - The only validation that will throw an error is, if the `new_default` == the actual default and version < replaced. Which means, that somebody replaced the value already, before the version was incremented. Apart from that also any value for `new_default` can be set, giving the same advantages as for the `old_default`. ### 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). - [x] New tests added to cover the changes. - [x] 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: Felix Schnabel <[email protected]>
Signed-off-by: Wenqi Li <[email protected]> Fixes #5782 ### Description - adds 'mode' and 'align_corners' options to the blocks and nets - fixes a few typos ### 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). - [x] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: Wenqi Li <[email protected]>
Signed-off-by: Wenqi Li <[email protected]> Fixes #5624 Fixes #5816 ### Description - undo the workaround (29a34ad) - smaller test case tests/test_auto3dseg_ensemble.py ### 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`. - [x] 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: Wenqi Li <[email protected]>
Signed-off-by: KumoLiu <[email protected]> Fixes #5609. ### Description Update the docstring for `HoVerNet` and `UpSample`. ### 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`. - [x] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: KumoLiu <[email protected]>
…5813) part of #5804. ### Description This adds a simple attribute access for ConfigParser so ```python from monai.bundle import ConfigParser parser = ConfigParser({"a":"b"}) a = parser.get_parsed_content("a") ``` can be rewritten to ```python from monai.bundle import ConfigParser parser = ConfigParser({"a":"b"}) a = parser.a ``` This only works for variables/methods that are not included in ConfigParser so e.g. `parser.config` would still get the whole config. This PR only supports shallow attribute accesses, since the returned value will be a `dict` where you need to use `["key"]` to get the content. ### 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). - [x] New tests added to cover the changes. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. Signed-off-by: Felix Schnabel <[email protected]>
running the test cases ### 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).
Fixes #5823. ### Description This PR types following decorators: - `deprecated` - `deprecated_arg` - `deprecated_arg_default` Found [here](https://github.com/Project-MONAI/MONAI/blob/dev/monai/utils/deprecate_utils.py). It also fixes any typing issues that occurred because of the additional typing. Secondly, it fixes untyped decorator usage of the `ignite` library (because of `optional_import`) for [Workflow](https://github.com/Project-MONAI/MONAI/blob/34d713f9887a85f140630a75e9261b89f0005c84/monai/engines/workflow.py#L45) and [IgniteMetric](https://github.com/Project-MONAI/MONAI/blob/f9d472af05ceb56513771ea2faccebb79edc1a7a/monai/handlers/ignite_metric.py#L36). ### 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). - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. Signed-off-by: Felix Schnabel <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: monai-bot <[email protected]> Signed-off-by: monai-bot <[email protected]>
Fixes #5833 ### 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. - [x] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] 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: Wenqi Li <[email protected]>
Fixes #5835. ### Description Use `from __future__ import annotations` in all source files using annotations, so we have consistent usage (and not only in ~5 files). The new annotations are also more readable e.g. `Optional[Union[List[str], str]]` vs. `list[str] | str | None`. Secondly, this issue includes changing `from typing import Callable, Sequence, ...` to `from collections.abc import Callable, Sequence, ...` since the ones in the `typing` module are deprecated. They are interchangeable even for `isinstance` checks (see also [this stackoverflow thread](https://stackoverflow.com/questions/62547848/should-isinstance-check-against-typing-or-collections-abc)). ### 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). - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. Signed-off-by: Felix Schnabel <[email protected]>
Signed-off-by: YanxuanLiu <[email protected]> fixes #5779 ### 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. review torch 1.12 tests and upgrade to the latest (1.13+) Signed-off-by: YanxuanLiu <[email protected]>
### Description This PR exclude `CuCIM`, `CuCIMD`, `RandCuCIM`, and `RandCuCIMD` wrapper transfrom from `get_transform_backends` as they are not supposed to support torch or numpy necessarily. ### 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). Signed-off-by: Behrooz <[email protected]>
Signed-off-by: Mikael Brudfors [[email protected]](mailto:[email protected]) part of #5740 ### Description Makes the binary and categorical metrics from MetricsReloaded available in MONAI via a wrapper module (`monai/metrics/wrapper.py`). This module allows to use the MetricsReloaded metrics as, e.g.: ```py import torch from monai.metrics import MetricsReloadedBinary metric_name = "Cohens Kappa" metric = MetricsReloadedBinary(metric_name=metric_name) # first iteration # shape [batch=1, channel=1, 2, 2] y_pred = torch.tensor([[[[1.0, 0.0], [0.0, 1.0]]]]) y = torch.tensor([[[[1.0, 0.0], [1.0, 1.0]]]]) print(metric(y_pred, y)) # second iteration # shape [batch=1, channel=1, 2, 2] y_pred = torch.tensor([[[[1.0, 0.0], [0.0, 0.0]]]]) y = torch.tensor([[[[1.0, 0.0], [1.0, 1.0]]]]) print(metric(y_pred, y)) # aggregate # shape ([batch=2, channel=1]) print(metric.aggregate(reduction="none")) # tensor([[0.5], [0.2]]) # reset metric.reset() ``` Tests of all metrics are in `tests/test_metrics_reloaded.py`. Note that MetricsReloaded is an optional dependency of MONAI; so in order to use the wrapper, MONAI needs to be installed with: ```sh pip install '.[metricsreloaded]' ``` ### 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). - [x] New tests added to cover the changes. - [x] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: Mikael Brudfors <[email protected]> Signed-off-by: monai-bot <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Mikael Brudfors <[email protected]> Co-authored-by: Wenqi Li <[email protected]> Co-authored-by: monai-bot <[email protected]>
Signed-off-by: Wenqi Li <[email protected]> Fixes #5844 - improves the error message when slicing data with inconsistent metadata - fixes an indexing case: ``` x = MetaTensor(np.zeros((10, 3, 4))) x[slice(1, 0)] # should return zero length data ``` ### 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). - [x] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: Wenqi Li <[email protected]>
Fixes #5855 ### 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. Test pre-merge pipeline only!
### Description We noted it was possible to instantiate classes derived from DenseNet only if spatial_dims, in_channels, and out_channels parameters were passed by keywords. Passing them via positional scheme was not working. This small bug should be fixed now. ### Example: Before my fix: ``` import monai net = monai.networks.nets.DenseNet(3,1,2) # Working net = monai.networks.nets.DenseNet121(3,1,2) # NOT woking net = monai.networks.nets.DenseNet121(spatial_dims=3, in_channels=1, out_channels=2) # Woking ``` After my fix: ``` import monai net = monai.networks.nets.DenseNet121(3,1,2) # Woking ``` Thanks to @robsver for pointing this issue out. ### 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: Wenqi Li <[email protected]> Fixes #5852 ### Description 1. the following partial instantiate doesn't work ```py config = {"import statements": "$import math", "calc": {"_target_": "math.isclose", "a": 0.001, "b": 0.001}} print(ConfigParser(config).calc()) ``` with an error message: ``` Component to instantiate must represent a valid class or function, but got math.isclose. Traceback (most recent call last): File "test.py", line 4, in <module> print(ConfigParser(config).calc()) TypeError: isclose() missing required argument 'a' (pos 1) ``` because `math.isclose` is a builtin type but not a function: ```py import inspect inspect.isfunction(math.isclose) # False inspect.isbuiltin(math.isclose) # True ``` the `partial` should support `callable` including builtin functions 2. also this PR supports `_target_` of reference object's methods such as partial init: ```py "forward": {"_target_": "$@model().forward", "x": "$torch.rand(1, 3, 256, 256)"} ``` ### 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). - [x] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: Wenqi Li <[email protected]>
Add ITK to the list of optional dependencies. ### Types of changes - [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. - [x] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] 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: Dženan Zukić <[email protected]>
Fixes #1840 . ### Description I integrated the trainable bilateral filter layer (TBF) in the MONAI repository as a new PyTorch filter layer. The TBF contains an analytical gradient derivation toward its filter parameters and its noisy input image which enables gradient-based optimization within the PyTorch graph. See [here](https://doi.org/10.1002/mp.15718) for more details on the gradient derivation. Unit tests were added that check the filter output as well as the gradient computation. ### 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). - [x] New tests added to cover the changes. - [x] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [x] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: Fabian Wagner <[email protected]>
Fixes #5862. ### Description if `untyped_storage()` is present (pytorch 2) use it, else use `storage()`. ### 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: Richard Brown <[email protected]>
Fixes #5865 ### Description A few sentences describing the changes proposed in this pull request. ### 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: Suraj Pai <[email protected]>
Signed-off-by: KumoLiu <[email protected]> Fixes #5875 . ### Description Add warning in `RandHistogramShift` when the image's intensity is a single value. ### 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). - [x] 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: KumoLiu <[email protected]>
Fixes #6184 . ### Description Enable bundlle_gen to skip an algorithm if the BundleAlgo pre_check_skip_algo() function sets skip_bundlegen=True. SegResNet2D overrided pre_check_skip_algo() and will be skipped if data is not highly anisotropic. ### 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: heyufan1995 <[email protected]>
…6254) Fixes #6193 ### Description - adds `buffer_step` (code adapted from @myron's idea/implementation) - clean up multioutput resizing logic - perf optimize - `overlap` to support different values along the spatial dimensions ### 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). - [x] New tests added to cover the changes. - [x] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [x] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Wenqi Li <[email protected]>
to solve: #6285 Currently ClassesToIndicesd can be used to pre-compute and cache the locations of all background/foreground classes. This significantly speedups the cropping transform RandCropByLabelClassesd, since the coordinates of class voxels do not need to be computed every time. Unfortunately for an average dataset it requires ~80gb of extra RAM, with an average cache (per image) is on the order of image size itself. (most of it due to background coordinates, or by some large segmentation classes). This PR clips (optionally) the number of coordinates in each class to a parameter max_indices_per_class. (e.g. 5000), which greatly reduces cache size requirements only to a few MB. Generally these coordinates are used to random choose a cropping center at each epoch, e.g. for 1000 epochs -> 1000 centers per image, so we don't need to store ALL the foreground coordinates, it's sufficient to store just some large random subset. PS: I wasn't sure if it's better to also change ClassesToIndices (not ClassesToIndicesD), feel free edit this PR. thank you ### Description A few sentences describing the changes proposed in this pull request. ### 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 <[email protected]> Signed-off-by: Wenqi Li <[email protected]> Co-authored-by: Wenqi Li <[email protected]>
…6309) Fixes # . #6297 ### Description PyTorch onnx exporter API has been changed since 1.10 to remove example_outputs as a required input argument. Special handling is added in this PR to support PyTorch version older than 1.10. Unit test is also extended to covert this case. ### 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). - [x] 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: Liqun Fu <[email protected]>
Second PR for issue #6291 Since the previous PR #6290 was reverted #6295 Allows to skip the already trained algos, and continue training only for the non-trained ones. after this PR, the default option AutoRunner(train=None) will have this behavior, whereas manually setting AutoRunner(train=True/False) will always train all or skip all training. Previously we can only train all or skip all (without any option to resume) I changed import_bundle_algo_history() to return a better algo_dict previously it returned "list[dict(name: algo)]" - a list of dict, but each dict must have a single key name "name => algo". Not it returns a list of dicts, each with several keys dict(AlgoEnsembleKeys.ID: name, AlgoEnsembleKeys.ALGO, algo, "is_trained": bool, etc). this allows to put additional metadata inside of each algo_dict, and it's easier to read it back. previously, to get a name we had to use "name = history[0].keys()[0]", now it's more elegant "name = history[0][AlgoEnsembleKeys.ID]". this however required to change many files, everywhere where import_bundle_algo_history and export_bundle_algo_history was used. All the tests have passed, except for "integration GPU utilization tests" , but those errors seems unrelated After this PR, tutorials need to be updated too Project-MONAI/tutorials#1288 --------- Signed-off-by: myron <[email protected]>
Signed-off-by: monai-bot <[email protected]> (closing #6318 closing #6319 auto3dseg) (closing #6314 closing #6315 dtype conversion) (closing #6326 closing #6329 metatensor clone) (including a workaround for #6311) --------- Signed-off-by: monai-bot <[email protected]> Signed-off-by: Mingxin Zheng <[email protected]> Signed-off-by: Liam Chalcroft <[email protected]> Signed-off-by: Wenqi Li <[email protected]> Signed-off-by: KumoLiu <[email protected]> Co-authored-by: Mingxin Zheng <[email protected]> Co-authored-by: Liam Chalcroft <[email protected]> Co-authored-by: Wenqi Li <[email protected]> Co-authored-by: YunLiu <[email protected]> Co-authored-by: Wenqi Li <[email protected]>
Fixes #6289 ### Description This PR enable WSIReader to be provided with objective power and resolution (micron per pixel) to decide which WSI level to load. It also set absolute and relative tolerances for power and mpp. ### 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). - [x] New tests added to cover the changes. - [x] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [x] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Behrooz <[email protected]>
Fixes #6032 . ### Description specified the data type of the `att_matrix` to be compliant with torch.jit.compile requirements for conditionals ### 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). - [x] 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`. - [x] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: a-parida12 <[email protected]>
…anceMapPostProcessing` (#6333) Fixes # . ### Description Since some operations in post-processing of HoVerNet will convert data to numpy. And most of the time we need to calculate the metric from the model output and label which should both be on CUDA. ### 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: KumoLiu <[email protected]>
Fixes #6258 . ### Description Add onnx as an option for converting pytorch models to TensorRT models through `trt_export` API. This pr depends on #6237 to add the onnx convert function. ### 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: binliu <[email protected]>
Fixes #6182 . fixes #6114 Added multi-gpu support for data analyzer. Tested on NGC using 4 16g V100 for total segmentator Speed up: 4 GPU: data analysis 6.90 mins (9.2 mins including yaml export) 1 GPU: data analysis 22.98 mins (25.33 mins including yaml export) ### 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: heyufan1995 <[email protected]>
Signed-off-by: monai-bot <[email protected]> closes #6339 (closes #6337) closes #6341 (closes #6340 closes #6253) closes #6345 closes #6247 (closes #6346) --------- Signed-off-by: monai-bot <[email protected]> Signed-off-by: binliu <[email protected]> Signed-off-by: Wenqi Li <[email protected]> Signed-off-by: Mingxin Zheng <[email protected]> Co-authored-by: Wenqi Li <[email protected]> Co-authored-by: binliunls <[email protected]> Co-authored-by: Wenqi Li <[email protected]> Co-authored-by: Mingxin Zheng <[email protected]>
Fixes #6137 . ### Description A user can now pass a `spacing` parameter to surface distance metrics (Hausdorff distance, surface distance, surface dice), so that correct results can be obtained for images with non-isotropic spacing (e.g. (0.5, 0.5, 2) mm). If `spacing` is a sequence, it must be of length equal to the image dimensions; if a single number, this spacing is used for all axes. If ``None``, spacing of unity is used. Defaults to ``None``so that current behaviour is preserved. ### 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). - [x] 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`. - [x] In-line docstrings updated. - [x] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: gasperp <[email protected]>
…env (#6347) Fixes #6342 . ### Description In some testing environment, there are more GPUs than the simulated dataset image number. This PR is to modify the tests so that it will generate images enough to finish the testing. ### 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). - [x] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. --------- Signed-off-by: Mingxin Zheng <[email protected]>
Signed-off-by: Wenqi Li <[email protected]>
- skip calls to torch.cuda.mem_get_info - fixes #6354 ### 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`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Wenqi Li <[email protected]>
As part of the text to vision encoder for medical image analysis. Support CLIP pre-trained embedding and random text embedding. Linked to the issue: #6177 --------- Signed-off-by: tangy5 <[email protected]>
SlidingWindowInfererAdapt extends SlidingWindowInferer to automatically switch to buffered and then to CPU stitching, when OOM on GPU. It also records a size of such large images to automatically try CPU stitching for the next large image of a similar size. If the stitching 'device' input parameter is provided, automatic adaptation won't be attempted, please keep the default option device = None for adaptive behavior. Note: the output might be on CPU (even if the input was on GPU), if the GPU memory was not sufficient. --- also fixes #6340 by adding one line to the resampling --------- Signed-off-by: myron <[email protected]> Signed-off-by: Wenqi Li <[email protected]> Co-authored-by: Wenqi Li <[email protected]>
Fixes #6191 #6259 . ### Description Big changes over autorunner to enable multinode training and multinode-multiGPU ensembler Multiple changes: 1. Add set_device_info() to create a self.device_dict to define device information (CUDA_VISIBLE_DEVICES, NUM_NODE, e.t.c.) for all parts in autorunner, including data analyzer, trainer, ensembler. No global env variable is set, all device info is from self.device_dict. Changes to bundlegen is made. 2. To enable multi-gpu/multi-node training for ensembler (call from subprocess), we need to separate the ensembler from autorunner (for subprocess to run from autorunner). Created a new EnsembleRunner class (similar to bundleGen), and moved all ensemble related function from autorunner to this class. Local multi-GPU ensembling passed. Passed some quick local testing. Needs to fix details and do test. Created PR to do a initial design pattern discussion. Slack me if there is any major concern of the change. @mingxin-zheng @wyli --------- Signed-off-by: heyufan1995 <[email protected]>
Fixes #6363. ### Description Correct type annotation for `end_lr`. ### Types of changes - [x] Non-breaking change (fix or new feature that would not break existing functionality). Signed-off-by: Josh <[email protected]>
### Description The new ALGO_HASH has two updates for better performance of Auto3DSeg algo templates: - Project-MONAI/research-contributions#193 - Project-MONAI/research-contributions#211 ### 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: Mingxin Zheng <[email protected]>
Fixes # #6361 Ensures ensemble preds are on the same device --------- Signed-off-by: myron <[email protected]>
Fixes # . If user defined CUDA_VISIBLE_DEVICES in train_params, bundleAlgo will put that into cmd and cause error. Pop this out before cmd and throw out a warning ### Description A few sentences describing the changes proposed in this pull request. ### 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: heyufan1995 <[email protected]> Signed-off-by: Wenqi Li <[email protected]> Co-authored-by: Wenqi Li <[email protected]> Co-authored-by: Wenqi Li <[email protected]>
Signed-off-by: monai-bot <[email protected]>
Fixes #6379 ### Description `track_meta` flag added to `Lambda` and derived transforms to allow type conversion to `np.ndarray` and `torch.Tensor` based on user-defined function ### 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). - [x] 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`. - [x] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: Suraj Pai <[email protected]>
Fixes #6378 . ### Description - Project-MONAI/research-contributions#221 - Project-MONAI/research-contributions#219 ### 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: Mingxin Zheng <[email protected]> Signed-off-by: Wenqi Li <[email protected]> Co-authored-by: Wenqi Li <[email protected]> Co-authored-by: Wenqi Li <[email protected]>
Fixes #6371 raise a warning message early when the applied_operations is modified, this only becomes a critical issue when we actually use the `applied_operations` (`InvertD` is one of the use cases). fixes #6390 fixes #6392 ### 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). - [x] New tests added to cover the changes. - [x] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Wenqi Li <[email protected]>
part of #5821 Fixes #6303 ### Description This PR simplified the MONAI FL `MonaiAlgo` module to leverage `BundleWorkflow`. The main point is to decouple the bundle read / write related logic with FL module and use predefined required-properties. ### 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: Nic Ma <[email protected]> Signed-off-by: monai-bot <[email protected]> Co-authored-by: Holger Roth <[email protected]> Co-authored-by: monai-bot <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes # .
Description
A few sentences describing the changes proposed in this pull request.
Types of changes
./runtests.sh -f -u --net --coverage
../runtests.sh --quick --unittests --disttests
.make html
command in thedocs/
folder.