chainer.functions.resize_images(x, output_shape, *, mode='bilinear', align_corners=True)[source]

Resize images to the given shape.

This function resizes 2D data to output_shape.

Notation: here is a notation for dimensionalities.

  • \(n\) is the batch size.

  • \(c_I\) is the number of the input channels.

  • \(h\) and \(w\) are the height and width of the input image, respectively.

  • \(h_O\) and \(w_O\) are the height and width of the output image.

  • x (Variable or N-dimensional array) – Input variable of shape \((n, c_I, h, w)\).

  • output_shape (tuple) – This is a tuple of length 2 whose values are (h_O, w_O). Note that the order of height and width is opposite of the one in OpenCV.

  • mode ({'bilinear', 'nearest'}) – Defines the sampling rule.

  • align_corners (bool) – When this value is True, the corners of the input are mapped to the corners of the output. When False, the behavior is the same as OpenCV.


Resized image whose shape is \((n, c_I, h_O, w_O)\).

Return type