res_unet_2d(pretrained: bool = False, overrides: object = {})ResUNet — U-Net with residual DoubleConv blocks, 2-D (Zhang et al., 2018).
Builds a 2-D U-Net with the standard channel / depth schedule but every DoubleConv block wraps an identity shortcut around its two 3x3 convs. This residual variant trains more reliably at greater depth and is a common drop-in upgrade for medical-imaging U-Nets.
Model Size
Parameters
pretrainedbool= FalseReserved for future pretrained-weight loading. Currently ignored.
**overridesobject= {}Keyword overrides forwarded into
UNetConfig (num_classes,
in_channels, base_channels, depth, ...).Returns
UNetForSemanticSegmentationSegmentation model with the 2-D ResUNet configuration applied
(or with overrides merged on top of it).
Notes
See Zhang, Liu, Wang, "Road Extraction by Deep Residual U-Net", IEEE Geosci. Remote Sens. Lett. 2018 (arXiv:1711.10684). The DoubleConv update with residual shortcut is
matching the He et al. residual formulation but applied at every encoder / decoder stage rather than only inside the backbone.
Examples
>>> import lucid
>>> from lucid.models.vision.unet import res_unet_2d
>>> model = res_unet_2d()
>>> x = lucid.randn(1, 1, 256, 256)
>>> out = model(x)
>>> out.logits.shape
(1, 2, 256, 256)