Skip to content

Commit 82f52c5

Browse files
authored
Merge branch 'Project-MONAI:dev' into feature/issue-7334
2 parents d81616b + 401ea4a commit 82f52c5

File tree

140 files changed

+2259
-1759
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+2259
-1759
lines changed

.github/workflows/pythonapp-min.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ jobs:
124124
strategy:
125125
fail-fast: false
126126
matrix:
127-
pytorch-version: ['2.4.1', '2.5.1', '2.6.0', '2.7.1']
127+
pytorch-version: ['2.5.1', '2.6.0', '2.7.1', '2.8.0']
128128
timeout-minutes: 40
129129
steps:
130130
- uses: actions/checkout@v4

.github/workflows/pythonapp.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
- if: runner.os == 'windows'
9595
name: Install torch cpu from pytorch.org (Windows only)
9696
run: |
97-
python -m pip install torch==2.4.1 torchvision==0.19.1+cpu --index-url https://download.pytorch.org/whl/cpu
97+
python -m pip install torch==2.5.1 torchvision==0.20.1+cpu --index-url https://download.pytorch.org/whl/cpu
9898
- if: runner.os == 'Linux'
9999
name: Install itk pre-release (Linux only)
100100
run: |
@@ -103,7 +103,7 @@ jobs:
103103
- name: Install the dependencies
104104
run: |
105105
python -m pip install --user --upgrade pip wheel
106-
python -m pip install torch==2.4.1 torchvision==0.19.1
106+
python -m pip install torch==2.5.1 torchvision==0.20.1
107107
cat "requirements-dev.txt"
108108
python -m pip install -r requirements-dev.txt
109109
python -m pip list
@@ -155,7 +155,7 @@ jobs:
155155
# install the latest pytorch for testing
156156
# however, "pip install monai*.tar.gz" will build cpp/cuda with an isolated
157157
# fresh torch installation according to pyproject.toml
158-
python -m pip install torch>=2.4.1 torchvision
158+
python -m pip install torch>=2.5.1 torchvision
159159
- name: Check packages
160160
run: |
161161
pip uninstall monai

CONTRIBUTING.md

Lines changed: 47 additions & 20 deletions
Large diffs are not rendered by default.

SECURITY.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Security Policy
2+
3+
## Reporting a Vulnerability
4+
MONAI takes security seriously and appreciate your efforts to responsibly disclose vulnerabilities. If you discover a security issue, please report it as soon as possible.
5+
6+
To report a security issue:
7+
* please use the GitHub Security Advisories tab to "[Open a draft security advisory](https://github.com/Project-MONAI/MONAI/security/advisories/new)".
8+
* Include a detailed description of the issue, steps to reproduce, potential impact, and any possible mitigations.
9+
* If applicable, please also attach proof-of-concept code or screenshots.
10+
* We aim to acknowledge your report within 72 hours and provide a status update as we investigate.
11+
* Please do not create public issues for security-related reports.
12+
13+
## Disclosure Policy
14+
* We follow a coordinated disclosure approach.
15+
* We will not publicly disclose vulnerabilities until a fix has been developed and released.
16+
* Credit will be given to researchers who responsibly disclose vulnerabilities, if requested.
17+
## Acknowledgements
18+
We greatly appreciate contributions from the security community and strive to recognize all researchers who help keep MONAI safe.

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ onnx>=1.13.0
4040
onnxruntime; python_version <= '3.10'
4141
zarr
4242
huggingface_hub
43-
pyamg>=5.0.0
43+
pyamg>=5.0.0, <5.3.0
4444
packaging
4545
polygraphy

monai/apps/auto3dseg/auto_runner.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,15 @@ class AutoRunner:
194194
├── segresnet2d_0 # network scripts/configs/checkpoints and pickle object of the algo
195195
└── swinunetr_0 # network scripts/configs/checkpoints and pickle object of the algo
196196
197+
198+
The input config requires at least the following keys:
199+
- ``modality``: the modality of the data, e.g. "ct", "mri", etc.
200+
- ``datalist``: the path to the datalist file in JSON format.
201+
- ``dataroot``: the root directory of the data files.
202+
203+
For the datalist file format, see the description under :py:func:`monai.data.load_decathlon_datalist`.
204+
Note that the AutoRunner will use the "validation" key in the datalist file if it exists, otherwise
205+
it will do cross-validation, by default with five folds (this is hardcoded).
197206
"""
198207

199208
analyze_params: dict | None

monai/apps/detection/metrics/coco.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def _compute_statistics(self, results_list: list[dict[int, dict[str, np.ndarray]
457457
dt_ignores = np.concatenate([r["dtIgnore"][:, 0:max_det] for r in results], axis=1)[:, inds]
458458
self.check_number_of_iou(dt_matches, dt_ignores)
459459
gt_ignore = np.concatenate([r["gtIgnore"] for r in results])
460-
num_gt = np.count_nonzero(gt_ignore == 0) # number of ground truth boxes (non ignored)
460+
num_gt = int(np.count_nonzero(gt_ignore == 0)) # number of ground truth boxes (non ignored)
461461
if num_gt == 0:
462462
logger.warning(f"WARNING, no gt found for coco metric for class {cls_i}")
463463
continue
@@ -523,13 +523,12 @@ def _compute_stats_single_threshold(
523523
recall = 0
524524

525525
# array where precision values nearest to given recall th are saved
526-
precision = np.zeros((num_recall_th,))
526+
precision = [0.0] * num_recall_th
527527
# save scores for corresponding recall value in here
528528
th_scores = np.zeros((num_recall_th,))
529529
# numpy is slow without cython optimization for accessing elements
530530
# use python array gets significant speed improvement
531531
pr = pr.tolist()
532-
precision = precision.tolist()
533532

534533
# smooth precision curve (create box shape)
535534
for i in range(len(tp) - 1, 0, -1):

monai/apps/detection/networks/retinanet_detector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def set_atss_matcher(self, num_candidates: int = 4, center_in_gt: bool = False)
357357
num_candidates: number of positions to select candidates from.
358358
Smaller value will result in a higher matcher threshold and less matched candidates.
359359
center_in_gt: If False (default), matched anchor center points do not need
360-
to lie withing the ground truth box. Recommend False for small objects.
360+
to lie within the ground truth box. Recommend False for small objects.
361361
If True, will result in a strict matcher and less matched candidates.
362362
"""
363363
self.proposal_matcher = ATSSMatcher(num_candidates, self.box_overlap_metric, center_in_gt, debug=self.debug)
@@ -611,7 +611,7 @@ def _reshape_maps(self, result_maps: list[Tensor]) -> Tensor:
611611
elif self.spatial_dims == 3:
612612
reshaped_result_map = reshaped_result_map.permute(0, 3, 4, 5, 1, 2)
613613
else:
614-
ValueError("Images can only be 2D or 3D.")
614+
raise ValueError("Images can only be 2D or 3D.")
615615

616616
# reshaped_result_map will become (B, HWA, num_channel) or (B, HWDA, num_channel)
617617
reshaped_result_map = reshaped_result_map.reshape(batch_size, -1, num_channel)

monai/apps/detection/utils/box_coder.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,10 @@ def decode_single(self, rel_codes: Tensor, reference_boxes: Tensor) -> Tensor:
210210
offset = reference_boxes.shape[-1]
211211

212212
pred_boxes = []
213-
boxes_cccwhd = convert_box_mode(reference_boxes, src_mode=StandardMode, dst_mode=CenterSizeMode)
213+
boxes_cccwhd: torch.Tensor = convert_box_mode(
214+
reference_boxes, src_mode=StandardMode, dst_mode=CenterSizeMode
215+
) # type: ignore[assignment]
216+
214217
for axis in range(self.spatial_dims):
215218
whd_axis = boxes_cccwhd[:, axis + self.spatial_dims]
216219
ctr_xyz_axis = boxes_cccwhd[:, axis]

monai/apps/generation/maisi/networks/diffusion_model_unet_maisi.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,9 @@ def _apply_down_blocks(self, h, emb, context, down_block_additional_residuals):
358358

359359
def _apply_up_blocks(self, h, emb, context, down_block_res_samples):
360360
for upsample_block in self.up_blocks:
361-
res_samples = down_block_res_samples[-len(upsample_block.resnets) :]
362-
down_block_res_samples = down_block_res_samples[: -len(upsample_block.resnets)]
361+
idx: int = -len(upsample_block.resnets) # type: ignore
362+
res_samples = down_block_res_samples[idx:]
363+
down_block_res_samples = down_block_res_samples[:idx]
363364
h = upsample_block(hidden_states=h, res_hidden_states_list=res_samples, temb=emb, context=context)
364365

365366
return h

0 commit comments

Comments
 (0)