Spaces:
Runtime error
Runtime error
Make it run on long videos
Browse files153 unmodified lines154155156157158159160161162163164165166167168169170171172173153 unmodified lineselse:video = video.asnumpy()_, h, w, _ = video.shapevideo = rearrange(video, "f h w c -> f c h w")video = torch.Tensor(video).to(device).to(dtype)# Use max if you want the larger side to be equal to resolution (e.g. 512)# k = float(resolution) / min(h, w)k = float(resolution) / max(h, w)h *= kw *= kh = int(np.round(h / 64.0)) * 64w = int(np.round(w / 64.0)) * 64video = Resize((h, w), interpolation=InterpolationMode.BILINEAR, antialias=True)(video)if normalize:video = video / 127.5 - 1.0return video, output_fps153 unmodified lines154155156157158159160161162163164165166167168169170171172173174175176177178179180181153 unmodified lineselse:video = video.asnumpy()_, h, w, _ = video.shapevideo_resized = []for f in range(video.shape[0]):frame = video[f:f+1, ...]frame = rearrange(frame, "f h w c -> f c h w")frame = torch.Tensor(frame).to(device).to(dtype)# Use max if you want the larger side to be equal to resolution (e.g. 512)# k = float(resolution) / min(h, w)k = float(resolution) / max(h, w)h *= kw *= kh = int(np.round(h / 64.0)) * 64w = int(np.round(w / 64.0)) * 64frame = Resize((h, w), interpolation=InterpolationMode.BILINEAR, antialias=True)(frame)if normalize:frame = frame / 127.5 - 1.0video_resized.append(frame)video = torch.cat(video_resized)return video, output_fps
utils.py+22-14