绘制heatmap

"""
输出热力图
fixedpoint_21.2/test_server/toHeatMap.py
wangmaolin-1029
"""
import cv2
import matplotlib.pyplot as plt
import pdb
import numpy as np

if __name__ == '__main__':
    image_path = '/home/wangmaolin/for_test/tofile/conv_82_memory'
    # image = cv2.imread(image_path, -1)# png格式
    # print(image.shape)

    image = np.fromfile(image_path, dtype=np.int16)# npy格式
    #image = np.fromfile(image_path, dtype=np.float32)
    #image = image.astype(np.float32)
    
    
    
    image = image.reshape(80, -1)
    
    fig = plt.figure(figsize=(8, 4))
    ax1 = fig.add_subplot(121)
    ax1.imshow(image)
    fig.savefig('/home/wangmaolin/for_test/tofile/conv_82_memory.png', facecolor='grey', edgecolor='red')
    plt.show()
posted @ 2021-10-31 20:07  荒唐了年少  阅读(71)  评论(0编辑  收藏  举报