visualizeWeights.py 文件源码

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

项目:GT-Deep-Learning-for-Sign-Language-Recognition 作者: payamsiyari 项目源码 文件源码
def visualize(convA):
    if convA == None:
        return 

    #imgY = 10

    for i in xrange(convA.shape[1]):
        print i
        temp = convA[:,i,:,:,:]
        print temp.shape
        #k = convA.shape[1] * convA.shape[0]
        #j = int(round(float(k) / imgY))
        gs1 = gridspec.GridSpec(temp.shape[0],temp.shape[1])
        gs1.update(left=None, bottom=None, right=None, top=None, wspace=0.1, hspace=0.3)
        dim = max(temp.shape[0],temp.shape[1])
        plt.figure(figsize=(dim,dim))
        for x in xrange(temp.shape[0]):
            for y in xrange(temp.shape[1]):
                w = temp[x,y,:,:]
                ax = plt.subplot(gs1[x,y])
                ax.imshow(w,cmap=plt.cm.gist_yarg,interpolation='nearest',aspect='auto')
                ax.axis('off')


        plt.axis('off')
        plt.tick_params(\
            axis='x',          # changes apply to the x-axis
            which='both',      # both major and minor ticks are affected
            bottom='off',      # ticks along the bottom edge are off
            top='off',         # ticks along the top edge are off
            labelbottom='off')
        plt.tick_params(\
            axis='y',          # changes apply to the y-axis
            which='both',      # both major and minor ticks are affected
            left='off', 
            right='off',    # ticks along the top edge are off
            labelleft='off')




        plt.savefig('./tempImages/test_fig_' + str(i) + '.png', dpi = 100)
        plt.close('all')
    createGIF()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号