def show_labes(image, probs, lables, true_label):
gs = gridspec.GridSpec(1, 3)
ax1 = plt.subplot(gs[1])
x = list(reversed(lables))
y = list(reversed(probs))
colors = ['#edf8fb', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76']
# colors = ['#624ea7', 'g', 'yellow', 'k', 'maroon']
# colors=list(reversed(colors))
width = 0.4 # the width of the bars
ind = np.arange(len(y)) # the x locations for the groups
ax1.barh(ind, y, width, align='center', color=colors)
ax1.set_yticks(ind + width / 2)
ax1.set_yticklabels(x, minor=False)
for i, v in enumerate(y):
ax1.text(v, i, '%5.2f%%' % v, fontsize=14)
plt.title('Probability Output', fontsize=20)
ax2 = plt.subplot(gs[2])
ax2.axis('off')
ax2.imshow(image)
# fig = plt.gcf()
# fig.set_size_inches(8, 6)
plt.title(true_label, fontsize=20)
plt.show()
svm_vision.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录