UNet backbone. This backbone is the implementation of `U-Net: Convolutional Networks for Biomedical Image Segmentation `_. Args: in_channels (int): Number of input image channels. Default" 3. base_channels (int): Number of base channels
| 223 | |
| 224 | @BACKBONES.register_module() |
| 225 | class UNet(BaseModule): |
| 226 | """UNet backbone. |
| 227 | |
| 228 | This backbone is the implementation of `U-Net: Convolutional Networks |
| 229 | for Biomedical Image Segmentation <https://arxiv.org/abs/1505.04597>`_. |
| 230 | |
| 231 | Args: |
| 232 | in_channels (int): Number of input image channels. Default" 3. |
| 233 | base_channels (int): Number of base channels of each stage. |
| 234 | The output channels of the first stage. Default: 64. |
| 235 | num_stages (int): Number of stages in encoder, normally 5. Default: 5. |
| 236 | strides (Sequence[int 1 | 2]): Strides of each stage in encoder. |
| 237 | len(strides) is equal to num_stages. Normally the stride of the |
| 238 | first stage in encoder is 1. If strides[i]=2, it uses stride |
| 239 | convolution to downsample in the correspondence encoder stage. |
| 240 | Default: (1, 1, 1, 1, 1). |
| 241 | enc_num_convs (Sequence[int]): Number of convolutional layers in the |
| 242 | convolution block of the correspondence encoder stage. |
| 243 | Default: (2, 2, 2, 2, 2). |
| 244 | dec_num_convs (Sequence[int]): Number of convolutional layers in the |
| 245 | convolution block of the correspondence decoder stage. |
| 246 | Default: (2, 2, 2, 2). |
| 247 | downsamples (Sequence[int]): Whether use MaxPool to downsample the |
| 248 | feature map after the first stage of encoder |
| 249 | (stages: [1, num_stages)). If the correspondence encoder stage use |
| 250 | stride convolution (strides[i]=2), it will never use MaxPool to |
| 251 | downsample, even downsamples[i-1]=True. |
| 252 | Default: (True, True, True, True). |
| 253 | enc_dilations (Sequence[int]): Dilation rate of each stage in encoder. |
| 254 | Default: (1, 1, 1, 1, 1). |
| 255 | dec_dilations (Sequence[int]): Dilation rate of each stage in decoder. |
| 256 | Default: (1, 1, 1, 1). |
| 257 | with_cp (bool): Use checkpoint or not. Using checkpoint will save some |
| 258 | memory while slowing down the training speed. Default: False. |
| 259 | conv_cfg (dict | None): Config dict for convolution layer. |
| 260 | Default: None. |
| 261 | norm_cfg (dict | None): Config dict for normalization layer. |
| 262 | Default: dict(type='BN'). |
| 263 | act_cfg (dict | None): Config dict for activation layer in ConvModule. |
| 264 | Default: dict(type='ReLU'). |
| 265 | upsample_cfg (dict): The upsample config of the upsample module in |
| 266 | decoder. Default: dict(type='InterpConv'). |
| 267 | norm_eval (bool): Whether to set norm layers to eval mode, namely, |
| 268 | freeze running stats (mean and var). Note: Effect on Batch Norm |
| 269 | and its variants only. Default: False. |
| 270 | dcn (bool): Use deformable convolution in convolutional layer or not. |
| 271 | Default: None. |
| 272 | plugins (dict): plugins for convolutional layers. Default: None. |
| 273 | pretrained (str, optional): model pretrained path. Default: None |
| 274 | init_cfg (dict or list[dict], optional): Initialization config dict. |
| 275 | Default: None |
| 276 | |
| 277 | Notice: |
| 278 | The input image size should be divisible by the whole downsample rate |
| 279 | of the encoder. More detail of the whole downsample rate can be found |
| 280 | in UNet._check_input_divisible. |
| 281 | """ |
| 282 |
nothing calls this directly
no outgoing calls
no test coverage detected