data
AttentionUNetConfig
extends
ModelConfigAttentionUNetConfig(num_classes: int = 2, in_channels: int = 1, base_channels: int = 64, depth: int = 4, bilinear: 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.
Parameters
num_classesint= 2Number of output segmentation classes.
in_channelsint= 1Number of input image channels.
base_channelsint= 64Feature channels at the first encoder stage.
Doubles at each depth level.
depthint= 4Number of encoder/decoder stages (excluding bottleneck).
bilinearbool= FalseIf True, use bilinear upsampling; otherwise ConvTranspose2d.
Notes
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