import numpy as np
import pylab
import matplotlib.pyplot as plt
%matplotlib inline
x=[0,1,2,3,4,5,6,7,8,9,10]
skeresult=[0.9009584664536742, 0.9585987261146497, 0.9555555555555556, 0.8575949367088608, 0.945859872611465, 0.9741100323624595, 0.9367088607594937, 0.9240506329113924, 0.9588607594936709, 0.9810126582278481, 0.9648562300319489]
rgbresult=[0.9201277955271565, 0.9936305732484076, 0.9746031746031746, 0.9082278481012658, 0.9522292993630573, 0.9838187702265372, 0.9651898734177216, 0.939873417721519, 0.9746835443037974, 0.9968354430379747, 0.9968051118210862]
fusionresult=[0.964856,1.0,0.993650,0.977848,0.974522,0.993527,0.984177,0.971518,0.990506,1.0,0.993610]
def autolabel(rects):
for rect in rects:
height = rect.get_height()
plt.text(rect.get_x()+rect.get_width()/2.-0.2, *height, '%s' % float(height))
name=['punch','kick','push','pat','point','hug','pass','pocket','handshake','toward','away']
total_width,n=0.6,3
width=total_width/n
a=plt.bar(x,skeresult,width=width,label='ske',fc='y')
for i in range(len(x)):
x[i] = x[i]+width
b=plt.bar(x,rgbresult,width=width,label='rgb',tick_label=name,fc='g')
for i in range(len(x)):
x[i] = x[i]+width
c=plt.bar(x,fusionresult,width=width,label='fusion',fc='r')
plt.xlabel('class')
plt.ylabel('acc')
plt.title('NTUtp Classification Accuracy')
plt.xticks(rotation=45)
plt.xlim(x[0]-0.5, x[i]+0.1)
plt.ylim(0.85, 1.0)
plt.savefig("NTUtpAccuracy.png")
plt.show()
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/a7cb527ae5963155091284073ac192c7.png)
def autolabel(rects):
for rect in rects:
height = rect.get_height()
plt.text(rect.get_x()+rect.get_width()/2.-0.2, 1*height, '%s' % float(height))
x1=[0,1,2]
result1=[0.9416]
result2=[0.9641]
result3=[0.9858]
name=['skeleton']
total_width,n=0.9,3
width=total_width/n
a=plt.bar(x1[0],result1,width=width,label='ske',tick_label='ske',fc='y')
b=plt.bar(x1[1],result2,width=width,label='rgb',tick_label='rgb',fc='g')
c=plt.bar(x1[2],result3,width=width,label='fusion',tick_label='fusion',fc='r')
autolabel(a)
autolabel(b)
autolabel(c)
plt.xlabel('model')
plt.ylabel('acc')
plt.title('NTUtp Classification Accuracy')
plt.legend()
plt.xlim(-0.5, 2.5)
plt.ylim(0.9, 1.0)
plt.xticks(x1,['ske','rgb','fusion'])
plt.savefig("NTUtpmodelAccuracy.png")
plt.show()
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/a61fa926fed32ecadd06d7a2ec00d846.png)