其他分享
首页 > 其他分享> > Wst矩阵和可视化

Wst矩阵和可视化

作者:互联网

import numpy as np
import cv2
import matplotlib.pyplot as plt

Wst = np.array(np.load('./TANetv10/attentation_map.npy'))
print('attentation_map_max:',np.max(Wst))
print('attentation_map_min:',np.min(Wst))
# Wst[Wst > 0.0004] = 1
# print(Wst)


a_index = []
a_init = np.array([])
# print(a_init)
for c in range(0, 6):
    # a = np.where(a_list==c)
    # a_index.append(np.where(a_list==c)[0])

    a_init = np.append(a_init, np.where(label_64_0_5_reshape == c)[0])
    # print(np.where(a_list==c)[0])
# print(a_index)
# print(np.append(a_index[0], a_index[1]))
print(type(a_init))
a_index = a_init.astype(int)
print(a_index)
# print(type(a_index[0][:]))
Wst_new = Wst[a_index,:]
print(Wst_new)
Wst_new[Wst_new > 0.00027] = 0.5
plt.imshow(Wst_new)
plt.show()
Wst_new_new = Wst_new.T[a_index, :].T.squeeze()
print(Wst_new_new)
Wst_new_new[Wst_new_new > 0.00027] = 0.5
plt.imshow(Wst_new_new)
plt.show()

 

标签:index,矩阵,np,init,可视化,Wst,print,new
来源: https://blog.csdn.net/qq_36926753/article/details/117480987