Real-ESRGAN x4
Fit diagram
Read at 100%
Clear selection
Download SVG
Download PNG
Click a block to read its description, or select it with Tab and Enter.
Real-ESRGAN x4
RGB super-resolution, native eval, 3 × 64 × 64 input. Shapes exclude batch.
LibreYOLO
Real-ESRGAN x4
RGB super-resolution, native eval, 3 × 64 × 64 input. Shapes exclude batch.
RRDBNet generator
Input image
3 × 64 × 64
Identity input
3 × 64 × 64
Conv2d 3×3
3 to 64; s=1, p=1
RRDB, n=23
64 × 64 × 64
Conv2d 3×3
64 to 64; s=1, p=1
+
Nearest-neighbor resize ×2
64 × 128 × 128
Conv2d 3×3
64 to 64; s=1, p=1
LeakyReLU
Negative slope 0.2
Nearest-neighbor resize ×2
64 × 256 × 256
Conv2d 3×3
64 to 64; s=1, p=1
LeakyReLU
Negative slope 0.2
Conv2d 3×3
64 to 64; s=1, p=1
LeakyReLU
Negative slope 0.2
Conv2d 3×3
64 to 3; s=1, p=1
Restored RGB
3 × 256 × 256
All convolutions have bias; no normalization layers.
RRDB: residual in residual
Input
64 channels
ResidualDenseBlock
64 channels
ResidualDenseBlock
64 channels
ResidualDenseBlock
64 channels
Multiply 0.2
Residual scaling
+
Each inner dense block also scales its residual by 0.2.
Input rearrangement and variants
PixelUnshuffle ×2 (x2 only)
3 × 64 × 64 becomes 12 × 32 × 32
Reshape and permute
2×2 spatial positions become channels
x4: U=1, no unshuffle; trunk at 64×64.
x2: U=2, pixel unshuffle; trunk at 32×32.
Both use 23 RRDBs, width 64, growth width 32.
Both execute two nearest-neighbor ×2 upsamplings.
Net upscale = 4/U; output is 256/U pixels per side.
x4t uses SRVGG, shown in a separate concrete view.
Network output is not clamped by RRDBNet.forward.
ResidualDenseBlock
X is the 64-channel input. F1...F4 each have 32 channels.
X
Identity X
64 channels
Conv2d 3×3
64 to 32; s=1, p=1
LeakyReLU, slope 0.2
F1
X
F1
Concat channel inputs
96 channels
Conv2d 3×3
96 to 32; s=1, p=1
LeakyReLU, slope 0.2
F2
X
F1
F2
Concat channel inputs
128 channels
Conv2d 3×3
128 to 32; s=1, p=1
LeakyReLU, slope 0.2
F3
X
F1
F2
F3
Concat channel inputs
160 channels
Conv2d 3×3
160 to 32; s=1, p=1
LeakyReLU, slope 0.2
F4
X
F1
F2
F3
F4
Concat channel inputs
192 channels
Conv2d 3×3
192 to 64; s=1, p=1
Multiply 0.2
64-channel dense residual
+
X
Named X/F connectors denote the same tensor at each use.
Inference generator only. GAN discriminator, degradation synthesis and adversarial training are outside this graph.
Source: libreyolo/models/realesrgan/nn.py and model.py. Revision a4d0ecc9e17f.
libreyolo.com