🤯🤯Try on the new version VideoScore-v1.1, which is a variant from VideoScore with better performance in "text-to-video alignment" subscore and the support for 48 frames in inference now!
VideoScore series is a video quality evaluation model series, taking Mantis-8B-Idefics2 or Qwen2-VL as base model
and trained on VideoFeedback,
a large video evaluation dataset with multi-aspect human scores.
VideoScore can reach 75+ Spearman correlation with humans on VideoFeedback-test, surpassing all the MLLM-prompting methods and feature-based metrics.
VideoScore also beat the best baselines on other three benchmarks EvalCrafter, GenAI-Bench and VBench, showing high alignment with human evaluations.
For the data details of four benchmarks, please refer to VideoScore-Bench.
This is the regression version of VideoScore
Evaluation Results
We test our video evaluation model series VideoScore on VideoFeedback-test, EvalCrafter, GenAI-Bench and VBench.
For the first two benchmarks, we take Spearman corrleation between model's output and human ratings
averaged among all the evaluation aspects as indicator.
For GenAI-Bench and VBench, which include human preference data among two or more videos,
we employ the model's output to predict preferences and use pairwise accuracy as the performance indicator.
For the benchmark VideoFeedback-test, We use VideoScore trained on the entire VideoFeedback dataset.
For other three benchmarks GenAI-Bench, VBench and EvalCrafter, We use VideoScore-anno-only trained on VideoFeedback dataset
excluding the real videos.
The evaluation results are shown below:
metric
Final Avg Score
VideoFeedback-test
EvalCrafter
GenAI-Bench
VBench
VideoScore (reg)
69.6
75.7
51.1
78.5
73.0
VideoScore (gen)
55.6
77.1
27.6
59.0
58.7
Gemini-1.5-Pro
39.7
22.1
22.9
60.9
52.9
Gemini-1.5-Flash
39.4
20.8
17.3
67.1
52.3
GPT-4o
38.9
23.1
28.7
52.0
51.7
CLIP-sim
31.7
8.9
36.2
34.2
47.4
DINO-sim
30.3
7.5
32.1
38.5
43.3
SSIM-sim
29.5
13.4
26.9
34.1
43.5
CLIP-Score
28.6
-7.2
21.7
45.0
54.9
LLaVA-1.5-7B
27.1
8.5
10.5
49.9
39.4
LLaVA-1.6-7B
23.3
-3.1
13.2
44.5
38.7
X-CLIP-Score
23.2
-1.9
13.3
41.4
40.1
PIQE
19.6
-10.1
-1.2
34.5
55.1
BRISQUE
19.0
-20.3
3.9
38.5
53.7
Idefics2
18.3
6.5
0.3
34.6
31.7
MSE-dyn
10.6
-5.5
-17.0
28.4
36.5
SSIM-dyn
9.2
-12.9
-26.4
31.4
44.5
The best in VideoScore series is in bold and the best in baselines is underlined.
Usage
Installation
pip install git+https://github.com/TIGER-AI-Lab/VideoScore.git
# or
# pip install mantis-vl
Inference
cd VideoScore/examples
python
1import av
2import numpy as np
3from typing import List
4from PIL import Image
5import torch
6from transformers import AutoProcessor
7from mantis.models.idefics2 import Idefics2ForSequenceClassification
89def_read_video_pyav(10 frame_paths:List[str],11 max_frames:int,12):13 frames =[]14 container.seek(0)15 start_index = indices[0]16 end_index = indices[-1]17for i, frame inenumerate(container.decode(video=0)):18if i > end_index:19break20if i >= start_index and i in indices:21 frames.append(frame)22return np.stack([x.to_ndarray(format="rgb24")for x in frames])2324MAX_NUM_FRAMES=1625ROUND_DIGIT=326REGRESSION_QUERY_PROMPT ="""
27Suppose you are an expert in judging and evaluating the quality of AI-generated videos,
28please watch the following frames of a given video and see the text prompt for generating the video,
29then give scores from 5 different dimensions:
30(1) visual quality: the quality of the video in terms of clearness, resolution, brightness, and color
31(2) temporal consistency, both the consistency of objects or humans and the smoothness of motion or movements
32(3) dynamic degree, the degree of dynamic changes
33(4) text-to-video alignment, the alignment between the text prompt and the video content
34(5) factual consistency, the consistency of the video content with the common-sense and factual knowledge
3536for each dimension, output a float number from 1.0 to 4.0,
37the higher the number is, the better the video performs in that sub-score,
38the lowest 1.0 means Bad, the highest 4.0 means Perfect/Real (the video is like a real video)
39Here is an output example:
40visual quality: 3.2
41temporal consistency: 2.7
42dynamic degree: 4.0
43text-to-video alignment: 2.3
44factual consistency: 1.8
4546For this video, the text prompt is "{text_prompt}",
47all the frames of video are as follows:
48"""4950model_name="TIGER-Lab/VideoScore"51video_path="video1.mp4"52video_prompt="Near the Elephant Gate village, they approach the haunted house at night. Rajiv feels anxious, but Bhavesh encourages him. As they reach the house, a mysterious sound in the air adds to the suspense."5354processor = AutoProcessor.from_pretrained(model_name,torch_dtype=torch.bfloat16)55model = Idefics2ForSequenceClassification.from_pretrained(model_name,torch_dtype=torch.bfloat16).eval()56device = torch.device("cuda"if torch.cuda.is_available()else"cpu")57model.to(device)5859# sample uniformly 8 frames from the video60container = av.open(video_path)61total_frames = container.streams.video[0].frames
62if total_frames > MAX_NUM_FRAMES:63 indices = np.arange(0, total_frames, total_frames / MAX_NUM_FRAMES).astype(int)64else:65 indices = np.arange(total_frames)6667frames =[Image.fromarray(x)for x in _read_video_pyav(container, indices)]68eval_prompt = REGRESSION_QUERY_PROMPT.format(text_prompt=video_prompt)69num_image_token = eval_prompt.count("<image>")70if num_image_token <len(frames):71 eval_prompt +="<image> "*(len(frames)- num_image_token)7273flatten_images =[]74for x in[frames]:75ifisinstance(x,list):76 flatten_images.extend(x)77else:78 flatten_images.append(x)79flatten_images =[Image.open(x)ifisinstance(x,str)else x for x in flatten_images]80inputs = processor(text=eval_prompt, images=flatten_images, return_tensors="pt")81inputs ={k: v.to(model.device)for k, v in inputs.items()}8283with torch.no_grad():84 outputs = model(**inputs)8586logits = outputs.logits
87num_aspects = logits.shape[-1]8889aspect_scores =[]90for i inrange(num_aspects):91 aspect_scores.append(round(logits[0, i].item(),ROUND_DIGIT))92print(aspect_scores)9394"""
95model output on visual quality, temporal consistency, dynamic degree,
96text-to-video alignment, factual consistency, respectively
9798[2.297, 2.469, 2.906, 2.766, 2.516]
99"""100
1@article{he2024videoscore,
2 title = {VideoScore: Building Automatic Metrics to Simulate Fine-grained Human Feedback for Video Generation},
3 author = {He, Xuan and Jiang, Dongfu and Zhang, Ge and Ku, Max and Soni, Achint and Siu, Sherman and Chen, Haonan and Chandra, Abhranil and Jiang, Ziyan and Arulraj, Aaran and Wang, Kai and Do, Quy Duc and Ni, Yuansheng and Lyu, Bohan and Narsupalli, Yaswanth and Fan, Rongqi and Lyu, Zhiheng and Lin, Yuchen and Chen, Wenhu},
4 journal = {ArXiv},
5 year = {2024},
6 volume={abs/2406.15252},
7 url = {https://arxiv.org/abs/2406.15252},
8}