RDResUNet#

RDNet derived from Kim et al., 2024. ResUNet derived from Zhang et al., 2017. ResUNet-a derived from Diakogiannis et al., 2020.

from pssr.models import RDResUNet
pssr.models.RDResUNet.__init__(self, channels: list[int] = 1, hidden: list[int] = [1024, 1024, 512, 256], scale: int = 4, depth: int = 3, dilations: list[list[int]] = None, pool_sizes: list[int] = None, encoder_pool: bool = False, rdnet_init: int = 128, growth_rates: list[int] = [64, 104, 128, 128, 128, 128, 224], ds_blocks: list[bool] = [False, True, True, False, False, False, True], ese_blocks: list[bool] = [False, False, True, True, True, True, True], n_blocks: list[int] = [3, 3, 3, 3, 3, 3, 3], patch_size: int = 2, bottleneck: int = 4, compression: float = 0.5, drop_rate: float = 0)#

A RDNet (Revitalized DenseNet) encoder and ResUNet decoder with an additional image upscaling block. RDNet is detailed in Kim et al., 2024. If dilations is provided, the decoder is instead a Atrous Residual UNet as detailed in Diakogiannis et al., 2019.

Skip connections from the RDNet encoder to the ResUNet decoder are created before each downsampling layer.

Channel sizes hidden[0] (and hidden[-1] if encoder_pool is True) must be divisible by pool_sizes if provided.

Parameters:
  • channels (list[int]) – Number of channels in image data. Can also be a list of in channels (low-resolution) and out channels (high-resolution) respectively.

  • hidden (list[int]) – Elementwise list of hidden layer channels of ResUNet decoder. Each element must have a corresponding skip connection in the RDNet encoder, provided after each downsample block.

  • scale (int) – Upscaling factor for predictions. Choose a power of 2 for best results. Default is 4.

  • depth (int) – Number of hidden layers per decoder residual block. Default is 3.

  • dilations (list[list[int]]) – List of dilation values per layer. If value is None, atrous convolutions will not be used. Default is None.

  • pool_sizes (list[int]) – Pooling ratios for PSP pooling. If value is None, PSP pooling will not be used. Default is None.

  • encoder_pool (bool) – Whether to include additional PSP pooling layer at end of encoder. Should not be used if last layer has a size of less than 16 pixels. Default is False.

  • rdnet_init (int) – Number of channels in first RDNet layer. Channels grow from this each layer according to growth parameters. Default is 128.

  • growth_rates (list[int]) – Growth rates for each RDNet layer, compounding over each layer.

  • ds_blocks (list[bool]) – Specifies which RDNet layers downsample image space. Number of downsampling blocks must be one less than ResUNet hidden layers.

  • ese_blocks (list[bool]) – Specifies which RDNet layers are ESE blocks.

  • n_blocks (list[int]) – Number of blocks per RDNet layer. Can also be an integer to be held constant across all layers. Default is 3.

  • patch_size (int) – Patch size for initial patch embedding. Default is 2.

  • bottleneck (int) – Bottleneck width ratio for all blocks. Default is 4.

  • compression (float) – Transition compression ratio to offset growth. Default is 0.5.

  • drop_rate (float) – Dropout rate for DropPath. Default is 0.


from pssr.models import RDResUNetA
pssr.models.RDResUNetA.__new__(cls, channels: int = 1, hidden: list[int] = [1024, 1024, 512, 256], scale: int = 4, depth: int = 3, dilations: list[list[int]] = [[1], [1], [1, 3], [1, 3, 15]], pool_sizes: list[int] = [1, 2, 4, 8], encoder_pool: bool = False, rdnet_init: int = 128, growth_rates: list[int] = [64, 104, 128, 128, 128, 128, 224], ds_blocks: list[bool] = [False, True, True, False, False, False, True], ese_blocks: list[bool] = [False, False, True, True, True, True, True], n_blocks: list[int] = [3, 3, 3, 3, 3, 3, 3], patch_size: int = 2, bottleneck: int = 4, compression: float = 0.5, drop_rate: float = 0)#

RDResUNet wrapper of Atrous Residual UNet as detailed in Diakogiannis et al., 2019. Provides alternative default arguments for an atrous network.

Skip connections from the RDNet encoder to the ResUNet decoder are created before each downsampling layer.

Channel sizes hidden[0] (and hidden[-1] if encoder_pool is True) must be divisible by pool_sizes if provided.

Parameters:
  • channels (int) – Number of channels in image data. Can also be a list of in channels and out channels respectively.

  • hidden (list[int]) – Elementwise list of hidden layer channels of ResUNet decoder. Each element must have a corresponding skip connection in the RDNet encoder, provided after each downsample block.

  • scale (int) – Upscaling factor for predictions. Choose a power of 2 for best results. Default is 4.

  • depth (int) – Number of hidden layers per decoder residual block. Default is 3.

  • dilations (list[list[int]]) – List of dilation values per layer. If value is None, atrous convolutions will not be used. Default is None.

  • pool_sizes (list[int]) – Pooling ratios for PSP pooling. If value is None, PSP pooling will not be used. Default is None.

  • encoder_pool (bool) – Whether to include additional PSP pooling layer at end of encoder. Should not be used if last layer has a size of less than 16 pixels. Default is False.

  • rdnet_init (int) – Number of channels in first RDNet layer. Channels grow from this each layer according to growth parameters. Default is 128.

  • growth_rates (list[int]) – Growth rates for each RDNet layer, compounding over each layer.

  • ds_blocks (list[bool]) – Specifies which RDNet layers downsample image space. Number of downsampling blocks must be one less than ResUNet hidden layers.

  • ese_blocks (list[bool]) – Specifies which RDNet layers are ESE blocks.

  • n_blocks (list[int]) – Number of blocks per RDNet layer. Can also be an integer to be held constant across all layers. Default is 3.

  • patch_size (int) – Patch size for initial patch embedding. Default is 2.

  • bottleneck (int) – Bottleneck width ratio for all blocks. Default is 4.

  • compression (float) – Transition compression ratio to offset growth. Default is 0.5.

  • drop_rate (float) – Dropout rate for DropPath. Default is 0.