File size: 4,081 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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
metrics = ['Creativity', 'Commonsense', 'Controllability', 'Human Fidelity', 'Physics', 'Overall']
diffusiondrf = [
    [53.79, 50.2, 52.34, 54.579, 45.471, 53.33, 50.65, 47.2, 48.09, 59.34],
    [55.52, 53.23, 54.08,56.96,56.38,54.08,54.95,55.23,58.68,57.82],
    [26.59, 27.26, 28.09, 27.98, 26.93, 24.24, 26.77, 28.66, 27.7, 28.59],
    [80.65, 77.2, 78.56,80.51,79.61,82.37,78.54,79.87,77.85,79.42],
    [48.4, 54.7, 55.71,56.85,57.77, 54.33, 56.71,57.23, 59.17, 57.68],
    [52.99, 53.26, 53.76,55.38,53.23,53.27,54.52,54.64,54.3,53.90]
]

vanilla_drf = [
    [53.79, 48.15, 47.13, 52.70, 43.11, 53.44, 54.67, 51.91, 52.49, 51.00],
    [55.52, 55.52, 54.95, 54.66, 54.66, 59.83, 55.18, 58.34, 57.76, 56.04],
    [26.59, 26.83, 24.7, 27.9, 24.6, 27.5, 27.0, 27.0, 27.2, 26.4],
    [80.65, 74.22, 77.74, 72.55, 78.57, 70.96, 70.25, 71.51, 72.39, 71.10],
    [48.4, 55.64, 55.64, 59.99, 52.61, 57.79, 57.17, 58.09, 57.33, 59.24],
    [52.99, 52.27, 52.25, 53.76, 50.92, 54.12, 52.70, 53.22, 53.33, 52.66]
]

videoalign = [
    [53.79, 54.64,48.53,49.87,49.67,48.59,48.51,49.27,51.37,48.49],
    [55.52, 56.09,53.22,55.81,56.67,57.24,54.66,53.8,54.37,54.08],
    [26.59, 26.32, 27.2, 27.41, 27.29, 26.23, 26.98, 24.43, 23.85, 24.02],
    [80.65, 81.43,82.22,78.47,78.98,77.79,79.26,78.16,79.04,74.77],
    [48.4, 54.26,51.28,52.66,54.79,52.85,52.46,53.42,55.5, 53.08],
    [52.99, 53.85,52.48,52.84,53.5,52.6,52.19,52.13,52.85,51.48]
]


pickscore = [
    [53.79, 43.64, 33.26, 35.97, 33.96, 32.9, 33.47, 35.25, 37.04, 36.9],
    [55.52, 54.22, 56.38, 55.23, 57.53, 51.78, 58.11, 54.52, 52.82, 55.97],
    [26.59, 24.32, 20.62, 23.88, 24.45, 18.17, 22.01,19.7, 21.83, 18.762],
    [80.65, 82.30, 81.21, 81.89, 82.91, 86.76, 82.84, 80.84, 79.46, 78.06],
    [48.4,  52.8, 56.06, 51.13, 55.64, 53.1, 49.54, 50.1, 52.58, 50.59],
    [52.99, 48.20, 49.61, 49.62, 49.08, 48.32, 49.99, 48.23, 50.81, 50.2]
]

base = [
    [53.79 for i in range(len(x))],
    [55.52 for i in range(len(x))],
    [26.59 for i in range(len(x))],
    [80.65 for i in range(len(x))],
    [48.4 for i in range(len(x))],
    [52.99 for i in range(len(x))],
]

for i in range(len(metrics)):

    plt.figure(figsize=(7, 4))

    # 三条折线,三角形标记
    plt.plot(x, diffusiondrf[i][:len(x)], marker='^', linestyle='-', linewidth=2, markersize=8, color='#C85A3C', label='Diffusion-DRF')
    plt.plot(x, vanilla_drf[i][:len(x)], marker='x', linestyle='-', linewidth=2, markersize=8, color='#5F9E93', label='Vanilla-DRF')   
    plt.plot(x, videoalign[i][:len(x)], marker='.', linestyle='-', linewidth=2, markersize=8, color='#9CAF88', label='VideoAlign')
    plt.plot(x, pickscore[i][:len(x)], marker='*', linestyle='-', linewidth=2, markersize=8, color='#5C7C8A', alpha=0.8, label='PickScore')
    plt.plot(x, base[i], linestyle='--', linewidth=2, markersize=8, color='gray', label='Base Model')

    # 添加标题与坐标轴标签
    # plt.title("", fontsize=13)
    plt.xlabel("Training Steps", fontsize=18)
    plt.ylabel(f"{metrics[i]} Score", fontsize=18)

    plt.xticks(fontsize=14)
    plt.yticks(fontsize=14)


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

    # 图例
    plt.legend(prop={'size': 14, 'weight': 'bold'})

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

    # 保存为 PDF 文件
    output_path = f"/nfs/ywang29/Reward_finetuning/VideoX-Fun/plots/learning_dyn_{metrics[i]}.pdf"
    plt.savefig(output_path, bbox_inches="tight", format="pdf", dpi=300)

    output_path = f"/nfs/ywang29/Reward_finetuning/VideoX-Fun/plots/learning_dyn_{metrics[i]}.png"
    plt.savefig(output_path, bbox_inches="tight", format="png", dpi=300)

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

    # # 显示图形
    plt.show()