MCPcopy
hub / github.com/OpenMotionLab/MotionGPT / upsample

Function upsample

mGPT/utils/temos_utils.py:112–125  ·  view source on GitHub ↗
(motion, last_framerate, new_framerate)

Source from the content-addressed store, hash-verified

110
111# TODO: use a real upsampler..
112def upsample(motion, last_framerate, new_framerate):
113 step = int(new_framerate / last_framerate)
114 assert step >= 1
115
116 # Alpha blending => interpolation
117 alpha = np.linspace(0, 1, step + 1)
118 last = np.einsum("l,...->l...", 1 - alpha, motion[:-1])
119 new = np.einsum("l,...->l...", alpha, motion[1:])
120
121 chuncks = (last + new)[:-1]
122 output = np.concatenate(chuncks.swapaxes(1, 0))
123 # Don't forget the last one
124 output = np.concatenate((output, motion[[-1]]))
125 return output
126
127
128if __name__ == "__main__":

Callers 1

temos_utils.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected