MCPcopy Create free account
hub / github.com/drinkingcoder/FlowFormer-Official / __init__

Method __init__

evaluate_FlowFormer_tile.py:34–47  ·  view source on GitHub ↗
(self, dims, mode='sintel')

Source from the content-addressed store, hash-verified

32class InputPadder:
33 """ Pads images such that dimensions are divisible by 8 """
34 def __init__(self, dims, mode='sintel'):
35 self.ht, self.wd = dims[-2:]
36 pad_ht = (((self.ht // 8) + 1) * 8 - self.ht) % 8
37 pad_wd = (((self.wd // 8) + 1) * 8 - self.wd) % 8
38 if mode == 'sintel':
39 self._pad = [pad_wd//2, pad_wd - pad_wd//2, pad_ht//2, pad_ht - pad_ht//2]
40 elif mode == 'kitti432':
41 self._pad = [0, 0, 0, 432 - self.ht]
42 elif mode == 'kitti400':
43 self._pad = [0, 0, 0, 400 - self.ht]
44 elif mode == 'kitti376':
45 self._pad = [0, 0, 0, 376 - self.ht]
46 else:
47 self._pad = [pad_wd//2, pad_wd - pad_wd//2, 0, pad_ht]
48
49 def pad(self, *inputs):
50 return [F.pad(x, self._pad, mode='constant', value=0.0) for x in inputs]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected