VideoScore2

提供商TIGER-Lab
分类visual-question-answering
许可证apache-2.0
下载量223
星标0

简介

VideoScore2 是一款由 TIGER-Lab 推出的视频质量评估模型,旨在解决视频生成领域中“好坏难量化”的痛点。不同于传统的单一指标,它能像人类一样感知视频的视觉质量和时间连续性,为 AI 生成视频提供客观的打分参考。对于开发者而言,它不仅可以用作模型训练的奖励函数(Reward Model)来优化生成效果,也可以在自动化筛选视频素材时替代人工审核,上手门槛较低,是构建视频生成管线中不可或缺的评价工具。

核心亮点

  • 精准量化视频视觉质量与流畅度
  • 可作为 RLHF 阶段的奖励模型优化生成
  • 替代人工打分,实现视频素材自动化筛选
  • Apache-2.0 协议,对商业应用非常友好

使用方法

安装依赖
# 安装 Hugging Face transformers
pip install transformers torch
SDK 使用
# 使用 transformers 加载模型
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("TIGER-Lab/VideoScore2")
tokenizer = AutoTokenizer.from_pretrained("TIGER-Lab/VideoScore2")

Hugging Face 下载

我们推荐使用命令行或者 Hugging Face Hub SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 huggingface_hub:

操作指引
pip install -U huggingface_hub

命令行下载

下载完整模型库

下载完整模型库
huggingface-cli download TIGER-Lab/VideoScore2

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
huggingface-cli download TIGER-Lab/VideoScore2 config.json --local-dir ./dir

更多命令行下载选项,可参见官方文档

SDK 下载

SDK 下载
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('TIGER-Lab/VideoScore2')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://huggingface.co/TIGER-Lab/VideoScore2

如果您希望跳过 lfs 大文件下载,可以使用如下命令

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/TIGER-Lab/VideoScore2

模型文件托管在 Hugging Face Hub,使用 HF CLI / SDK / Git 直接下载,不经过本站。

PyTorch / Transformers 使用

安装 Transformers

安装 Transformers
pip install -U transformers torch

模型加载和推理

模型加载和推理
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('TIGER-Lab/VideoScore2')
tokenizer = AutoTokenizer.from_pretrained('TIGER-Lab/VideoScore2')

模型下载

我们推荐使用命令行或者 ModelScope SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 ModelScope:

操作指引
pip install modelscope

命令行下载

下载完整模型库

下载完整模型库
modelscope download --model TIGER-Lab/VideoScore2

下载单个文件到指定本地文件夹(以下载 README.md 到当前路径下 dir 目录为例)

下载单个文件到指定本地文件夹(以下载 README.md 到当前路径下 dir 目录为例)
modelscope download --model TIGER-Lab/VideoScore2 README.md --local_dir ./dir

更多更丰富的命令行下载选项,可参见具体文档

SDK 下载

SDK 下载
# 模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('TIGER-Lab/VideoScore2')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://www.modelscope.cn/TIGER-Lab/VideoScore2.git

如果您希望跳过 lfs 大文件下载,可以使用如下命令

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/TIGER-Lab/VideoScore2.git

ModelScope 模型页直接下载模型文件;无需将模型文件放在本站服务器。

Notebook 快速开发

下载并安装 ModelScope library

下载并安装 ModelScope library
pip install "modelscope[audio,cv,nlp,multi-modal,science]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

模型加载和推理

模型加载和推理
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

p = pipeline('text-generation', 'TIGER-Lab/VideoScore2')

完整文档

来源: HuggingFace

---
license: apache-2.0
datasets:

  • TIGER-Lab/VideoFeedback2

language:
  • en

metrics:
  • accuracy

  • pearsonr

base_model:
  • Qwen/Qwen2.5-VL-7B-Instruct

pipeline_tag: visual-question-answering
---

📃Paper |
🌐Website |
💻Code |
🛢️Dataset (VideoFeedback2) |
🤗Model (VideoScore2) |
🤗Space (VideoScore2)

🤔Ablation1: SFT-only |
🤔Ablation2: SFT-w/o-CoT |
🤔Ablation3: RL-w/o-SFT

!VideoScore

Introduction

We present VideoScore2, a multi-dimensional, interpretable, and human-aligned framework that explicitly evaluates visual quality, text-to-video alignment, and physical/common-sense consistency while producing detailed chain-of-thought rationales.

Our model is trained on a large-scale dataset VideoFeedback2 containing 27,168 human-annotated videos with both scores and reasoning traces across three dimensions, using a two-stage pipeline of supervised fine-tuning followed by reinforcement learning with Group Relative Policy Optimization (GRPO) to enhance analytical robustness.

Extensive experiments demonstrate that VideoScore2 achieves superior performance with 44.35 (+5.94) accuracy on our in-domain benchmark VideoScore-Bench-v2 and 50.37 (+4.32) average performance across four out-of-domain benchmarks (VideoGenReward-Bench, VideoPhy2, etc).

Usage

Inference

For running inference of VideoScore2, firstly install:
code
pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0
pip install transformers==4.53.2
pip install qwen-vl-utils
pip install accelerate
pip install scipy
pip install opencv-python-headless
pip install numpy==2.2.6

Run inference over one video:

code
from transformers import AutoProcessor, AutoModelForVision2Seq, AutoTokenizer
from qwen_vl_utils import process_vision_info
import torch
import numpy as np
import cv2
import os
import re
from string import Template

def _get_video_fps(url_or_p: str):
cap = cv2.VideoCapture(url_or_p)
if not cap.isOpened():
raise ValueError(f"Cannot open video: {url_or_p}")
fps = cap.get(cv2.CAP_PROP_FPS)
cap.release()
return fps

def ll_based_soft_score_normed(hard_val, token_idx, scores, tokenizer):
if hard_val is None or token_idx < 0:
return None
logits = scores[token_idx][0]
score_range = list(range(1, 6))
score_probs = []
for s in score_range:
ids = tokenizer.encode(str(s), add_special_tokens=False)
if len(ids) == 1:
tid = ids[0]
logp = torch.log_softmax(logits, dim=-1)[tid].item()
prob = float(np.exp(logp))
score_probs.append((s, prob))
if not score_probs:
print("[warn] No valid score token found.")
return None
scores_list, probs_list = zip(*score_probs)
total_prob = sum(probs_list)
max_prob = max(probs_list)
best_score = scores_list[probs_list.index(max_prob)]
normalized_prob = max_prob / total_prob if total_prob > 0 else 0
return round(best_score * normalized_prob, 4)

def find_score_token_index_by_prompt(prompt_text, tokenizer, gen_ids):
gen_str = tokenizer.decode(gen_ids, skip_special_tokens=False)
pattern = r"(?:\(\d+\)\s*|\n\s*)?" + re.escape(prompt_text)
match = re.search(pattern, gen_str, flags=re.IGNORECASE)
if not match:
return -1
after_text = gen_str[match.end():]
num_match = re.search(r"\d", after_text)
if not num_match:
return -1
target_substr = gen_str[:match.end() + num_match.start() + 1]
for i in range(len(gen_ids)):
partial = tokenizer.decode(gen_ids[:i+1], skip_special_tokens=False)
if partial == target_substr:
return i
return -1

def main(MODEL_NAME, video_path, t2v_prompt):
# --- prepare query ---
VS2_QUERY_TEMPLATE = Template("""
You are an expert for evaluating AI-generated videos from three dimensions:
(1) visual quality – clarity, smoothness, artifacts;
(2) text-to-video alignment – fidelity to the prompt;
(3) physical/common-sense consistency – naturalness and physics plausibility.

Video prompt: $t2v_prompt

Please output in this format:
visual quality: <v_score>;
text-to-video alignment: <t_score>,
physical/common-sense consistency: <p_score>
""")
user_prompt = VS2_QUERY_TEMPLATE.substitute(t2v_prompt=t2v_prompt)

if not os.path.exists(video_path):
raise ValueError(f"Video not found: {video_path}")

infer_fps, max_tokens, temperature = 2.0, 1024, 0.7
if infer_fps == "raw":
infer_fps = _get_video_fps(video_path)

print(f"[Init] Loading model: {MODEL_NAME}")
model = AutoModelForVision2Seq.from_pretrained(MODEL_NAME, trust_remote_code=True).to("cuda")
processor = AutoProcessor.from_pretrained(MODEL_NAME, trust_remote_code=True)
tokenizer = getattr(processor, "tokenizer", None) or AutoTokenizer.from_pretrained(
MODEL_NAME, trust_remote_code=True, use_fast=False
)

# --- preprocess ---
messages = [{"role": "user", "content": [
{"type": "video", "video": video_path, "fps": infer_fps},
{"type": "text", "text": user_prompt}
]}]
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
image_inputs, video_inputs = process_vision_info(messages)

inputs = processor(
text=[text], images=image_inputs, videos=video_inputs,
fps=infer_fps, padding=True, return_tensors="pt"
).to("cuda")

# --- inference ---
gen_out = model.generate(
**inputs,
max_new_tokens=max_tokens,
output_scores=True,
return_dict_in_generate=True,
do_sample=True,
temperature=temperature,
)

sequences = gen_out.sequences
scores = gen_out.scores
input_len = inputs["input_ids"].shape[1]
gen_token_ids = sequences[0, input_len:].tolist()

output_text = processor.batch_decode(
sequences[:, input_len:], skip_special_tokens=True, clean_up_tokenization_spaces=False
)[0]
print("\n[Raw Model Output]\n", output_text)

# --- parse scores ---
pattern = r"visual quality:\s*(\d+).*?text-to-video alignment:\s*(\d+).*?physical/common-sense consistency:\s*(\d+)"
match = re.search(pattern, output_text, re.DOTALL | re.IGNORECASE)
v_score = int(match.group(1)) if match else None
t_score = int(match.group(2)) if match else None
p_score = int(match.group(3)) if match else None

idx_v = find_score_token_index_by_prompt("visual quality:", tokenizer, gen_token_ids)
idx_t = find_score_token_index_by_prompt("text-to-video alignment:", tokenizer, gen_token_ids)
idx_p = find_score_token_index_by_prompt("physical/common-sense consistency:", tokenizer, gen_token_ids)

v_soft = ll_based_soft_score_normed(v_score, idx_v, scores, tokenizer)
t_soft = ll_based_soft_score_normed(t_score, idx_t, scores, tokenizer)
p_soft = ll_based_soft_score_normed(p_score, idx_p, scores, tokenizer)

print("\n====== Inference Result ======")
print(f"Video Path: {video_path}")
print(f"Visual Quality: {v_soft}")
print(f"Text-to-Video Alignment: {t_soft}")
print(f"Physical Consistency: {p_soft}")
print("==============================\n")

if __name__ == "__main__":
MODEL_NAME = "TIGER-Lab/VideoScore2"
video_path = "" # ← your video path here
t2v_prompt = "" # ← the text prompt for this video
main(MODEL_NAME, video_path, t2v_prompt)

Training (SFT and RL)

see [VideoScore2/training](https://git