File size: 1,752 Bytes
1a19f57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.font_manager as fm

from matplotlib import font_manager, rcParams

font_path = "/nfs/ywang29/GmNet/times.ttf"  # 按实际路径修改
font_manager.fontManager.addfont(font_path)
rcParams['font.family'] = 'Times New Roman'


# 示例数据
x = np.arange(0, 10) * 500
diffusionrf = [26.59, 27.26, 28.09, 27.98, 26.93, 24.24, 26.77, 28.66, 27.7, 28.59]
videoalign = [26.59, 26.32, 27.2, 27.41, 27.29, 26.23, 26.98, 24.43, 23.85, 24.02]
pickscore = [26.59, 24.32, 20.62, 23.88, 24.45, 18.17, 22.01,19.7, 21.83, 18.762]
base = [26.59 for i in range(len(x))]
plt.figure(figsize=(7, 4))

# 三条折线,三角形标记
plt.plot(x, diffusionrf, marker='^', linestyle='-', linewidth=2, markersize=8, label='Diffusion-DRF')
plt.plot(x, videoalign, marker='^', linestyle='-', linewidth=2, markersize=8, label='VideoAlign')
plt.plot(x, pickscore, marker='^', linestyle='-', linewidth=2, markersize=8, label='PickScore')
plt.plot(x, base, linestyle='--', linewidth=2, markersize=8, color='gray', label='Base Model')

# 添加标题与坐标轴标签
# plt.title("", fontsize=13)
plt.xlabel("Training Steps", fontsize=18)
plt.ylabel("Controllability Score", fontsize=18)

# 添加网格
plt.grid(True, linestyle='--', alpha=0.6)

# 图例
plt.legend()

# 自动紧凑布局
plt.tight_layout()

# 保存为 PDF 文件
output_path = "/nfs/ywang29/Reward_finetuning/VideoX-Fun/plots/learning_dyn.pdf"
plt.savefig(output_path, bbox_inches="tight", format="pdf", dpi=300)

output_path = "/nfs/ywang29/Reward_finetuning/VideoX-Fun/plots/learning_dyn.png"
plt.savefig(output_path, bbox_inches="tight", format="png", dpi=300)

print(f"✅ 图已保存为 {output_path}")

# # 显示图形
# plt.show()