Skip to content

Commit

Permalink
set dtype in proper place to make use of blown up value range (and wi…
Browse files Browse the repository at this point in the history
…th is precision) in Gaussian
  • Loading branch information
FabianIsensee committed Oct 27, 2023
1 parent d78f17f commit af9ba85
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nnunetv2/inference/sliding_window_prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ def compute_gaussian(tile_size: Union[Tuple[int, ...], List[int]], sigma_scale:
tmp[tuple(center_coords)] = 1
gaussian_importance_map = gaussian_filter(tmp, sigmas, 0, mode='constant', cval=0)

gaussian_importance_map = torch.from_numpy(gaussian_importance_map).type(dtype).to(device)
gaussian_importance_map = torch.from_numpy(gaussian_importance_map)

gaussian_importance_map = gaussian_importance_map / torch.max(gaussian_importance_map) * value_scaling_factor
gaussian_importance_map = gaussian_importance_map.type(dtype)
gaussian_importance_map = gaussian_importance_map.type(dtype).to(device)

# gaussian_importance_map cannot be 0, otherwise we may end up with nans!
gaussian_importance_map[gaussian_importance_map == 0] = torch.min(
Expand Down

0 comments on commit af9ba85

Please sign in to comment.