(video, processor, output_type="np")
| 45 | return frames |
| 46 | |
| 47 | def 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 | |
| 69 | def get_aligned_face(face_loss_helper, frames, device): |
no outgoing calls
no test coverage detected