Skip to content

Throw exception on invalid images in retinanet detector #8515

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

Merged
merged 2 commits into from
Jul 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions monai/apps/detection/networks/retinanet_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def set_atss_matcher(self, num_candidates: int = 4, center_in_gt: bool = False)
num_candidates: number of positions to select candidates from.
Smaller value will result in a higher matcher threshold and less matched candidates.
center_in_gt: If False (default), matched anchor center points do not need
to lie withing the ground truth box. Recommend False for small objects.
to lie within the ground truth box. Recommend False for small objects.
If True, will result in a strict matcher and less matched candidates.
"""
self.proposal_matcher = ATSSMatcher(num_candidates, self.box_overlap_metric, center_in_gt, debug=self.debug)
Expand Down Expand Up @@ -611,7 +611,7 @@ def _reshape_maps(self, result_maps: list[Tensor]) -> Tensor:
elif self.spatial_dims == 3:
reshaped_result_map = reshaped_result_map.permute(0, 3, 4, 5, 1, 2)
else:
ValueError("Images can only be 2D or 3D.")
raise ValueError("Images can only be 2D or 3D.")

# reshaped_result_map will become (B, HWA, num_channel) or (B, HWDA, num_channel)
reshaped_result_map = reshaped_result_map.reshape(batch_size, -1, num_channel)
Expand Down
Loading