change nat2AVAMOS
Browse files- local/convert_metrics.py +27 -25
- local/nat2avaMOS.png +0 -0
local/convert_metrics.py
CHANGED
@@ -4,7 +4,9 @@ import matplotlib.pyplot as plt
|
|
4 |
# Natural MOS to AVA MOS
|
5 |
|
6 |
def linear_function(x):
|
7 |
-
|
|
|
|
|
8 |
|
9 |
def quadratic_function(x):
|
10 |
return -0.0816 * (x - 5) ** 2 + 5
|
@@ -27,13 +29,13 @@ def WER2INTELI(x):
|
|
27 |
else:
|
28 |
return 100 * np.exp(-0.01 * (x - 100))
|
29 |
|
30 |
-
#
|
31 |
# x = np.linspace(0, 200, 400) # 从0到200生成400个点
|
32 |
|
33 |
-
#
|
34 |
-
# y = [
|
|
|
35 |
|
36 |
-
# # 绘制函数图像
|
37 |
# plt.plot(x, y)
|
38 |
# plt.xlabel('x')
|
39 |
# plt.ylabel('f(x)')
|
@@ -41,31 +43,31 @@ def WER2INTELI(x):
|
|
41 |
# plt.grid(True)
|
42 |
# plt.show()
|
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 |
# plt.savefig("./local/WER2INT.png")
|
|
|
4 |
# Natural MOS to AVA MOS
|
5 |
|
6 |
def linear_function(x):
|
7 |
+
m = (4 - 1) / (1.5 - 1)
|
8 |
+
b = 1 - m * 1
|
9 |
+
return m * x + b
|
10 |
|
11 |
def quadratic_function(x):
|
12 |
return -0.0816 * (x - 5) ** 2 + 5
|
|
|
29 |
else:
|
30 |
return 100 * np.exp(-0.01 * (x - 100))
|
31 |
|
32 |
+
# 生成 x 值
|
33 |
# x = np.linspace(0, 200, 400) # 从0到200生成400个点
|
34 |
|
35 |
+
# 计算对应的 y 值
|
36 |
+
# y = [WER2INTELI(xi) for xi in x]
|
37 |
+
|
38 |
|
|
|
39 |
# plt.plot(x, y)
|
40 |
# plt.xlabel('x')
|
41 |
# plt.ylabel('f(x)')
|
|
|
43 |
# plt.grid(True)
|
44 |
# plt.show()
|
45 |
|
46 |
+
# 生成 x 值的范围
|
47 |
+
x1 = np.linspace(1, 1.5, 100)
|
48 |
+
x2 = np.linspace(1.5, 5, 100)
|
49 |
|
50 |
+
# 计算对应的 y 值
|
51 |
+
y1 = linear_function(x1)
|
52 |
+
y2 = quadratic_function(x2)
|
53 |
|
54 |
+
# 绘制线性部分
|
55 |
+
plt.plot(x1, y1, label='Linear Function (1 <= x <= 1.5)')
|
56 |
|
57 |
+
# 绘制二次部分
|
58 |
+
plt.plot(x2, y2, label='Quadratic Function (1.5 <= x <= 5)')
|
59 |
|
60 |
+
# 添加标签和标题
|
61 |
+
plt.xlabel('Natural Mean Opinion Score')
|
62 |
+
plt.ylabel('AVA Mean Opinion Score')
|
63 |
+
plt.title('nat2avaMOS')
|
64 |
|
65 |
+
# 添加图例
|
66 |
+
plt.legend()
|
67 |
|
68 |
+
# 显示图形
|
69 |
+
plt.grid(True)
|
70 |
|
71 |
+
# 显示图像
|
72 |
+
plt.savefig("./local/nat2avaMOS.png")
|
73 |
# plt.savefig("./local/WER2INT.png")
|
local/nat2avaMOS.png
CHANGED