svm_predict.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:Land_Use_CNN 作者: BUPTLdy 项目源码 文件源码
def show_labes(image,probs,lables,true_label):
    gs = gridspec.GridSpec(1, 2,width_ratios=[1,1],height_ratios=[1,1])
    ax1 = plt.subplot(gs[0])
    x = list(reversed(lables))
    y = list(reversed(probs))  
    colors=['#edf8fb','#b2e2e2','#66c2a4','#2ca25f','#006d2c']
    #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[1])
    ax2.axis('off')
    ax2.imshow(image)
#    fig = plt.gcf()
#    fig.set_size_inches(8, 6)
    plt.title(true_label,fontsize=20)
    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号