Shortcuts

mmagic.models.utils.flow_warp

Module Contents

Functions

flow_warp(x, flow[, interpolation, padding_mode, ...])

Warp an image or a feature map with optical flow.

mmagic.models.utils.flow_warp.flow_warp(x, flow, interpolation='bilinear', padding_mode='zeros', align_corners=True)[source]

Warp an image or a feature map with optical flow.

Parameters
  • x (Tensor) – Tensor with size (n, c, h, w).

  • flow (Tensor) – Tensor with size (n, h, w, 2). The last dimension is a two-channel, denoting the width and height relative offsets. Note that the values are not normalized to [-1, 1].

  • interpolation (str) – Interpolation mode: ‘nearest’ or ‘bilinear’. Default: ‘bilinear’.

  • padding_mode (str) – Padding mode: ‘zeros’ or ‘border’ or ‘reflection’. Default: ‘zeros’.

  • align_corners (bool) – Whether align corners. Default: True.

Returns

Warped image or feature map.

Return type

Tensor

Read the Docs v: latest
Versions
latest
stable
0.x
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.