monai-weekly 1.5.dev2518__py3-none-any.whl → 1.5.dev2519__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- monai/__init__.py +1 -1
- monai/_version.py +3 -3
- monai/apps/deepgrow/transforms.py +2 -2
- monai/bundle/scripts.py +1 -24
- monai/bundle/workflows.py +1 -27
- monai/metrics/__init__.py +1 -1
- monai/metrics/generalized_dice.py +4 -13
- monai/metrics/hausdorff_distance.py +3 -37
- monai/metrics/utils.py +2 -5
- monai/networks/nets/swin_unetr.py +4 -20
- monai/networks/schedulers/ddpm.py +1 -1
- monai/networks/schedulers/scheduler.py +5 -3
- monai/transforms/croppad/array.py +3 -4
- monai/transforms/croppad/dictionary.py +4 -4
- monai/transforms/utils.py +4 -5
- monai/utils/misc.py +1 -1
- {monai_weekly-1.5.dev2518.dist-info → monai_weekly-1.5.dev2519.dist-info}/METADATA +2 -3
- {monai_weekly-1.5.dev2518.dist-info → monai_weekly-1.5.dev2519.dist-info}/RECORD +22 -22
- {monai_weekly-1.5.dev2518.dist-info → monai_weekly-1.5.dev2519.dist-info}/WHEEL +1 -1
- tests/networks/nets/test_swin_unetr.py +4 -22
- {monai_weekly-1.5.dev2518.dist-info → monai_weekly-1.5.dev2519.dist-info}/licenses/LICENSE +0 -0
- {monai_weekly-1.5.dev2518.dist-info → monai_weekly-1.5.dev2519.dist-info}/top_level.txt +0 -0
monai/__init__.py
CHANGED
monai/_version.py
CHANGED
@@ -8,11 +8,11 @@ import json
|
|
8
8
|
|
9
9
|
version_json = '''
|
10
10
|
{
|
11
|
-
"date": "2025-05-
|
11
|
+
"date": "2025-05-11T02:34:08+0000",
|
12
12
|
"dirty": false,
|
13
13
|
"error": null,
|
14
|
-
"full-revisionid": "
|
15
|
-
"version": "1.5.
|
14
|
+
"full-revisionid": "552815d9e48a40cf72c7c718034df7984f5d14dd",
|
15
|
+
"version": "1.5.dev2519"
|
16
16
|
}
|
17
17
|
''' # END VERSION_JSON
|
18
18
|
|
@@ -441,8 +441,8 @@ class SpatialCropForegroundd(MapTransform):
|
|
441
441
|
|
442
442
|
if np.all(np.less(current_size, self.spatial_size)):
|
443
443
|
cropper = SpatialCrop(roi_center=center, roi_size=self.spatial_size)
|
444
|
-
box_start =
|
445
|
-
box_end =
|
444
|
+
box_start = [s.start for s in cropper.slices]
|
445
|
+
box_end = [s.stop for s in cropper.slices]
|
446
446
|
else:
|
447
447
|
cropper = SpatialCrop(roi_start=box_start, roi_end=box_end)
|
448
448
|
|
monai/bundle/scripts.py
CHANGED
@@ -31,7 +31,6 @@ from torch.cuda import is_available
|
|
31
31
|
|
32
32
|
from monai._version import get_versions
|
33
33
|
from monai.apps.utils import _basename, download_url, extractall, get_logger
|
34
|
-
from monai.bundle.config_item import ConfigComponent
|
35
34
|
from monai.bundle.config_parser import ConfigParser
|
36
35
|
from monai.bundle.utils import DEFAULT_INFERENCE, DEFAULT_METADATA, merge_kv
|
37
36
|
from monai.bundle.workflows import BundleWorkflow, ConfigWorkflow
|
@@ -48,7 +47,6 @@ from monai.networks import (
|
|
48
47
|
from monai.utils import (
|
49
48
|
IgniteInfo,
|
50
49
|
check_parent_dir,
|
51
|
-
deprecated_arg,
|
52
50
|
ensure_tuple,
|
53
51
|
get_equivalent_dtype,
|
54
52
|
min_version,
|
@@ -629,9 +627,6 @@ def download(
|
|
629
627
|
_check_monai_version(bundle_dir_, name_)
|
630
628
|
|
631
629
|
|
632
|
-
@deprecated_arg("net_name", since="1.2", removed="1.5", msg_suffix="please use ``model`` instead.")
|
633
|
-
@deprecated_arg("net_kwargs", since="1.2", removed="1.5", msg_suffix="please use ``model`` instead.")
|
634
|
-
@deprecated_arg("return_state_dict", since="1.2", removed="1.5")
|
635
630
|
def load(
|
636
631
|
name: str,
|
637
632
|
model: torch.nn.Module | None = None,
|
@@ -650,10 +645,7 @@ def load(
|
|
650
645
|
workflow_name: str | BundleWorkflow | None = None,
|
651
646
|
args_file: str | None = None,
|
652
647
|
copy_model_args: dict | None = None,
|
653
|
-
return_state_dict: bool = True,
|
654
648
|
net_override: dict | None = None,
|
655
|
-
net_name: str | None = None,
|
656
|
-
**net_kwargs: Any,
|
657
649
|
) -> object | tuple[torch.nn.Module, dict, dict] | Any:
|
658
650
|
"""
|
659
651
|
Load model weights or TorchScript module of a bundle.
|
@@ -699,12 +691,7 @@ def load(
|
|
699
691
|
workflow_name: specified bundle workflow name, should be a string or class, default to "ConfigWorkflow".
|
700
692
|
args_file: a JSON or YAML file to provide default values for all the args in "download" function.
|
701
693
|
copy_model_args: other arguments for the `monai.networks.copy_model_state` function.
|
702
|
-
return_state_dict: whether to return state dict, if True, return state_dict, else a corresponding network
|
703
|
-
from `_workflow.network_def` will be instantiated and load the achieved weights.
|
704
694
|
net_override: id-value pairs to override the parameters in the network of the bundle, default to `None`.
|
705
|
-
net_name: if not `None`, a corresponding network will be instantiated and load the achieved weights.
|
706
|
-
This argument only works when loading weights.
|
707
|
-
net_kwargs: other arguments that are used to instantiate the network class defined by `net_name`.
|
708
695
|
|
709
696
|
Returns:
|
710
697
|
1. If `load_ts_module` is `False` and `model` is `None`,
|
@@ -719,9 +706,6 @@ def load(
|
|
719
706
|
when `model` and `net_name` are all `None`.
|
720
707
|
|
721
708
|
"""
|
722
|
-
if return_state_dict and (model is not None or net_name is not None):
|
723
|
-
warnings.warn("Incompatible values: model and net_name are all specified, return state dict instead.")
|
724
|
-
|
725
709
|
bundle_dir_ = _process_bundle_dir(bundle_dir)
|
726
710
|
net_override = {} if net_override is None else net_override
|
727
711
|
copy_model_args = {} if copy_model_args is None else copy_model_args
|
@@ -757,11 +741,8 @@ def load(
|
|
757
741
|
warnings.warn(f"the state dictionary from {full_path} should be a dictionary but got {type(model_dict)}.")
|
758
742
|
model_dict = get_state_dict(model_dict)
|
759
743
|
|
760
|
-
if return_state_dict:
|
761
|
-
return model_dict
|
762
|
-
|
763
744
|
_workflow = None
|
764
|
-
if model is None
|
745
|
+
if model is None:
|
765
746
|
bundle_config_file = bundle_dir_ / name / "configs" / f"{workflow_type}.json"
|
766
747
|
if bundle_config_file.is_file():
|
767
748
|
_net_override = {f"network_def#{key}": value for key, value in net_override.items()}
|
@@ -781,10 +762,6 @@ def load(
|
|
781
762
|
return model_dict
|
782
763
|
else:
|
783
764
|
model = _workflow.network_def
|
784
|
-
elif net_name is not None:
|
785
|
-
net_kwargs["_target_"] = net_name
|
786
|
-
configer = ConfigComponent(config=net_kwargs)
|
787
|
-
model = configer.instantiate() # type: ignore
|
788
765
|
|
789
766
|
model.to(device) # type: ignore
|
790
767
|
|
monai/bundle/workflows.py
CHANGED
@@ -27,7 +27,7 @@ from monai.bundle.config_parser import ConfigParser
|
|
27
27
|
from monai.bundle.properties import InferProperties, MetaProperties, TrainProperties
|
28
28
|
from monai.bundle.utils import DEFAULT_EXP_MGMT_SETTINGS, EXPR_KEY, ID_REF_KEY, ID_SEP_KEY
|
29
29
|
from monai.config import PathLike
|
30
|
-
from monai.utils import BundleProperty, BundlePropertyConfig,
|
30
|
+
from monai.utils import BundleProperty, BundlePropertyConfig, ensure_tuple
|
31
31
|
|
32
32
|
__all__ = ["BundleWorkflow", "ConfigWorkflow"]
|
33
33
|
|
@@ -45,10 +45,6 @@ class BundleWorkflow(ABC):
|
|
45
45
|
or "infer", "inference", "eval", "evaluation" for a inference workflow,
|
46
46
|
other unsupported string will raise a ValueError.
|
47
47
|
default to `None` for only using meta properties.
|
48
|
-
workflow: specifies the workflow type: "train" or "training" for a training workflow,
|
49
|
-
or "infer", "inference", "eval", "evaluation" for a inference workflow,
|
50
|
-
other unsupported string will raise a ValueError.
|
51
|
-
default to `None` for common workflow.
|
52
48
|
properties_path: the path to the JSON file of properties. If `workflow_type` is specified, properties will be
|
53
49
|
loaded from the file based on the provided `workflow_type` and meta. If no `workflow_type` is specified,
|
54
50
|
properties will default to loading from "meta". If `properties_path` is None, default properties
|
@@ -65,17 +61,9 @@ class BundleWorkflow(ABC):
|
|
65
61
|
supported_train_type: tuple = ("train", "training")
|
66
62
|
supported_infer_type: tuple = ("infer", "inference", "eval", "evaluation")
|
67
63
|
|
68
|
-
@deprecated_arg(
|
69
|
-
"workflow",
|
70
|
-
since="1.2",
|
71
|
-
removed="1.5",
|
72
|
-
new_name="workflow_type",
|
73
|
-
msg_suffix="please use `workflow_type` instead.",
|
74
|
-
)
|
75
64
|
def __init__(
|
76
65
|
self,
|
77
66
|
workflow_type: str | None = None,
|
78
|
-
workflow: str | None = None,
|
79
67
|
properties_path: PathLike | None = None,
|
80
68
|
meta_file: str | Sequence[str] | None = None,
|
81
69
|
logging_file: str | None = None,
|
@@ -102,7 +90,6 @@ class BundleWorkflow(ABC):
|
|
102
90
|
)
|
103
91
|
meta_file = None
|
104
92
|
|
105
|
-
workflow_type = workflow if workflow is not None else workflow_type
|
106
93
|
if workflow_type is not None:
|
107
94
|
if workflow_type.lower() in self.supported_train_type:
|
108
95
|
workflow_type = "train"
|
@@ -403,10 +390,6 @@ class ConfigWorkflow(BundleWorkflow):
|
|
403
390
|
or "infer", "inference", "eval", "evaluation" for a inference workflow,
|
404
391
|
other unsupported string will raise a ValueError.
|
405
392
|
default to `None` for common workflow.
|
406
|
-
workflow: specifies the workflow type: "train" or "training" for a training workflow,
|
407
|
-
or "infer", "inference", "eval", "evaluation" for a inference workflow,
|
408
|
-
other unsupported string will raise a ValueError.
|
409
|
-
default to `None` for common workflow.
|
410
393
|
properties_path: the path to the JSON file of properties. If `workflow_type` is specified, properties will be
|
411
394
|
loaded from the file based on the provided `workflow_type` and meta. If no `workflow_type` is specified,
|
412
395
|
properties will default to loading from "train". If `properties_path` is None, default properties
|
@@ -419,13 +402,6 @@ class ConfigWorkflow(BundleWorkflow):
|
|
419
402
|
|
420
403
|
"""
|
421
404
|
|
422
|
-
@deprecated_arg(
|
423
|
-
"workflow",
|
424
|
-
since="1.2",
|
425
|
-
removed="1.5",
|
426
|
-
new_name="workflow_type",
|
427
|
-
msg_suffix="please use `workflow_type` instead.",
|
428
|
-
)
|
429
405
|
def __init__(
|
430
406
|
self,
|
431
407
|
config_file: str | Sequence[str],
|
@@ -436,11 +412,9 @@ class ConfigWorkflow(BundleWorkflow):
|
|
436
412
|
final_id: str = "finalize",
|
437
413
|
tracking: str | dict | None = None,
|
438
414
|
workflow_type: str | None = "train",
|
439
|
-
workflow: str | None = None,
|
440
415
|
properties_path: PathLike | None = None,
|
441
416
|
**override: Any,
|
442
417
|
) -> None:
|
443
|
-
workflow_type = workflow if workflow is not None else workflow_type
|
444
418
|
if config_file is not None:
|
445
419
|
_config_files = ensure_tuple(config_file)
|
446
420
|
config_root_path = Path(_config_files[0]).parent
|
monai/metrics/__init__.py
CHANGED
@@ -19,7 +19,7 @@ from .f_beta_score import FBetaScore
|
|
19
19
|
from .fid import FIDMetric, compute_frechet_distance
|
20
20
|
from .froc import compute_fp_tp_probs, compute_fp_tp_probs_nd, compute_froc_curve_data, compute_froc_score
|
21
21
|
from .generalized_dice import GeneralizedDiceScore, compute_generalized_dice
|
22
|
-
from .hausdorff_distance import HausdorffDistanceMetric, compute_hausdorff_distance
|
22
|
+
from .hausdorff_distance import HausdorffDistanceMetric, compute_hausdorff_distance
|
23
23
|
from .loss_metric import LossMetric
|
24
24
|
from .meandice import DiceHelper, DiceMetric, compute_dice
|
25
25
|
from .meaniou import MeanIoU, compute_iou
|
@@ -14,7 +14,7 @@ from __future__ import annotations
|
|
14
14
|
import torch
|
15
15
|
|
16
16
|
from monai.metrics.utils import do_metric_reduction, ignore_background
|
17
|
-
from monai.utils import MetricReduction, Weight, deprecated_arg,
|
17
|
+
from monai.utils import MetricReduction, Weight, deprecated_arg, look_up_option
|
18
18
|
|
19
19
|
from .metric import CumulativeIterationMetric
|
20
20
|
|
@@ -37,6 +37,8 @@ class GeneralizedDiceScore(CumulativeIterationMetric):
|
|
37
37
|
reduction: Define mode of reduction to the metrics. Available reduction modes:
|
38
38
|
{``"none"``, ``"mean"``, ``"sum"``, ``"mean_batch"``, ``"sum_batch"``,
|
39
39
|
``"mean_channel"``, ``"sum_channel"``}, default to ``"mean"``. if "none", will not do reduction.
|
40
|
+
Default value is changed from `MetricReduction.MEAN_BATCH` to `MetricReduction.MEAN` in v1.5.0.
|
41
|
+
Old versions computed `mean` when `mean_batch` was provided due to bug in reduction.
|
40
42
|
weight_type: {``"square"``, ``"simple"``, ``"uniform"``}. Type of function to transform
|
41
43
|
ground truth volume into a weight factor. Defaults to ``"square"``.
|
42
44
|
|
@@ -44,21 +46,10 @@ class GeneralizedDiceScore(CumulativeIterationMetric):
|
|
44
46
|
ValueError: When the `reduction` is not one of MetricReduction enum.
|
45
47
|
"""
|
46
48
|
|
47
|
-
@deprecated_arg_default(
|
48
|
-
"reduction",
|
49
|
-
old_default=MetricReduction.MEAN_BATCH,
|
50
|
-
new_default=MetricReduction.MEAN,
|
51
|
-
since="1.4.0",
|
52
|
-
replaced="1.5.0",
|
53
|
-
msg_suffix=(
|
54
|
-
"Old versions computed `mean` when `mean_batch` was provided due to bug in reduction, "
|
55
|
-
"If you want to retain the old behavior (calculating the mean), please explicitly set the parameter to 'mean'."
|
56
|
-
),
|
57
|
-
)
|
58
49
|
def __init__(
|
59
50
|
self,
|
60
51
|
include_background: bool = True,
|
61
|
-
reduction: MetricReduction | str = MetricReduction.
|
52
|
+
reduction: MetricReduction | str = MetricReduction.MEAN,
|
62
53
|
weight_type: Weight | str = Weight.SQUARE,
|
63
54
|
) -> None:
|
64
55
|
super().__init__()
|
@@ -17,18 +17,12 @@ from typing import Any
|
|
17
17
|
import numpy as np
|
18
18
|
import torch
|
19
19
|
|
20
|
-
from monai.metrics.utils import
|
21
|
-
|
22
|
-
get_edge_surface_distance,
|
23
|
-
get_surface_distance,
|
24
|
-
ignore_background,
|
25
|
-
prepare_spacing,
|
26
|
-
)
|
27
|
-
from monai.utils import MetricReduction, convert_data_type, deprecated
|
20
|
+
from monai.metrics.utils import do_metric_reduction, get_edge_surface_distance, ignore_background, prepare_spacing
|
21
|
+
from monai.utils import MetricReduction, convert_data_type
|
28
22
|
|
29
23
|
from .metric import CumulativeIterationMetric
|
30
24
|
|
31
|
-
__all__ = ["HausdorffDistanceMetric", "compute_hausdorff_distance"
|
25
|
+
__all__ = ["HausdorffDistanceMetric", "compute_hausdorff_distance"]
|
32
26
|
|
33
27
|
|
34
28
|
class HausdorffDistanceMetric(CumulativeIterationMetric):
|
@@ -216,31 +210,3 @@ def _compute_percentile_hausdorff_distance(
|
|
216
210
|
if 0 <= percentile <= 100:
|
217
211
|
return torch.quantile(surface_distance, percentile / 100)
|
218
212
|
raise ValueError(f"percentile should be a value between 0 and 100, get {percentile}.")
|
219
|
-
|
220
|
-
|
221
|
-
@deprecated(since="1.3.0", removed="1.5.0")
|
222
|
-
def compute_percent_hausdorff_distance(
|
223
|
-
edges_pred: np.ndarray,
|
224
|
-
edges_gt: np.ndarray,
|
225
|
-
distance_metric: str = "euclidean",
|
226
|
-
percentile: float | None = None,
|
227
|
-
spacing: int | float | np.ndarray | Sequence[int | float] | None = None,
|
228
|
-
) -> float:
|
229
|
-
"""
|
230
|
-
This function is used to compute the directed Hausdorff distance.
|
231
|
-
"""
|
232
|
-
|
233
|
-
surface_distance: np.ndarray = get_surface_distance( # type: ignore
|
234
|
-
edges_pred, edges_gt, distance_metric=distance_metric, spacing=spacing
|
235
|
-
)
|
236
|
-
|
237
|
-
# for both pred and gt do not have foreground
|
238
|
-
if surface_distance.shape == (0,):
|
239
|
-
return np.nan
|
240
|
-
|
241
|
-
if not percentile:
|
242
|
-
return surface_distance.max() # type: ignore[no-any-return]
|
243
|
-
|
244
|
-
if 0 <= percentile <= 100:
|
245
|
-
return np.percentile(surface_distance, percentile) # type: ignore[no-any-return]
|
246
|
-
raise ValueError(f"percentile should be a value between 0 and 100, get {percentile}.")
|
monai/metrics/utils.py
CHANGED
@@ -30,7 +30,6 @@ from monai.utils import (
|
|
30
30
|
convert_to_numpy,
|
31
31
|
convert_to_tensor,
|
32
32
|
deprecated_arg,
|
33
|
-
deprecated_arg_default,
|
34
33
|
ensure_tuple_rep,
|
35
34
|
look_up_option,
|
36
35
|
optional_import,
|
@@ -131,9 +130,6 @@ def do_metric_reduction(
|
|
131
130
|
return f, not_nans
|
132
131
|
|
133
132
|
|
134
|
-
@deprecated_arg_default(
|
135
|
-
name="always_return_as_numpy", since="1.3.0", replaced="1.5.0", old_default=True, new_default=False
|
136
|
-
)
|
137
133
|
@deprecated_arg(
|
138
134
|
name="always_return_as_numpy",
|
139
135
|
since="1.5.0",
|
@@ -146,7 +142,7 @@ def get_mask_edges(
|
|
146
142
|
label_idx: int = 1,
|
147
143
|
crop: bool = True,
|
148
144
|
spacing: Sequence | None = None,
|
149
|
-
always_return_as_numpy: bool =
|
145
|
+
always_return_as_numpy: bool = False,
|
150
146
|
) -> tuple[NdarrayTensor, NdarrayTensor]:
|
151
147
|
"""
|
152
148
|
Compute edges from binary segmentation masks. This
|
@@ -175,6 +171,7 @@ def get_mask_edges(
|
|
175
171
|
otherwise `scipy`'s binary erosion is used to calculate the edges.
|
176
172
|
always_return_as_numpy: whether to a numpy array regardless of the input type.
|
177
173
|
If False, return the same type as inputs.
|
174
|
+
The default value is changed from `True` to `False` in v1.5.0.
|
178
175
|
"""
|
179
176
|
# move in the funciton to avoid using all the GPUs
|
180
177
|
cucim_binary_erosion, has_cucim_binary_erosion = optional_import("cucim.skimage.morphology", name="binary_erosion")
|
@@ -25,7 +25,6 @@ from monai.networks.blocks import MLPBlock as Mlp
|
|
25
25
|
from monai.networks.blocks import PatchEmbed, UnetOutBlock, UnetrBasicBlock, UnetrUpBlock
|
26
26
|
from monai.networks.layers import DropPath, trunc_normal_
|
27
27
|
from monai.utils import ensure_tuple_rep, look_up_option, optional_import
|
28
|
-
from monai.utils.deprecate_utils import deprecated_arg
|
29
28
|
|
30
29
|
rearrange, _ = optional_import("einops", name="rearrange")
|
31
30
|
|
@@ -50,16 +49,8 @@ class SwinUNETR(nn.Module):
|
|
50
49
|
<https://arxiv.org/abs/2201.01266>"
|
51
50
|
"""
|
52
51
|
|
53
|
-
@deprecated_arg(
|
54
|
-
name="img_size",
|
55
|
-
since="1.3",
|
56
|
-
removed="1.5",
|
57
|
-
msg_suffix="The img_size argument is not required anymore and "
|
58
|
-
"checks on the input size are run during forward().",
|
59
|
-
)
|
60
52
|
def __init__(
|
61
53
|
self,
|
62
|
-
img_size: Sequence[int] | int,
|
63
54
|
in_channels: int,
|
64
55
|
out_channels: int,
|
65
56
|
patch_size: int = 2,
|
@@ -83,10 +74,6 @@ class SwinUNETR(nn.Module):
|
|
83
74
|
) -> None:
|
84
75
|
"""
|
85
76
|
Args:
|
86
|
-
img_size: spatial dimension of input image.
|
87
|
-
This argument is only used for checking that the input image size is divisible by the patch size.
|
88
|
-
The tensor passed to forward() can have a dynamic shape as long as its spatial dimensions are divisible by 2**5.
|
89
|
-
It will be removed in an upcoming version.
|
90
77
|
in_channels: dimension of input channels.
|
91
78
|
out_channels: dimension of output channels.
|
92
79
|
patch_size: size of the patch token.
|
@@ -113,13 +100,13 @@ class SwinUNETR(nn.Module):
|
|
113
100
|
Examples::
|
114
101
|
|
115
102
|
# for 3D single channel input with size (96,96,96), 4-channel output and feature size of 48.
|
116
|
-
>>> net = SwinUNETR(
|
103
|
+
>>> net = SwinUNETR(in_channels=1, out_channels=4, feature_size=48)
|
117
104
|
|
118
105
|
# for 3D 4-channel input with size (128,128,128), 3-channel output and (2,4,2,2) layers in each stage.
|
119
|
-
>>> net = SwinUNETR(
|
106
|
+
>>> net = SwinUNETR(in_channels=4, out_channels=3, depths=(2,4,2,2))
|
120
107
|
|
121
108
|
# for 2D single channel input with size (96,96), 2-channel output and gradient checkpointing.
|
122
|
-
>>> net = SwinUNETR(
|
109
|
+
>>> net = SwinUNETR(in_channels=3, out_channels=2, use_checkpoint=True, spatial_dims=2)
|
123
110
|
|
124
111
|
"""
|
125
112
|
|
@@ -130,12 +117,9 @@ class SwinUNETR(nn.Module):
|
|
130
117
|
|
131
118
|
self.patch_size = patch_size
|
132
119
|
|
133
|
-
img_size = ensure_tuple_rep(img_size, spatial_dims)
|
134
120
|
patch_sizes = ensure_tuple_rep(self.patch_size, spatial_dims)
|
135
121
|
window_size = ensure_tuple_rep(window_size, spatial_dims)
|
136
122
|
|
137
|
-
self._check_input_size(img_size)
|
138
|
-
|
139
123
|
if not (0 <= drop_rate <= 1):
|
140
124
|
raise ValueError("dropout rate should be between 0 and 1.")
|
141
125
|
|
@@ -1109,7 +1093,7 @@ def filter_swinunetr(key, value):
|
|
1109
1093
|
from monai.networks.utils import copy_model_state
|
1110
1094
|
from monai.networks.nets.swin_unetr import SwinUNETR, filter_swinunetr
|
1111
1095
|
|
1112
|
-
model = SwinUNETR(
|
1096
|
+
model = SwinUNETR(in_channels=1, out_channels=3, feature_size=48)
|
1113
1097
|
resource = (
|
1114
1098
|
"https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/ssl_pretrained_weights.pth"
|
1115
1099
|
)
|
@@ -238,7 +238,7 @@ class DDPMScheduler(Scheduler):
|
|
238
238
|
pred_prev_sample = pred_original_sample_coeff * pred_original_sample + current_sample_coeff * sample
|
239
239
|
|
240
240
|
# 6. Add noise
|
241
|
-
variance = 0
|
241
|
+
variance: torch.Tensor = torch.tensor(0)
|
242
242
|
if timestep > 0:
|
243
243
|
noise = torch.randn(
|
244
244
|
model_output.size(),
|
@@ -105,9 +105,11 @@ def _cosine_beta(num_train_timesteps: int, s: float = 8e-3):
|
|
105
105
|
x = torch.linspace(0, num_train_timesteps, num_train_timesteps + 1)
|
106
106
|
alphas_cumprod = torch.cos(((x / num_train_timesteps) + s) / (1 + s) * torch.pi * 0.5) ** 2
|
107
107
|
alphas_cumprod /= alphas_cumprod[0].item()
|
108
|
-
|
109
|
-
betas =
|
110
|
-
|
108
|
+
betas = 1.0 - (alphas_cumprod[1:] / alphas_cumprod[:-1])
|
109
|
+
betas = torch.clip(betas, 0.0, 0.999)
|
110
|
+
alphas = 1.0 - betas
|
111
|
+
alphas_cumprod = torch.cumprod(alphas, dim=0)
|
112
|
+
return betas, alphas, alphas_cumprod
|
111
113
|
|
112
114
|
|
113
115
|
class Scheduler(nn.Module):
|
@@ -51,7 +51,6 @@ from monai.utils import (
|
|
51
51
|
TransformBackends,
|
52
52
|
convert_data_type,
|
53
53
|
convert_to_tensor,
|
54
|
-
deprecated_arg_default,
|
55
54
|
ensure_tuple,
|
56
55
|
ensure_tuple_rep,
|
57
56
|
fall_back_tuple,
|
@@ -809,13 +808,12 @@ class CropForeground(Crop):
|
|
809
808
|
|
810
809
|
"""
|
811
810
|
|
812
|
-
@deprecated_arg_default("allow_smaller", old_default=True, new_default=False, since="1.2", replaced="1.5")
|
813
811
|
def __init__(
|
814
812
|
self,
|
815
813
|
select_fn: Callable = is_positive,
|
816
814
|
channel_indices: IndexSelection | None = None,
|
817
815
|
margin: Sequence[int] | int = 0,
|
818
|
-
allow_smaller: bool =
|
816
|
+
allow_smaller: bool = False,
|
819
817
|
return_coords: bool = False,
|
820
818
|
k_divisible: Sequence[int] | int = 1,
|
821
819
|
mode: str = PytorchPadMode.CONSTANT,
|
@@ -830,7 +828,8 @@ class CropForeground(Crop):
|
|
830
828
|
margin: add margin value to spatial dims of the bounding box, if only 1 value provided, use it for all dims.
|
831
829
|
allow_smaller: when computing box size with `margin`, whether to allow the image edges to be smaller than the
|
832
830
|
final box edges. If `False`, part of a padded output box might be outside of the original image, if `True`,
|
833
|
-
the image edges will be used as the box edges. Default to `
|
831
|
+
the image edges will be used as the box edges. Default to `False`.
|
832
|
+
The default value is changed from `True` to `False` in v1.5.0.
|
834
833
|
return_coords: whether return the coordinates of spatial bounding box for foreground.
|
835
834
|
k_divisible: make each spatial dimension to be divisible by k, default to 1.
|
836
835
|
if `k_divisible` is an int, the same `k` be applied to all the input spatial dimensions.
|
@@ -50,7 +50,7 @@ from monai.transforms.inverse import InvertibleTransform
|
|
50
50
|
from monai.transforms.traits import LazyTrait, MultiSampleTrait
|
51
51
|
from monai.transforms.transform import LazyTransform, MapTransform, Randomizable
|
52
52
|
from monai.transforms.utils import is_positive
|
53
|
-
from monai.utils import MAX_SEED, Method, PytorchPadMode,
|
53
|
+
from monai.utils import MAX_SEED, Method, PytorchPadMode, ensure_tuple_rep
|
54
54
|
|
55
55
|
__all__ = [
|
56
56
|
"Padd",
|
@@ -716,7 +716,6 @@ class CropForegroundd(Cropd):
|
|
716
716
|
for more information.
|
717
717
|
"""
|
718
718
|
|
719
|
-
@deprecated_arg_default("allow_smaller", old_default=True, new_default=False, since="1.2", replaced="1.5")
|
720
719
|
def __init__(
|
721
720
|
self,
|
722
721
|
keys: KeysCollection,
|
@@ -724,7 +723,7 @@ class CropForegroundd(Cropd):
|
|
724
723
|
select_fn: Callable = is_positive,
|
725
724
|
channel_indices: IndexSelection | None = None,
|
726
725
|
margin: Sequence[int] | int = 0,
|
727
|
-
allow_smaller: bool =
|
726
|
+
allow_smaller: bool = False,
|
728
727
|
k_divisible: Sequence[int] | int = 1,
|
729
728
|
mode: SequenceStr = PytorchPadMode.CONSTANT,
|
730
729
|
start_coord_key: str | None = "foreground_start_coord",
|
@@ -744,7 +743,8 @@ class CropForegroundd(Cropd):
|
|
744
743
|
margin: add margin value to spatial dims of the bounding box, if only 1 value provided, use it for all dims.
|
745
744
|
allow_smaller: when computing box size with `margin`, whether to allow the image edges to be smaller than the
|
746
745
|
final box edges. If `False`, part of a padded output box might be outside of the original image, if `True`,
|
747
|
-
the image edges will be used as the box edges. Default to `
|
746
|
+
the image edges will be used as the box edges. Default to `False`.
|
747
|
+
The default value is changed from `True` to `False` in v1.5.0.
|
748
748
|
k_divisible: make each spatial dimension to be divisible by k, default to 1.
|
749
749
|
if `k_divisible` is an int, the same `k` be applied to all the input spatial dimensions.
|
750
750
|
mode: available modes for numpy array:{``"constant"``, ``"edge"``, ``"linear_ramp"``, ``"maximum"``,
|
monai/transforms/utils.py
CHANGED
@@ -58,7 +58,6 @@ from monai.utils import (
|
|
58
58
|
SplineMode,
|
59
59
|
TraceKeys,
|
60
60
|
TraceStatusKeys,
|
61
|
-
deprecated_arg_default,
|
62
61
|
ensure_tuple,
|
63
62
|
ensure_tuple_rep,
|
64
63
|
ensure_tuple_size,
|
@@ -1067,13 +1066,12 @@ def _create_translate(
|
|
1067
1066
|
return array_func(affine) # type: ignore
|
1068
1067
|
|
1069
1068
|
|
1070
|
-
@deprecated_arg_default("allow_smaller", old_default=True, new_default=False, since="1.2", replaced="1.5")
|
1071
1069
|
def generate_spatial_bounding_box(
|
1072
1070
|
img: NdarrayOrTensor,
|
1073
1071
|
select_fn: Callable = is_positive,
|
1074
1072
|
channel_indices: IndexSelection | None = None,
|
1075
1073
|
margin: Sequence[int] | int = 0,
|
1076
|
-
allow_smaller: bool =
|
1074
|
+
allow_smaller: bool = False,
|
1077
1075
|
) -> tuple[list[int], list[int]]:
|
1078
1076
|
"""
|
1079
1077
|
Generate the spatial bounding box of foreground in the image with start-end positions (inclusive).
|
@@ -1093,8 +1091,9 @@ def generate_spatial_bounding_box(
|
|
1093
1091
|
of image. if None, select foreground on the whole image.
|
1094
1092
|
margin: add margin value to spatial dims of the bounding box, if only 1 value provided, use it for all dims.
|
1095
1093
|
allow_smaller: when computing box size with `margin`, whether to allow the image edges to be smaller than the
|
1096
|
-
|
1097
|
-
|
1094
|
+
final box edges. If `True`, the bounding boxes edges are aligned with the input image edges, if `False`,
|
1095
|
+
the bounding boxes edges are aligned with the final box edges. Default to `False`.
|
1096
|
+
The default value is changed from `True` to `False` in v1.5.0.
|
1098
1097
|
|
1099
1098
|
"""
|
1100
1099
|
check_non_lazy_pending_ops(img, name="generate_spatial_bounding_box")
|
monai/utils/misc.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: monai-weekly
|
3
|
-
Version: 1.5.
|
3
|
+
Version: 1.5.dev2519
|
4
4
|
Summary: AI Toolkit for Healthcare Imaging
|
5
5
|
Home-page: https://monai.io/
|
6
6
|
Author: MONAI Consortium
|
@@ -29,8 +29,7 @@ Classifier: Typing :: Typed
|
|
29
29
|
Requires-Python: >=3.9
|
30
30
|
Description-Content-Type: text/markdown; charset=UTF-8
|
31
31
|
License-File: LICENSE
|
32
|
-
Requires-Dist: torch
|
33
|
-
Requires-Dist: torch>=2.4.1; sys_platform == "win32"
|
32
|
+
Requires-Dist: torch<2.7.0,>=2.4.1
|
34
33
|
Requires-Dist: numpy<3.0,>=1.24
|
35
34
|
Provides-Extra: all
|
36
35
|
Requires-Dist: nibabel; extra == "all"
|
@@ -1,5 +1,5 @@
|
|
1
|
-
monai/__init__.py,sha256=
|
2
|
-
monai/_version.py,sha256=
|
1
|
+
monai/__init__.py,sha256=6Lqce9ju_1prrRexTvxrqDOAXR4V_2jIexYWftm4WI0,4095
|
2
|
+
monai/_version.py,sha256=MEanOs38grhINGP6ufrVEYiEk-QFqmAz6U2O5UwqGRg,503
|
3
3
|
monai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
monai/_extensions/__init__.py,sha256=NEBPreRhQ8H9gVvgrLr_y52_TmqB96u_u4VQmeNT93I,642
|
5
5
|
monai/_extensions/loader.py,sha256=7SiKw36q-nOzH8CRbBurFrz7GM40GCu7rc93Tm8XpnI,3643
|
@@ -26,7 +26,7 @@ monai/apps/deepedit/transforms.py,sha256=Udj35m10Irek5Gtqo6Hgv6Lt7S6jSo-z0NuyVbs
|
|
26
26
|
monai/apps/deepgrow/__init__.py,sha256=s9djSd6kvViPnFvMR11Dgd30Lv4oY6FaPJr4ZZJZLq0,573
|
27
27
|
monai/apps/deepgrow/dataset.py,sha256=W0wv1QujA4sZgrAcBS64dl3OBbDBM2cF4RK0fDCQnRU,10054
|
28
28
|
monai/apps/deepgrow/interaction.py,sha256=Und57h06LSZ9W7CAWh7evPU7l97XZIB5KuEMvVCvMtM,3745
|
29
|
-
monai/apps/deepgrow/transforms.py,sha256=
|
29
|
+
monai/apps/deepgrow/transforms.py,sha256=tyLVynUh20JgQl4Tiw9FjI8RdjiqokYqzsrICojaQYA,43329
|
30
30
|
monai/apps/detection/__init__.py,sha256=s9djSd6kvViPnFvMR11Dgd30Lv4oY6FaPJr4ZZJZLq0,573
|
31
31
|
monai/apps/detection/metrics/__init__.py,sha256=s9djSd6kvViPnFvMR11Dgd30Lv4oY6FaPJr4ZZJZLq0,573
|
32
32
|
monai/apps/detection/metrics/coco.py,sha256=bpF6hAAMKsBNLfat-Fzh0CR-0swDsAAVcwTaZ-lo1_g,26618
|
@@ -115,9 +115,9 @@ monai/bundle/config_item.py,sha256=rMjXSGkjJZdi04BwSHwCcIwzIb_TflmC3xDhC3SVJRs,1
|
|
115
115
|
monai/bundle/config_parser.py,sha256=cGyEn-cqNk0rEEZ1Qiv6UydmIDvtWZcMVljyfVm5i50,23025
|
116
116
|
monai/bundle/properties.py,sha256=iN3K4FVmN9ny1Hw9p5j7_ULcCdSD8PmrR7qXxbNz49k,11582
|
117
117
|
monai/bundle/reference_resolver.py,sha256=GXCMK4iogxxE6VocsmAbUrcXosmC5arnjeG9zYhHKpg,16748
|
118
|
-
monai/bundle/scripts.py,sha256=
|
118
|
+
monai/bundle/scripts.py,sha256=G6otT4PLWeWJ0P1Nk8-IwdYejMNakWiC3mFZ6qoNEfc,89709
|
119
119
|
monai/bundle/utils.py,sha256=t-22uFvLn7Yy-dr1v1U33peNOxgAmU4TJiGAbsBrUKs,10108
|
120
|
-
monai/bundle/workflows.py,sha256=
|
120
|
+
monai/bundle/workflows.py,sha256=6OUyC0a_hsG5yGe-uVvFNeHzjf4W86NHu-XNGuNkdZo,33179
|
121
121
|
monai/config/__init__.py,sha256=CN28CfTdsp301gv8YXfVvkbztCfbAqrLKrJi_C8oP9s,1048
|
122
122
|
monai/config/deviceconfig.py,sha256=f3Xa0OL9kNqdsbZ0PfUEvm6NZivAPh454_VCE8BmsWE,10582
|
123
123
|
monai/config/type_definitions.py,sha256=a8_YmLkVOeldchAS6cM3KiG9n9YixkXHoyYo1XoskMI,3512
|
@@ -222,7 +222,7 @@ monai/losses/sure_loss.py,sha256=QrXCmy7YwASZNufroDTjiZo8w5FahVd07asDeTd6r3s,819
|
|
222
222
|
monai/losses/tversky.py,sha256=uLuqCvsac8OabTJzKQEzAfAvlwrflYCh0s76rgbcVJ0,6955
|
223
223
|
monai/losses/unified_focal_loss.py,sha256=rCj8IpueYH_UMrOUXU0tjbXIN4Uix3bGnRZQtRvl7Sg,10224
|
224
224
|
monai/losses/utils.py,sha256=wrpKcEO0XhbFOHz_jJRqeAeIgpMiMxmepnRf31_DNRU,2786
|
225
|
-
monai/metrics/__init__.py,sha256=
|
225
|
+
monai/metrics/__init__.py,sha256=4Yj495eFZzzQ8fO5TlT-GJbYdo7taiKGxfwtc0qJW4Q,2219
|
226
226
|
monai/metrics/active_learning_metrics.py,sha256=uKID2O4mnY-9P2ZzyT4sqJd2NfgzjSpNKpAwulWCozU,8211
|
227
227
|
monai/metrics/average_precision.py,sha256=rQYfPAmE78np8E4UoDPk-DSVRtEVC2hAcj5w9Q6ZIqk,8454
|
228
228
|
monai/metrics/confusion_matrix.py,sha256=Spb20jYPnbgGZfPKDQI36ePznPf1xujxhboNnW8HxdQ,15064
|
@@ -230,8 +230,8 @@ monai/metrics/cumulative_average.py,sha256=8GGjHmiBboBikprg1380SsNn7RgzFIrHGWBYD
|
|
230
230
|
monai/metrics/f_beta_score.py,sha256=urI0J_tvl0qQ5-l2fgWV_jChbgpzLmgpRq125B3yxpw,3984
|
231
231
|
monai/metrics/fid.py,sha256=p5G03tQn_2rhukYdkPS-5Y9IRzVcGlgBcxU1BCKGLzc,4795
|
232
232
|
monai/metrics/froc.py,sha256=q7MAFsHHIp5EHBHwa5UbF5PRApjUonw-hUXax9k1WxQ,7981
|
233
|
-
monai/metrics/generalized_dice.py,sha256=
|
234
|
-
monai/metrics/hausdorff_distance.py,sha256=
|
233
|
+
monai/metrics/generalized_dice.py,sha256=Kv6g8-PF9xNl4C12zF8l1O-1hylRh7h5eW44IAT5rQ4,8661
|
234
|
+
monai/metrics/hausdorff_distance.py,sha256=xOeOvnN0iCbi8YW2xW1J3TPkqWckdQ8jifiRIyFFX4o,10778
|
235
235
|
monai/metrics/loss_metric.py,sha256=m9jXobVHKLeDY_8yrA9m7FwfapSAb-kYIdUJOsbvBvY,4907
|
236
236
|
monai/metrics/meandice.py,sha256=Q2Fp_YfZrlsx4cxR_h40zpeeGoIkKWQN78qzCShnbro,16237
|
237
237
|
monai/metrics/meaniou.py,sha256=cGoW1re7v4hxXJfjyEVEFNsuzEupgJaIe6ZK_qrbIjw,7004
|
@@ -242,7 +242,7 @@ monai/metrics/regression.py,sha256=JV7x8ibD04hZeWz83Ac26jjyufsCanvAmohD-eWKtbY,2
|
|
242
242
|
monai/metrics/rocauc.py,sha256=xOopgYaahaH1-PmD4yG3B3f25kA95yK56BbXIykra60,8094
|
243
243
|
monai/metrics/surface_dice.py,sha256=aNERsTuJkPMfxatPaAzoW1KtvZvUAv4qe_7Kl_dOROI,15149
|
244
244
|
monai/metrics/surface_distance.py,sha256=bKDTm7ulhjfiphHLrDJoA3OKI3npwQy2Z5wY-JkXtXg,9727
|
245
|
-
monai/metrics/utils.py,sha256=
|
245
|
+
monai/metrics/utils.py,sha256=jU4YEM1P7BZKoxZ8IvXpi0Z-254fZ78wFvAghBa_DpU,46858
|
246
246
|
monai/metrics/wrapper.py,sha256=c1zg-xcypQyZ840TEuhhLgr4sClYMWTxlv1OieJTtvE,11781
|
247
247
|
monai/networks/__init__.py,sha256=ZzU2Qo8gDXNiRBF0JapIo3xlecZHjXsJuarF0IKVKKY,1086
|
248
248
|
monai/networks/trt_compiler.py,sha256=IFfsM1qFZvmCUBbEvbHnZe6_zmMcXghkpkzmP43dZbk,27535
|
@@ -331,7 +331,7 @@ monai/networks/nets/senet.py,sha256=yLhP9gDPoa-h9UwJZJm5qxPdPvF9calY95lButXJESs,
|
|
331
331
|
monai/networks/nets/spade_autoencoderkl.py,sha256=-b2Sbl4jPpwo3ukTgsTcON26cSTB35K9sy1S9DKlZz0,19566
|
332
332
|
monai/networks/nets/spade_diffusion_model_unet.py,sha256=zYsXhkHNpHWWyal5ljAMxOICJ1loYQQMAOuzWzdLBCM,39007
|
333
333
|
monai/networks/nets/spade_network.py,sha256=GguYucjIRyT_rZa9DrvUmv00FtqXHZtY1VfJM9Rygns,16479
|
334
|
-
monai/networks/nets/swin_unetr.py,sha256=
|
334
|
+
monai/networks/nets/swin_unetr.py,sha256=Qkr-llizxBvv6W7LHXIqgRFVCUqyStuKHK0fn9Hqa7A,44807
|
335
335
|
monai/networks/nets/torchvision_fc.py,sha256=3g5PD7C1MSkQ8xndhnVd0b3aN8zfshT8uiFS0OHyQaY,6309
|
336
336
|
monai/networks/nets/transchex.py,sha256=5b8luTeajjbl3P560Y5xpwblT3j1-0ghuhmQbkIat0U,15822
|
337
337
|
monai/networks/nets/transformer.py,sha256=-nzl20Z5xdtn7xChOd_cRbbPVoPIFGVfTQw3fIEGMuE,6395
|
@@ -346,10 +346,10 @@ monai/networks/nets/voxelmorph.py,sha256=Q5VQFLLKSFqhsG0Z8_72ZGfK1nA4kdCfFnGbqI6
|
|
346
346
|
monai/networks/nets/vqvae.py,sha256=Zf9fTL_rluhuJhH6gTNB6iiKRfwBxfuuyhCdU9TLmAk,18417
|
347
347
|
monai/networks/schedulers/__init__.py,sha256=Jic-Ln0liMjDVQ1KAv9Z1fsoxGZXuBKxqBeWJthgwHY,798
|
348
348
|
monai/networks/schedulers/ddim.py,sha256=MygHvgLB_NL9488DhHsE_g-EvV6DlDPtiBROpnCvDHc,14380
|
349
|
-
monai/networks/schedulers/ddpm.py,sha256=
|
349
|
+
monai/networks/schedulers/ddpm.py,sha256=WFK9dLzuOldVQyaJVHRvm-YK8-KtkMmA_pU5htPRGQE,11415
|
350
350
|
monai/networks/schedulers/pndm.py,sha256=9Qe8NOw_tvlpCBK7yvkmyriyGfIO5RRDV8ZKPh85cQY,14472
|
351
351
|
monai/networks/schedulers/rectified_flow.py,sha256=n0Pi03Z8GJBZVf9G5YUQ-uc9dZSGK4ra2SnMc4sI0GE,13757
|
352
|
-
monai/networks/schedulers/scheduler.py,sha256=
|
352
|
+
monai/networks/schedulers/scheduler.py,sha256=2laFdXL2LXO5sOq5cs7H-vrkf6UKMY1QruEafdBZ00E,9272
|
353
353
|
monai/optimizers/__init__.py,sha256=XUL7o9vSL7bZImpxVZqcc1c8MwUMrOZL4nJ-mjAA7yM,796
|
354
354
|
monai/optimizers/lr_finder.py,sha256=tbVi6qd-LLI6pENM9cDUv-Hh1HqziO3Wb9aI6JoaPng,21992
|
355
355
|
monai/optimizers/lr_scheduler.py,sha256=YPY5MWgCTmExuIOBsVJrgfErkCT1ELBekcH0XeRP6Kk,4082
|
@@ -363,14 +363,14 @@ monai/transforms/inverse_batch_transform.py,sha256=fMbukZq2P99BhqqMuWZFJ9uboZ5dN
|
|
363
363
|
monai/transforms/nvtx.py,sha256=1EKEXZIhTUFKoIrJmd_fevwrHwo731dVFUFJQFiOk3w,3386
|
364
364
|
monai/transforms/traits.py,sha256=F8kmhnekTyaAdo8wIFjO3-uqpVtmFym3mNxbYbyvkFI,3563
|
365
365
|
monai/transforms/transform.py,sha256=0eC_Gw7T2jBb589-3EHLh-8gJD687k2OVmrnMxaKs3o,22256
|
366
|
-
monai/transforms/utils.py,sha256=
|
366
|
+
monai/transforms/utils.py,sha256=yl7cAi0TVlDOQzI1INLROwZS08Xgg0s4b9VovDDSLnM,106364
|
367
367
|
monai/transforms/utils_create_transform_ims.py,sha256=QEJVHsCZX7ZxsBArk6NjgCzSZuuokf8l1uFqiUZBBys,31155
|
368
368
|
monai/transforms/utils_morphological_ops.py,sha256=tt0lRLLxmlnn9roUuPEBtqah6t7BH8ittxyDFuskkUI,6767
|
369
369
|
monai/transforms/utils_pytorch_numpy_unification.py,sha256=pM6-x-TAGVcQohSYirfTqiy2SQnPixcKKHTmTqtBbg0,18706
|
370
370
|
monai/transforms/croppad/__init__.py,sha256=s9djSd6kvViPnFvMR11Dgd30Lv4oY6FaPJr4ZZJZLq0,573
|
371
|
-
monai/transforms/croppad/array.py,sha256=
|
371
|
+
monai/transforms/croppad/array.py,sha256=CpCbciNGeQh2xYyNr4Of6bmDW9dyOhAQeLSt0P8gQA8,74574
|
372
372
|
monai/transforms/croppad/batch.py,sha256=5ukcYk3VCDpk62AL5Q_jTqpXmSNTlw0UCUhDeAB4aV0,6138
|
373
|
-
monai/transforms/croppad/dictionary.py,sha256=
|
373
|
+
monai/transforms/croppad/dictionary.py,sha256=TSX6GZUnzC4nFW8SpSKMO2aGTZYpWRtwBGjDqqqMhJE,60692
|
374
374
|
monai/transforms/croppad/functional.py,sha256=iroD0XBaMG1Mox6-EotIh2nAUxJPrpIyUrHopc83Sug,12640
|
375
375
|
monai/transforms/intensity/__init__.py,sha256=s9djSd6kvViPnFvMR11Dgd30Lv4oY6FaPJr4ZZJZLq0,573
|
376
376
|
monai/transforms/intensity/array.py,sha256=jVHHMvmUTYrqIp6i_MhvLt_-fup_Bl770RRV7cald3g,121808
|
@@ -411,7 +411,7 @@ monai/utils/deprecate_utils.py,sha256=gKeEV4MsI51qeQ5gci2me_C-0e-tDwa3VZzd3XPQqL
|
|
411
411
|
monai/utils/dist.py,sha256=7brB42CvdS8Jvr8Y7hfqov1uk6NNnYea9dYfgMYy0BY,8578
|
412
412
|
monai/utils/enums.py,sha256=aupxnORUHqVPF2Ac5nxstsP5aIyewMoqgGb88D62yxg,19931
|
413
413
|
monai/utils/jupyter_utils.py,sha256=BYtj80LWQAYg5RWPj5g4j2AMCzLECvAcnZdXns0Ruw8,15651
|
414
|
-
monai/utils/misc.py,sha256=
|
414
|
+
monai/utils/misc.py,sha256=AOlcW24yo0rpe7AZB6aX5r-FeXXSK6847UtwN_z7288,31759
|
415
415
|
monai/utils/module.py,sha256=R37PpCNCcHQvjjZFbNjNyzWb3FURaKLxQucjhzQk0eU,26087
|
416
416
|
monai/utils/nvtx.py,sha256=i9JBxR1uhW1ZCgLPLlTx8b907QlXkFzJyTBLMlFjhtU,6876
|
417
417
|
monai/utils/ordering.py,sha256=0nlA5b5QpVCHbtiCbTC-YsqjTmjm0bub0IeJhGFBOes,8270
|
@@ -426,7 +426,7 @@ monai/visualize/img2tensorboard.py,sha256=n4ztSa5BQAUxSTGvi2tp45v-F7-RNgSlbsdy-9
|
|
426
426
|
monai/visualize/occlusion_sensitivity.py,sha256=OQHEJLyIhB8zWqQsfKaX-1kvCjWFVYtLfS4dFC0nKFI,18160
|
427
427
|
monai/visualize/utils.py,sha256=B-MhTVs7sQbIqYS3yPnpBwPw2K82rE2PBtGIfpwZtWM,9894
|
428
428
|
monai/visualize/visualizer.py,sha256=qckyaMZCbezYUwE20k5yc-Pb7UozVavMDbrmyQwfYHY,1377
|
429
|
-
monai_weekly-1.5.
|
429
|
+
monai_weekly-1.5.dev2519.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
430
430
|
tests/apps/__init__.py,sha256=s9djSd6kvViPnFvMR11Dgd30Lv4oY6FaPJr4ZZJZLq0,573
|
431
431
|
tests/apps/test_auto3dseg_bundlegen.py,sha256=FpTJo9Lfe8vdhGuWeZ9y1BQmqYwTt-s8mDVtoLGAz_I,5594
|
432
432
|
tests/apps/test_check_hash.py,sha256=MuZslW2DDCxHKEo6-PiL7hnbxGuZRRYf6HOh3ZQv1qQ,1761
|
@@ -785,7 +785,7 @@ tests/networks/nets/test_senet.py,sha256=V9HyDyYMR2r2F6FzZUl6INDipH5mk-IrExkkeZw
|
|
785
785
|
tests/networks/nets/test_spade_autoencoderkl.py,sha256=vU9j-flnprLJT-VctKuiLK1KyKw1UrAO87mpddE0sNs,9289
|
786
786
|
tests/networks/nets/test_spade_diffusion_model_unet.py,sha256=LEN1PAGid0DMdP2NySi94RrlE8FgomJ9ZV3YRe0ubaE,18347
|
787
787
|
tests/networks/nets/test_spade_vaegan.py,sha256=ur1SPoXEmpr_8KwVS6-E_1tIPMBKpNqsvHJ7z5-obzA,5632
|
788
|
-
tests/networks/nets/test_swin_unetr.py,sha256=
|
788
|
+
tests/networks/nets/test_swin_unetr.py,sha256=_IJArChAl0D67EySfFgNT9urKx7gxsfUPt0tuS3xA6w,5149
|
789
789
|
tests/networks/nets/test_torchvision_fc_model.py,sha256=oNb-PaOhIAjOrpnsXApC2hKSUK6lMutIEinMrCOKQoA,6397
|
790
790
|
tests/networks/nets/test_transchex.py,sha256=G8WHEAlZlovlpJjlWD5cfeGD6FTFzUM6Y7_bVehHNY0,3293
|
791
791
|
tests/networks/nets/test_transformer.py,sha256=rsGjemv0JV9SMTTWiZ8Sz_w5t5Rkz15b2rjJit4R2XA,4218
|
@@ -1189,7 +1189,7 @@ tests/visualize/test_vis_gradcam.py,sha256=WpA-pvTB75eZs7JoIc5qyvOV9PwgkzWI8-Vow
|
|
1189
1189
|
tests/visualize/utils/__init__.py,sha256=s9djSd6kvViPnFvMR11Dgd30Lv4oY6FaPJr4ZZJZLq0,573
|
1190
1190
|
tests/visualize/utils/test_blend_images.py,sha256=RVs2p_8RWQDfhLHDNNtZaMig27v8o0km7XxNa-zWjKE,2274
|
1191
1191
|
tests/visualize/utils/test_matshow3d.py,sha256=wXYj77L5Jvnp0f6DvL1rsi_-YlCxS0HJ9hiPmrbpuP8,5021
|
1192
|
-
monai_weekly-1.5.
|
1193
|
-
monai_weekly-1.5.
|
1194
|
-
monai_weekly-1.5.
|
1195
|
-
monai_weekly-1.5.
|
1192
|
+
monai_weekly-1.5.dev2519.dist-info/METADATA,sha256=qit8fwiG7yXW-iXJqSdNUo3ghhoQqkFfx2lN1erfdLI,12033
|
1193
|
+
monai_weekly-1.5.dev2519.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
1194
|
+
monai_weekly-1.5.dev2519.dist-info/top_level.txt,sha256=hn2Y6P9xBf2R8faMeVMHhPMvrdDKxMsIOwMDYI0yTjs,12
|
1195
|
+
monai_weekly-1.5.dev2519.dist-info/RECORD,,
|
@@ -51,7 +51,6 @@ for attn_drop_rate in [0.4]:
|
|
51
51
|
"spatial_dims": len(img_size),
|
52
52
|
"in_channels": in_channels,
|
53
53
|
"out_channels": out_channels,
|
54
|
-
"img_size": img_size,
|
55
54
|
"feature_size": feature_size,
|
56
55
|
"depths": depth,
|
57
56
|
"norm_name": norm_name,
|
@@ -67,7 +66,7 @@ for attn_drop_rate in [0.4]:
|
|
67
66
|
|
68
67
|
TEST_CASE_FILTER = [
|
69
68
|
[
|
70
|
-
{"
|
69
|
+
{"in_channels": 1, "out_channels": 14, "feature_size": 48, "use_checkpoint": True},
|
71
70
|
"swinViT.layers1.0.blocks.0.norm1.weight",
|
72
71
|
torch.tensor([0.9473, 0.9343, 0.8566, 0.8487, 0.8065, 0.7779, 0.6333, 0.5555]),
|
73
72
|
]
|
@@ -85,30 +84,13 @@ class TestSWINUNETR(unittest.TestCase):
|
|
85
84
|
|
86
85
|
def test_ill_arg(self):
|
87
86
|
with self.assertRaises(ValueError):
|
88
|
-
SwinUNETR(
|
89
|
-
in_channels=1,
|
90
|
-
out_channels=3,
|
91
|
-
img_size=(128, 128, 128),
|
92
|
-
feature_size=24,
|
93
|
-
norm_name="instance",
|
94
|
-
attn_drop_rate=4,
|
95
|
-
)
|
87
|
+
SwinUNETR(spatial_dims=1, in_channels=1, out_channels=2, feature_size=48, norm_name="instance")
|
96
88
|
|
97
89
|
with self.assertRaises(ValueError):
|
98
|
-
SwinUNETR(in_channels=1, out_channels=
|
90
|
+
SwinUNETR(in_channels=1, out_channels=4, feature_size=50, norm_name="instance")
|
99
91
|
|
100
92
|
with self.assertRaises(ValueError):
|
101
|
-
SwinUNETR(in_channels=1, out_channels=
|
102
|
-
|
103
|
-
with self.assertRaises(ValueError):
|
104
|
-
SwinUNETR(
|
105
|
-
in_channels=1,
|
106
|
-
out_channels=3,
|
107
|
-
img_size=(85, 85, 85),
|
108
|
-
feature_size=24,
|
109
|
-
norm_name="instance",
|
110
|
-
drop_rate=0.4,
|
111
|
-
)
|
93
|
+
SwinUNETR(in_channels=1, out_channels=3, feature_size=24, norm_name="instance", drop_rate=-1)
|
112
94
|
|
113
95
|
def test_patch_merging(self):
|
114
96
|
dim = 10
|
File without changes
|
File without changes
|