Repository navigation
Remove deprecated functionality for v1.5 - #8430
Merged
Merged
Conversation
remove deprecated functionality Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
for more information, see https://pre-commit.ci
Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Jose1654
approved these changes
Apr 29, 2025
ericspod
approved these changes
Apr 29, 2025
Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Contributor
Author
|
/build |
Contributor
Author
|
Error log: |
Member
|
Hi @KumoLiu can you set |
KumoLiu
added a commit
to Project-MONAI/research-contributions
that referenced
this pull request
May 9, 2025
Remove deprecated `img_size` args in `SwinUNETR` Add `allow_smaller=True` in CropForeground / CropForegroundd since default value has been changed Project-MONAI/MONAI#8430 --------- Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Contributor
Author
Hi @ericspod, it should be fixed by this PR: Project-MONAI/research-contributions#416. |
Signed-off-by: monai-bot <monai.miccai2019@gmail.com>
Contributor
Author
|
/build |
Contributor
Author
|
Identify the issue: There’s a dependency between this one and #8443. They must be merged simultaneously. If the changes to core aren’t merged, the algo adjustments won’t function properly. |
Member
KumoLiu
enabled auto-merge (squash)
May 9, 2025 15:40
nishanthta
pushed a commit
to nishanthta/monai-dae
that referenced
this pull request
Sep 9, 2025
Remove deprecated `img_size` args in `SwinUNETR` Add `allow_smaller=True` in CropForeground / CropForegroundd since default value has been changed Project-MONAI/MONAI#8430 --------- Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
2 tasks done
ericspod
added a commit
to Project-MONAI/model-zoo
that referenced
this pull request
Oct 20, 2026
Fixes Project-MONAI/MONAILabel#1894. ### Description `SwinUNETR` no longer accepts `img_size` (deprecated in MONAI 1.3 via Project-MONAI/MONAI#7093, removed in 1.5 via Project-MONAI/MONAI#8430). Two bundles still pass it in `network_def`, so on current MONAI they fail to instantiate their network: ``` TypeError: SwinUNETR.__init__() got an unexpected keyword argument 'img_size' ``` This removes the argument from: - `swin_unetr_btcv_segmentation`: `inference.json`, `train.json` (version 0.5.9 → 0.6.0) - `pediatric_abdominal_ct_segmentation`: `inference_swinunetr.yaml` (version 0.4.7 → 0.4.8) Because `img_size` is still a required argument in MONAI 1.3 and 1.4, both bundles now declare `monai_version` 1.5.0, with `pytorch_version` 2.6.0 and `numpy_version` 1.26.4 to satisfy MONAI 1.5's requirements (`torch>=2.4.1`, `numpy>=1.24`), matching other MONAI 1.5 bundles. `img_size` never affected the network weights, so the pretrained checkpoints are unaffected. (`patch_norm`, whose `SwinUNETR` default was added in 1.5, is `False` both before and after, so the architecture is unchanged.) Verified with MONAI 1.5.2 by parsing `network_def` with `ConfigParser`: all three configs fail before the change and instantiate `SwinUNETR` after it. ### Status **Ready** ### Please ensure all the checkboxes: - [x] Update `version` and `changelog` in `metadata.json` if changing an existing bundle. - [x] Ensure versions of packages such as `monai`, `pytorch` and `numpy` are correct in `metadata.json`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Updates** * SwinUNETR inference and training configurations, including the pediatric abdominal CT model, no longer specify `img_size`; other network settings remain unchanged. * Updated version information and changelogs for the pediatric abdominal CT and BTCV segmentation models. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
Merged
2 tasks done
ericspod
pushed a commit
to Project-MONAI/model-zoo
that referenced
this pull request
Oct 20, 2026
…800) ### Description Follow-up to #799, checking the other changes in Project-MONAI/MONAI#8430 ("Remove deprecated functionality for v1.5") against the bundles on `dev`. None of the removed arguments are still used, but one changed default affects a bundle: `CropForeground(d)` now defaults to `allow_smaller=False` (was `True`). `wholeBody_ct_segmentation/configs/train.json` uses `CropForegroundd` with `margin: 10` and `k_divisible: [96, 96, 96]` in both training and validation preprocessing and does not set `allow_smaller`, so on MONAI 1.5 the crop changes whenever the foreground touches the volume border, which is common for whole-body CT. Checked with MONAI 1.5.2 on a synthetic volume with the bundle's parameters: for foreground touching the border, `allow_smaller=True` and `False` give crops with the same shape and foreground voxel count but different contents (shifted placement); for interior foreground they are identical. This sets `"allow_smaller": true` explicitly in both transforms, so the bundle behaves as it did on MONAI 1.4 (its declared `monai_version`) on any version; 1.4 already accepts the argument. Bundle version 0.2.8 → 0.2.9. Verified that `train#preprocessing` and `validate#preprocessing` parse with `ConfigParser` on MONAI 1.5.2 and both `CropForegroundd` instances have `allow_smaller=True`. Other bundles using `CropForeground(d)`: `vista3d` already sets `allow_smaller`, and `pediatric_abdominal_ct_segmentation` uses no `margin`/`k_divisible`, so the default does not affect it. ### Status **Ready** ### Please ensure all the checkboxes: - [x] Update `version` and `changelog` in `metadata.json` if changing an existing bundle. - [x] Ensure versions of packages such as `monai`, `pytorch` and `numpy` are correct in `metadata.json`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Updated training and validation cropping behavior to allow regions smaller than the configured target dimensions. - Preserved previous cropping results when processing images with dimensions smaller than the requested crop size, improving compatibility with the latest framework version. - **Documentation** - Updated the model metadata changelog to record the cropping behavior adjustment. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This file contains hidden or 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
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.
remove deprecated functionality
Part of #8421
Description
Removed Functionality:
compute_percent_hausdorff_distance. Usecompute_hausdorff_distancewith thepercentileargument instead.net_name,net_kwargs, andreturn_state_dictarguments fromload(). Use themodelargument for network instantiation.workflowargument fromBundleWorkflowandConfigWorkflow. Useworkflow_typeinstead.img_sizeargument fromSwinUNETR. Input size checks are now performed duringforward().Default Value Changes:
GeneralizedDiceScore: Changed defaultreductionfromMEAN_BATCHtoMEAN.CropForeground/CropForegroundd: Changed defaultallow_smallerfromTruetoFalse.get_mask_edges: Changed defaultalways_return_as_numpyfromTruetoFalse.generate_spatial_bounding_box: Changed defaultallow_smallerfromTruetoFalse.Types of changes
./runtests.sh -f -u --net --coverage../runtests.sh --quick --unittests --disttests.make htmlcommand in thedocs/folder.