在torch(lua)中可视化中间层中的图像

5
在卷积神经网络模型中,我知道如何可视化过滤器,我们可以使用 itorch.image(model:get(1).weight) 进行操作。
但是,如何高效地可视化卷积后的输出图像呢?特别是在深度神经网络的第二层或第三层中的那些图像?
谢谢。

第二个答案更为恰当,请重新选择答案,以便于那些寻找更好、更正确答案的人们。 - Anuj
2个回答

13

与重量类似,你可以使用:

itorch.image(model:get(1).output)

谢谢!让我试试。 - James LT

5
要可视化权重:
-- visualizing weights
n = nn.SpatialConvolution(1,64,16,16)
itorch.image(n.weight)

要可视化特征映射:
-- initialize a simple conv layer
n = nn.SpatialConvolution(1,16,12,12)

-- push lena through net :)
res = n:forward(image.rgb2y(image.lena())) 

-- res here is a 16x501x501 volume. We view it now as 16 separate sheets of size 1x501x501 using the :view function
res = res:view(res:size(1), 1, res:size(2), res:size(3))
itorch.image(res)

更多内容请参考:https://github.com/torch/tutorials/blob/master/1_get_started.ipynb


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接