A PyTorch implementation of a Residual UNet architecture for image denoising, integrating residual connections to enhance feature propagation and mitigate gradient vanishing issues.
- Encoder: 3 residual blocks with channel progression 3→16→32→64, using MaxPool2d for downsampling
- Bottleneck: 128-channel block with dilated convolution (padding=2, dilation=2) for expanded receptive field
- Decoder: 3 upsample blocks (transposed convolution with stride=2) with channel progression 128→64→32→16
- Residual Connections: Skip connections between encoder-decoder layers and initial input feature mapping
- Output Layer: 1x1 convolution + Tanh activation to produce 3-channel output
- Residual blocks with GroupNorm (4 groups) and LeakyReLU (0.2) activation
- Dilated convolution in bottleneck for capturing long-range dependencies
- Element-wise addition for feature fusion (instead of concatenation)
- Input preprocessing via 1x1 convolution for residual connection compatibility
Suitable for image denoising tasks (e.g., natural images, low-light conditions) with 3-channel (RGB) input/output. The residual design improves training stability for deeper networks.
- Uses GroupNorm instead of BatchNorm for better performance with small batches
- LeakyReLU activation prevents dead neurons in negative regions
- Transposed convolution for efficient upsampling in decoder
- Tanh output activation constrains results to [-1, 1] range (common for image generation)