-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot.py
90 lines (80 loc) · 3.43 KB
/
plot.py
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
# -*- codeing = utf-8 -*-
# @Time : 2024-07-26 13:55
# @Author : 张庭恺
# @File : plot.py
# @Software : PyCharm
# -*- codeing = utf-8 -*-
# @Time : 2024-06-15 13:04
# @Author : 张庭恺
# @File : plot.py
# @Software : PyCharm
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
import numpy as np
class a:
def __init__(self, len) -> None:
super().__init__()
self.lis = list(range(len))
def __iter__(self):
ret = iter(self.lis)
i = 0
while i<len(self.lis):
i += 1
yield next(ret)
a = a(10)
for i in a :
print(i)
# 数据
models = ['MV3D', 'AVOD', 'F-Pointnet', 'VoxelNet', 'SECOND', 'PointRCNN', 'SA-SSD','TRPP']
fps = [2.8, 12.5, 5.9, 2, 26.3, 10, 25,23] # Flops
map = [70, 64.32, 74.05, 67.36, 73.04, 78.22, 70,74.15] # PSNR
params = [2, 2, 2.6, 6.4, 5.31, 4.034, 5.4,1.2] # 参数量
colors=["limegreen", "darkorange", "c", "dodgerblue", "peru", "blueviolet", "lightpink",'red']
# 绘制散点图
plt.figure(figsize=(10, 6))
plt.scatter(fps, map, s=[p * 150 for p in params], alpha=0.8, c = colors)
plt.scatter(fps[-1], map[-1], s=params[-1] * 150, alpha=0.8, c="red", marker='*')
plt.text(fps[0]-0.8, map[0]+0.8, models[0],
fontdict={'fontsize': 10, 'fontweight': 'bold', 'fontname': 'Arial', 'color': 'black'},)
plt.text(fps[1]-0.8, map[1]+0.8, models[1],
fontdict={'fontsize': 10, 'fontweight': 'bold', 'fontname': 'Arial', 'color': 'black'},)
plt.text(fps[2]-1.2, map[2]+1.5, models[2],
fontdict={'fontsize': 10, 'fontweight': 'bold', 'fontname': 'Arial', 'color': 'black'},)
plt.text(fps[3]-1.2, map[3]+2, models[3],
fontdict={'fontsize': 10, 'fontweight': 'bold', 'fontname': 'Arial', 'color': 'black'},)
plt.text(fps[4]-0.8, map[4]+2, models[4],
fontdict={'fontsize': 10, 'fontweight': 'bold', 'fontname': 'Arial', 'color': 'black'},)
plt.text(fps[5]-0.8, map[5]+2, models[5],
fontdict={'fontsize': 10, 'fontweight': 'bold', 'fontname': 'Arial', 'color': 'black'},)
plt.text(fps[6]-0.8, map[6]+2, models[6],
fontdict={'fontsize': 10, 'fontweight': 'bold', 'fontname': 'Arial', 'color': 'black'},)
plt.text(fps[7]-0.8, map[7]+0.8, models[7] + '(ours)',
fontdict={'fontsize': 10, 'fontweight': 'bold', 'fontname': 'Arial', 'color': 'black'},)
# 设置坐标轴标签和标题
plt.xlabel('Fps', family='Arial', size=18, weight="bold", )
plt.ylabel('mAP(M)', family='Arial', size=18, weight="bold", )
title_properties = {
'family': 'Arial', # 字体
# 'style': 'italic', # 斜体
'size': 20, # 字号
'weight': 'bold', # 加粗
}
font_properties = FontProperties(**title_properties)
# plt.title('VESSEL', fontproperties=font_properties, color="royalblue")
plt.ylim(bottom=50, top=100)
plt.xlim(left=0, right=30)
plt.tick_params(axis='both', # 修改x轴和y轴的刻度
which='both', # 修改主刻度和次刻度
direction='out', # 刻度线方向,'in', 'out', 'inout'
length=3, # 刻度线长度
width=1, # 刻度线宽度
colors='black', # 刻度线颜色
grid_color='gray', # 网格线颜色
grid_alpha=0.5, # 网格线透明度
labelsize=12)
# 显示图例
# plt.legend(loc='best')
# 显示图表
plt.grid(which=u'both', axis=u'both', linestyle='-', linewidth=1)
plt.savefig("./mAP_Fps.png")
plt.show()