Flows Utils

class master_thesis.utils.FlowsUtils

Bases: object

Utilities class containing flow-related methods.

static flow_abs_to_relative(flow)

Given a normalized flow between [-1, 1], returns the relative flow between [-2, 2]

Parameters
  • flow – tensor of size (B,F,S,S,2) containing absolute position

  • flows.

Returns

relative dense flow tensor of size (B,F,S,S,2).

Return type

torch.FloatTensor

static flow_relative_to_abs(flow_rel)

Given a relative flow between [-2, 2], returns the absolute flow between [-1, 1]

Parameters
  • flow_rel (torch.FloatTensor) – tensor of size (B,F,S,S,2) containing

  • flows. (relative position) –

Returns

absolute dense flow tensor of size (B,F,S,S,2).

Return type

torch.FloatTensor

static crop_flow(flow, crop_size, crop_position)

Cuts an absolute flow between at the position crop_position.

Parameters
  • flow (torch.FloatTensor) – tensor of size (B,F,H,W,2) containing

  • flows. (absolute position) –

Returns

cropped dense flow tensor of size (B,F,H’,W’,2).

Return type

torch.FloatTensor

static resize_flow(flow, size)
static align_set(x, v, flow)
static interpolate_flow(flow, h_new, w_new)