polarrcnn-thesis/thsis_figure/speed_method.py

54 lines
1.9 KiB
Python
Raw Normal View History

2024-08-20 00:32:41 +08:00
import matplotlib.pyplot as plt
import matplotlib as mpl
# 设置全局字体为 Times New Roman
mpl.rcParams['font.family'] = 'Times New Roman'
mpl.rcParams['font.serif'] = ['Times New Roman']
mpl.rcParams['axes.titlesize'] = 14
mpl.rcParams['axes.labelsize'] = 12
mpl.rcParams['xtick.labelsize'] = 12
mpl.rcParams['ytick.labelsize'] = 12
mpl.rcParams['legend.fontsize'] = 12
mark_size = 8
# 定义数据
data = {
'LaneATT (2021)': {'x': [3.23, 5.01, 23.67], 'y': [75.09, 76.68, 77.02], 'color': 'magenta', 'marker': 'H'},
'CLRNet (2022)': {'x': [7.37, 8.81, 9.31, 14.36], 'y': [79.58, 79.73, 80.47, 80.13], 'color': 'orange', 'marker': 'p'},
2024-08-20 00:37:36 +08:00
'CLRerNet (2023)': {'x': [8.81, 9.31, 14.36], 'y': [80.76, 81.12, 80.91], 'color': 'orangered', 'marker': 'p'},
2024-08-20 00:32:41 +08:00
'ADNet (2023)': {'x': [8.4, 10.67], 'y': [77.56, 78.94], 'color': 'green', 'marker': 'v'},
'SRLane (2024)': {'x': [3.12], 'y': [79.73], 'color': 'red', 'marker': '*'},
'UFLDv2 (2022)': {'x': [2.7, 4.6], 'y': [75, 76], 'color': 'purple', 'marker': '^'},
'PolarRCNN-NMS (ours)': {'x': [3.71, 4.97, 5.47, 6.14], 'y': [80.81, 80.92, 81.49, 81.34], 'color': 'blue', 'marker': 'o'},
'PolarRCNN (ours)': {'x': [4.77, 6.10, 6.54, 7.13], 'y': [80.81, 80.92, 81.49, 81.34], 'color': 'cyan', 'marker': 'o'},
}
plt.xlim(0, 30)
# 绘制数据点
for label, props in data.items():
plt.plot(
props['x'], props['y'],
alpha=0.8,
c=props['color'],
marker=props['marker'],
# edgecolors='w',
markersize = mark_size,
linewidth=1.2,
label=label
)
# 设置标题和标签
plt.grid(True, linestyle='-', alpha=0.5)
plt.xlabel('Latency (ms) on NVIDIA A100')
plt.ylabel('F1-score (%)')
# 添加图例,并调整图例中的标记大小
legend = plt.legend(loc="upper right")
for handle in legend.legend_handles:
handle._sizes = [20]
plt.savefig('speed_method.png', dpi=300)
plt.show()