Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion monai/losses/image_dissimilarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def __init__(
"""
super().__init__(reduction=LossReduction(reduction).value)
if num_bins <= 0:
raise ValueError("num_bins must > 0, got {num_bins}")
raise ValueError(f"num_bins must > 0, got {num_bins}")
bin_centers = torch.linspace(0.0, 1.0, num_bins) # (num_bins,)
sigma = torch.mean(bin_centers[1:] - bin_centers[:-1]) * sigma_ratio
self.kernel_type = look_up_option(kernel_type, ["gaussian", "b-spline"])
Expand Down
2 changes: 1 addition & 1 deletion monai/losses/nacl_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __init__(

def get_constr_target(self, mask: torch.Tensor) -> torch.Tensor:
"""
Converts the mask to one hot represenation and is smoothened with the selected spatial filter.
Converts the mask to one hot representation and is smoothened with the selected spatial filter.

Args:
mask: the shape should be BH[WD].
Expand Down
6 changes: 3 additions & 3 deletions monai/losses/unified_focal_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(
to_onehot_y: whether to convert `y` into the one-hot format. Defaults to False.
delta : weight of the background. Defaults to 0.7.
gamma : value of the exponent gamma in the definition of the Focal loss . Defaults to 0.75.
epsilon : it defines a very small number each time. simmily smooth value. Defaults to 1e-7.
epsilon : it defines a very small number each time. similarly smooth value. Defaults to 1e-7.
"""
super().__init__(reduction=LossReduction(reduction).value)
self.to_onehot_y = to_onehot_y
Expand Down Expand Up @@ -109,7 +109,7 @@ def __init__(
to_onehot_y : whether to convert `y` into the one-hot format. Defaults to False.
delta : weight of the background. Defaults to 0.7.
gamma : value of the exponent gamma in the definition of the Focal loss . Defaults to 0.75.
epsilon : it defines a very small number each time. simmily smooth value. Defaults to 1e-7.
epsilon : it defines a very small number each time. similarly smooth value. Defaults to 1e-7.
"""
super().__init__(reduction=LossReduction(reduction).value)
self.to_onehot_y = to_onehot_y
Expand Down Expand Up @@ -169,7 +169,7 @@ def __init__(
num_classes : number of classes, it only supports 2 now. Defaults to 2.
delta : weight of the background. Defaults to 0.7.
gamma : value of the exponent gamma in the definition of the Focal loss. Defaults to 0.75.
epsilon : it defines a very small number each time. simmily smooth value. Defaults to 1e-7.
epsilon : it defines a very small number each time. similarly smooth value. Defaults to 1e-7.
weight : weight for each loss function, if it's none it's 0.5. Defaults to None.

Example:
Expand Down
2 changes: 1 addition & 1 deletion monai/networks/blocks/downsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class SubpixelDownsample(nn.Module):
Example: (1, 1, 4, 4) with r=2 becomes (1, 4, 2, 2).

See: Shi et al., 2016, "Real-Time Single Image and Video Super-Resolution
Using a nEfficient Sub-Pixel Convolutional Neural Network."
Using an Efficient Sub-Pixel Convolutional Neural Network."

The pixel unshuffle mechanism is the inverse operation of:
https://github.com/Project-MONAI/MONAI/blob/dev/monai/networks/blocks/upsample.py
Expand Down
2 changes: 1 addition & 1 deletion monai/networks/blocks/upsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class SubpixelUpsample(nn.Module):
default single layer.

See: Shi et al., 2016, "Real-Time Single Image and Video Super-Resolution
Using a nEfficient Sub-Pixel Convolutional Neural Network."
Using an Efficient Sub-Pixel Convolutional Neural Network."

See: Aitken et al., 2017, "Checkerboard artifact free sub-pixel convolution".

Expand Down
6 changes: 3 additions & 3 deletions monai/networks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def pixelshuffle(x: torch.Tensor, spatial_dims: int, scale_factor: int) -> torch
Apply pixel shuffle to the tensor `x` with spatial dimensions `spatial_dims` and scaling factor `scale_factor`.

See: Shi et al., 2016, "Real-Time Single Image and Video Super-Resolution
Using a nEfficient Sub-Pixel Convolutional Neural Network."
Using an Efficient Sub-Pixel Convolutional Neural Network."

See: Aitken et al., 2017, "Checkerboard artifact free sub-pixel convolution".

Expand Down Expand Up @@ -1183,7 +1183,7 @@ def replace_modules_temp(

def freeze_layers(model: nn.Module, freeze_vars=None, exclude_vars=None):
"""
A utilty function to help freeze specific layers.
A utility function to help freeze specific layers.

Args:
model: a source PyTorch model to freeze layer.
Expand Down Expand Up @@ -1272,7 +1272,7 @@ def cast_all(x, from_dtype=torch.float16, to_dtype=torch.float32):
class CastToFloat(torch.nn.Module):
"""
Class used to add autocast protection for ONNX export
for forward methods with single return vaue
for forward methods with single return value
"""

def __init__(self, mod):
Expand Down
Loading