Skip to content
Merged
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 docs/source/networks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Blocks
.. autoclass:: SEResNetBottleneck
:members:

`Squeeze-and-Excitation ResneXt Bottleneck`
`Squeeze-and-Excitation ResNeXt Bottleneck`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: SEResNeXtBottleneck
:members:
Expand Down
2 changes: 1 addition & 1 deletion monai/apps/pathology/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def _load_a_patch(self, index):
"""
Load sample given the index

Since index is sequential and the patches are comming in an stream from different images,
Since index is sequential and the patches are coming in an stream from different images,
this method, first, finds the whole slide image and the patch that should be extracted,
then it loads the patch and provide it with its image name and the corresponding mask location.
"""
Expand Down
2 changes: 1 addition & 1 deletion monai/csrc/filtering/bilateral/bilateralfilter_cuda_phl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void BilateralFilterPHLCuda(
cudaMalloc(&data, desc.batchCount * desc.channelStride * desc.channelCount * sizeof(scalar_t));
cudaMalloc(&features, desc.batchCount * desc.channelStride * featureChannelCount * sizeof(scalar_t));

// Prparing constant memory
// Preparing constant memory
cudaMemcpyToSymbol(cBatchStride, &desc.batchStride, sizeof(int));
cudaMemcpyToSymbol(cChannelStride, &desc.channelStride, sizeof(int));
cudaMemcpyToSymbol(cSpatialStrides, desc.strides, sizeof(int) * desc.dimensions);
Expand Down
2 changes: 1 addition & 1 deletion monai/csrc/filtering/permutohedral/hash_table.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.

//#define USE_ADDITIVE_HASH

// turn this on if you want to get slighly less memory consumption and slightly longer run times.
// turn this on if you want to get slightly less memory consumption and slightly longer run times.
//#define LINEAR_D_MEMORY

#define USE_CUSTOM_MODULO
Expand Down
24 changes: 12 additions & 12 deletions monai/networks/blocks/crf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class CRF(torch.nn.Module):
"""
Conditional Random Field: Combines message passing with a class
compatability convolution into an iterative process designed
compatibility convolution into an iterative process designed
to successively minimise the energy of the class labeling.

In this implementation, the message passing step is a weighted
Expand All @@ -40,7 +40,7 @@ def __init__(
bilateral_color_sigma: float = 0.5,
gaussian_spatial_sigma: float = 5.0,
update_factor: float = 3.0,
compatability_kernel_range: int = 1,
compatibility_kernel_range: int = 1,
iterations: int = 5,
):
"""
Expand All @@ -51,7 +51,7 @@ def __init__(
bilateral_color_sigma: standard deviation in color space for the bilateral term.
gaussian_spatial_sigma: standard deviation in spatial coordinates for the gaussian term.
update_factor: determines the magnitude of each update.
compatability_kernel_range: the range of the kernel used in the compatability convolution.
compatibility_kernel_range: the range of the kernel used in the compatibility convolution.
iterations: the number of iterations.
"""
super(CRF, self).__init__()
Expand All @@ -61,14 +61,14 @@ def __init__(
self.bilateral_color_sigma = bilateral_color_sigma
self.gaussian_spatial_sigma = gaussian_spatial_sigma
self.update_factor = update_factor
self.compatability_kernel_range = compatability_kernel_range
self.compatibility_kernel_range = compatibility_kernel_range
self.iterations = iterations

def forward(self, input_tensor: torch.Tensor, reference_tensor: torch.Tensor):
"""
Args:
input_tensor: tensor containing initial class logits.
referenece_tensor: the reference tensor used to guide the message passing.
reference_tensor: the reference tensor used to guide the message passing.

Returns:
output (torch.Tensor): output tensor.
Expand All @@ -77,7 +77,7 @@ def forward(self, input_tensor: torch.Tensor, reference_tensor: torch.Tensor):
# useful values
spatial_dim = input_tensor.dim() - 2
class_count = input_tensor.size(1)
padding = self.compatability_kernel_range
padding = self.compatibility_kernel_range

# constructing spatial feature tensor
spatial_features = _create_coordinate_tensor(reference_tensor)
Expand All @@ -88,18 +88,18 @@ def forward(self, input_tensor: torch.Tensor, reference_tensor: torch.Tensor):
)
gaussian_features = spatial_features / self.gaussian_spatial_sigma

# compatability matrix (potts model (1 - diag) for now)
compatability_matrix = _potts_model_weights(class_count).to(device=input_tensor.device)
# compatibility matrix (potts model (1 - diag) for now)
compatibility_matrix = _potts_model_weights(class_count).to(device=input_tensor.device)

# expanding matrix to kernel
compatability_kernel = _expand_matrix_to_kernel(
compatability_matrix, spatial_dim, self.compatability_kernel_range
compatibility_kernel = _expand_matrix_to_kernel(
compatibility_matrix, spatial_dim, self.compatibility_kernel_range
)

# choosing convolution function
conv = [conv1d, conv2d, conv3d][spatial_dim - 1]

# seting up output tensor
# setting up output tensor
output_tensor = softmax(input_tensor, dim=1)

# mean field loop
Expand All @@ -114,7 +114,7 @@ def forward(self, input_tensor: torch.Tensor, reference_tensor: torch.Tensor):

# compatibility convolution
combined_output = pad(combined_output, 2 * spatial_dim * [padding], mode="replicate")
compatibility_update = conv(combined_output, compatability_kernel)
compatibility_update = conv(combined_output, compatibility_kernel)

# update and normalize
output_tensor = softmax(input_tensor - self.update_factor * compatibility_update, dim=1)
Expand Down
2 changes: 1 addition & 1 deletion monai/networks/blocks/regunet_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def __init__(
spatial_dims: number of spatial dimensions
extract_levels: spatial levels to extract feature from, 0 refers to the input scale
num_channels: number of channels at each scale level,
List or Tuple of lenth equals to `depth` of the RegNet
List or Tuple of length equals to `depth` of the RegNet
out_channels: number of output channels
kernel_initializer: kernel initializer
activation: kernel activation function
Expand Down
4 changes: 2 additions & 2 deletions monai/networks/layers/filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class BilateralFilter(torch.autograd.Function):
input: input tensor.

spatial sigma: the standard deviation of the spatial blur. Higher values can
hurt performace when not using the approximate method (see fast approx).
hurt performance when not using the approximate method (see fast approx).

color sigma: the standard deviation of the color blur. Lower values preserve
edges better whilst higher values tend to a simple gaussian spatial blur.
Expand Down Expand Up @@ -95,7 +95,7 @@ def forward(ctx, input, features, sigmas=None):

@staticmethod
def backward(ctx, grad_output):
raise NotImplementedError("PHLFilter does not currently support backpropergation")
raise NotImplementedError("PHLFilter does not currently support Backpropagation")
# scaled_features, = ctx.saved_variables
# grad_input = _C.phl_filter(grad_output, scaled_features)
# return grad_input
2 changes: 1 addition & 1 deletion monai/transforms/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from monai.transforms.inverse import InvertibleTransform

# For backwards compatiblity (so this still works: from monai.transforms.compose import MapTransform)
# For backwards compatibility (so this still works: from monai.transforms.compose import MapTransform)
from monai.transforms.transform import ( # noqa: F401
MapTransform,
Randomizable,
Expand Down
6 changes: 3 additions & 3 deletions tests/test_crf_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
0.5, # bilateral_color_sigma
5.0, # gaussian_spatial_sigma
1.0, # update_factor
1, # compatability_kernel_range
1, # compatibility_kernel_range
5, # iterations
],
# Input
Expand Down Expand Up @@ -92,7 +92,7 @@
0.5, # bilateral_color_sigma
5.0, # gaussian_spatial_sigma
1.0, # update_factor
1, # compatability_kernel_range
1, # compatibility_kernel_range
5, # iterations
],
# Input
Expand Down Expand Up @@ -189,7 +189,7 @@
0.1, # bilateral_color_sigma
5.0, # gaussian_spatial_sigma
1.0, # update_factor
1, # compatability_kernel_range
1, # compatibility_kernel_range
2, # iterations
],
# Input
Expand Down
6 changes: 3 additions & 3 deletions tests/test_crf_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
0.5, # bilateral_color_sigma
5.0, # gaussian_spatial_sigma
1.0, # update_factor
1, # compatability_kernel_range
1, # compatibility_kernel_range
5, # iterations
],
# Input
Expand Down Expand Up @@ -92,7 +92,7 @@
0.5, # bilateral_color_sigma
5.0, # gaussian_spatial_sigma
1.0, # update_factor
1, # compatability_kernel_range
1, # compatibility_kernel_range
5, # iterations
],
# Input
Expand Down Expand Up @@ -189,7 +189,7 @@
0.1, # bilateral_color_sigma
5.0, # gaussian_spatial_sigma
1.0, # update_factor
1, # compatability_kernel_range
1, # compatibility_kernel_range
2, # iterations
],
# Input
Expand Down