MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / SegResNet

Class SegResNet

monai/networks/nets/segresnet.py:29–184  ·  view source on GitHub ↗

SegResNet based on `3D MRI brain tumor segmentation using autoencoder regularization `_. The module does not include the variational autoencoder (VAE). The model supports 2D or 3D inputs. Args: spatial_dims: spatial dimension of the

Source from the content-addressed store, hash-verified

27
28
29class SegResNet(nn.Module):
30 """
31 SegResNet based on `3D MRI brain tumor segmentation using autoencoder regularization
32 <https://arxiv.org/pdf/1810.11654.pdf>`_.
33 The module does not include the variational autoencoder (VAE).
34 The model supports 2D or 3D inputs.
35
36 Args:
37 spatial_dims: spatial dimension of the input data. Defaults to 3.
38 init_filters: number of output channels for initial convolution layer. Defaults to 8.
39 in_channels: number of input channels for the network. Defaults to 1.
40 out_channels: number of output channels for the network. Defaults to 2.
41 dropout_prob: probability of an element to be zero-ed. Defaults to ``None``.
42 act: activation type and arguments. Defaults to ``RELU``.
43 norm: feature normalization type and arguments. Defaults to ``GROUP``.
44 norm_name: deprecating option for feature normalization type.
45 num_groups: deprecating option for group norm. parameters.
46 use_conv_final: if add a final convolution block to output. Defaults to ``True``.
47 blocks_down: number of down sample blocks in each layer. Defaults to ``[1,2,2,4]``.
48 blocks_up: number of up sample blocks in each layer. Defaults to ``[1,1,1]``.
49 upsample_mode: [``"deconv"``, ``"nontrainable"``, ``"pixelshuffle"``]
50 The mode of upsampling manipulations.
51 Using the ``nontrainable`` modes cannot guarantee the model&#x27;s reproducibility. Defaults to``nontrainable``.
52
53 - ``deconv``, uses transposed convolution layers.
54 - ``nontrainable``, uses non-trainable `linear` interpolation.
55 - ``pixelshuffle``, uses :py:class:`monai.networks.blocks.SubpixelUpsample`.
56
57 """
58
59 def __init__(
60 self,
61 spatial_dims: int = 3,
62 init_filters: int = 8,
63 in_channels: int = 1,
64 out_channels: int = 2,
65 dropout_prob: float | None = None,
66 act: tuple | str = ("RELU", {"inplace": True}),
67 norm: tuple | str = ("GROUP", {"num_groups": 8}),
68 norm_name: str = "",
69 num_groups: int = 8,
70 use_conv_final: bool = True,
71 blocks_down: tuple = (1, 2, 2, 4),
72 blocks_up: tuple = (1, 1, 1),
73 upsample_mode: UpsampleMode | str = UpsampleMode.NONTRAINABLE,
74 ):
75 super().__init__()
76
77 if spatial_dims not in (2, 3):
78 raise ValueError("`spatial_dims` can only be 2 or 3.")
79
80 self.spatial_dims = spatial_dims
81 self.init_filters = init_filters
82 self.in_channels = in_channels
83 self.blocks_down = blocks_down
84 self.blocks_up = blocks_up
85 self.dropout_prob = dropout_prob
86 self.act = act # input options

Callers 4

test_seg_res_netMethod · 0.90
test_shapeMethod · 0.90
test_ill_argMethod · 0.90
test_scriptMethod · 0.90

Calls

no outgoing calls

Tested by 4

test_seg_res_netMethod · 0.72
test_shapeMethod · 0.72
test_ill_argMethod · 0.72
test_scriptMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…