EMA-VFI
EMA-VFI (Zhang et al., CVPR 2023; large and small, for the middle frame or any time): makes the frame between two video frames from motion and appearance features that inter-frame attention extracts together, for slow motion and higher frame rates. Apache-2.0 code and weights.
experimental Fork of MCG-NJU/EMA-VFI@75b6f6a · backends: portable, kernels
- Paper Extracting Motion and Appearance via Inter-Frame Attention for Efficient Video Frame Interpolation CVPR 2023 · first released 1 Mar 2023
Paper 2023 Added in 0.2.0 Evaluated with 0.2.0
Use it
pip install fastforks Lean install with only what this model needs: pip install fastforks-core
from fastforks import interpolation
model = interpolation.load("ema-vfi") # kernels on a supported GPU, else portable PyTorch
result = model(frame1, frame2)
result.frame
result.backend # what ran: mode, device, dtype, kernels fastforks bench ema-vfi Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.
Speed and memory
Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | not measured | – | – | – | – |
| Original fp16torch.autocast(float16) around the call; upstream MultiScaleFlow as Model.inference (no TTA), timestep 0.5, BGR, replicate pad to 32 | fp16 | 296 | – | 3,940 MiB/4,290 MiB | 1.2 | 0.34 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 233 | 1.3× | 2,827 MiB/3,184 MiB | 0.8 | 0.23 |
| Kernels | fp16 | 207 | 1.4× | 368 MiB/3,566 MiB | 0.8 | 0.21 |
| Portable + torch.compile | 165 | 1.8× | 3,325 MiB/3,542 MiB | 91 (build) | – | |
| TensorRT fp16 | fp16 | 124 | 2.4× | 1,426 MiBenginenot comparable | 91 (build) | – |
Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-14 to 2026-11-16. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two
times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.
Other devices
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14 | Original | fp32 | 36849 | 10.4 GiB process | – | 1080x1920 |
| Portable | fp16 | 1981 | 6,883 MiB process | matches | 1080x1920 | |
| Portable | fp32 | 19632 | 11.3 GiB process | matches | 1080x1920 | |
| Kernels | fp16 | not implemented | – | 1080x1920 | ||
CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.
Licence and weights
Commercial use allowed
Our reading of the licences, not legal advice.
Weights
ema-vfi-ours.pkl 264 MB· hosted on Google Drivefastforks downloads and checks these files on first use (fastforks download ema-vfi).
Accuracy
The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.
DAVIS 2017 480p
2 frame triplets per video (180), PSNR / SSIM
| Run | dtype | psnr ↑ | ssim ↑ | Δ psnr vs fp32 original | triplets | ms / triplet |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 27.67 | 0.8119 | reference | 180 | – |
| Original fp16 | fp16 | 27.67 | 0.8119 | ±0.00 | 180 | – |
| Portable fp32 | not measured | |||||
| Portable | fp16 | 27.67 | 0.8119 | ±0.00 | 180 | – |
| Kernels | fp16 | 27.67 | 0.8119 | ±0.00 | 180 | – |
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 for the 180-triplet benchmark. Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-14; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks d199e94c, 2026-11-14.
Closeness to the original
Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. 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).
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.00005 | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.001 | 0.00018 |
| GPU default dtypes, p99 |diff| | ≤ 0.005 | 0.00062 |
Recorded for ema-vfi on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-14, with these kernels: cudnn_hacc
Details
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].
- Input / output
- 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]. - Input size
- any H x W >= 32, padded to a multiple of 32; tested up to 1988x2880 (7,625 MiB allocated)
- Options
cuda_graphs=truetta=false· changes the output
- Outputs
frame- CUDA kernels
cudnn_haccconvolutions with fp16 accumulation (cuDNN)
- Apple (MPS)
- fp32, fp16
Limitations
- Kernels keep CUDA graphs: their private pool and static outputs stay reserved, so peak reserved is ~670 (480x854) / 3200 (1080x1920) MiB above portable (peak allocated is not); `cuda_graphs=false` or `release_graphs()` frees it.
Full reference, generated from the repository
EMA-VFI (Zhang et al., CVPR 2023; large and small, for the middle frame or any time): makes the frame between two video frames from motion and appearance features that inter-frame attention extracts together, for slow motion and higher frame rates. Apache-2.0 code and weights.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
ema-vfi | synthetic (1080x1920) | original portable kernels portable + torch.compile TensorRT fp16 | 296 233 207 165 124 | 3940 / 4290 2827 / 3184 368 / 3566 3325 / 3542 1719 / 1786 |
ema-vfi-small | synthetic (1080x1920) | original portable kernels portable + torch.compile TensorRT fp16 | 121 89.4 84.4 59.6 43.7 | 2272 / 2384 1614 / 1792 271 / 1914 1809 / 1890 1018 / 1110 |
ema-vfi-t | synthetic (1080x1920) | original portable kernels portable + torch.compile TensorRT fp16 | 287 233 207 165 125 | 3940 / 4290 2827 / 3184 368 / 3566 3325 / 3702 1719 / 1766 |
ema-vfi-small-t | synthetic (1080x1920) | original portable kernels portable + torch.compile TensorRT fp16 | 114 89.4 84.3 59.8 43.4 | 2272 / 2384 1614 / 1792 271 / 1914 1809 / 1890 1018 / 1110 |
Details
- Original code: https://github.com/MCG-NJU/EMA-VFI at
75b6f6a889e6 - Code licence: Apache-2.0 (permissive); files:
LICENSE - Weights licence: Apache-2.0
- 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)
- Training data: Vimeo-90K (septuplets / triplets for frame interpolation) (README: the fixed-time models train on Vimeo-90K triplets (train.py); the arbitrary-time
_tmodels are evaluated on 4x / 8x benchmarks, their training data is not stated (the paper: Vimeo-90K septuplets).) - Options:
cuda_graphs= True (speed only),tta= False - Kernel libraries:
cudnn_hacc - Variants:
ema-vfi,ema-vfi-small,ema-vfi-t,ema-vfi-small-t - Outputs: frame
- Input size: any H x W >= 32, padded to a multiple of 32
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
ema-vfi1988x2880 (7.4 GiB peak allocated, 9.1 reserved);ema-vfi-small3000x4000 (8.9 GiB peak allocated, 11.4 reserved);ema-vfi-t1988x2880 (7.4 GiB peak allocated, 9.1 reserved);ema-vfi-small-t3000x4000 (8.9 GiB peak allocated, 11.4 reserved) ema-vfi1080x1920, first call: portable + torch.compile 91 s (cold Inductor cache), TensorRT fp16 91 s (ONNX + engine).ema-vfi-small1080x1920, first call: portable + torch.compile 79 s (cold Inductor cache), TensorRT fp16 68 s (ONNX + engine).ema-vfi-t1080x1920, first call: portable + torch.compile 85 s (cold Inductor cache), TensorRT fp16 92 s (ONNX + engine).ema-vfi-small-t1080x1920, first call: portable + torch.compile 78 s (cold Inductor cache), TensorRT fp16 69 s (ONNX + engine).ema-vfioriginal 1080x1920: torch.autocast(float16) around the call; upstream MultiScaleFlow as Model.inference (no TTA), timestep 0.5, BGR, replicate pad to 32ema-vfi-smalloriginal 1080x1920: torch.autocast(float16) around the call; upstream MultiScaleFlow as Model.inference (no TTA), timestep 0.5, BGR, replicate pad to 32ema-vfi-toriginal 1080x1920: torch.autocast(float16) around the call; upstream MultiScaleFlow as Model.inference (no TTA), timestep 0.5, BGR, replicate pad to 32ema-vfi-small-toriginal 1080x1920: torch.autocast(float16) around the call; upstream MultiScaleFlow as Model.inference (no TTA), timestep 0.5, BGR, replicate pad to 32ema-vfiload / first call: original 2.69 s / 0.5 s, portable 0.83 s / 0.234 s, kernels 0.81 s / 0.207 sema-vfi-smallload / first call: original 0.36 s / 0.179 s, portable 0.27 s / 0.09 s, kernels 0.56 s / 0.085 sema-vfi-tload / first call: original 2.77 s / 0.495 s, portable 0.73 s / 0.398 s (480x854), kernels 1.18 s / 0.359 s (480x854)ema-vfi-small-tload / first call: original 1.05 s / 0.175 s, portable 0.28 s / 0.437 s (480x854), kernels 0.56 s / 0.348 s (480x854)- Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5
Measured
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 for the 180-triplet benchmark. 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
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).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
ema-vfi | 0.00018 / 0.00062 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400 |
ema-vfi-small | 0.00018 / 0.00058 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400 |
ema-vfi-t | 0.0002 / 0.00082 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400 |
ema-vfi-small-t | 0.00019 / 0.00065 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400 |
Limitations
- Kernels keep CUDA graphs: their private pool and static outputs stay reserved, so peak reserved is ~670 (480x854) / 3200 (1080x1920) MiB above portable (peak allocated is not);
cuda_graphs=falseorrelease_graphs()frees it.
Example output
No example rendered for this checkpoint yet.