AttentionUNetConfig
ModelConfigAttentionUNetConfig(num_classes: int = 2, spatial_dims: int = 2, in_channels: int = 1, base_channels: int = 64, depth: int = 4, bilinear: bool = False, deep_supervision: bool = False)Configuration for Attention U-Net.
Extends the standard U-Net architecture (Ronneberger et al., 2015) by adding soft attention gates on skip connections. Each gate computes a spatial attention map from the skip feature and the gating signal from the decoder, suppressing irrelevant activations before concatenation.
Architecture overview: Encoder: depth × (2×Conv3x3-BN-ReLU + MaxPool2x2) Bottleneck: 2×Conv3x3-BN-ReLU Decoder: depth × (Upsample/ConvTranspose + AttentionGate + Cat + 2×Conv3x3-BN-ReLU) Head: Conv1x1 → num_classes
Args:
num_classes: Number of output segmentation classes.
in_channels: Number of input image channels.
base_channels: Feature channels at the first encoder stage.
Doubles at each depth level.
depth: Number of encoder/decoder stages (excluding bottleneck).
bilinear: If True, use bilinear upsampling; otherwise ConvTranspose2d.
deep_supervision: Attach a 1x1 classifier to every decoder level,
resample each to the input resolution, and fuse the stack with a
final 1x1 convolution — the dsv in the reference's
unet_CT_multi_att_dsv model. Despite the name this is not a
training-only auxiliary loss: the prediction itself comes out of
the fusion, so switching it on changes inference too. Defaults
off so existing checkpoints keep loading.
Examples
>>> from lucid.models.vision.attention_unet._config import AttentionUNetConfig
>>> cfg = AttentionUNetConfig()
>>> cfg.model_type
'attention_unet'
>>> cfg.num_classes, cfg.in_channels
(2, 1)