🚀 🤖 多輸入ResShift擴散視頻幀插值(Multi‑Input ResShift Diffusion VFI)
多輸入ResShift擴散視頻幀插值模型主要用於視頻幀插值任務,能夠在動畫、視頻等場景中,根據已有幀生成中間幀,同時還支持不確定性估計,為視頻處理提供了更豐富的功能和更準確的結果。
🚀 快速開始
環境搭建
首先,直接從GitHub下載源代碼:
git clone https://github.com/VicFonch/Multi-Input-Resshift-Diffusion-VFI.git
創建一個conda環境並安裝所有依賴項:
conda create -n multi-input-resshift python=3.12
conda activate multi-input-resshift
pip install -r requirements.txt
⚠️ 重要提示
請確保你的系統與 CUDA 12.4 兼容。如果不兼容,請根據你當前的CUDA版本安裝 CuPy。
推理示例
import os
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
from torchvision.transforms import Compose, ToTensor, Resize, Normalize
from utils.utils import denorm
from model.hub import MultiInputResShiftHub
model = MultiInputResShiftHub.from_pretrained("vfontech/Multiple-Input-Resshift-VFI").cuda()
model.eval()
img0_path = r"_data\example_images\frame1.png"
img2_path = r"_data\example_images\frame3.png"
mean = std = [0.5]*3
transforms = Compose([
Resize((256, 448)),
ToTensor(),
Normalize(mean=mean, std=std),
])
img0 = transforms(Image.open(img0_path).convert("RGB")).unsqueeze(0).cuda()
img2 = transforms(Image.open(img2_path).convert("RGB")).unsqueeze(0).cuda()
tau = 0.5
img1 = model.reverse_process([img0, img2], tau)
plt.figure(figsize=(10, 5))
plt.subplot(1, 3, 1)
plt.imshow(denorm(img0, mean=mean, std=std).squeeze().permute(1, 2, 0).cpu().numpy())
plt.subplot(1, 3, 2)
plt.imshow(denorm(img1, mean=mean, std=std).squeeze().permute(1, 2, 0).cpu().numpy())
plt.subplot(1, 3, 3)
plt.imshow(denorm(img2, mean=mean, std=std).squeeze().permute(1, 2, 0).cpu().numpy())
plt.show()
📄 許可證
本項目採用MIT許可證。
屬性 |
詳情 |
模型類型 |
PyTorch模型 |
標籤 |
pytorch_model_hub_mixin、animation、video-frame-interpolation、uncertainty-estimation |
任務類型 |
圖像到圖像 |