model = torch.load(‘my_resnet18_network.pth’)
model.cuda()
remove few layers , to see intermediate conv layer features
my_model = nn.Sequential(*list(model.children())[:-3])
data = np.load(’/load/data/from/hdd.npy’)
copy= data
data    =np.swapaxes(data,0,2)
data    = np.swapaxes(data,0,1)
trans    = transforms.ToTensor()
T_Data          =trans(data)
T_Data  = T_Data.unsqueeze(0)
T_Data  = Variable(T_Data)
T_Data = T_Data.cuda()
outs= my_model(T_Data)
outs= outs.data.cpu().numpy()  ### convert to numpy
code to visualize feature_maps###
def show_me_feature_maps(feature_map,num_of_rows=8, num_of_columns=8, see_all_feature_map=False):
one_feature_map= feature_map[0]
num_of_feature_maps =32   ### to visualize limited number of feature map

if see_all_feature_map== True:
	num_of_feature_maps= one_feature_map.shape[0]
	num_of_rows= num_of_feature_maps/num_of_columns
	print (num_of_rows)

for i in range(1,num_of_feature_maps+1):
	plt.subplot(num_of_rows,num_of_columns,i)
	plt.imshow(misc.imresize(one_feature_map[i-1],[240,240]),cmap='gray')
  plt.show()

##################
show_me_feature_maps(outs)
Is this correct?