Upsample

Resample · node type · Resize, Upsample

Enlarges a feature map by interpolation, with nothing to learn.

Also called Resize, Interpolate, Nearest-neighbor upsampling, Bilinear

Figure 1. Upsample inside Turn a photo into a mosaic, a real model in WeightSpace. The 2 outlined nodes are Upsample; select any node for its shapes and parameters.

What it does

Resize makes a tensor larger (or smaller) by computing each output pixel from nearby input pixels: copying the nearest one, or blending neighbors linearly or cubically. It has no learned parameters, so it cannot invent detail, but followed by a convolution it is a common replacement for transposed convolution because it avoids checkerboard artifacts. Decoders, feature pyramids and depth or matting heads use it to bring coarse predictions back to full resolution.

Formula

nearest: Y[y, x] = X[⌊y / s⌋, ⌊x / s⌋]bilinear: Y = Σ over the 4 nearest inputs of (1 − |Δy|)(1 − |Δx|) · X

Shapes and parameters

Shapes
Input [N, C, H, W] and a scale per axis (or target sizes); output [N, C, s·H, s·W].
Parameters
None.
Used for
U-Net and U²-Net decoders, feature pyramids in detectors, depth estimation and portrait matting heads, style transfer upsampling layers.

Figure 2. The typed ports of Upsample, in the same format as every model drawing. Letters such as N or C stand for any size.

In WeightSpace

Read-only in WeightSpace today.