EMA-VFI (fastforks)
EMA-VFI (Zhang et al., CVPR 2023): video frame interpolation with inter-frame attention. A hybrid CNN and Transformer backbone; in its two window-attention stages (1/16 and 1/32 of the image) each frame attends to the other, and the attention map gives both the appearance features and motion features (the attention-weighted pixel offsets). Two heads estimate the flow to both frames and a fusion mask, a U-Net refines the blend of both warped frames. ema-vfi and ema-vfi-small are trained for the middle frame, ema-vfi-t and ema-vfi-small-t for any time in [0, 1].
This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/MCG-NJU/EMA-VFI at 75b6f6a889e6.
Task: interpolation. Tier: experimental. Outputs: frame. Backends: portable, kernels.
Input: two RGB images (consecutive frames). Output: the frame between them at timestep (0.5 by default; 0 = the first, 1 = the second), RGB in [0, 1].
Variants
Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|---|---|---|---|---|
ema-vfi@1 |
ema-vfi-ours.pkl | f9085bb32d8b |
Apache-2.0 | yes |
ema-vfi-small@1 |
ema-vfi-ours_small.pkl | ef0e455a7fe7 |
Apache-2.0 | yes |
ema-vfi-small-t@1 |
ema-vfi-ours_small_t.pkl | ad845671f725 |
Apache-2.0 | yes |
ema-vfi-t@1 |
ema-vfi-ours_t.pkl | c09e82d193e3 |
Apache-2.0 | yes |
Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Licence files: LICENSE.
Training data: Vimeo-90K (septuplets / triplets for frame interpolation) (README: the fixed-time models train on Vimeo-90K triplets (train.py); the arbitrary-time _t models are evaluated on 4x / 8x benchmarks, their training data is not stated (the paper: Vimeo-90K septuplets).).
Licence evidence: https://github.com/MCG-NJU/EMA-VFI/blob/75b6f6a889e695df875e103374040d47a4cfac7c/LICENSE ; https://github.com/MCG-NJU/EMA-VFI/blob/75b6f6a889e695df875e103374040d47a4cfac7c/README.md (checkpoints: https://drive.google.com/drive/folders/16jUa3HkQ85Z5lb5gce1yoaWkP-rdCd0o)
Input size
any H x W >= 32, padded to a multiple of 32
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): ema-vfi 1988x2880 (7.4 GiB peak allocated, 9.1 reserved); ema-vfi-small 3000x4000 (8.9 GiB peak allocated, 11.4 reserved); ema-vfi-small-t 3000x4000 (8.9 GiB peak allocated, 11.4 reserved); ema-vfi-t 1988x2880 (7.4 GiB peak allocated, 9.1 reserved)
Speed and memory
Interpolation, synthetic, 1080x1920
| model | time (ms): original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
|---|---|---|---|---|---|---|---|---|
ema-vfi |
296 | 234 | 207 | 1.4x | 1.1x | 3940 / 4290 | 2827 / 3204 | 3129 / 4152 |
ema-vfi-small |
121 | 89.5 | 84.5 | 1.4x | 1.1x | 2272 / 2384 | 1614 / 1792 | 1660 / 2178 |
ema-vfi-small-t |
114 | 89.4 | 84.5 | 1.3x | 1.1x | 2272 / 2384 | 1614 / 1792 | 1660 / 2178 |
ema-vfi-t |
287 | 233 | 207 | 1.4x | 1.1x | 3940 / 4290 | 2827 / 3184 | 3129 / 4152 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
ema-vfi |
2.69 | 0.73 | 0.74 | 0.50 | 0.23 | 0.21 |
ema-vfi-small |
0.36 | 0.27 | 0.58 | 0.18 | 0.09 | 0.09 |
ema-vfi-small-t |
1.05 | 0.28 (480x854) | 0.56 (480x854) | 0.17 | 0.43 (480x854) | 0.35 (480x854) |
ema-vfi-t |
2.77 | 0.90 (480x854) | 0.74 (480x854) | 0.49 | 0.68 (480x854) | 0.39 (480x854) |
torch.compile and TensorRT
| model | input | time: portable | compile | TensorRT fp16 | kernels | preparation: compile (cold first call) | ONNX + engine build | peak MiB (alloc / reserved): portable | compile | kernels | TensorRT (engine + torch) |
|---|---|---|---|---|---|---|---|---|---|---|---|
ema-vfi |
1080x1920 | 234 ms | 165 ms | 124 ms | 207 ms | 90.6 s | 90.9 s | 2827 / 3204 | 3325 / 3542 | 3129 / 4152 | 1719 / 1786 |
ema-vfi-small |
1080x1920 | 89.5 ms | 59.6 ms | 43.7 ms | 84.5 ms | 78.5 s | 67.6 s | 1614 / 1792 | 1809 / 1890 | 1660 / 2178 | 1018 / 1110 |
ema-vfi-small-t |
1080x1920 | 89.4 ms | 59.8 ms | 43.4 ms | 84.5 ms | 77.9 s | 68.8 s | 1614 / 1792 | 1809 / 1890 | 1660 / 2178 | 1018 / 1110 |
ema-vfi-t |
1080x1920 | 233 ms | 165 ms | 125 ms | 207 ms | 84.6 s | 91.5 s | 2827 / 3184 | 3325 / 3702 | 3129 / 4152 | 1719 / 1766 |
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.
Accuracy
On public datasets
DAVIS 2017 trainval 480p (JPEG), frames 0 / 2 and 20 / 22 of each of the 90 videos give the frame 1 / 21 at time 0.5, compared with the real one: PSNR and SSIM (Gaussian 11 x 11, sigma 1.5) of the output rounded to uint8, on RGB in [0, 1], averaged over the triplets. Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | kernels | note |
|---|---|---|---|---|---|---|
ema-vfi |
DAVIS 2017 480p, 2 frame triplets per video (180), PSNR / SSIM | 27.67 / 0.8119 | 27.67 / 0.8119 | 27.67 / 0.8119 | 27.67 / 0.8119 | |
ema-vfi-small |
DAVIS 2017 480p, 2 frame triplets per video (180), PSNR / SSIM | 27.44 / 0.8043 | 27.44 / 0.8043 | 27.44 / 0.8043 | 27.44 / 0.8043 | |
ema-vfi-t |
DAVIS 2017 480p, 2 frame triplets per video (180), PSNR / SSIM | 29.07 / 0.8568 | 29.07 / 0.8567 | 29.07 / 0.8567 | 29.07 / 0.8567 | |
ema-vfi-small-t |
DAVIS 2017 480p, 2 frame triplets per video (180), PSNR / SSIM | 28.65 / 0.8461 | 28.65 / 0.8461 | 28.65 / 0.8461 | 28.65 / 0.8461 |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks d199e94c, 2026-11-14.
Parity with the original code
Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 5e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.001 and p99 <= 0.005 (absolute error of the output frame).
Usage
from fastforks import interpolation
model = interpolation.load("ema-vfi") # mode="auto": the preferred backend from recorded measurements
result = model("frame1.png", "frame2.png") # timestep=0.5: the middle frame
result.frame # [3, H, W] float32 RGB in [0, 1], input resolution
result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: ema-vfi, ema-vfi-small, ema-vfi-small-t, ema-vfi-t.
Kernels backend
interpolation.load("ema-vfi", mode="kernels") runs our CUDA kernels (cudnn_hacc). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.