monai-weekly 1.4.dev2430__py3-none-any.whl → 1.4.dev2431__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/bundle/config_parser.py +2 -2
- monai/bundle/reference_resolver.py +18 -1
- monai/bundle/scripts.py +16 -5
- monai/bundle/utils.py +3 -1
- monai/networks/nets/spade_autoencoderkl.py +2 -2
- monai/transforms/post/array.py +2 -1
- {monai_weekly-1.4.dev2430.dist-info → monai_weekly-1.4.dev2431.dist-info}/METADATA +1 -1
- {monai_weekly-1.4.dev2430.dist-info → monai_weekly-1.4.dev2431.dist-info}/RECORD +13 -13
- {monai_weekly-1.4.dev2430.dist-info → monai_weekly-1.4.dev2431.dist-info}/WHEEL +1 -1
- {monai_weekly-1.4.dev2430.dist-info → monai_weekly-1.4.dev2431.dist-info}/LICENSE +0 -0
- {monai_weekly-1.4.dev2430.dist-info → monai_weekly-1.4.dev2431.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": "2024-
|
11
|
+
"date": "2024-08-04T02:19:41+0000",
|
12
12
|
"dirty": false,
|
13
13
|
"error": null,
|
14
|
-
"full-revisionid": "
|
15
|
-
"version": "1.4.
|
14
|
+
"full-revisionid": "951a77d7a7737a3108afa94623a50b87d21eb4a7",
|
15
|
+
"version": "1.4.dev2431"
|
16
16
|
}
|
17
17
|
''' # END VERSION_JSON
|
18
18
|
|
monai/bundle/config_parser.py
CHANGED
@@ -118,7 +118,7 @@ class ConfigParser:
|
|
118
118
|
self.ref_resolver = ReferenceResolver()
|
119
119
|
if config is None:
|
120
120
|
config = {self.meta_key: {}}
|
121
|
-
self.set(config=config)
|
121
|
+
self.set(config=self.ref_resolver.normalize_meta_id(config))
|
122
122
|
|
123
123
|
def __repr__(self):
|
124
124
|
return f"{self.config}"
|
@@ -221,7 +221,7 @@ class ConfigParser:
|
|
221
221
|
if isinstance(conf_, dict) and k not in conf_:
|
222
222
|
conf_[k] = {}
|
223
223
|
conf_ = conf_[k if isinstance(conf_, dict) else int(k)]
|
224
|
-
self[ReferenceResolver.normalize_id(id)] = config
|
224
|
+
self[ReferenceResolver.normalize_id(id)] = self.ref_resolver.normalize_meta_id(config)
|
225
225
|
|
226
226
|
def update(self, pairs: dict[str, Any]) -> None:
|
227
227
|
"""
|
@@ -17,7 +17,7 @@ from collections.abc import Sequence
|
|
17
17
|
from typing import Any, Iterator
|
18
18
|
|
19
19
|
from monai.bundle.config_item import ConfigComponent, ConfigExpression, ConfigItem
|
20
|
-
from monai.bundle.utils import ID_REF_KEY, ID_SEP_KEY
|
20
|
+
from monai.bundle.utils import DEPRECATED_ID_MAPPING, ID_REF_KEY, ID_SEP_KEY
|
21
21
|
from monai.utils import allow_missing_reference, look_up_option
|
22
22
|
|
23
23
|
__all__ = ["ReferenceResolver"]
|
@@ -202,6 +202,23 @@ class ReferenceResolver:
|
|
202
202
|
"""
|
203
203
|
return str(id).replace("#", cls.sep) # backward compatibility `#` is the old separator
|
204
204
|
|
205
|
+
def normalize_meta_id(self, config: Any) -> Any:
|
206
|
+
"""
|
207
|
+
Update deprecated identifiers in `config` using `DEPRECATED_ID_MAPPING`.
|
208
|
+
This will replace names that are marked as deprecated with their replacement.
|
209
|
+
|
210
|
+
Args:
|
211
|
+
config: input config to be updated.
|
212
|
+
"""
|
213
|
+
if isinstance(config, dict):
|
214
|
+
for _id, _new_id in DEPRECATED_ID_MAPPING.items():
|
215
|
+
if _id in config.keys():
|
216
|
+
warnings.warn(
|
217
|
+
f"Detected deprecated name '{_id}' in configuration file, replacing with '{_new_id}'."
|
218
|
+
)
|
219
|
+
config[_new_id] = config.pop(_id)
|
220
|
+
return config
|
221
|
+
|
205
222
|
@classmethod
|
206
223
|
def split_id(cls, id: str | int, last: bool = False) -> list[str]:
|
207
224
|
"""
|
monai/bundle/scripts.py
CHANGED
@@ -217,10 +217,15 @@ def _remove_ngc_prefix(name: str, prefix: str = "monai_") -> str:
|
|
217
217
|
|
218
218
|
|
219
219
|
def _download_from_ngc(
|
220
|
-
download_path: Path,
|
220
|
+
download_path: Path,
|
221
|
+
filename: str,
|
222
|
+
version: str,
|
223
|
+
prefix: str = "monai_",
|
224
|
+
remove_prefix: str | None = "monai_",
|
225
|
+
progress: bool = True,
|
221
226
|
) -> None:
|
222
227
|
# ensure prefix is contained
|
223
|
-
filename = _add_ngc_prefix(filename)
|
228
|
+
filename = _add_ngc_prefix(filename, prefix=prefix)
|
224
229
|
url = _get_ngc_bundle_url(model_name=filename, version=version)
|
225
230
|
filepath = download_path / f"{filename}_v{version}.zip"
|
226
231
|
if remove_prefix:
|
@@ -231,10 +236,16 @@ def _download_from_ngc(
|
|
231
236
|
|
232
237
|
|
233
238
|
def _download_from_ngc_private(
|
234
|
-
download_path: Path,
|
239
|
+
download_path: Path,
|
240
|
+
filename: str,
|
241
|
+
version: str,
|
242
|
+
repo: str,
|
243
|
+
prefix: str = "monai_",
|
244
|
+
remove_prefix: str | None = "monai_",
|
245
|
+
headers: dict | None = None,
|
235
246
|
) -> None:
|
236
247
|
# ensure prefix is contained
|
237
|
-
filename = _add_ngc_prefix(filename)
|
248
|
+
filename = _add_ngc_prefix(filename, prefix=prefix)
|
238
249
|
request_url = _get_ngc_private_bundle_url(model_name=filename, version=version, repo=repo)
|
239
250
|
if has_requests:
|
240
251
|
headers = {} if headers is None else headers
|
@@ -491,7 +502,7 @@ def download(
|
|
491
502
|
url: url to download the data. If not `None`, data will be downloaded directly
|
492
503
|
and `source` will not be checked.
|
493
504
|
If `name` is `None`, filename is determined by `monai.apps.utils._basename(url)`.
|
494
|
-
remove_prefix: This argument is used when `source` is "ngc". Currently, all ngc bundles
|
505
|
+
remove_prefix: This argument is used when `source` is "ngc" or "ngc_private". Currently, all ngc bundles
|
495
506
|
have the ``monai_`` prefix, which is not existing in their model zoo contrasts. In order to
|
496
507
|
maintain the consistency between these two sources, remove prefix is necessary.
|
497
508
|
Therefore, if specified, downloaded folder name will remove the prefix.
|
monai/bundle/utils.py
CHANGED
@@ -36,7 +36,7 @@ DEFAULT_METADATA = {
|
|
36
36
|
"monai_version": _conf_values["MONAI"],
|
37
37
|
"pytorch_version": str(_conf_values["Pytorch"]).split("+")[0].split("a")[0], # 1.9.0a0+df837d0 or 1.13.0+cu117
|
38
38
|
"numpy_version": _conf_values["Numpy"],
|
39
|
-
"
|
39
|
+
"required_packages_version": {},
|
40
40
|
"task": "Describe what the network predicts",
|
41
41
|
"description": "A longer description of what the network does, use context, inputs, outputs, etc.",
|
42
42
|
"authors": "Your Name Here",
|
@@ -157,6 +157,8 @@ DEFAULT_MLFLOW_SETTINGS = {
|
|
157
157
|
|
158
158
|
DEFAULT_EXP_MGMT_SETTINGS = {"mlflow": DEFAULT_MLFLOW_SETTINGS} # default experiment management settings
|
159
159
|
|
160
|
+
DEPRECATED_ID_MAPPING = {"optional_packages_version": "required_packages_version"}
|
161
|
+
|
160
162
|
|
161
163
|
def load_bundle_config(bundle_path: str, *config_names: str, **load_kw_args: Any) -> Any:
|
162
164
|
"""
|
@@ -59,7 +59,7 @@ class SPADEResBlock(nn.Module):
|
|
59
59
|
label_nc=label_nc,
|
60
60
|
norm_nc=in_channels,
|
61
61
|
norm="GROUP",
|
62
|
-
norm_params={"num_groups": norm_num_groups, "affine": False},
|
62
|
+
norm_params={"num_groups": norm_num_groups, "affine": False, "eps": norm_eps},
|
63
63
|
hidden_channels=spade_intermediate_channels,
|
64
64
|
kernel_size=3,
|
65
65
|
spatial_dims=spatial_dims,
|
@@ -77,7 +77,7 @@ class SPADEResBlock(nn.Module):
|
|
77
77
|
label_nc=label_nc,
|
78
78
|
norm_nc=out_channels,
|
79
79
|
norm="GROUP",
|
80
|
-
norm_params={"num_groups": norm_num_groups, "affine": False},
|
80
|
+
norm_params={"num_groups": norm_num_groups, "affine": False, "eps": norm_eps},
|
81
81
|
hidden_channels=spade_intermediate_channels,
|
82
82
|
kernel_size=3,
|
83
83
|
spatial_dims=spatial_dims,
|
monai/transforms/post/array.py
CHANGED
@@ -211,7 +211,8 @@ class AsDiscrete(Transform):
|
|
211
211
|
raise ValueError("`to_onehot=True/False` is deprecated, please use `to_onehot=num_classes` instead.")
|
212
212
|
img = convert_to_tensor(img, track_meta=get_track_meta())
|
213
213
|
img_t, *_ = convert_data_type(img, torch.Tensor)
|
214
|
-
|
214
|
+
argmax = self.argmax if argmax is None else argmax
|
215
|
+
if argmax:
|
215
216
|
img_t = torch.argmax(img_t, dim=self.kwargs.get("dim", 0), keepdim=self.kwargs.get("keepdim", True))
|
216
217
|
|
217
218
|
to_onehot = self.to_onehot if to_onehot is None else to_onehot
|
@@ -1,5 +1,5 @@
|
|
1
|
-
monai/__init__.py,sha256=
|
2
|
-
monai/_version.py,sha256=
|
1
|
+
monai/__init__.py,sha256=dXBm2eh5DsP3pasuxDuHHGRAwh3K_BrVq4EybgqpOQg,2722
|
2
|
+
monai/_version.py,sha256=fHOVhDg9cUEScqRJF52042X5Hjis0bgHRM4yagWLeUg,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
|
@@ -109,11 +109,11 @@ monai/auto3dseg/utils.py,sha256=zEicEO_--6-1kzT5HlmhAAd575gnl2AFmW8O3FnIznE,1867
|
|
109
109
|
monai/bundle/__init__.py,sha256=xvYgiAzq9fiyMkCRo0vwn41ZSzj0udyvF0jmySnqBRI,1443
|
110
110
|
monai/bundle/__main__.py,sha256=RiAn6raPUvPMfXvd03irAhB3nkIAgG1lf8GE34PG4Js,952
|
111
111
|
monai/bundle/config_item.py,sha256=rMjXSGkjJZdi04BwSHwCcIwzIb_TflmC3xDhC3SVJRs,16151
|
112
|
-
monai/bundle/config_parser.py,sha256=
|
112
|
+
monai/bundle/config_parser.py,sha256=euPLLd9An2HYV7RoO-z0UDCbna-Gaq9tm_lIK3Ay1OM,22969
|
113
113
|
monai/bundle/properties.py,sha256=iN3K4FVmN9ny1Hw9p5j7_ULcCdSD8PmrR7qXxbNz49k,11582
|
114
|
-
monai/bundle/reference_resolver.py,sha256=
|
115
|
-
monai/bundle/scripts.py,sha256=
|
116
|
-
monai/bundle/utils.py,sha256=
|
114
|
+
monai/bundle/reference_resolver.py,sha256=aBw3ML7B_YsiFUNl_mcRYPry1UbrEIK0R39A0zFw8kI,16463
|
115
|
+
monai/bundle/scripts.py,sha256=itzeju2vTSaof1UomzXmIVJHt7NnHjeKXO9KOnfASmk,88789
|
116
|
+
monai/bundle/utils.py,sha256=wzYtp2MuzKyq_zv-cwNqz_81BlDUTubqtyDAF8-bgOA,9034
|
117
117
|
monai/bundle/workflows.py,sha256=VMuBTkk6DGsnGRLFzNfVUzgy8UqUReluUlIPUaxODPQ,24765
|
118
118
|
monai/config/__init__.py,sha256=CN28CfTdsp301gv8YXfVvkbztCfbAqrLKrJi_C8oP9s,1048
|
119
119
|
monai/config/deviceconfig.py,sha256=3EU1Zi6yD_bxEAeHfzjbslEjq6vOvxNG6o9dxKUiEvc,10315
|
@@ -313,7 +313,7 @@ monai/networks/nets/resnet.py,sha256=oo1MCA9hccBVwDcMrZNpVmbDSRn3dOEkrn3DbKW2WZk
|
|
313
313
|
monai/networks/nets/segresnet.py,sha256=xNkSIvdk7kAyc3eVn-U_gGj8MoGVc5nklFKc_fkgOUs,13994
|
314
314
|
monai/networks/nets/segresnet_ds.py,sha256=01R-t-cIvAoVEsqTRPC2sHVYGyiVfcvy8hng53X-6yQ,15703
|
315
315
|
monai/networks/nets/senet.py,sha256=gulqPMYmSABbMbN39NElGzSU1TKGviJas7EPTBaZ60A,19289
|
316
|
-
monai/networks/nets/spade_autoencoderkl.py,sha256=
|
316
|
+
monai/networks/nets/spade_autoencoderkl.py,sha256=lu4uPsNWIXKhzaVQ4iplTQ9g3eeViIHMXLH0nOaNanc,18277
|
317
317
|
monai/networks/nets/spade_diffusion_model_unet.py,sha256=JQJRMX96jLHPPUmetpCpy5ZPm4qjoO-NoI4dfnWNaPI,36785
|
318
318
|
monai/networks/nets/spade_network.py,sha256=GguYucjIRyT_rZa9DrvUmv00FtqXHZtY1VfJM9Rygns,16479
|
319
319
|
monai/networks/nets/swin_unetr.py,sha256=H7cjCHZJmZoXDcVFYXJM5iPfQbHZGt1AES2-UoNsGo4,44849
|
@@ -368,7 +368,7 @@ monai/transforms/lazy/utils.py,sha256=dtLRJlIpp5Seh8hyb5fcN88-SH7Vsg5uLK1p3ftQdP
|
|
368
368
|
monai/transforms/meta_utility/__init__.py,sha256=s9djSd6kvViPnFvMR11Dgd30Lv4oY6FaPJr4ZZJZLq0,573
|
369
369
|
monai/transforms/meta_utility/dictionary.py,sha256=YqbYeZOi4cFEmEPmrw2VIpOIwre6wxYB2UGZSrf-MoM,4896
|
370
370
|
monai/transforms/post/__init__.py,sha256=s9djSd6kvViPnFvMR11Dgd30Lv4oY6FaPJr4ZZJZLq0,573
|
371
|
-
monai/transforms/post/array.py,sha256=
|
371
|
+
monai/transforms/post/array.py,sha256=06Dfd_6cf-VJneet7WwbxFFlJEhYh365xu3fkcvGTws,45042
|
372
372
|
monai/transforms/post/dictionary.py,sha256=pq4Oh3GoDcS6sjUkLvHzYmySxuxzVW7grjogFuRsUsA,43042
|
373
373
|
monai/transforms/regularization/__init__.py,sha256=s9djSd6kvViPnFvMR11Dgd30Lv4oY6FaPJr4ZZJZLq0,573
|
374
374
|
monai/transforms/regularization/array.py,sha256=yJbvs0-ElS7uK8jEZzYOL-nW2wizXvwni77s1pR7qvk,8036
|
@@ -409,8 +409,8 @@ monai/visualize/img2tensorboard.py,sha256=NnMcyfIFqX-jD7TBO3Rn02zt5uug79d_7pIIaV
|
|
409
409
|
monai/visualize/occlusion_sensitivity.py,sha256=OQHEJLyIhB8zWqQsfKaX-1kvCjWFVYtLfS4dFC0nKFI,18160
|
410
410
|
monai/visualize/utils.py,sha256=B-MhTVs7sQbIqYS3yPnpBwPw2K82rE2PBtGIfpwZtWM,9894
|
411
411
|
monai/visualize/visualizer.py,sha256=qckyaMZCbezYUwE20k5yc-Pb7UozVavMDbrmyQwfYHY,1377
|
412
|
-
monai_weekly-1.4.
|
413
|
-
monai_weekly-1.4.
|
414
|
-
monai_weekly-1.4.
|
415
|
-
monai_weekly-1.4.
|
416
|
-
monai_weekly-1.4.
|
412
|
+
monai_weekly-1.4.dev2431.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
413
|
+
monai_weekly-1.4.dev2431.dist-info/METADATA,sha256=RQqh6NocBMeoO3k6i4D9NlwSrif431KY-e92S9I174k,10953
|
414
|
+
monai_weekly-1.4.dev2431.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
415
|
+
monai_weekly-1.4.dev2431.dist-info/top_level.txt,sha256=UaNwRzLGORdus41Ip446s3bBfViLkdkDsXDo34J2P44,6
|
416
|
+
monai_weekly-1.4.dev2431.dist-info/RECORD,,
|
File without changes
|
File without changes
|