Overview
RRDBNet (Residual in Residual Dense Block Network) is the primary architecture used in Real-ESRGAN models. It’s based on ESRGAN and features a deep network with residual connections and dense blocks for high-quality image super-resolution. This architecture is imported from BasicSR and used in the flagship Real-ESRGAN models.RRDBNet is defined in
basicsr.archs.rrdbnet_arch and is part of the BasicSR library, which Real-ESRGAN depends on.Class Definition
Parameters
Number of input channels. Typically 3 for RGB images.
Number of output channels. Typically 3 for RGB images.
Number of base feature channels. This determines the width of the network.
Number of RRDB (Residual in Residual Dense Block) blocks. More blocks increase model capacity and quality but also computational cost.Common configurations:
- 23 blocks: Standard models (RealESRGAN_x4plus, RealESRGAN_x2plus)
- 6 blocks: Lightweight anime model (RealESRGAN_x4plus_anime_6B)
Number of growth channels in dense blocks. Controls the feature growth rate within each dense block.
Upsampling scale factor. Real-ESRGAN models commonly use 2 or 4.
Architecture Details
RRDBNet consists of:- Shallow feature extraction: Initial convolution layer
- Deep feature extraction: Stack of RRDB blocks with residual scaling
- Upsampling module: Convolution + PixelShuffle layers
- Reconstruction: Final convolution to output RGB image
- Multiple dense blocks with residual connections
- Beta residual scaling for training stability
- Feature reuse through dense connections
The “Residual in Residual” design allows for very deep networks (23+ blocks) while maintaining stable training through multiple levels of skip connections.
Model Configurations
RealESRGAN_x4plus (Standard)
RealESRNet_x4plus (No GAN)
RealESRGAN_x4plus_anime_6B (Anime)
RealESRGAN_x2plus (2× Scale)
Usage Example
Integration with RealESRGANer
Comparison with SRVGGNetCompact
| Feature | RRDBNet | SRVGGNetCompact |
|---|---|---|
| Architecture | Deep residual + dense blocks | Compact VGG-style |
| Parameters | ~17M (23 blocks) | ~1-2M |
| Quality | Highest quality | Good quality |
| Speed | Slower | Faster |
| Use case | High-quality images | Real-time, video |
Choose RRDBNet for maximum quality on photos and general images. Use SRVGGNetCompact for faster processing, video upscaling, or when computational resources are limited.
Source
Defined inbasicsr.archs.rrdbnet_arch (BasicSR library)
Used in inference_realesrgan.py for model initialization