MCPcopy Create free account
hub / github.com/Francis-Rings/StableAnimator / tensor2vid

Function tensor2vid

animation/utils/utils.py:47–66  ·  view source on GitHub ↗
(video, processor, output_type="np")

Source from the content-addressed store, hash-verified

45 return frames
46
47def tensor2vid(video, processor, output_type="np"):
48 batch_size, channels, num_frames, height, width = video.shape
49 outputs = []
50 for batch_idx in range(batch_size):
51 batch_vid = video[batch_idx].permute(1, 0, 2, 3)
52 batch_output = processor.postprocess(batch_vid, output_type)
53
54 outputs.append(batch_output)
55
56 if output_type == "np":
57 outputs = np.stack(outputs)
58
59 elif output_type == "pt":
60 outputs = torch.stack(outputs)
61
62 elif not output_type == "pil":
63 # raise ValueError(f"{output_type} does not exist. Please choose one of ['np', 'pt', 'pil]")
64 return outputs
65
66 return outputs
67
68
69def get_aligned_face(face_loss_helper, frames, device):

Callers 1

faceid_loss_computeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected