MCPcopy Create free account
hub / github.com/MotrixLab/insactor / get_transl

Function get_transl

tools/demo_utils/diffuse.py:30–51  ·  view source on GitHub ↗
(transl)

Source from the content-addressed store, hash-verified

28
29
30def get_transl(transl):
31 x_beg, y_beg = 0, 0
32 x_ed, y_ed = transl
33
34 x_beg = -0.5 * x_ed
35 y_beg = -0.5 * y_ed
36
37 x_ed = 0.5 * x_ed
38 y_ed = 0.5 * y_ed
39
40 x_mean, x_std, y_mean, y_std = mean[0], std[0], mean[1], std[1]
41
42 x_beg = (x_beg - x_mean) / x_std
43 y_beg = (y_beg - y_mean) / y_std
44
45 x_ed = (x_ed - x_mean) / x_std if x_ed is not None else None
46 y_ed = (y_ed - y_mean) / y_std if y_ed is not None else None
47
48 trans_req = np.stack([x_beg, y_beg, x_ed, y_ed], -1)
49 trans_req = torch.from_numpy(trans_req).cuda().float()
50
51 return trans_req
52
53def infer_motion_diffusion(text, pre_seq, transl, motion_length):
54 print('start diffusion!')

Callers 1

infer_motion_diffusionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected