之前做的一些项目中涉及到feature map 可视化的问题,一个层中feature map的数量往往就是当前层out_channels的值,我们可以通过以下代码可视化自己网络中某层的feature map,个人感觉可视化feature map对调参还是很有用的。不多说了,直接看代码:
import torch
from torch.autograd import Variable
import torch.nn as nn
import pickle
from sys import path
path.append('/residual model path')
import residual_model
from residual_model import Residual_Model
model = Residual_Model()
model.load_state_dict(torch.load('./model.pkl'))
class