# 上采样

上采样是一种信号与图像处理技术，通过插入新样本提高数据的采样率或空间分辨率，这些新样本既可以用插值核计算得到，也可以用转置卷积或亚像素卷积学习得到。普通上采样只产生一个更密的网格，携带的信息不变；超分辨率则是一项不同的任务，旨在创造低分辨率输入中并不存在的新细节。<sup>[1](https://visionbook.mit.edu/upsamplig_downsampling_2.html)</sup> 这一操作是生成网络和分割网络中解码器的核心，也是超分辨率模型以及计算机视觉中经典重采样的核心。<sup>[1](https://visionbook.mit.edu/upsamplig_downsampling_2.html)</sup><sup> • </sup><sup>[2](https://visionbook.mit.edu/sampling_and_aliasing.html)</sup>

| 关键事实 | 细节 |
|---|---|
| 定义 | 先扩展（每个样本后插入 \( k - 1 \) 个零），再与可分离核做卷积<sup>[1](https://visionbook.mit.edu/upsamplig_downsampling_2.html)</sup> |
| 信息量 | 普通上采样增加像素数但不增加信息；超分辨率创造新细节<sup>[1](https://visionbook.mit.edu/upsamplig_downsampling_2.html)</sup> |
| 转置卷积 | 当 \( \mathrm{stride} > 1 \) 时在输入元素之间插入零，然后施加学习到的核<sup>[3](https://docs.pytorch.org/docs/stable/generated/torch.nn.modules.conv.ConvTranspose2d.md)</sup> |
| 亚像素卷积 | 在低分辨率空间卷积至 \( r^{2} \cdot C \) 个通道，再周期性地重排为 \( r \cdot H \times r \cdot W \times C \)<sup>[4](https://openaccess.thecvf.com/content_cvpr_2016/papers/Shi_Real-Time_Single_Image_CVPR_2016_paper.pdf)</sup> |
| 速度 | 在前向传播中，亚像素层比反卷积层快 \( \log_{2}(r^{2}) \) 倍，比先上采样的设计快 \( r^{2} \) 倍<sup>[4](https://openaccess.thecvf.com/content_cvpr_2016/papers/Shi_Real-Time_Single_Image_CVPR_2016_paper.pdf)</sup> |
| 主要伪影 | 由核重叠、随机初始化和基于下采样的损失导致的棋盘/网格伪影<sup>[5](http://arxiv.org/pdf/1707.02937v1)</sup> |
| 典型的学习式超分辨率增益 | 在 4× 下，相比双三次缩放，PSNR 提升 +1 至 +2 dB，SSIM 提升 +0.05 至 +0.1<sup>[6](https://eprints.whiterose.ac.uk/id/eprint/168212/1/CNN_Upscaling_Paper.pdf)</sup> |

## 工作原理

对于整数倍因子 \( k \)，上采样是先扩展后插值的序列：在每个样本后插入 \( k - 1 \) 个零，再将填零信号与核做卷积以填充数值。<sup>[1](https://visionbook.mit.edu/upsamplig_downsampling_2.html)</sup> 插零会在原频谱上产生频谱副本；插值核必须抑制这些副本。理想的重建滤波器在频域中是零相位矩形窗，在空域中是 sinc 函数，但其无限支撑使其不切实际，因此改用局部核（最近邻、线性、三次、Lanczos）。<sup>[2](https://visionbook.mit.edu/sampling_and_aliasing.html)</sup> 即便是实现 \( k = 2 \) 双线性插值的二项式滤波器 \( [1/2,\ 1,\ 1/2] \)，也不能完全抑制副本。<sup>[1](https://visionbook.mit.edu/upsamplig_downsampling_2.html)</sup>

奈奎斯特约束同时支配两个方向：带限信号的完美重建要求采样频率 \( w_{\mathrm{s}} > 2 \cdot w_{\mathrm{max}} \)，当频谱副本重叠时就会出现混叠。<sup>[2](https://visionbook.mit.edu/sampling_and_aliasing.html)</sup> 学习式上采样器符合同样的框架：转置卷积就是插零后接一个学习到的、步长为 1 的核<sup>[3](https://docs.pytorch.org/docs/stable/generated/torch.nn.modules.conv.ConvTranspose2d.md)</sup><sup> • </sup><sup>[7](https://arxiv.org/pdf/2012.09904)</sup>，而亚像素卷积是一种低分辨率卷积，其 \( r^{2} \) 个输出通道被周期性地重排到位。<sup>[4](https://openaccess.thecvf.com/content_cvpr_2016/papers/Shi_Real-Time_Single_Image_CVPR_2016_paper.pdf)</sup>

## 实现方式

**固定插值核。** 最近邻将最近的输入样本赋给输出，是一个无需计算的方波脉冲，但会造成块状伪影。双线性使用 2×2 的感受野（二维中为四个样本）；双三次使用 4×4 的感受野，是三者中最慢的，但当超分辨率模型应用插值时，它是通常的选择。<sup>[8](https://export.arxiv.org/pdf/2209.13131v2.pdf)</sup> 在频域中，线性插值对应一个具有 \( \mathrm{sinc}^{2} \) 响应的三角滤波器，最近邻对应一个具有 sinc 响应的矩形滤波器；\( \mathrm{sinc}^{2} \) 较低的旁瓣能更多地衰减高频。<sup>[9](https://ar5iv.labs.arxiv.org/html/2010.14356)</sup>

**转置卷积。** 当 \( \mathrm{stride} > 1 \) 时，`ConvTranspose2d` 在输入元素之间插入零并施加核；输出形状为 \( H_{\mathrm{out}} = (H_{\mathrm{in}} - 1) \times \mathrm{stride} - 2 \times \mathrm{padding} + \mathrm{dilation} \times (\mathrm{kernel\_size} - 1) + \mathrm{output\_padding} + 1 \)。<sup>[3](https://docs.pytorch.org/docs/stable/generated/torch.nn.modules.conv.ConvTranspose2d.md)</sup> 等价地，每个输入元素与核相乘后广播到一个中间张量，再将结果求和；这一名称反映出该层交换了卷积的前向与反向函数（乘以 Wᵀ 而非 W）。<sup>[10](https://d2l.ai/chapter%5Fcomputer-vision/transposed-conv.html)</sup>

**亚像素卷积（像素重排）。** 一个卷积将通道维度扩展到 \( s^{2} \cdot c \) 个通道，然后一个周期性重排算子 PS 将 \( H \times W \times C \cdot r^{2} \) 张量重排为 \( r \cdot H \times r \cdot W \times C \)，即 \( \mathrm{PS}(T)_{x,y,c} = T_{\lfloor x/r \rfloor, \lfloor y/r \rfloor, c \cdot r^{2} + r \cdot \mathrm{mod}(y,r) + \mathrm{mod}(x,r)} \)。<sup>[4](https://openaccess.thecvf.com/content_cvpr_2016/papers/Shi_Real-Time_Single_Image_CVPR_2016_paper.pdf)</sup><sup> • </sup><sup>[8](https://export.arxiv.org/pdf/2209.13131v2.pdf)</sup> 当核大小能被 r 整除时，反卷积层在数学上等同于输出 \( r^{2} \) 个通道的低分辨率卷积后接周期性重排。<sup>[11](https://doi.org/10.48550/arxiv.1609.07009)</sup>

**其他算子。** 重缩放卷积（先插值再普通卷积）完全避免了棋盘伪影。<sup>[5](http://arxiv.org/pdf/1707.02937v1)</sup> PyTorch 的 `interpolate` 提供 nearest、linear、bilinear、bicubic、trilinear、area 和 nearest-exact 模式，其中 `align_corners` 控制像素中心对齐，`antialias` 可用于 bilinear 和 bicubic。<sup>[12](https://docs.pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.md)</sup>

## 起源

如今称为转置卷积的层出现在早期的反卷积网络工作中，当时没有专门名称；反卷积层这一术语后来被采用并在 Caffe 框架中实现，此后这一操作积累了许多名称，包括亚像素卷积层或分数卷积层、转置卷积层，以及逆卷积层、上卷积层或反向卷积层。<sup>[11](https://doi.org/10.48550/arxiv.1609.07009)</sup> 学习放大滤波器的想法曾在一篇早期超分辨率论文的脚注中被提及，但未在该文中深入探索。<sup>[4](https://openaccess.thecvf.com/content_cvpr_2016/papers/Shi_Real-Time_Single_Image_CVPR_2016_paper.pdf)</sup> Shi 及其同事于 2016 年在 arXiv 上通过 ESPCN 提出了高效的亚像素卷积层，这是第一个能在单块 K2 GPU 上对 1080p 视频进行实时超分辨率的 CNN。<sup>[13](https://doi.org/10.48550/arxiv.1609.05158)</sup> Shi 及其同事的一篇配套短文证明了反卷积层与低分辨率卷积加周期性重排的等价性。<sup>[11](https://doi.org/10.48550/arxiv.1609.07009)</sup> 一项对棋盘伪影的分析确立了重缩放卷积作为一种无伪影的替代方案。<sup>[5](http://arxiv.org/pdf/1707.02937v1)</sup>

## 变体

**内容感知核。** CARAFE 通过通道压缩器、内容编码器和 softmax 核归一化器，在大感受野上为每个目标位置预测一个重装配核，取代了反卷积固定的、与实例无关的核。<sup>[14](https://arxiv.org/pdf/1905.02188)</sup> FADE 将高分辨率编码器特征与解码器特征融合以生成动态核。<sup>[15](https://ar5iv.labs.arxiv.org/html/2207.10392)</sup> DLU 对此做了轻量化：CARAFE 的参数规模为 \( \sigma^{2} \cdot k_{\mathrm{up}}^{2} \)，而 DLU 的规模为 \( k_{\mathrm{up}}^{2} + 2\sigma^{2} \)，当 \( k_{\mathrm{up}} \geq 3 \) 且 \( \sigma \geq 2 \) 时 DLU 更便宜。<sup>[16](https://arxiv.org/html/2410.22139)</sup>

**采样与注意力视角。** 基于注意力的上采样用逐像素计算的自注意力权重取代固定的转置卷积核，参数为 \( 3 \cdot C_{\mathrm{in}} \cdot C_{\mathrm{out}} + K \cdot C_{\mathrm{out}} \)，而带步长的转置卷积为 \( C_{\mathrm{in}} \cdot C_{\mathrm{out}} \cdot K^{2} \)，在 \( K = 3 \) 时约少 3 倍。<sup>[7](https://arxiv.org/pdf/2012.09904)</sup> DySample 将上采样重新表述为内容感知的点采样：输入被连续化，学习到的偏移量对其重新采样；对于 256 × 120 × 120 的特征图，其推理时间为 6.2 ms，双线性插值则为 1.6 ms。<sup>[17](https://openaccess.thecvf.com/content/ICCV2023/papers/Liu_Learning_to_Upsample_by_Learning_to_Sample_ICCV_2023_paper.pdf)</sup> LIIF 使用一个解码 MLP 将二维坐标和邻域特征映射为 RGB 值，从而实现连续的任意尺度上采样。<sup>[18](https://doi.org/10.48550/arxiv.2012.09161)</sup>

## 应用

**解码器。** U-Net 由 Ronneberger、Fischer 和 Brox 于 2015 年为生物医学分割提出，是一种广泛使用的编码器-解码器网络。<sup>[19](https://doi.org/10.48550/arxiv.1505.04597)</sup> 在检测和分割中，CARAFE 能以更低的成本替代 FPN 中的最近邻上采样，以及 [Mask R-CNN](https://www.edgepedia.org/zh/mask-r-cnn) 掩码头中的反卷积（14×14 到 28×28）。<sup>[14](https://arxiv.org/pdf/1905.02188)</sup>

**超分辨率。** ESRGAN 由 Wang、Yu、Wu 及其同事于 2018 年报告，在 4× 下使用论文中面向 [PSNR](https://www.edgepedia.org/zh/peak-signal-to-noise-ratio) 的 RRDB 模型（而非感知型 ESRGAN 模型）在 Set5 上达到 32.73 dB PSNR / 0.9011 SSIM<sup>[20](https://doi.org/10.48550/arxiv.1809.00219)</sup>；[Real-ESRGAN](https://www.edgepedia.org/zh/real-esrgan) 由 Wang、Xie、Dong 和 Shan（2021）提出，使用像素反重排来减小空间尺寸，将同一生成器扩展到 2× 和 1× 尺度。<sup>[21](https://doi.org/10.48550/arxiv.2107.10833)</sup> 基于扩散的超分辨率包括 SR3，由 Saharia、Ho、Chan 及其同事于 2021 年报告，它以 LR 图像为条件在细化步骤中做去噪<sup>[22](https://doi.org/10.48550/arxiv.2104.07636)</sup>；以及潜在扩散，由 Rombach、Blattmann、Lorenz 及其同事于 2021 年报告，它在低维潜在空间中运行扩散。<sup>[23](https://doi.org/10.48550/arxiv.2112.10752)</sup>

**成本与质量。** 在 MaskFormer-SwinB 分割上，DySample 比 CARAFE 多带来 46% 的性能提升，而参数量仅为其 3%，FLOPs 仅为其 20%。<sup>[17](https://openaccess.thecvf.com/content/ICCV2023/papers/Liu_Learning_to_Upsample_by_Learning_to_Sample_ICCV_2023_paper.pdf)</sup> 在 4× 下的 ESPCN、SRResNet、ProGanSR 和 LapSRN 中，CNN 缩放相比双三次平均获得 +1 至 +2 dB PSNR 和 +0.05 至 +0.1 SSIM 的增益。<sup>[6](https://eprints.whiterose.ac.uk/id/eprint/168212/1/CNN_Upscaling_Paper.pdf)</sup>

## 局限与替代方案

**棋盘效应。** 识别出三种棋盘伪影来源：当核大小不能被步长整除时的反卷积重叠、随机初始化（即便能整除伪影仍存在，因为在亚像素卷积中每组子核是独立初始化的），以及带有下采样操作的[损失函数](https://www.edgepedia.org/zh/loss-function)，如 VGG 特征损失或 GAN 判别器。<sup>[5](http://arxiv.org/pdf/1707.02937v1)</sup> 从机制上看，当核大小不能被步长整除时会出现不均匀重叠，重叠的核对输出像素做出不均匀的贡献，产生与上述其他来源不同的网格状伪影。<sup>[24](https://www.ecva.net/papers/eccv_2024/papers_ECCV/papers/07582.pdf)</sup> CARAFE 独立预测的核可能导致同样的伪影，因为相邻输出像素之间没有直接关系。<sup>[16](https://arxiv.org/html/2410.22139)</sup>

**频谱伪影。** 转置卷积会添加大量高频噪声，而基于插值的上采样+卷积缺乏高频，因此生成模型无法再现频谱分布；钉床式上采样产生复制频谱，常见的 3×3 滤波器无法去除，这促使人们采用频谱正则化以及至少 5×5 的最终生成器滤波器。<sup>[25](https://openaccess.thecvf.com/content_CVPR_2020/papers/Durall_Watch_Your_Up-Convolution_CNN_Based_Generative_Deep_Neural_Networks_Are_CVPR_2020_paper.pdf)</sup> 像素重排将插入值设为来自不同通道的无关值，产生一个在频带极限处有频率的非平滑信号。<sup>[24](https://www.ecva.net/papers/eccv_2024/papers_ECCV/papers/07582.pdf)</sup>

**经典伪影与补救措施。** [插值](https://www.edgepedia.org/zh/interpolation)伪影分为四类：振铃、混叠、块效应和模糊；混叠是真正的伪影，因为从混叠数据中精确恢复永远不可能。<sup>[26](http://ncorr.com/download/publications/thevanezinterpolation.pdf)</sup> 下采样前的抗混叠可防止高频干扰低频，但不能保留高频；超分辨率则可以转而利用混叠模式恢复丢失的细节。<sup>[2](https://visionbook.mit.edu/sampling_and_aliasing.html)</sup> 补救措施包括：重缩放卷积，完全避免棋盘效应<sup>[5](http://arxiv.org/pdf/1707.02937v1)</sup>；无混叠重采样，在奈奎斯特截止频率 \( f_{\mathrm{Nyquist}} = f_{\mathrm{s}}/2 \)（采样频率的一半）处使用 Kaiser 窗低通滤波器，可在不增加可训练参数的情况下改善扩散 UNet 中的 FID 和 KID<sup>[27](https://arxiv.org/pdf/2411.09174)</sup>；以及大上下文转置卷积（7×7，或配合并行 3×3 的 11×11），它们能更好地逼近理想的 sinc 上采样器，并优于像素重排。<sup>[24](https://www.ecva.net/papers/eccv_2024/papers_ECCV/papers/07582.pdf)</sup> 注意，产生细节幻觉的感知型超分辨率模型可能不适合医学或监控用途，因为所生成的数据在技术上并不存在于原始图像中。<sup>[6](https://eprints.whiterose.ac.uk/id/eprint/168212/1/CNN_Upscaling_Paper.pdf)</sup>

## References

1. [Downsampling and Upsampling Images – Foundations of Computer Vision (MIT)](https://visionbook.mit.edu/upsamplig_downsampling_2.html)
2. [Image Sampling and Aliasing – Foundations of Computer Vision (MIT)](https://visionbook.mit.edu/sampling_and_aliasing.html)
3. [ConvTranspose2d, PyTorch documentation](https://docs.pytorch.org/docs/stable/generated/torch.nn.modules.conv.ConvTranspose2d.md)
4. [Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network (CVPR 2016)](https://openaccess.thecvf.com/content_cvpr_2016/papers/Shi_Real-Time_Single_Image_CVPR_2016_paper.pdf)
5. [Checkerboard artifact free sub-pixel convolution: A note on sub-pixel convolution, resize convolution and convolution resize](http://arxiv.org/pdf/1707.02937v1)
6. [A comparison study of deep learning techniques to increase the spatial resolution of photo-realistic images](https://eprints.whiterose.ac.uk/id/eprint/168212/1/CNN_Upscaling_Paper.pdf)
7. [Attention-Based Upsampling (Kundu et al., 2020)](https://arxiv.org/pdf/2012.09904)
8. [Deep Learning for Image Super-resolution: A Survey / Hitchhiker's Guide to Super-Resolution (IEEE TPAMI 2023)](https://export.arxiv.org/pdf/2209.13131v2.pdf)
9. [Upsampling artifacts in neural audio synthesis (arXiv 2010.14356, Dolby Laboratories)](https://ar5iv.labs.arxiv.org/html/2010.14356)
10. [14.10. Transposed Convolution, Dive into Deep Learning](https://d2l.ai/chapter%5Fcomputer-vision/transposed-conv.html)
11. [Shi, Wenzhe and colleagues (2016). Is the deconvolution layer the same as a convolutional layer?. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1609.07009)
12. [torch.nn.functional.interpolate, PyTorch documentation](https://docs.pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.md)
13. [Shi, Wenzhe and colleagues (2016). Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1609.05158)
14. [CARAFE: Content-Aware ReAssembly of FEatures (ICCV 2019)](https://arxiv.org/pdf/1905.02188)
15. [FADE: Fusing the Assets of Decoder and Encoder for Task-Agnostic Upsampling](https://ar5iv.labs.arxiv.org/html/2207.10392)
16. [Lighten CARAFE: Dynamic Lightweight Upsampling with Guided Reassemble Kernels (DLU)](https://arxiv.org/html/2410.22139)
17. [Learning to Upsample by Learning to Sample (DySample, ICCV 2023)](https://openaccess.thecvf.com/content/ICCV2023/papers/Liu_Learning_to_Upsample_by_Learning_to_Sample_ICCV_2023_paper.pdf)
18. [Chen, Yinbo, Liu, Sifei, Wang, Xiaolong (2020). Learning Continuous Image Representation with Local Implicit Image Function. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2012.09161)
19. [Ronneberger, Olaf, Fischer, Philipp, Brox, Thomas (2015). U-Net: Convolutional Networks for Biomedical Image Segmentation. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1505.04597)
20. [Wang, Xintao and colleagues (2018). ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1809.00219)
21. [Wang, Xintao and colleagues (2021). Real-ESRGAN: Training Real-World Blind Super-Resolution with Pure Synthetic Data. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2107.10833)
22. [Saharia, Chitwan and colleagues (2021). Image Super-Resolution via Iterative Refinement. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2104.07636)
23. [Rombach, Robin and colleagues (2021). High-Resolution Image Synthesis with Latent Diffusion Models. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2112.10752)
24. [Improving Feature Stability during Upsampling – Spectral Artifacts and the Importance of Spatial Context (ECCV 2024)](https://www.ecva.net/papers/eccv_2024/papers_ECCV/papers/07582.pdf)
25. [Watch Your Up-Convolution: CNN Based Generative Deep Neural Networks Are Failing to Reproduce Spectral Distributions (CVPR 2020)](https://openaccess.thecvf.com/content_CVPR_2020/papers/Durall_Watch_Your_Up-Convolution_CNN_Based_Generative_Deep_Neural_Networks_Are_CVPR_2020_paper.pdf)
26. [Image Interpolation and Resampling (Thévenaz, Blu & Unser, Handbook of Medical Imaging)](http://ncorr.com/download/publications/thevanezinterpolation.pdf)
27. [Alias-Free Resampling in Diffusion Models (arXiv 2411.09174)](https://arxiv.org/pdf/2411.09174)

---
*Initially written Sep 29, 2026 · Edited: Oct 15, 2026; Oct 25, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Algorithms and computational methods › Numerical, string, and geometric algorithms › Numerical methods and approximation

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/upsampling

English original: https://www.edgepedia.org/upsampling
