---
title: Efficient Sub-Pixel CNN (ESPCN)
url: https://www.emergentmind.com/topics/efficient-sub-pixel-convolutional-neural-network-espcn
type: topic
---

# Efficient Sub-Pixel CNN (ESPCN)

An Efficient Sub-Pixel Convolutional Neural Network (ESPCN) is a convolutional neural network architecture designed for real-time single image and video super-resolution. ESPCN achieves high-quality upscaling of low-resolution (LR) images to high-resolution (HR) outputs by performing feature extraction entirely in the LR space and employing a final layer that learns multiple upscaling kernels per channel. The core innovation is the sub-pixel convolution layer and the "pixel shuffle" (periodic shuffling) operation, which realizes computational efficiency and improved modeling capacity compared to conventional upsampling methods or deconvolution layers [1609.05158][1609.07009][1707.02937].

## 1. ESPCN Architecture and Sub-Pixel Convolution Principle

In ESPCN, all learnable feature extraction occurs exclusively in the LR space. For a typical setup, the network consists of several convolutional layers followed by a final convolution that increases the channel count to $C' \cdot r^2$, where $C'$ is the number of output channels (e.g., $C'=3$ for RGB), and $r$ is the integer upscaling factor (commonly $r=2$ or $3$). This is followed by the pixel shuffle operator that reorganizes the output from $H \times W \times (r^2 C')$ to $(rH) \times (rW) \times C'$.

The sub-pixel convolution operation is mathematically defined as:
\[
Y = W * f_{l-1}(I_{\text{LR}}), \quad Y \in \mathbb{R}^{(r^2 C_{\text{out}}) \times H \times W}
\]
\[
I_{\text{SR}} = P(Y)
\]
where $P(\cdot)$ operates as periodic shuffling. Channel index mapping is:
\[
c_{\text{out}} = \left\lfloor \frac{c}{r^2} \right\rfloor, \quad \alpha = c \bmod r^2, \quad \Delta i = \left\lfloor \frac{\alpha}{r} \right\rfloor, \quad \Delta j = \alpha \bmod r
\]
\[
I_{\text{SR}}[c_{\text{out}}, r \cdot i + \Delta i, r \cdot j + \Delta j] = Y[c, i, j]
\]
This structure enables the learning of $r^2$ upscaling filters per output channel, as opposed to representing upscaling as a fixed or single learned filter [1609.05158][1707.02937].

## 2. Comparative Analysis of Upscaling Schemes

Three related upscaling schemes are rigorously detailed and compared by performance, artifacts, and modeling power [1707.02937]:

- **Sub-pixel convolution (SPC)**: Convolves in LR space, pixel-shuffle to HR in the last layer.
- **Resize convolution (RC)**: Nearest-neighbor upsampling to HR, then convolution in HR space.
- **Convolution followed by NN resize (Conv–NN)**: Convolution in LR, then upsampling via non-learnable NN interpolation.

A summary of their computation and parameter requirements is:

| Method   | Parameters                     | Multiply-Adds (per sample)                                              |
|----------|-------------------------------|-------------------------------------------------------------------------|
| SPC      | $r^2 C_{\text{out}} C_{\text{in}} k^2$ | $H W C_{\text{in}} k^2 (r^2 C_{\text{out}})$                                 |
| RC       | $C_{\text{out}} C_{\text{in}} k^2$     | $(rH)(rW) C_{\text{in}} k^2 C_{\text{out}} = r^2 H W C_{\text{in}} k^2 C_{\text{out}}$ |
| Conv–NN  | $C_{\text{out}} C_{\text{in}} k^2$     | $H W C_{\text{in}} k^2 C_{\text{out}}$                                       |

SPC and RC are equivalent in FLOPs, but SPC provides $r^2$ larger parameterization, yielding superior modeling power. Conv–NN, while more efficient, is limited in expressivity since the upscaling kernel is fixed by the NN interpolation and thus non-learnable [1707.02937].

## 3. Equivalence with Transposed (Deconvolution) Layers

ESPCN's sub-pixel convolution layer is algebraically equivalent to a transposed convolution (often termed “deconvolution”) layer, in the sense that a proper permuting and reshaping of the sub-pixel convolution's kernels yields a transposed convolution kernel with support $(k\cdot r) \times (k\cdot r)$ [1609.07009]. The mapping:
\[
\text{LR-conv} \rightarrow \text{pixel-shuffle} = \text{zero-scatter} \rightarrow \text{HR-conv} \rightarrow \text{crop}
\]
demonstrates these layers realize the same linear operator. Sub-pixel convolution, however, achieves this at substantially lower computational cost (saving an $r^2$ factor on early layers) and is thus better suited for deep super-resolution pipelines under practical resource constraints [1609.07009].

## 4. Initialization, Checkerboard Artifact Suppression, and Best Practices

Standard random initialization of sub-pixel kernels leads to checkerboard artifacts in the HR outputs because each $r^2$ sub-kernel is initially independent, generating disjoint pixel grids. The artifact-free "ICNR" (Initialized to Convolution NN Resize) method addresses this by initializing all $r^2$ sub-kernels to identical weights, equivalent to an NN-upsampled ordinary convolution kernel [1707.02937]. Specifically:
1. Initialize a base kernel $W_o$ using a standard method (e.g., He, orthogonal).
2. Copy $W_o$ into each of the $r^2$ sub-kernels.

Mathematically, this ensures for any input $f$, $P(W_{\text{sp}} * f) \equiv N(W_o * f)$, eliminating artifacts from initialization. Empirical evidence shows ICNR-initialized models not only remain checkerboard-free at $t=0$ but also converge faster and to lower test MSE than vanilla SPC or RC approaches [1707.02937].

Optimal ESPCN implementation includes:
- Using sub-pixel convolution in the final layer for maximal capacity at constant cost.
- Applying ICNR initialization for checkerboard-free starts and accelerated convergence.
- Maintaining $r^2 C_{\text{out}}$ output channels before the pixel-shuffle stage.
- Standard He or orthogonal initialization for intermediate layers.
- Recognizing that advanced upsampling (e.g., bicubic) may require further kernel adjustments.

## 5. Computational and Modeling Advantages

By keeping all heavy convolutions in the LR space, ESPCN significantly reduces the required FLOPs for a fixed depth. For a network of $L$ layers and upscaling factor $r$, the difference in computation compared to HR-First (upsample-then-convolve) networks is:

- HR-First: $\sum_{i=1}^L r^2 H W C_{i-1} C_i k^2$
- ESPCN: $\sum_{i=1}^{L-1} H W C_{i-1} C_i k^2 + H W C_{L-1} (r^2 C_L) k^2$

For typical $L$ and $r$, this results in a $2\times$–$10\times$ reduction in overall multiply-adds for ESPCN [1609.07009]. A crucial implication is that, for a fixed computational budget, ESPCN can support proportionally more feature maps per layer. This increased representational capacity means every HR-First network can be embedded into an ESPCN at equal cost, but not the reverse [1609.07009].

## 6. Empirical Performance and Benchmarks

The original ESPCN model achieved state-of-the-art accuracy and speed on standard benchmarks using the following training and network settings [1609.05158]:
- 3-layer network: Layer 1 ($5 \times 5 \times C \times 64$), Layer 2 ($3 \times 3 \times 64 \times 32$), Layer 3 ($3 \times 3 \times 32 \times (C \cdot r^2)$), with $r=3$ or $4$.
- Activation: tanh in hidden layers, linear in the last layer.
- Learning rate scheduling: main layers at $0.01 \rightarrow 10^{-4}$, last layer at $1/10$ the rate.
- Training data: 50,000 random ImageNet images.
- Mean PSNR on Set14 ($r=3$): $\approx 29.4$ dB, $\approx 200$ fps on GPU.
- On 1080p video, ESPCN runs in $0.038$ s/frame ($r=3$), nearly an order of magnitude faster than SRCNN-9-5-5.

Evaluation on 350k ImageNet crops and BSD500 produced:
- Lowest training/test MSE for SPC+ICNR versus RC or vanilla SPC.
- Immediate checkerboard artifact elimination with ICNR or RC.
- Faster convergence and lower MSE with ICNR than alternative approaches [1707.02937].

## 7. Theoretical and Practical Implications

ESPCN provides a paradigm shift from "upsample-then-convolve" to "convolve-in-LR, then cheap rearrangement." This offers speed advantages, increased model capacity at constant cost, and—if combined with proper initialization—artifact-free outputs from the outset. The architectural principle generalizes to other upsampling tasks where fine-grained learnable interpolation is beneficial.

Future directions involve extending initialization schemes for more complex upscaling, integrating with advanced loss functions and adversarial settings, and generalizing the periodic shuffling mechanism to tasks beyond super-resolution. Practical deployment guidelines stress the importance of initialization (ICNR), minimal depth for real-time constraints, and careful consideration of backbone and upscaling factor for specific application domains.

---

**References**:

- "Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network" [1609.05158]
- "Is the deconvolution layer the same as a convolutional layer?" [1609.07009]
- "Checkerboard artifact free sub-pixel convolution: A note on sub-pixel convolution, resize convolution and convolution resize" [1707.02937]

Source: https://www.emergentmind.com/topics/efficient-sub-pixel-convolutional-neural-network-espcn