概述
现代方法使用神经网络来估计每个像素的运动方式,然后对相邻帧进行变形和融合。同样的理念也为游戏中的慢动作工具、帧率转换器和帧生成提供支持。
主要要点
- 视频帧插值通过在现有帧之间创建新帧来实现,通常是通过估计运动并将相邻帧向目标时间进行变形(warping)。
- Super SloMo (CVPR 2018) 将双向光流与可见性图相结合,能够生成任意数量的中间帧。
- RIFE (ECCV 2022) 直接估计中间光流,其作者报告称其速度比 Super SloMo 和 DAIN 快 4 到 27 倍。
- NVIDIA 于 2022 年 9 月发布的 DLSS 3 帧生成技术,将相同的理念实时应用于 RTX 40 系列 GPU 的游戏中。
- 插值帧是预测结果,因此它们在面对剧烈运动、遮挡和细小物体时会失效,并且不会增加任何新的真实信息。
深入探讨
Video frame interpolation (VFI) means synthesizing frames that were never filmed. Given frame A at time 0 and frame B at time 1, the goal is a believable frame at some time t in between, often t = 0.5 for doubling the frame rate. The simplest approaches either repeat a frame or blend A and B, but blending produces ghosted double images whenever something moves. Learned interpolation instead tries to work out where each object would be at time t and draw it there, which is why it can produce smooth slow motion from footage recorded at normal speed.
Most modern methods rely on optical flow, a map that gives every pixel a motion vector showing where it moves between two frames. A typical flow-based pipeline works in four steps. First, estimate flow between A and B in both directions. Second, scale and combine those flows to approximate the flow from the unknown middle frame back to each input. Third, warp, meaning resample, A and B along those flows so both line up with time t. Fourth, fuse the two warped images with weights that say which input to trust at each pixel, because some pixels are hidden in one frame and visible in the other, a problem called occlusion. A refinement network then fixes remaining errors.
NVIDIA's Super SloMo, presented at CVPR 2018, is the clearest example of this design. One U-Net, a common encoder-decoder image network, estimates the bidirectional flow; the flows are linearly combined for each time step; and a second U-Net refines the flows and predicts soft visibility maps that exclude occluded pixels before fusion. Because none of its learned parameters depend on time, it can produce any number of intermediate frames. It was trained on 1,132 clips recorded at 240 frames per second, about 300,000 frames, where real intermediate frames provide the ground truth.
A second family skips explicit flow. Kernel-based methods predict, for every output pixel, a small filter that is applied to patches of the two input frames. Niklaus, Mai and Liu's adaptive separable convolution (ICCV 2017) replaced large 2D kernels with pairs of 1D kernels, cutting the parameters needed to handle large motion and allowing a whole frame to be generated in one pass, which in turn made it practical to train with a perceptual loss. Kernel methods handle some effects that flow struggles with, but their reach is limited by kernel size.
Later work focused on speed and large motion. RIFE, accepted to ECCV 2022, estimates intermediate flow directly with a network called IFNet instead of computing two-way flow and then approximating, and its authors report it is 4 to 27 times faster than Super SloMo and DAIN while scoring better. FILM, from Google Research at ECCV 2022, targets large motion between near-duplicate photos with a multi-scale feature extractor that shares weights across scales, needs no pretrained flow or depth networks, and uses a Gram matrix loss to keep results sharp; it reports leading results on the Xiph large-motion benchmark. In September 2022 NVIDIA brought the idea to games with DLSS 3, which uses current and prior frames, hardware optical flow and engine data such as motion vectors and depth to generate a whole new frame.
The main alternatives are capture and rendering. Filming at a higher frame rate gives true intermediate frames but needs a capable camera and more light. In games, rendering more frames costs GPU time, which is why frame generation is attractive. Simple frame repetition or blending costs almost nothing but either stutters or ghosts on motion. Generative video models can also create in-between frames, and LDMVFI (AAAI 2024) explicitly frames interpolation as conditional generation with a latent diffusion model.
Interpolation fails in predictable ways. Fast or large motion breaks flow estimation and produces smearing or tearing. Occlusions, transparent or reflective surfaces, repeating textures, motion blur, scene cuts and flickering lights confuse the motion model. Thin objects such as fences and spokes often break apart. Interpolated frames also add no new information: a generated frame is a guess, so it should not be treated as evidence in forensic or scientific footage. In games, a generated frame cannot react to the newest input, which is why NVIDIA pairs DLSS 3 with its Reflex latency-reduction technology. Evaluation is also tricky: the LDMVFI authors argue that common pixel metrics such as L1 and L2 distance are poor indicators of how good an interpolated frame looks.
In practice, open-source models run on consumer GPUs. RIFE's repository reports more than 30 fps for 2x interpolation of 720p video on an RTX 2080 Ti and offers simple options such as --exp=1 for 2x and --exp=2 for 4x output. FILM's repository lists CUDA 11.2.1 and cuDNN 8.1.0 as tested versions, can split high-resolution frames into patches, and writes interpolated frames and an MP4. Training a model from scratch requires high-frame-rate video so that real middle frames can be held out as targets. DLSS 3 frame generation, by contrast, is limited by NVIDIA to RTX 40 Series hardware.
04工作示例
使用 RIFE 将剪辑的帧率翻倍
克隆 ECCV2022-RIFE 存储库,安装其要求并下载预训练模型文件,如其自述文件所述。
选择一个中等运动的 30 fps 短剪辑,例如一个人在行走,并将其另存为 video.mp4。
运行 python inference_video.py --exp=1 --video=video.mp4 以 60 fps 生成 2x 版本。
使用 --exp=2 再次运行它以生成 4x 版本进行比较。
逐帧浏览输出并标记生成的帧显示重影、拉伸或破碎的薄物体的位置。
对具有快速平移或场景剪切的剪辑重复此操作,以查看运动模型在哪里失败。
它显示了什么
学习者可以获得更流畅的 60 fps 和 120 fps 版本的剪辑以及失败案例列表。要客观地检查质量,请丢弃真实 60 fps 剪辑的每一秒帧,将其插回并使用 PSNR 或 SSIM 将生成的帧与保留的原始帧进行比较。
现实世界的实施
NVIDIA 的 DLSS 3 于 2022 年 9 月推出,适用于 GeForce RTX 40 系列卡,可使用先前帧和当前帧、硬件光流场和引擎运动矢量在渲染的游戏帧之间生成整个额外帧。
Google Research 的 FILM 在 ECCV 2022 上发布,将两张近乎重复的照片变成一个简短的慢动作剪辑,并在 Apache-2.0 许可下作为开源 TensorFlow 代码发布。
开源 RIFE 模型在 Flowframes、SVP 和 Autodesk Flame 等工具内部使用,以提高视频帧速率,其作者报告称,在 RTX 2080 Ti 上,每秒 30 帧以上,可将 720p 视频翻倍。
NVIDIA 的 Super SloMo 在 CVPR 2018 上展示,它接受了以每秒 240 帧拍摄的 1,132 个剪辑的训练,可以产生任意数量的中间帧,将普通镜头变成慢动作。
FILM 的命令行工具将连拍照片文件夹转换为平滑剪辑:每个额外通道都会使中间帧加倍,为 n 个通道提供 (2^n + 1) x (帧 - 1) 个输出帧,写入图像和 MP4。
视频帧插值的未来
Two trends are visible in recent research. First, interpolation is converging with video generation. LDMVFI, accepted at AAAI 2024, treats interpolation as conditional generation with a latent diffusion model and reports better perceptual quality than earlier methods in quantitative tests and a user study. Second, real-time frame generation has moved into consumer products: NVIDIA's DLSS 3, announced in September 2022, generates whole frames in games on dedicated hardware. Open problems remain. Very large motion, occlusion and thin structures still cause visible errors, which is why FILM's 2022 paper focused on large-motion benchmarks. Evaluation is unsettled, since pixel metrics such as PSNR and L1 can disagree with human judgments of sharpness and plausibility, as the LDMVFI authors argue. Latency is a constraint for interactive use, because generating a frame between two rendered ones means waiting for the second. There are also questions of trust. As generated frames become harder to spot, footage used for journalism, science or legal evidence may need clear labeling of which frames were captured and which were synthesized. How such provenance will be recorded is still being worked out across the industry.
付诸实践
为什么这很重要
- 速度与规模. 视觉人工智能可以大规模自动化检查、检测和标记任务。
- 构建选择. 创意团队可以通过更少的手动修改更快地构建概念原型。
- 团队与工作流程. 操作可以使用以前难以处理的图像和视频信号。
留意
- 如果出处不明,肖像权和同意可能会成为法律风险。
- 模型性能可能因光照、人口统计和环境的不同而有所不同。
- 除非监控置信阈值,否则误报可能会被忽视。
后续步骤
- 定义精确度、召回率和错误成本的接受标准。
- 使用符合实际生产条件的数据进行测试。
- 为低置信度或高影响力的预测添加人工审核。
- 跟踪模型漂移并在相机或数据集更改后重新验证。
资料来源与延伸阅读
- arXiv (CVPR 2018)Super SloMo:用于视频插值的多个中间帧的高质量估计
- arXiv (ICCV 2017)通过自适应可分离卷积进行视频帧插值
- arXiv (ECCV 2022)视频帧插值的实时中间流估计
- GitHubECCV2022-RIFE 存储库
- arXiv (ECCV 2022)电影:大运动的帧插值
- Google Research on GitHubFILM:大运动帧插值(官方代码)
- NVIDIANVIDIA DLSS 3:人工智能驱动的性能倍增器将帧速率提高高达 4 倍
- arXiv (AAAI 2024)LDMVFI:使用潜在扩散模型的视频帧插值
不断探索
常见问题
什么是视频帧插值?
视频帧插值是在视频的两个现有帧之间创建新帧的任务,以便素材可以更流畅地播放或以慢动作播放。现代方法使用神经网络来估计每个像素如何移动,然后扭曲和混合相邻帧。同样的想法也适用于游戏中的慢动作工具、帧速率转换器和帧生成。
视频帧插值为视频剪辑添加了什么?
帧插值在现有帧之间合成合理的中间帧,平滑运动或实现慢动作播放。
为什么插值不能简单地平均(混合)两个相邻帧?
由于对象在帧之间移动,简单的混合会产生重影;插值器必须考虑运动,以便在中间时间正确放置对象。
帧插值中的光流是什么?
光流估计帧之间每个像素的运动,允许模型将内容扭曲到正确的中间位置。
为什么像 DAIN 这样的模型要包含深度信息?
深度感知使模型能够解决变形过程中的遮挡问题,因此较近的物体可以正确地与远处的物体重叠,从而减少伪影。
“去遮挡”是指插值中的挑战是什么?
随着对象移动,之前隐藏的背景变得可见并且必须进行合成,因为它没有完全存在于两个输入帧中。