megvii-research / DCLS-SR

Official PyTorch implementation of the paper "Deep Constrained Least Squares for Blind Image Super-Resolution", CVPR 2022.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

去模糊特徵圖R的可視化圖

joe880923 opened this issue · comments

作者您好,想請問你可以提供去模糊特徵圖R的可視化方法嗎?
有嘗試使用一些方法但可視化的圖片很奇怪。

你好,可以尝试使用matplotlib并设置cmap='jet' .

作者您好,我儲存R特徵圖的code是這樣
test = self.channel_1(f2) #將R特徵圖channel做1*1con讓channel為1
test = np.squeeze(test, axis=2)
ndarr = test.detach().squeeze().cpu().numpy()
ndarr = (ndarr * 255).clip(0, 255).astype(np.uint8)
print("ndarr-------------------", ndarr.shape)
print("ndarr dtype-------------------", ndarr.dtype)
print("ndarr min/max-----------------", ndarr.min(), ndarr.max())
ndarr = ndarr.astype(np.uint8)
ndarr_transposed = np.transpose(ndarr, (0, 1)) # 对于二维数组,不需要改变轴的顺序

    plt.imshow(ndarr_transposed, cmap='jet')
    plt.savefig('feature_map.png')
    plt.show()

儲存的結果長這樣是正確的嗎?
image

image

image

感覺應該正常不會長這樣,再麻煩您跟我說一下,謝謝!

看起来不对= =。你为什么要加一个1x1卷积让channel为1呢?可以直接只取第一个(或者前N个)通道的特征不?

我原本的理解是如果只使用第一個channel的話會導致資訊流失,依照您給的建議有嘗試過使用第1個channel來測試,如下:
first_channel = f2[0, :1, :, :]
test = np.squeeze(first_channel, axis=0)
ndarr = test.detach().squeeze().cpu().numpy()
ndarr = (ndarr * 255).clip(0, 255).astype(np.uint8)
plt.imshow(ndarr, cmap='jet')
plt.savefig('feature_map.png')
plt.show()

印出的結果為
image

image

好像更加的不太對的樣子,不太確定我哪邊理解有問題或操作,再麻煩您給我點指導,謝謝您!

你这是学习后的模型吗还是random weights?可以多打印几个feature通道看看呢,理论上有些通道信息比较多。

作者您好,我是使用已經訓練完後的權重檔案去印出圖片,作者您說的多印幾個是指我針對第一個通道、第二個通道、第三個通道打印出來分別儲存起來的意思嗎?

是的,有的通道信息应该会多一点