MCPcopy
hub / github.com/dunnousername/yanderifier / process

Function process

yanderify/yanderify.py:165–179  ·  view source on GitHub ↗
(frame)

Source from the content-addressed store, hash-verified

163 kp_driving_initial = kp_detector(driving[:, :, 0])
164
165 def process(frame):
166 driving_frame = torch.tensor(np.array(frame)[np.newaxis][np.newaxis].astype(np.float32)).permute(0, 4, 1, 2, 3)[:, :, 0]
167 if not cpu:
168 driving_frame = driving_frame.cuda()
169 kp_driving = kp_detector(driving_frame)
170 kp_norm = normalize_kp(kp_source=kp_source, kp_driving=kp_driving,
171 kp_driving_initial=kp_driving_initial, use_relative_movement=relative,
172 use_relative_jacobian=relative, adapt_movement_scale=adapt_movement_scale)
173 out = generator(source, kp_source=kp_source, kp_driving=kp_norm)
174 del driving_frame
175 del kp_driving
176 del kp_norm
177 result = np.transpose(out['prediction'].data.cpu().numpy(), [0, 2, 3, 1])[0]
178 del out
179 return result
180
181 yield process(first)
182 for frame in driving_generator:

Callers 1

make_animation_modifiedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected