Paper commentary
Pre-Trained Image Processing Transformer
Pre-trained transformer handles several image restoration tasks with one model
- Problem Restoration tasks such as denoising and super-resolution have little labeled data, and a system cannot know in advance which operation a test image needs. Separate models for each task are costly to keep ready.
- Method IPT is a transformer with task-specific heads and tails around a shared body. It is pre-trained on corrupted ImageNet images, using an L1 loss and a contrastive loss, then fine-tuned on the target task.
- Results IPT reaches 33.76 dB PSNR on x2 Urban100 super-resolution and 41.62 dB PSNR on Rain100L deraining, beating the compared methods.
Why one pre-trained model for low-level tasks
Restoration tasks such as super-resolution, denoising and deraining each tend to have little labeled data, and the shortage is sharper for medical and satellite imagery. Camera settings, lighting and weather shift the statistics of captured images, so the training distribution changes from one collection to another. A deployed system also cannot know in advance which operation a test image needs, so separate modules have to be kept ready even though they may share low-level operations.
Pre-training has worked well in language modeling, where transformers learn from large text corpora before adaptation to a downstream dataset. Most vision pre-training work targets classification, where the output is a label rather than an image, so it does not map directly onto restoration. Image processing offers a shortcut: a clean image can be degraded by a known operation to form an input, and the clean image then serves as the target, so the training pairs need no manual labels.
The authors build a single transformer, IPT, that serves several restoration tasks through task-specific ends around a shared core.
Building corrupted ImageNet pairs
ImageNet supplies the source images because it is diverse, with over 1M color images from 1,000 categories. The semantic labels are removed, and the images serve only as clean signals to be degraded. The degradations follow models already used in image processing, such as bicubic downsampling for super-resolution and additive Gaussian noise for denoising.
Each corrupted input is written as \( I_{corrupted} = f(I_{clean}) \), where f depends on the task. For super-resolution f is bicubic interpolation, for denoising \( f_{noise}(I) = I + \eta \) with η as additive Gaussian noise, and for deraining \( f_{rain}(I) = I + r \) with r as a hand-crafted rain streak. Six degradation types are generated: 2×, 3× and 4× bicubic interpolation, Gaussian noise at levels 30 and 50, and added rain streaks.
Training images are cropped into 48×48 patches with 3 channels, which gives over 10M patches. The introduction counts over 10 million images for the same training dataset, so the unit of the count differs between the introduction and the experiments section.
Heads, shared body and tails
A task-specific head \( H_i \) maps the input \( x \in R^{3×H×W} \) to a feature map \( f_H = H_i(x) \) with C channels at the same height and width, where C is typically 64. The main text describes each head as three convolutional layers, whereas the appendix describes one convolutional layer followed by two ResBlocks.
The feature map is cut into N patches of size P, and each patch is flattened into a word of length P² × C. A learnable position encoding \( E_{p_i} \) is added to each patch, and the sum is passed to the encoder. The output of the last encoder layer gives encoded features \( f_{E_i} \) with the same patch shape as the input.
The decoder has the same kind of layers, with two multi-head self-attention layers and one feed-forward network, but it adds a learned task embedding \( E_t \) for each task. The decoded patch features are reshaped back into a \( C×H×W \) feature map.
Each task has its own tail that maps the decoded features to an output image whose size depends on the task, so x2 super-resolution doubles the height and width. The denoising and deraining tails are one 3×3 convolution from 64 to 3 channels, while super-resolution tails use pixelshuffle layers, one for ×2 and ×3 and two for ×4.
Supervised and contrastive losses
The supervised term sums an L1 loss over the tasks, comparing the output for each task's corrupted input with the clean image, as \( L_{supervised} = \sum_{i=1}^{N_t} L_1(IPT(I^i_{corrupted}), I_{clean}) \). Each batch, however, draws one of the N_t tasks at random and runs only that task's head, tail and task embedding.
The contrastive term works on decoder patch features: patches from the same image should move closer, and patches from different images should move apart. The loss for a pair of patch sets is \( l = -\log \frac{\exp(d(f^j_{D_{i1}}, f^j_{D_{i2}}))}{\sum_{k=1}^{B} I_{k\neq j}\exp(d(f^j_{D_{i1}}, f^k_{D_{i2}}))} \), so the denominator sums over the other images in the batch.
Cosine similarity is \( d(a,b) = \frac{a^T b}{\|a\|\|b\|} \), and the contrastive loss averages this over the N² patch pairs and the B images in the batch.
The final objective is \( L_{IPT} = \lambda \cdot L_{contrastive} + L_{supervised} \), where λ balances the two terms. The λ values are compared in the ablation, where λ = 0.1 gives the best reported result.
Pre-training and fine-tuning settings
Pre-training runs on 32 NVIDIA Tesla V100 cards with the Adam optimizer, β1 = 0.9 and β2 = 0.999, for 300 epochs on the modified ImageNet data. The initial learning rate is 5e-5, decayed to 2e-5 at epoch 200, with a batch size of 256.
Batches are formed from one randomly selected task, because mixing tasks in one batch is too expensive in memory.
For adaptation, the pre-trained model is fine-tuned on the desired task, for example ×3 single image super-resolution, for 30 epochs at a learning rate of 2e-5. The heads and tails of the other tasks are dropped, and the remaining head, tail and body are updated by back-propagation.
At test time images are cropped into 48×48 patches with a 10 pixel overlap, and the CNN baselines are tested with the same strategy.
Super-resolution results
The authors report that IPT is best at every scale on all datasets.
On Urban100 at ×2, IPT reaches 33.76 dB PSNR, the highest value in the table, with HAN next at 33.35 dB. The authors state that this is more than about 0.4 dB above the other methods, whereas earlier state-of-the-art gains were under 0.2 dB.
On Urban100 at ×3, IPT reaches 29.49 against 29.10 for HAN, and at ×4 it reaches 27.26 against 26.85 for HAN.
The visual comparison at ×4 on Urban100 shows the authors' view that earlier methods produce blurry images while IPT recovers more detail.
Denoising results
Table 2 compares IPT with CBM3D, TNRD, DnCNN, MemNet, IRCNN, FFDNet, SADNet and RDN at Gaussian noise levels 30 and 50 on BSD68 and Urban100. On BSD68, IPT scores 30.75 at level 30 and 28.39 at level 50, and on Urban100 it scores 32.00 and 29.71. The strongest other row is RDN, at 30.67 and 28.31 on BSD68 and 31.69 and 29.29 on Urban100, and the authors report that IPT is best at each level.
The authors put the Urban100 gain at about 0.3 dB and attribute it to pre-training together with the transformer body.
The visual comparison at noise level 50 shows, in the authors' reading, that IPT recovers hair detail on a cat that the other methods lose.
Deraining results
Deraining is evaluated on the synthesized Rain100L dataset of 100 rainy images. IPT reaches 41.62 dB PSNR, a 1.62 dB improvement on the best compared method.
Unseen noise levels
To test transfer, denoising is evaluated at noise levels 10 and 70, which are not in the synthesized ImageNet data, using the denoising heads and tails.
What the ablations isolate
The data-percentage study trains on 20%, 40%, 60%, 80% and 100% of the synthesized ImageNet data and plots PSNR for IPT, EDSR, IGNN and RDN. CNN models perform better when they are not pre-trained or pre-trained on less than 60% of the data, and with large-scale data the transformer models overtake them.
Table 5 varies λ at ×2 on Set4: PSNR is 38.27 at λ = 0, 38.32 at 0.05, 38.37 at 0.1, 38.33 at 0.2 and 38.26 at 0.5. λ = 0.1 is 0.1 dB above λ = 0, and this comparison covers only ×2 on Set4.
Replacing learnable position encodings with fixed encodings, or removing them, lowers performance by 0.2 to 0.3 dB depending on the task. Removing the task embeddings lowers performance by 0.1 to 0.5 dB depending on the task.
Multi-task training leaves performance on the pre-trained tasks almost unchanged and gives about 0.3 dB better transfer to other tasks than single-task training.
Parameter and FLOP counts
The whole IPT model has 114M parameters and 33G FLOPs. This comparison reports parameter and FLOP counts, not measured runtime or memory.
Deblurring appendix results
Table 6 lists IPT at 32.58 and IPT+ at 32.91 on the GoPro deblurring benchmark. The next highest rows are BANET at 32.44 and MB2D at 32.16.
Limits of the evidence
The authors state that not every degradation can be synthesized, and that the wide range of practical noise levels calls for further improving the generalization of IPT. Generalization was tested only at denoising noise levels 10 and 70.
The super-resolution comparisons are against CNN-based methods. Pre-training used 32 V100 cards, and multi-task batches were limited to one task because mixing tasks exceeded memory.
The λ ablation covers one scale and one dataset, and the data-percentage result is shown only as a plot. Extensions to inpainting and dehazing are left to future work.
Paper info
- Authors
- Hanting Chen, Yunhe Wang, Tianyu Guo, Chang Xu, Yiping Deng, Zhenhua Liu, Siwei Ma, Chunjing Xu, Chao Xu, Wen Gao
- Venue
- arXiv · Preprint
- First published
- 2020-12-1
- Added
- 2026-11-12
- Updated
- 2021-11-8
- Version
- v4
- arXiv
- 2012.00364
- Category
- cs.CV · cs.LG
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Hanting Chen, Yunhe Wang, Tianyu Guo, Chang Xu, Yiping Deng, Zhenhua Liu, Siwei Ma, Chunjing Xu, Chao Xu, Wen Gao (2020). Pre-Trained Image Processing Transformer. arXiv:2012.00364v4. https://arxiv.org/abs/2012.00364v4
BibTeX
@misc{chen2020trained,
title = {{Pre-Trained Image Processing Transformer}},
author = {Hanting Chen and Yunhe Wang and Tianyu Guo and Chang Xu and Yiping Deng and Zhenhua Liu and Siwei Ma and Chunjing Xu and Chao Xu and Wen Gao},
year = {2020},
eprint = {2012.00364},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2012.00364v4}
}