Visualize images in intermediate layers in torch (lua)

旧巷老猫 提交于 2019-12-04 08:03:34

Similarly to weight, you can use:

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

To visualize the weights:

-- visualizing weights
n = nn.SpatialConvolution(1,64,16,16)
itorch.image(n.weight)

To visualize the feature maps:

-- 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)

For more: https://github.com/torch/tutorials/blob/master/1_get_started.ipynb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!